mcp-knowledge-base
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-knowledge-base Search my notes for Python"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
š§ MCP Knowledge Base Server
A Personal Knowledge Base built as an MCP (Model Context Protocol) server in Python. Connect it to Claude Desktop, Claude Code, VS Code Copilot, Cursor, or any MCP-compatible client ā and let your AI assistant manage your notes, tasks, and ideas.
This project teaches you the three core MCP primitives through a practical, useful application:
Primitive | What It Is | Examples in This Project |
Tools | Functions the LLM can call |
|
Resources | Data the LLM can browse |
|
Prompts | Reusable templates |
|
Architecture
āāāāāāāāāāāāāāāāāāāāāāā stdio / SSE āāāāāāāāāāāāāāāāāāāāāāāā
ā MCP Client āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāŗā Knowledge Base ā
ā (Claude Desktop, ā JSON-RPC 2.0 messages ā MCP Server ā
ā Claude Code, ā ā ā
ā Cursor, etc.) ā ā āāāāāāāāāāāāāāāā ā
ā ā tools/call āāāāāāāāāāāāāāāŗ ā ā 12 Tools ā ā
ā ā resources/read āāāāāāāāāāāŗ ā ā 4 Resources ā ā
ā ā prompts/get āāāāāāāāāāāāāāŗ ā ā 4 Prompts ā ā
āāāāāāāāāāāāāāāāāāāāāāā ā āāāāāāāā¬āāāāāāāā ā
ā ā ā
ā āāāāāāāā¼āāāāāāāā ā
ā ā SQLite DB ā ā
ā ā + FTS5 idx ā ā
ā āāāāāāāāāāāāāāāā ā
āāāāāāāāāāāāāāāāāāāāāāāāRelated MCP server: Memory Bear
Quick Start
Prerequisites
Python 3.11+
uv (modern Python package manager)
# Install uv if you don't have it
curl -LsSf https://astral.sh/uv/install.sh | sh1. Clone & Install
cd mcp-knowledge-base
# Create virtual environment and install dependencies
uv venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
uv sync2. Verify It Works
uv run test_server.pyYou should see all tests pass ā tools, resources, and prompts all registering correctly.
3. Connect to an MCP Client
Option A: Claude Desktop
Edit your Claude Desktop config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"knowledge-base": {
"command": "uv",
"args": [
"--directory", "/FULL/PATH/TO/mcp-knowledge-base",
"run", "server.py"
]
}
}
}ā ļø Replace
/FULL/PATH/TO/mcp-knowledge-basewith the actual absolute path.
Restart Claude Desktop. You should see a šØ hammer icon in the chat input ā click it to see all 12 tools.
Option B: Claude Code
# From the project directory
claude mcp add knowledge-base -- uv run server.py
# Or globally
claude mcp add --scope user knowledge-base -- uv --directory /FULL/PATH/TO/mcp-knowledge-base run server.pyThen in Claude Code, your knowledge base tools are available automatically.
Option C: Cursor / VS Code
Add to your .cursor/mcp.json or VS Code MCP settings:
{
"mcpServers": {
"knowledge-base": {
"command": "uv",
"args": ["--directory", "/FULL/PATH/TO/mcp-knowledge-base", "run", "server.py"]
}
}
}What You Can Do
Once connected, try these conversations with Claude:
Notes
"Save a note about what I learned about MCP today ā it uses JSON-RPC 2.0, has three primitives (tools, resources, prompts), and the Python SDK uses FastMCP for the high-level API."
"Search my notes for anything about Python"
"Show me all my notes tagged with 'learning'"
Tasks
"Add a task: Build a multi-agent system with CrewAI, high priority, due next Friday"
"What are my urgent tasks?"
"Mark task #3 as done"
Prompts (Workflows)
"Run my daily review" ā triggers the
daily_reviewprompt
"Help me plan my week" ā triggers
weekly_planning
"I want to capture what I learned about Docker" ā triggers
capture_learning
Stats
"Give me an overview of my knowledge base"
Project Structure
mcp-knowledge-base/
āāā server.py # The MCP server ā all tools, resources, prompts
āāā test_server.py # Test client to verify everything works
āāā pyproject.toml # Project config and dependencies
āāā README.md # You are hereData is stored in ~/.mcp-knowledge-base/knowledge.db (SQLite with FTS5 full-text search).
Key Concepts You'll Learn
1. Tools (the most important primitive)
Tools are Python functions decorated with @mcp.tool(). The MCP SDK automatically generates the JSON schema from your type hints and docstrings:
@mcp.tool()
def add_note(title: str, content: str, tags: list[str] | None = None) -> dict:
"""Create a new note in the knowledge base."""
...The LLM sees this as a callable function with typed parameters. Good docstrings = better tool use.
2. Resources (browsable data)
Resources are URIs the LLM can read, like a file system:
@mcp.resource("kb://notes/{note_id}")
def resource_single_note(note_id: int) -> str:
"""Full content of a specific note."""
...3. Prompts (workflow templates)
Prompts are pre-written instructions that guide the LLM through multi-step workflows:
@mcp.prompt()
def daily_review() -> str:
"""Generate a daily review of all open tasks and recent notes."""
return "Please review my current tasks and recent notes..."4. Full-Text Search with FTS5
SQLite's FTS5 extension gives you fast, relevance-ranked search across all your notes ā no external search engine needed.
5. Transport Modes
stdio (default): The client spawns the server as a subprocess. Used by Claude Desktop, Claude Code, Cursor.
SSE: Server runs as an HTTP endpoint. Used by web-based clients.
Extending This Project
Here are ideas to keep building:
Add a
web_cliptool ā save content from URLs as notes (usehttpx+BeautifulSoup)Add reminders ā tasks with due dates that surface automatically
Add note linking ā
[[wiki-style]]links between notesAdd export tools ā export notes as Markdown files or a PDF
Add an embedding-based search ā use OpenAI/Anthropic embeddings for semantic search alongside FTS5
Add OAuth ā protect your server when running over SSE (the June 2025 MCP spec update covers this)
Deploy to the cloud ā run on Cloudflare Workers, Fly.io, or Railway with Streamable HTTP transport
Troubleshooting
Issue | Fix |
Claude Desktop doesn't show tools | Restart Claude Desktop after editing config. Check the config path is correct. |
| Run |
Server crashes on startup | Check Python version: |
FTS search returns nothing | FTS index only covers notes added after the table was created |
Database locked errors | Make sure only one instance of the server is running |
Resources
FastMCP ā the high-level API (v1 is built into the official SDK)
MCP Server Registry ā discover community servers
MCP Specification (Nov 2025) ā the full protocol spec
License
MIT ā use this however you want. Build on it, learn from it, ship it.
Available Tools
11 toolsadd_noteA
Create a new note in the knowledge base.
Args: title: A short descriptive title for the note. content: The full body/content of the note (supports markdown). tags: Optional list of tags for categorization (e.g. ["python", "tutorial"]).
Returns: The newly created note with its assigned ID.
Inputs: title (required), content (required), tags.
add_taskA
Create a new task.
Args: title: Short task title. description: Detailed description of what needs to be done. priority: One of "low", "medium", "high", or "urgent". due_date: Optional due date in ISO format (YYYY-MM-DD). tags: Optional list of tags.
Returns: The newly created task.
Inputs: title (required), tags, due_date, priority, +1 more.
delete_noteA
Delete a note by ID.
Args: note_id: The ID of the note to delete.
Returns: True if the note was deleted, False if not found.
Inputs: note_id (required). Returns: result
delete_taskA
Delete a task by ID.
Args: task_id: The ID of the task to delete.
Returns: True if deleted, False if not found.
Inputs: task_id (required). Returns: result
get_noteA
Retrieve a single note by ID.
Args: note_id: The unique ID of the note.
Returns: The note if found, or None.
Inputs: note_id (required). Returns: result
get_statsA
Get an overview of the knowledge base: counts of notes and tasks by status.
Returns: Dictionary with note count, task counts by status, and tag frequencies.
Inputs: no named parameters.
list_notesA
List all notes, optionally filtered by a tag.
Args: tag: If provided, only return notes containing this tag. limit: Maximum number of notes to return (default 20).
Returns: List of notes, newest first.
Inputs: tag, limit. Returns: result
list_tasksA
List tasks with optional filters.
Args: status: Filter by status ("todo", "in_progress", or "done"). priority: Filter by priority ("low", "medium", "high", "urgent"). tag: Filter by a specific tag.
Returns: List of matching tasks ordered by priority then due date.
Inputs: tag, status, priority. Returns: result
search_notesA
Full-text search across all notes (titles, content, and tags).
Args: query: Search query string. Supports FTS5 syntax (e.g. "python OR rust"). limit: Maximum number of results to return (default 10).
Returns: List of matching notes ranked by relevance.
Inputs: query (required), limit. Returns: result
update_noteA
Update an existing note. Only provided fields are changed.
Args: note_id: The ID of the note to update. title: New title (optional). content: New content (optional). tags: New tags list (optional).
Returns: The updated note, or None if not found.
Inputs: note_id (required), tags, title, content. Returns: result
update_taskA
Update a task. Only provided fields are changed.
Args: task_id: The ID of the task to update. title: New title (optional). description: New description (optional). status: New status: "todo", "in_progress", or "done" (optional). priority: New priority: "low", "medium", "high", or "urgent" (optional). due_date: New due date in ISO format (optional). tags: New tags list (optional).
Returns: The updated task, or None if not found.
Inputs: task_id (required), tags, title, status, +3 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 11 tools
Every tool targets a distinct resource and action: notes vs. tasks, with separate CRUD and list/search operations. get_stats provides an overview, and there is no ambiguity between note and task operations.
All tool names follow a consistent verb_noun snake_case pattern (add_note, list_tasks, delete_note, etc.). The naming is uniform and predictable across the entire set.
11 tools is well-scoped for a knowledge base managing notes and tasks. Each tool covers a distinct operation, and there are no redundant or unnecessary tools.
Notes have full CRUD plus search. Tasks have add, list, update, and delete, but lack a dedicated get_task by ID (though list_tasks can filter). This is a minor gap that agents can work around.
Maintenance
Related MCP Connectors
Markdown-based note-taking with a hosted MCP server. Your notes serve you and your AI.
Google Keep-style notes app with an MCP server for AI agents to read/write notes.
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
One memory, every AI. A shared, user-owned markdown memory your AI clients read and write over MCP.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA local-first MCP server that gives AI assistants long-term memory by storing, searching, and recalling notes as Markdown files on your machine.9 npmMIT
- FlicenseNot gradedqualityDmaintenanceAn MCP server that transforms markdown notes into a searchable knowledge base with semantic search, smart note creation, and flashcard management for AI assistants.1-
- AlicenseAqualityDmaintenanceA personal notes MCP server that allows AI assistants to create, search, edit, and manage notes stored in a local SQLite database.6MIT
- AlicenseNot gradedqualityDmaintenanceA lightweight personal wiki MCP server that allows AI assistants to save, search, and link markdown notes with backlinks and full-text search, functioning as a file-based second brain.1MIT