I built a tiny MCP notes server in Python — here's the whole thing, free
Описание и применение
Небольшой сервер заметок на Python, совместимый с MCP, хранит данные в локальном JSON, поддерживает создание, список и поиск заметок, решает проблемы с одинаковыми метками времени и версиями SDK.
Задача
Provide a minimal, local notes server that an AI assistant can use without a database or cloud account.
Результат
A minimal MCP notes server that stores notes in a local JSON file, supports create, list, and search, and handles timestamp sorting and SDK versioning bugs.
Рабочий процесс
- Implement create_note, list_notes, search_notes tools.
- Store notes in notes.json with atomic writes.
- Add insertion index to resolve same‑second timestamp sorting.
- Pin mcp SDK version to <2 to avoid import errors.
- Package .mcpb bundles for Smithery and Anthropic registries.
- Publish code on GitHub and install via Smithery.
- Verify end‑to‑end functionality with the real SDK.
Доказательства
Most MCP (Model Context Protocol) examples are either toy "hello world" servers or sprawling frameworks. I wanted the smallest useful thing: a notes server an AI assistant can actually use — create a note, list notes, search notes — backed by a plain local JSON file. No database, no cloud, no account.
Three tools, that's it: create_note(title, body, tags) — appends a note with an ISO timestamp; list_notes(limit) — newest first; search_notes(query) — case-insensitive substring search over title, body, and tags
Notes live in a local notes.json. Saves are atomic (write to temp file, then rename), so a crash mid-write can't corrupt your notes.
Same-second timestamps sort wrong. If two notes are created within the same second, sorting by timestamp alone gives you unstable order. Fix: keep a monotonically increasing insertion index and sort by (created_at, index).
Pin your SDK major version. mcp>=1.6.0 now resolves to the 2.x SDK, where FastMCP moved and 1.x-style code breaks at import time. My requirements now read mcp>=1.6.0,<2.
I verified the server end-to-end over stdio with the real SDK — tools list correctly, and create/search/list all round-trip.
- Дата записи: 2026-10-14T17:56:00.159Z