pandashhh

rag-mcp-server

Community pandashhh
Updated

rag-mcp-server

A lightweight MCP server that exposes an existing Anthropic documentation RAG service as tools for Claude Desktop.

What this is

This project wraps the anthropic-docs-rag API (a separately running RAG service) and makes it accessible to Claude Desktop via the Model Context Protocol (MCP). Claude Desktop can then call search_anthropic_docs or list_available_topics as native tools during a conversation — without any copy-pasting or manual API calls.

The actual intelligence (embedding, retrieval, answer generation) lives entirely in the RAG service. This server is purely a protocol adapter.

Architecture

Claude Desktop
     │
     │  stdio (stdin/stdout)
     ▼
MCP Server  (src/server.py — FastMCP)
     │
     │  HTTP POST /ask
     ▼
RAG Service  (localhost:8002 — anthropic-docs-rag)
     │
     ├──▶ ChromaDB  (vector store)
     └──▶ Claude API  (answer generation)

Transport: stdio vs. HTTP/SSE

This server uses stdio transport — Claude Desktop launches the Python process directly and communicates over stdin/stdout. It's the standard for local MCP servers: simple, no port conflicts, no auth needed.

For remote or production MCP servers (shared across multiple users or machines), you'd switch to HTTP/SSE transport, where the MCP server runs as a persistent web service and clients connect via Server-Sent Events. FastMCP supports both; only the mcp.run() call changes.

Tools

Tool Signature Description
search_anthropic_docs (query: str) -> str Sends a question to the RAG service and returns the generated answer
list_available_topics () -> list[str] Returns the static list of topics covered in the indexed documentation

Prerequisites

The anthropic-docs-rag service must be running on port 8002 before starting this server or using the tools in Claude Desktop. This MCP server will start successfully either way, but tool calls will fail with a connection error if the RAG service is unavailable.

Setup

source .venv/bin/activate
pip install -r requirements.txt

# Optional: override the RAG service URL
cp .env.example .env

Claude Desktop Configuration

Add this to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "anthropic-docs-rag": {
      "command": "/absolute/path/to/rag-mcp-server/.venv/bin/python",
      "args": ["/absolute/path/to/rag-mcp-server/src/server.py"],
      "env": {
        "RAG_SERVICE_URL": "http://localhost:8002"
      }
    }
  }
}

Restart Claude Desktop — the two tools will appear automatically in the tool list.

Tests

pytest tests/ -v

3 tests, all HTTP calls to the RAG service are mocked with unittest.mock.

Note

This is a learning project for understanding MCP — how tools are defined, how Claude Desktop discovers and calls them, and how stdio transport works. It is not a standalone production system. All the interesting logic (RAG pipeline, embeddings, vector search) lives in the anthropic-docs-rag service.

MCP Server · Populars

MCP Server · New

    abskrj

    velane

    Code Runtime and iPaaS for AI Agent — execute Bun/Python snippets at scale via POST API + integrate with 800+ tools (N8N for AI Agents)

    Community abskrj
    jean-technologies

    Jean Memory

    next-generation AI memory infrastructure (powered by mem0 and graphiti)

    Community jean-technologies
    PascaleBeier

    HitKeep

    HitKeep is privacy-first analytics for humans and AI agents, self-hosted or in managed EU/US cloud regions.

    Community PascaleBeier
    prometheus

    Prometheus MCP Server

    MCP server for LLMs to interact with Prometheus

    Community prometheus
    TencentEdgeOne

    EdgeOne Makers MCP

    An MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.

    Community TencentEdgeOne