KB-MCP Server
A local-first knowledge base server that enables AI clients to store, retrieve, and manage documents using semantic search. Provides privacy-focused, offline-capable memory for AI assistants with tools for ingesting, querying, updating, and deleting knowledge.
README
KB-MCP Server
A local-first Knowledge Base with Model Context Protocol (MCP) support. Give your AI a reliable memory. Run it locally. Stream answers in real time.
What is This?
A Knowledge Base (KB) is a structured collection of facts, documents, and embeddings stored in machine-readable form, with interfaces to:
- Add knowledge
- Query knowledge (semantic + keyword search)
- Update/Delete knowledge
This MCP server exposes your KB to any MCP-compatible AI client (Claude, custom agents, etc.).
Why Local-First?
| Benefit | Description |
|---|---|
| Privacy | No cloud leaks — your data stays on your machine |
| Zero latency | No network round-trips |
| Offline support | Works without internet |
| Full control | You own the data and the logic |
| No vendor lock-in | Swap components freely |
Quick Start
Installation
npm install
npm run build
Run the Server
npm start
Or for development:
npm run dev
Configure with Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"knowledge-base": {
"command": "node",
"args": ["/path/to/kb-mcp-server/dist/index.js"],
"env": {
"KB_DATA_DIR": "/path/to/your/data"
}
}
}
}
Available Tools
| Tool | Description |
|---|---|
ingest_document |
Add a document with title, content, and metadata |
query_knowledge |
Semantic search across all documents |
list_documents |
List documents with pagination |
get_document |
Get full document by ID |
update_document |
Update existing document |
delete_document |
Remove document from KB |
kb_stats |
Get knowledge base statistics |
How It Works
1. User asks a question
↓
2. AI sends MCP query → KB-MCP Server
↓
3. KB retrieves relevant facts (semantic search)
↓
4. AI grounds the answer with real data
↓
5. Response streams to user
↓
6. (Optional) New insights stored back
Result: AI answers correctly. Knowledge compounds. No hallucinations.
Architecture
┌─────────────────┐
│ AI Client │
│ (Claude, Agent) │
└────────┬────────┘
│ MCP Protocol
↓
┌─────────────────┐
│ KB-MCP Server │ ← stdio transport
│ ┌───────────┐ │
│ │ Tools │ │ ingest | query | list | delete
│ └─────┬─────┘ │
│ ↓ │
│ ┌───────────┐ │
│ │ Engine │ │ Embeddings + Similarity Search
│ └─────┬─────┘ │
│ ↓ │
│ ┌───────────┐ │
│ │ Store │ │ JSON file (swap with Chroma/pgvector)
│ └───────────┘ │
└─────────────────┘
Configuration
| Environment Variable | Default | Description |
|---|---|---|
KB_DATA_DIR |
./.kb-data |
Directory for storing knowledge base data |
Production Enhancements
For production use, consider:
- Real embeddings: Replace hash-based embeddings with OpenAI, Cohere, or local models (Ollama)
- Vector database: Swap JSON store with Chroma, Qdrant, or pgvector
- Chunking: Split large documents into chunks for better retrieval
- Hybrid search: Combine semantic + BM25 keyword search
- Access control: Add authentication for multi-user setups
License
MIT — Use freely.
Author
Matrix Agent
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.