Skip to main content

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.

PyPI version License: MIT

DocChat transforms your API documentation into a smart MCP server. AI assistants like Claude Code can query your API docs through natural language — with ~80% of queries resolved via deterministic routing (zero LLM cost).

How It Works

User question → Deterministic routing (trigger keywords / field names / feed codes)
                   ↓ matched                    ↓ not matched
           Load knowledge files          Return "needs LLM fallback"
                   ↓
    AI client receives structured docs and generates answer

The engine handles routing + knowledge retrieval. The AI client (Claude Code, Claude Desktop, etc.) handles reasoning.

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
  • CLI toolinginit / build / validate / serve / mcp

Quick Start

# Install
pip install docchat-mcp

# Initialize a knowledge pack
docchat init --name my-api

# Write your docs (see docs/writing-guide.md or use docchat-author skill)
# Each feed gets: META.yaml (triggers + fields) + GUIDE.md (usage guide)

# Validate format
docchat validate

# Build index
docchat build

# Start MCP server
docchat mcp        # stdio mode (for Claude Code)
docchat serve      # HTTP mode (for remote access)

Connect to Claude Code

# Add as MCP server (stdio)
claude mcp add my-api -- docchat mcp --dir ./my-api-docs/

# Or via uvx (zero install)
claude mcp add my-api -- uvx docchat-mcp mcp --dir ./my-api-docs/

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

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

docchat_mcp-0.1.0.tar.gz (97.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

docchat_mcp-0.1.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file docchat_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: docchat_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 97.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.15

File hashes

Hashes for docchat_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8a2a003c5e34a08177c75bbca81a75040f5c245f7d9f4b801bf58d69270aabfb
MD5 5037128a256c4cb7cc8d12a78bbf6190
BLAKE2b-256 745c0b5b450b5f56e1c557e8ccf9ce83d007d01438f1d9a863a5794d3efc0e64

See more details on using hashes here.

File details

Details for the file docchat_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for docchat_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ccb8f2c6b3194d62e037cb361a2e0938236859bdeedac38313125874a39088c1
MD5 6b35d058669600ed4bf1a789950fc46c
BLAKE2b-256 4bcc0a9c74db7647d91c37a34c9e935c73a61bd06a5dd500058ef6f3a9a73f83

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page