Indexes and searches local Markdown documentation folders to provide AI agents with context-aware information, helping reduce hallucinations and token costs.
Supports local embedding generation via Ollama to enable private semantic search without external API dependencies.
Utilizes local ONNX models for efficient, zero-config semantic search and document embedding generation.
Integrates with OpenAI embedding models to enable semantic search capabilities for documentation.
Supports PostgreSQL with the pgvector extension for production-scale hybrid keyword and semantic search across large document sets.
Uses SQLite with FTS5 keyword search as a zero-config local backend for indexing and searching document knowledge bases.
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 with keyword search, or add [embeddings] for local semantic search. Scale to PostgreSQL + pgvector when needed.
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. Or use --watch to auto-re-ingest on file changes. 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
That's it. Your AI agent can now search your docs.
Want semantic search? Add local ONNX embeddings (no API key needed, ~23MB model):
Test it before connecting to an editor:
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:
Or install as a Claude Code plugin for a richer experience with slash commands.
Cursor
Add to .cursor/mcp.json:
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
VS Code (GitHub Copilot)
Add to .vscode/mcp.json in your workspace:
Also discoverable via the VS Code MCP gallery — search @mcp gnosis in the Extensions view.
Enterprise: Your org admin needs the "MCP servers in Copilot" policy enabled. Free/Pro/Pro+ plans work without this.
JetBrains (IntelliJ, PyCharm, WebStorm)
Go to Settings > Tools > AI Assistant > MCP Servers, click +, and add:
Name:
docsCommand:
gnosis-mcpArguments:
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 — including Zed, Neovim (via plugins), and custom agents. The server communicates over stdio by default, or SSE with --transport sse.
Choose Your Backend
SQLite (default) | SQLite + embeddings | PostgreSQL | |
Install |
|
|
|
Config | Nothing | Nothing | Set |
Search | FTS5 keyword (BM25) | Hybrid keyword + semantic (RRF) | tsvector + pgvector hybrid |
Embeddings | None | Local ONNX (23MB, no API key) | Any provider + HNSW index |
Multi-table | No | No | Yes ( |
Best for | Quick start, keyword-only | Semantic search without a server | Production, 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.
For hybrid semantic+keyword search, also enable pgvector:
Then backfill embeddings:
Claude Code Plugin
For Claude Code users, install as a plugin to get the MCP server plus slash commands:
This gives you:
Component | What you get |
MCP server |
|
| Search docs with keyword or |
| Health check — connectivity, doc stats, troubleshooting |
| CRUD — add, delete, update metadata, bulk embed |
The plugin works with both SQLite and PostgreSQL backends.
Add to .claude/mcp.json:
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 by keyword or hybrid semantic+keyword | Read |
| Retrieve a full document by path | Read |
| Find linked/related documents | Read |
| Create or replace a document | Write |
| Remove a document and its chunks | Write |
| Change title, category, tags | Write |
Read tools are always available. Write tools require GNOSIS_MCP_WRITABLE=true.
Resources
URI | Returns |
| All documents — path, title, category, chunk count |
| Full document content |
| Categories with document counts |
How search works
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.
Search results include a highlight field with matched terms wrapped in <mark> tags for context-aware snippets (FTS5 snippet() on SQLite, ts_headline() on PostgreSQL).
Embeddings
Embeddings enable semantic search — finding docs by meaning, not just keywords.
1. Local ONNX (recommended for SQLite) — zero-config, no API key needed:
Uses MongoDB/mdbr-leaf-ir (~23MB quantized, Apache 2.0). Auto-downloads on first run. Customize with GNOSIS_MCP_EMBED_MODEL.
2. Remote providers — OpenAI, Ollama, or any OpenAI-compatible endpoint:
3. Pre-computed vectors — pass embeddings to upsert_doc or query_embedding to search_docs from your own pipeline.
Hybrid search — when embeddings are available, search automatically combines keyword (BM25) and semantic (cosine) results using Reciprocal Rank Fusion (RRF). Works on both SQLite (via sqlite-vec) and PostgreSQL (via pgvector).
Configuration
All settings via environment variables. Nothing required for SQLite — it works with zero config.
Variable | Default | Description |
| SQLite auto | PostgreSQL URL or SQLite file path |
|
| Force |
|
| Enable write tools ( |
|
| Server transport: |
|
| Database schema (PostgreSQL only) |
|
| Table name for chunks |
| — | Custom search function (PostgreSQL only) |
|
| Vector dimension for init-db |
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/local), GNOSIS_MCP_EMBED_MODEL (text-embedding-3-small for remote, MongoDB/mdbr-leaf-ir for local), GNOSIS_MCP_EMBED_DIM (384, Matryoshka truncation dimension for local provider), 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).
Delegate search to your own PostgreSQL function for custom ranking:
Query across multiple doc tables:
All tables must share the same schema. Reads use UNION ALL. Writes target the first table.
CLI Reference
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 frontmatterAuto-linking —
relates_toin frontmatter creates bidirectional links (queryable viaget_related)Auto-categorization — infers category from the parent directory name
Incremental updates — content hashing skips unchanged files on re-run
Watch mode —
gnosis-mcp serve --watch ./docs/auto-re-ingests on file changesDry run — preview what would be indexed with
--dry-run
Available on
Gnosis MCP is listed on the Official MCP Registry (which feeds the VS Code MCP gallery and GitHub Copilot), PyPI, and major MCP directories including mcp.so, Glama, and cursor.directory.
Architecture
AI-Friendly Docs
These files are optimized for AI agents to consume:
File | Purpose |
Quick overview — what it does, tools, config | |
Complete reference in one file | |
Step-by-step installation guide |
Development
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.