gurbani-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gurbani-mcp Search for 'sewa' in the Guru Granth Sahib"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
gurbani-mcp
A local, self-hosted tool for looking up and verifying that a quote is authentically from Sri Guru Granth Sahib (SGGS). This project covers SGGS only (not other Banis).
It runs entirely on your own machine. No data leaves your computer unless you choose to expose it to an AI client (Claude, ChatGPT, etc.), and even then, only the query text you send is transmitted — never the underlying database.
Search — keyword search with Gurbani concept expansion (e.g. "sewa" also matches "service", "selfless service")
Verify — check a Gurmukhi quote against SGGS; get back the verbatim text + citation (Ang, Shabad, author), or a clear "not found"
Guard — scan a block of text for every Gurmukhi quote in it and verify each one individually
Two ways to connect an AI client: an MCP server (Claude Desktop, Claude Code, Cursor) and a plain HTTP API (ChatGPT via Custom GPT Actions, or any REST client)
Gurbani text is only ever returned from the source database — never paraphrased, summarized, or generated. See Quote Verification below.
Quick start
Prerequisites:
Tool | Why | Install |
one-time database build |
| |
run the Python servers |
|
git clone <this-repo-url> gurbani-mcp
cd gurbani-mcp
bash scripts/setup.shsetup.sh builds database/dist/banidb.sqlite from the official
Khalis Foundation BaniDB
Docker image (the dataset behind SikhiToTheMax), then installs Python
dependencies. It takes several minutes the first time (downloading + seeding
a ~640MB dataset); nothing about your database is uploaded anywhere.
Verify it worked:
bash scripts/test_search.sh "benefits of sewa"
uv run --extra dev pytestRelated MCP server: anna-book-search
Connect to an AI client
Claude Desktop / Claude Code (MCP)
Add this to your Claude Desktop config
(~/Library/Application Support/Claude/claude_desktop_config.json on macOS,
%APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"gurbani": {
"command": "uv",
"args": ["run", "--directory", "/absolute/path/to/gurbani-mcp", "python", "-m", "mcp_server.server"]
}
}
}Restart Claude Desktop. You should see a 🔨 tools icon indicating the
gurbani server is connected, exposing search_gurbani, verify_quote,
guard_text, get_shabad_by_ang, get_line, and get_shabad_by_line.
For Claude Code, add the same server with:
claude mcp add gurbani -- uv run --directory /absolute/path/to/gurbani-mcp python -m mcp_server.serverChatGPT (Custom GPT Actions, via the HTTP API)
Start the HTTP API:
uv run uvicorn api_server.app:app --port 8421ChatGPT Actions need a public HTTPS URL — they can't reach
localhost. The fastest way to get one without an account is a Cloudflare quick tunnel:cloudflared tunnel --url http://localhost:8421This prints a temporary
https://<random>.trycloudflare.comURL. Treat it as sensitive while it's live — anyone with the URL can query your local API. It's meant for short sessions; for anything longer-lived, put an API key or auth layer in front of it first (not included here — see Follow-ups).In ChatGPT: Explore GPTs → Create → Configure → Actions → Import from URL, and paste
https://<random>.trycloudflare.com/openapi.json. ChatGPT will pick up all the endpoints (/api/search,/api/verify,/api/guard, etc.) automatically.Give the GPT instructions like: "When asked to verify a Gurbani quote, always call the verify or guard action and quote its
source_textback verbatim — never answer from your own memory."
Example: verifying every quote in a document
curl -s "http://localhost:8421/api/guard" --get \
--data-urlencode "q=$(cat my_document.txt)" | jqReturns every Gurmukhi span found in the text, each marked verified,
verified_fuzzy (found, but with minor punctuation/spelling differences), or
not_found — with the exact source citation (Ang, author, full line) for
anything that verified.
Quote verification — how authenticity is guaranteed
Four layers, all sharing one matching core in gurbani_rag/verify.py:
Build gate (
scripts/validate_db.py) — structural checks (row counts, Ang coverage, no gaps/duplicates) run automatically duringsetup.sh, so an incomplete or corrupted database can never reach runtime.Retrieval — every search result comes straight from the source database with its citation attached. Authentic by construction.
Verify (
verify_quote) — exact match first (punctuation-agnostic), then fuzzy match via FTS5 + rapidfuzz with a 0.90 confidence floor. Below that:not_found. The text returned is always the source's own — never your input echoed back.Guard (
guard_text) — scans arbitrary text for every Gurmukhi span and verifies each one independently. This is the tool for auditing any drafted or existing content.
See CLAUDE.md for the full architecture and schema.
Optional: semantic search
The default search is keyword + concept expansion (works well, no extra setup). An optional ChromaDB-based semantic index can also be built:
uv run python scripts/build_index.pyRunning tests
uv run --extra dev pytesttests/test_golden.py checks known-authentic quotes verify at their correct
Ang, and known fakes are correctly rejected.
Data attribution
Scripture text, translations, and transliterations: Khalis Foundation BaniDB (SikhiToTheMax dataset).
BaniDB's compiled/proprietary form is not redistributed by this repo —
database/dist/banidb.sqlite is always built locally from the official
BaniDB Docker image (see scripts/setup.sh).
Follow-ups (not built yet)
The HTTP API has no authentication — fine for a short-lived tunnel session, not for leaving it exposed long-term.
No CI workflow yet.
License
MIT — see LICENSE.
Available Tools
6 toolsget_lineA
Fetch a specific line from the SGGS by its BaniDB verse ID (an integer, as returned by search_gurbani).
Inputs: line_id (required).
get_shabad_by_angA
Fetch all lines on a given Ang (page number) of the SGGS. Ang range: 1–1430.
Inputs: ang (required).
get_shabad_by_lineA
Given any line ID from the SGGS, return the complete Shabad (hymn) it belongs to — all lines in order, with Gurmukhi text, English transliteration, translation, and Ang reference. Use this after search_gurbani to expand a matching line into its full hymn context.
Inputs: line_id (required).
guard_textA
Audit a block of prose: find every Gurmukhi span in it and verify each against the source scripture. Use to check a drafted answer (or existing content) before presenting it. Returns each span's verdict (verified / not found) with citations.
Inputs: text (required).
search_gurbaniA
Search Sri Guru Granth Sahib (SGGS) by concept or keyword. Query in plain English — e.g. 'get rid of ego', 'love for God', 'fear of death'. Searches the English translations and returns matching lines with Gurmukhi text, English transliteration, translation, author, and Ang (page) reference.
Inputs: query (required), n_results.
verify_quoteA
Check whether a Gurmukhi quote is authentically present in the source scripture. ALWAYS call this before presenting any Gurmukhi quote that did not come directly from another tool's result (e.g. a quote recalled from memory). Returns the verbatim source text + citation (Ang, author) if found, or NOT FOUND — in which case the quote must not be presented as authentic. Tolerates vishraam/punctuation/spelling differences; the returned text is always the source's own.
Inputs: text (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool serves a clearly distinct purpose: search, retrieval by Ang or line, expanding to full Shabad, and two levels of quote verification (single quote vs. full text audit). No two tools appear to do the same thing.
All tool names follow a consistent verb_noun pattern with snake_case: search_, get_, verify_, guard_. The naming style is uniform and predictable.
Six tools is well-scoped for a scripture server covering search, retrieval, and verification. Each tool earns its place with no redundancy.
The domain is covered end-to-end: search to find lines, retrieve by page or line, expand to full shabad, and verify quotes with the source. No obvious gaps for the stated purpose.
Maintenance
Related MCP Connectors
One MCP server for all web data. Scrape, search, crawl, and AI research in one install.
Agent-native MCP server over the public saagarpatel.dev corpus. Read-only, stateless.
MCP server for Project Gutenberg: 78,000+ public-domain ebooks with full plain-text retrieval.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides powerful search capabilities for Jewish texts and literature. This server enables Large Language Models to search and reference Jewish texts through a standardized interface.23MIT
- AlicenseNot gradedqualityCmaintenanceSelf-hosted MCP server for searching and discovering books using Anna's Archive and Goodreads datasets, enabling full-text search, ISBN/md5 lookup, similarity matching, and optional download URL retrieval.12 npm4MIT
- AlicenseNot gradedqualityDmaintenanceMCP server to search and retrieve passages from a corpus of 7,872 classical Islamic books via the Sahifah API, with full citations and mu'tabar filtering.MIT
- AlicenseNot gradedqualityCmaintenanceSemantic search and comparative retrieval over a multi-tradition corpus of sacred and foundational texts, exposed as an MCP server.MIT