Turn your API docs into an intelligent MCP server with deterministic routing and layered knowledge injection.
Project description
DocChat MCP
Turn your API docs into an intelligent MCP server with deterministic routing and layered knowledge injection.
English | 中文
DocChat transforms your API documentation into a smart MCP server. AI coding assistants like Claude Code can query your API docs through natural language — with ~80% of queries resolved via deterministic routing (zero LLM cost).
Use Case
You're building an app that calls a third-party API. You want Claude Code to understand that API — parameters, response fields, error codes, best practices — so it can write correct integration code.
Your API docs → DocChat → MCP server (runs locally) → Claude Code queries it while coding
DocChat is the bridge: it turns your docs into structured knowledge that AI assistants can search and retrieve on demand.
How It Works
Your machine
┌───────────────────────────────────────────────────┐
│ │
│ Claude Code ◄── stdio ──► docchat mcp │
│ (LLM) (local process) │
│ │ │ │
│ │ "How do I call │ reads from │
│ │ the users API?" ▼ │
│ │ ./my-api-docs/ │
│ │ ├── META.yaml │
│ │ ├── GUIDE.md │
│ ▼ └── ... │
│ Generates answer │
│ using retrieved docs │
│ │
└───────────────────────────────────────────────────┘
The engine handles routing + knowledge retrieval. The AI client handles reasoning. No external services, no extra LLM calls.
Quick Start
1. Install
pip install docchat-mcp
2. Create your knowledge pack
Option A: Import from OpenAPI spec (recommended)
docchat import your-api-spec.json
This parses your OpenAPI spec (JSON/YAML, v2.0/3.x) and generates feed skeletons automatically — META.yaml with fields + endpoint info, and GUIDE.md with parameters, response fields, and examples. You just need to add trigger keywords and refine the docs.
Option B: Start from scratch
docchat init --name my-api
Then manually create each feed directory:
my-api/
└── feeds/
└── get-users/
├── META.yaml # Trigger keywords + field names (for routing)
└── GUIDE.md # Usage guide (for answering)
See docs/writing-guide.md for the format, or use the docchat-author skill to let Claude Code help you write them.
3. Validate and build
docchat validate # Check format
docchat build # Verify index loads correctly
4. Connect to Claude Code
# Register as a local MCP server (runs on your machine via stdio)
claude mcp add my-api -- docchat mcp --dir ./my-api-docs/
# Or via uvx (no prior install needed)
claude mcp add my-api -- uvx docchat-mcp mcp --dir ./my-api-docs/
That's it. Now when you ask Claude Code about your API, it queries DocChat's MCP server locally, retrieves the relevant docs, and generates accurate answers.
Team sharing (optional)
If you want multiple people to use the same knowledge pack:
# Start HTTP server on a shared machine
docchat serve --port 8000
# Team members connect remotely
claude mcp add my-api --transport http http://your-server:8000/mcp/
Features
- Deterministic routing — trigger keywords, field names, and feed codes match queries without LLM
- Layered knowledge injection — feed-level, overview, shared, and topic-matched knowledge
- Custom dimensions — organize feeds by any hierarchy (product, version, region, etc.)
- MCP native — 4 tools, 3 resources, 2 prompts — works with any MCP client
- Zero LLM dependency — the engine only provides data; AI reasoning is done by the client
- OpenAPI import —
docchat import spec.jsongenerates feed skeletons from OpenAPI specs (v2.0/3.x) - CLI tooling —
init/import/build/validate/serve/mcp
Knowledge Pack Structure
my-api/
├── docchat.yaml # Pack config (name, dimensions, assistant)
├── _shared/ # Shared knowledge (error codes, auth, etc.)
│ ├── INDEX.yaml # Topic keywords for matching
│ └── error_codes.md
├── _overview/ # API overview
│ └── INDEX.md
└── feeds/ # One directory per API endpoint
├── get-users/
│ ├── META.yaml # Triggers, fields, description
│ ├── GUIDE.md # Usage guide
│ ├── FAQ.md # Optional: troubleshooting
│ └── fields/ # Optional: field reference
└── get-posts/
├── META.yaml
└── GUIDE.md
See docs/knowledge-pack-format.md for the full specification.
Custom Dimensions
Organize feeds by any hierarchy via docchat.yaml:
# Simple API (all feeds flat)
dimensions: []
# Two dimensions (product x sport)
dimensions:
- key: product
values: { rest: "REST API", ws: "WebSocket" }
- key: sport
values: { soccer: "Soccer", basketball: "Basketball" }
MCP Tools
| Tool | Description |
|---|---|
list_feeds |
List all available feeds |
search_by_field |
Find feeds by field name |
get_feed_info |
Get feed details + documentation |
route_question |
Route a query and return matched feeds + knowledge |
Updating
Knowledge files changed (META.yaml, GUIDE.md, etc.): Restart Claude Code. The MCP server reloads on startup.
Engine updated (new docchat-mcp version):
pip install --upgrade docchat-mcp
# Then restart Claude Code
# If using uvx, clear cache first:
uv cache clean docchat-mcp
Why Not RAG?
| Approach | Limitation | DocChat |
|---|---|---|
| Swagger UI | Browse only, no Q&A | Natural language queries |
| ChatGPT + docs | Full context dump, token overflow | Layered injection |
| RAG (embeddings) | Embedding quality varies, routing opaque | Deterministic routing (~80% zero LLM) |
| No MCP | AI can't access docs | MCP native, Claude Code direct |
Demo
See it in action at docchat.site
License
MIT
Project details
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 docchat_mcp-0.2.0.tar.gz.
File metadata
- Download URL: docchat_mcp-0.2.0.tar.gz
- Upload date:
- Size: 133.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4cda24f00b1ded67cc0d27e21f838d5354e3dc05ff4a1bb1a9db6b33453073b0
|
|
| MD5 |
a09da9491ea0660d60d4256a33390619
|
|
| BLAKE2b-256 |
934f3e511b0b6ccf3e82382be0fc05545260614c9701834b6cbc33e856c7e28a
|
File details
Details for the file docchat_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: docchat_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 28.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe9ba8b431c9f59236e8e4cf39eb073201723d47c4fa8eba1ad64d8593b40985
|
|
| MD5 |
ab59253635dfce773606708c1ad5b3a7
|
|
| BLAKE2b-256 |
e7ed31f7091130d1e43981fcd0c4093b67f0e4f4fef0b86ac78e5d31df8084b8
|