This repository contains a Retrieval-Augmented Generation (RAG) system built over U.S. tax code documents. The core logic is exposed via an MCP server (STDIO-based), with supporting scripts for ingestion and local evaluation. The system uses ChromaDB for vector storage and supports configurable retrieval parameters (e.g., k).
- Ingestion Pipeline: Parses tax code documents, generates embeddings, and stores them in ChromaDB
- Vector Store: ChromaDB with local persistence (
chroma_db/) - MCP Server: Primary interface for querying the RAG pipeline using MCP (STDIO)
- Inspector UI: Used to interactively test queries via browser
The design intentionally separates ingestion, retrieval, and serving, making it easier to adapt or extend.
- Python 3.12
- GitHub
- Docker
- MCP documentation
python -m venv .venv
source .venv/bin/activate # macOS / Linux
# .venv\Scripts\activate # Windowspip install -r requirements.txtBefore running the server, embeddings must be generated and stored locally.
python src/ingestion/ingest.pyThis will:
- Parse the tax code source documents
- Generate embeddings
- Persist the vector store to
./chroma_db/
Note:
chroma_db/is generated at runtime and is not committed to Git.
Start the MCP server using:
mcp-inspector python src/main.pyOn startup, the logs will print a local inspection URL and access key.
- Copy the URL and key from the logs
- Open the URL in your browser
- Paste the key when prompted
- Submit queries against the tax code
You can experiment with:
- Different natural language questions
- Different
kvalues (number of retrieved chunks)
This allows you to directly observe retrieval quality and grounding behavior.
Common parameters can be adjusted via environment variables or config files:
CHROMA_PATH– location of the vector store (default:./chroma_db)TOP_K– number of retrieved documents per query- Embedding / LLM provider settings
These defaults are chosen to make local evaluation simple.
The project can also be run using Docker for a reproducible environment.
docker compose up --build -d .docker run -p 8010:8010 -v $(pwd)/chroma_db:/app/chroma_db tax-code-mcp \
python src/main.pydocker compose down
The
chroma_dbdirectory is mounted as a volume so embeddings persist across runs.
- The MCP server is the primary interface; HTTP adapters can be layered on top if needed
- Vector DB artifacts are generated locally to avoid committing large derived files
- The system favors clarity and reproducibility over production hardening
Common extensions include:
- Adding an HTTP/FastAPI adapter on top of the MCP server
- Supporting additional document sources
- Swapping vector stores or embedding models
- Deploying the HTTP adapter to a managed service
This repository demonstrates:
- End-to-end RAG over tax code data
- Clean separation between ingestion, retrieval, and serving
- MCP-based interaction with configurable retrieval parameters
It is intended to be easy to run locally, inspect interactively, and adapt for further experimentation.