Zero-config MCP server for searchable documentation (SQLite default, PostgreSQL optional)
Project description
Gnosis MCP
Give your AI agent a searchable knowledge base. Zero config.
Quick Start · Backends · Editor Setup · Tools & Resources · Configuration · Full Reference
AI coding agents can read your source code but not your documentation. They guess at architecture, miss established patterns, and hallucinate details they could have looked up.
Gnosis MCP fixes this. Point it at a folder of markdown files and it creates a searchable knowledge base that any MCP-compatible AI agent can query — Claude Code, Cursor, Windsurf, Cline, and any tool that supports the Model Context Protocol.
No database server. SQLite works out of the box. Scale to PostgreSQL + pgvector when you need hybrid semantic search.
Why use this
Less hallucination. Agents search your docs before guessing. Architecture decisions, API contracts, billing rules — one tool call away instead of made up.
Lower token costs. A search returns ~600 tokens of ranked results. Reading the same docs as files costs 3,000-8,000+ tokens. On a 170-doc knowledge base (~840K tokens), that's the difference between a precise answer and a blown context window.
Docs that stay current. Add a new markdown file, run ingest, it's searchable immediately. No routing tables to maintain, no hardcoded paths to update.
Works with what you have. Your docs are already markdown files in a folder. Gnosis MCP indexes them as-is — no format conversion, no special syntax needed.
Quick Start
pip install gnosis-mcp
gnosis-mcp ingest ./docs/ # loads markdown, auto-creates SQLite database
gnosis-mcp serve # starts MCP server
That's it. Your AI agent can now search your docs.
Test it before connecting to an editor:
gnosis-mcp search "getting started" # verify search works
gnosis-mcp stats # see what was indexed
Try without installing (uvx)
uvx gnosis-mcp ingest ./docs/
uvx gnosis-mcp serve
Editor Integrations
Gnosis MCP works with any MCP-compatible editor. Add the server config, and your AI agent gets search_docs, get_doc, and get_related tools automatically.
Claude Code
Add to .claude/mcp.json:
{
"mcpServers": {
"docs": {
"command": "gnosis-mcp",
"args": ["serve"]
}
}
}
Or install as a Claude Code plugin for a richer experience with slash commands.
Cursor
Add to .cursor/mcp.json:
{
"mcpServers": {
"docs": {
"command": "gnosis-mcp",
"args": ["serve"]
}
}
}
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"docs": {
"command": "gnosis-mcp",
"args": ["serve"]
}
}
}
Cline
Open Cline MCP settings panel and add the same server config.
Other MCP clients
Any tool that supports the Model Context Protocol works. The server communicates over stdio by default, or SSE with --transport sse.
Choose Your Backend
| SQLite (default) | PostgreSQL | |
|---|---|---|
| Install | pip install gnosis-mcp |
pip install gnosis-mcp[postgres] |
| Config | Nothing — works immediately | Set DATABASE_URL |
| Search | FTS5 keyword (BM25) | tsvector + pgvector hybrid |
| Embeddings | Stored as binary blobs | Native vector type + HNSW index |
| Multi-table | No | Yes (UNION ALL across tables) |
| Best for | Personal projects, small teams | Production, semantic search, large doc sets |
Auto-detection: Set DATABASE_URL to postgresql://... and it uses PostgreSQL. Don't set it and it uses SQLite. Override with GNOSIS_MCP_BACKEND=sqlite|postgres.
PostgreSQL setup
pip install gnosis-mcp[postgres]
export GNOSIS_MCP_DATABASE_URL="postgresql://user:pass@localhost:5432/mydb"
gnosis-mcp init-db # create tables + indexes
gnosis-mcp ingest ./docs/ # load your markdown
gnosis-mcp serve
For hybrid semantic+keyword search, also enable pgvector:
CREATE EXTENSION IF NOT EXISTS vector;
Then backfill embeddings:
gnosis-mcp embed # via OpenAI (default)
gnosis-mcp embed --provider ollama # or use local Ollama
Claude Code Plugin
For Claude Code users, install as a plugin to get the MCP server plus slash commands:
claude plugin marketplace add nicholasglazer/gnosis-mcp
claude plugin install gnosis
This gives you:
| Component | What you get |
|---|---|
| MCP server | gnosis-mcp serve — auto-configured |
/gnosis:search |
Search docs with keyword or --semantic hybrid mode |
/gnosis:status |
Health check — connectivity, doc stats, troubleshooting |
/gnosis:manage |
CRUD — add, delete, update metadata, bulk embed |
The plugin works with both SQLite and PostgreSQL backends.
Manual setup (without plugin)
Add to .claude/mcp.json:
{
"mcpServers": {
"gnosis": {
"command": "gnosis-mcp",
"args": ["serve"]
}
}
}
For PostgreSQL, add "env": {"GNOSIS_MCP_DATABASE_URL": "postgresql://..."}.
What It Does
Gnosis MCP exposes 6 tools and 3 resources over MCP. Your AI agent calls these automatically when it needs information from your docs.
Tools
| Tool | What it does | Mode |
|---|---|---|
search_docs |
Search by keyword or hybrid semantic+keyword | Read |
get_doc |
Retrieve a full document by path | Read |
get_related |
Find linked/related documents | Read |
upsert_doc |
Create or replace a document | Write |
delete_doc |
Remove a document and its chunks | Write |
update_metadata |
Change title, category, tags | Write |
Read tools are always available. Write tools require GNOSIS_MCP_WRITABLE=true.
Resources
| URI | Returns |
|---|---|
gnosis://docs |
All documents — path, title, category, chunk count |
gnosis://docs/{path} |
Full document content |
gnosis://categories |
Categories with document counts |
How search works
# Keyword search — works on both SQLite and PostgreSQL
gnosis-mcp search "stripe webhook"
# Hybrid search — keyword + semantic similarity (PostgreSQL + embeddings)
gnosis-mcp search "how does billing work" --embed
# Filtered — narrow results to a specific category
gnosis-mcp search "auth" -c guides
When called via MCP, the agent passes a query string for keyword search. On PostgreSQL with embeddings, it can also pass query_embedding for hybrid mode that combines keyword matching with semantic similarity.
Embeddings
Embeddings enable semantic search — finding docs by meaning, not just keywords. Gnosis MCP supports three approaches, none of which add runtime dependencies:
1. Pre-computed vectors — pass embeddings to upsert_doc or query_embedding to search_docs if you generate them in your own pipeline.
2. CLI backfill — find chunks missing embeddings and generate them:
gnosis-mcp embed --dry-run # preview what needs embedding
gnosis-mcp embed # backfill via OpenAI (default)
gnosis-mcp embed --provider ollama # or use local Ollama
Supports OpenAI, Ollama, and any OpenAI-compatible endpoint (e.g., local models via vLLM or LiteLLM).
3. Built-in hybrid scoring — on PostgreSQL, when both keyword and embedding results are available, search automatically combines them using reciprocal rank fusion.
Configuration
All settings via environment variables. Nothing required for SQLite — it works with zero config.
| Variable | Default | Description |
|---|---|---|
GNOSIS_MCP_DATABASE_URL |
SQLite auto | PostgreSQL URL or SQLite file path |
GNOSIS_MCP_BACKEND |
auto |
Force sqlite or postgres |
GNOSIS_MCP_WRITABLE |
false |
Enable write tools (upsert_doc, delete_doc, update_metadata) |
GNOSIS_MCP_TRANSPORT |
stdio |
Server transport: stdio or sse |
GNOSIS_MCP_SCHEMA |
public |
Database schema (PostgreSQL only) |
GNOSIS_MCP_CHUNKS_TABLE |
documentation_chunks |
Table name for chunks |
GNOSIS_MCP_SEARCH_FUNCTION |
— | Custom search function (PostgreSQL only) |
GNOSIS_MCP_EMBEDDING_DIM |
1536 |
Vector dimension for init-db |
All variables
Search & chunking: GNOSIS_MCP_CONTENT_PREVIEW_CHARS (200), GNOSIS_MCP_CHUNK_SIZE (4000), GNOSIS_MCP_SEARCH_LIMIT_MAX (20).
Connection pool (PostgreSQL): GNOSIS_MCP_POOL_MIN (1), GNOSIS_MCP_POOL_MAX (3).
Webhooks: GNOSIS_MCP_WEBHOOK_URL, GNOSIS_MCP_WEBHOOK_TIMEOUT (5s). Set a URL to receive POST notifications when documents are created, updated, or deleted.
Embeddings: GNOSIS_MCP_EMBED_PROVIDER (openai/ollama/custom), GNOSIS_MCP_EMBED_MODEL (text-embedding-3-small), GNOSIS_MCP_EMBED_API_KEY, GNOSIS_MCP_EMBED_URL (custom endpoint), GNOSIS_MCP_EMBED_BATCH_SIZE (50).
Column overrides (for connecting to existing tables with non-standard column names): GNOSIS_MCP_COL_FILE_PATH, GNOSIS_MCP_COL_TITLE, GNOSIS_MCP_COL_CONTENT, GNOSIS_MCP_COL_CHUNK_INDEX, GNOSIS_MCP_COL_CATEGORY, GNOSIS_MCP_COL_AUDIENCE, GNOSIS_MCP_COL_TAGS, GNOSIS_MCP_COL_EMBEDDING, GNOSIS_MCP_COL_TSV, GNOSIS_MCP_COL_SOURCE_PATH, GNOSIS_MCP_COL_TARGET_PATH, GNOSIS_MCP_COL_RELATION_TYPE.
Links table: GNOSIS_MCP_LINKS_TABLE (documentation_links).
Logging: GNOSIS_MCP_LOG_LEVEL (INFO).
Custom search function (PostgreSQL)
Delegate search to your own PostgreSQL function for custom ranking:
CREATE FUNCTION my_schema.my_search(
p_query_text text,
p_categories text[],
p_limit integer
) RETURNS TABLE (
file_path text, title text, content text,
category text, combined_score double precision
) ...
GNOSIS_MCP_SEARCH_FUNCTION=my_schema.my_search
Multi-table mode (PostgreSQL)
Query across multiple doc tables:
GNOSIS_MCP_CHUNKS_TABLE=documentation_chunks,api_docs,tutorial_chunks
All tables must share the same schema. Reads use UNION ALL. Writes target the first table.
CLI Reference
gnosis-mcp ingest <path> [--dry-run] Load markdown files into the database
gnosis-mcp serve [--transport stdio|sse] [--ingest PATH] Start MCP server (optionally ingest first)
gnosis-mcp search <query> [-n LIMIT] [-c CAT] [--embed] Search from the command line
gnosis-mcp stats Show document and chunk counts
gnosis-mcp check Verify database connection
gnosis-mcp embed [--provider P] [--model M] [--dry-run] Backfill embeddings
gnosis-mcp init-db [--dry-run] Create tables + indexes manually
gnosis-mcp export [-f json|markdown] [-c CAT] Export documents
How ingestion works
gnosis-mcp ingest scans a directory for .md files and loads them into the database:
- Smart chunking — splits by H2 headings, keeping sections together (not arbitrary character limits)
- Frontmatter support — extracts
title,category,audience,tagsfrom YAML frontmatter - Auto-categorization — infers category from the parent directory name
- Incremental updates — content hashing skips unchanged files on re-run
- Dry run — preview what would be indexed with
--dry-run
Available on
Gnosis MCP is listed on the Official MCP Registry, PyPI, and major MCP directories. It works with any MCP-compatible client today, with more editor integrations coming as the MCP ecosystem grows.
Architecture
src/gnosis_mcp/
├── backend.py DocBackend protocol + create_backend() factory
├── pg_backend.py PostgreSQL — asyncpg, tsvector, pgvector
├── sqlite_backend.py SQLite — aiosqlite, FTS5
├── sqlite_schema.py SQLite DDL — tables, FTS5, triggers
├── config.py Config from env vars, backend auto-detection
├── db.py Backend lifecycle + FastMCP lifespan
├── server.py FastMCP server — 6 tools, 3 resources
├── ingest.py Markdown scanner — H2 chunking, frontmatter
├── schema.py PostgreSQL DDL — tables, indexes, search functions
├── embed.py Embedding providers — OpenAI, Ollama, custom
└── cli.py CLI — serve, ingest, search, embed, stats, check
AI-Friendly Docs
These files are optimized for AI agents to consume:
| File | Purpose |
|---|---|
llms.txt |
Quick overview — what it does, tools, config |
llms-full.txt |
Complete reference in one file |
llms-install.md |
Step-by-step installation guide |
Development
git clone https://github.com/nicholasglazer/gnosis-mcp.git
cd gnosis-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest # 176 tests, no database needed
ruff check src/ tests/
All tests run without a database. Keep it that way.
Good first contributions: new embedding providers, export formats, ingestion for RST/AsciiDoc/HTML, search highlighting. Open an issue first for larger changes.
Sponsors
If Gnosis MCP saves you time, consider sponsoring the project.
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gnosis_mcp-0.6.2.tar.gz.
File metadata
- Download URL: gnosis_mcp-0.6.2.tar.gz
- Upload date:
- Size: 266.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4e70078f6cda87b3b7d948b1bfdbea3535d2b33e1eae26116b23cbae28285ca8
|
|
| MD5 |
e4a77b04ae82c27fa976fa754f7e0e91
|
|
| BLAKE2b-256 |
2892de9ab409d9038d90b527dea0b47ceaf723187ef5076421b98154095d926e
|
Provenance
The following attestation bundles were made for gnosis_mcp-0.6.2.tar.gz:
Publisher:
publish.yml on nicholasglazer/gnosis-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gnosis_mcp-0.6.2.tar.gz -
Subject digest:
4e70078f6cda87b3b7d948b1bfdbea3535d2b33e1eae26116b23cbae28285ca8 - Sigstore transparency entry: 969438209
- Sigstore integration time:
-
Permalink:
nicholasglazer/gnosis-mcp@1b73ff66c39889851653e060ad0813fb9284760d -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/nicholasglazer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1b73ff66c39889851653e060ad0813fb9284760d -
Trigger Event:
push
-
Statement type:
File details
Details for the file gnosis_mcp-0.6.2-py3-none-any.whl.
File metadata
- Download URL: gnosis_mcp-0.6.2-py3-none-any.whl
- Upload date:
- Size: 37.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a1cb433171dea9c58f6db462a6b3a0042c5304a7413406b7741ad658892735f
|
|
| MD5 |
5627c24c1a1fa4da7b5e319b083a7db5
|
|
| BLAKE2b-256 |
5e7caae5b513ea9d7c7420777e48f1e3225725bdc5e0d3c608f5f34b687bdc1d
|
Provenance
The following attestation bundles were made for gnosis_mcp-0.6.2-py3-none-any.whl:
Publisher:
publish.yml on nicholasglazer/gnosis-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gnosis_mcp-0.6.2-py3-none-any.whl -
Subject digest:
6a1cb433171dea9c58f6db462a6b3a0042c5304a7413406b7741ad658892735f - Sigstore transparency entry: 969438211
- Sigstore integration time:
-
Permalink:
nicholasglazer/gnosis-mcp@1b73ff66c39889851653e060ad0813fb9284760d -
Branch / Tag:
refs/tags/v0.6.2 - Owner: https://github.com/nicholasglazer
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1b73ff66c39889851653e060ad0813fb9284760d -
Trigger Event:
push
-
Statement type: