Labsco
dhamma-seeker logo

Tripitaka MCP

1

from dhamma-seeker

Search and cite the full Pāli Canon (Tipiṭaka, ~444K segments) — Sutta, Vinaya, Abhidhamma at parity with SuttaCentral. Hybrid search, full-sutta fetch, translation comparison, Pāli word lookup. Free, non-commercial, offered as Dhamma Dāna.

🔥🔥🔥✓ VerifiedAccount requiredAdvanced setup

Tripitaka MCP Server

<p align="center"> <img src="https://tripitaka-mcp.com/favicon-192.png" alt="Tripitaka MCP logo — folded hands over a dhammacakka in pixel art" width="160" height="160"> </p>

License: MIT MCP Spec Coverage Hosted Dhamma Dāna Glama Smithery

An MCP Server for searching and citing content from the Pāli Tipiṭaka. Gives AI agents (such as Claude or Cursor) the ability to look up suttas, quote the teachings, and compare translations across languages.

🙏 This project is offered as Dhamma Dāna — 100% free, non-commercial only. License details: LICENSE (code) + NOTICE.md (data)

✨ Features

  • 📚 Full Tipiṭaka coverage at parity with SuttaCentral — all three baskets indexed (~444K segments): Sutta (Pāli + Sujato English), Vinaya (Pāli + Brahmali English), and Abhidhamma (Pāli only — no English in upstream bilara-data for any Abhidhamma book). Live counts via list_structure.
  • ⚖️ Hybrid Search — highest precision by combining keyword and semantic search through Reciprocal Rank Fusion (RRF). Ready to use.
  • 🔍 Keyword Search — trigram fuzzy matching with cross-language alignment.
  • 🧠 Semantic Search — meaning-based search via vector similarity (pgvector).
  • 📖 Translation Comparison — view and compare renderings across editions, aligned at the segment level.
  • 📚 Dictionary Bridge — built-in dictionary of 20,000+ entries (P. A. Payutto, PTS, DPPN).
  • 📖 Get Sutta & Reference — fetch sutta content by ID (e.g. mn1, pli-tv-bu-vb-pj1, patthana1.1) and generate properly formatted academic citations.
  • 🔬 Pāli word analyzer — strip inflectional suffixes to find the root form when dictionary lookup misses (bhikkhūnaṁbhikkhu).
  • 🔗 Cross-reference URLs in every response — a clickable deep link to the project's own bilingual reader (Pāli + English, with a segment anchor that highlights the cited verse). The reader renders SuttaCentral's bilara-data verbatim, so it is the authoritative text; AI clients surface this link so users verify the source in one click.
  • 📡 Dual transport — both legacy SSE (/sse) and canonical Streamable HTTP (/mcp, MCP spec 2025-03-26).
  • 📦 MCP Resourcestripitaka://structure, tripitaka://sutta/{id}, tripitaka://word/{w} for clients that pin context as resources.
  • 📄 Curated reference pages at /topics/* — six markdown pages covering canon structure, getting-started + tool selection, places (Mahājanapada + holy sites + cosmology), 10 foundational themes with locus classicus, ~30 major figures, and a phase-based timeline of the Buddha's 45-year mission. Sutta IDs verified against live data; AI clients can fetch a page in one shot instead of running 30+ tool calls.
  • 🤖 Claude skillskills/tipitaka-research.md ships a ready-to-install workflow file that activates a multi-step research pattern (clarify → verify coverage → search → drill in → cite) on Claude Desktop / Claude Code.
  • 📮 Postman Ready — ships with a Postman collection for testing the API.

🏗️ Tech Stack

TechnologyRole
Python + FastMCPMCP Server
PostgreSQL + pgvectorDatabase + Vector Search
sentence-transformersEmbeddings for semantic search
Docker ComposeInfrastructure

🔧 Connecting to Claude Desktop

The repo ships claude_desktop_config.example.json with three ready-to-use entries — copy whichever fits your setup into claude_desktop_config.json (~/Library/Application Support/Claude/ on macOS, %APPDATA%\Claude\ on Windows), then edit the absolute paths:

EntryWhen to useTransport
tripitaka-localYou ran the installer locally on the same machine as Claude Desktopstdio (no network)
tripitaka-remoteYou self-hosted the server on a VPS and want the modern transportStreamable HTTP (/mcp)
tripitaka-remote-sseYour client doesn't support Streamable HTTP yetLegacy SSE (/sse)

The remote entries route through mcp-remote — Claude Desktop ↔ npx bridge ↔ remote MCP. The example file has annotated comments explaining each field; remove the _comment keys before saving.

Heads-up for nvm users: command and env.PATH need absolute node paths — Claude Desktop doesn't read your shell profile. Find the right paths with which npx / which python while your normal shell is active.

Optional: install the research skill

For Claude Desktop / Claude Code users, copying the bundled skill activates the multi-step research workflow automatically:

Copy & paste — that's it
mkdir -p ~/.claude/skills
cp skills/tipitaka-research.md ~/.claude/skills/
# Restart Claude Desktop (Cmd+Q then reopen) to pick up the skill

Details in skills/README.md.

📦 MCP Tools (12 total)

ToolDescription
search_hybrid(Recommended for concept search) Combined keyword + semantic via RRF — best when looking for "discourses about X".
search_by_keywordTrigram keyword search — best for the top few matches of an exact word (appamāda, ānāpānassati).
survey_corpusExhaustive corpus survey — exact total + per-pitaka breakdown + the matched word-forms, for "how many times / every place X appears" (coverage, not just best matches). mode=thorough adds concept-level semantic recall.
search_semanticPure vector similarity — usually you want search_hybrid instead.
get_suttaFetch a sutta by ID (e.g. mn1, dn22, dhp1-20) with cross-reference URLs. Whole sutta by default; for long ones use mode="outline" (table of contents, no text), around="<segment_id>"+window (context around a hit), or segment_range/offset+limit to fetch just a slice.
open_sutta_viewerInteractive sutta viewer (MCP Apps) — renders the sutta inline in the chat as Pāli + English side by side, with the cited segment highlighted. The calling model can attach an AI translation of the displayed segments into the user's own language (translations param) as a clearly-badged third row — the canon itself stays Pāli + English. Requires an MCP Apps-capable host (Claude, Claude Desktop, VS Code Copilot, …); other hosts get a graceful text fallback.
get_referenceGenerate a properly formatted academic citation with all source URLs.
compare_translationsCompare renderings of a single segment across editions.
list_structureShow the Tipiṭaka structure with segment-count coverage per nikāya.
list_editionsList Thai/English translation editions currently loaded.
get_word_definitionPāli dictionary lookup (PTS, DPPN, and the Payutto Thai dictionary).
parse_pali_wordStrip Pāli suffixes to recover the root form when get_word_definition misses (bhikkhūnaṁbhikkhu).

⚠️ Note on search_semantic

The vector index is built only on text_pali (SuttaCentral's bilara-data does not yet include Thai translations) using a multilingual MiniLM model that is not specifically trained on Pāli. As a result:

  • Pāli / English queries → accurate (good cross-lingual alignment)
  • Thai queries → loose matches, not recommended
  • For exact keywords like appamāda, search_by_keyword is more precise
  • For general-purpose search, search_hybrid (keyword + semantic) tolerates this limitation best

Upgrading to a Pāli-trained embedding model (e.g. bge-m3) plus embedding the Thai edition is on the roadmap.

📁 Project Structure

Copy & paste — that's it
tripitaka-mcp/
├── main.py                       # Main MCP Server (12 tools + 3 resources)
├── db/
│   ├── connection.py             # Database connection pool
│   └── schema.py                 # Schema (supports translation table)
├── embedding/
│   └── model.py                  # SentenceTransformer wrapper
├── scripts/
│   ├── install.sh                    # One-shot installer (HF dump → DB)
│   ├── deploy.sh                     # Deploy / restart on a VPS
│   ├── backup.sh                     # pg_dump → S3-compatible store
│   ├── dump_and_publish.sh           # Verify embeddings → pg_dump → upload to HuggingFace
│   ├── seed_metadata.py              # Seed pitaka/nikāya metadata
│   ├── data_loader.py                # Load Sutta Piṭaka (Pāli + Sujato English)
│   ├── load_vinaya.py                # Vinaya loader (Vibhaṅga + Pātimokkha + Khandhaka + Parivāra, Brahmali EN)
│   ├── load_abhidhamma.py            # Abhidhamma loader (7 books, Pāli — bilara has no EN)
│   ├── load_thai_cc0.py              # Thai translation loader
│   ├── load_dictionary.py            # Load dictionary data
│   ├── scrape_payutto.py             # Web scraper for the Payutto dictionary
│   ├── generate_embeddings.py        # Generate vector embeddings
│   ├── run_embedding_with_retry.sh   # Resilient wrapper around embedding generation (retries on DB drop)
│   ├── check_embedding_progress.py   # Live progress snapshot (or --watch mode) for the embedding job
│   ├── smoke_test.sh                 # Endpoint smoke test (TLS + /sse + /mcp + /health)
│   └── test_full_sutta.py            # Full-content smoke test (22 size-tiered suttas across all 3 piṭakas)
├── topics/                       # Static markdown pages served at /topics/*
│   ├── README.md                 # Index of available topic pages
│   ├── tipitaka-overview.md      # Canon structure + coverage
│   ├── getting-started.md        # Connection paths, tool selection, prompt patterns
│   ├── places.md                 # Geography of the suttas (Mahājanapada, holy sites, cosmology)
│   ├── themes.md                 # 10 foundational teachings + locus classicus
│   └── people.md                 # ~30 major figures (chief disciples, lay supporters, kings)
├── skills/                       # Portable Claude skills for AI clients
│   ├── README.md                 # How to install
│   └── tipitaka-research.md      # Multi-step research workflow
├── infra/                        # Reverse proxy + deploy config
│   ├── Caddyfile                 # Caddy: TLS, rate limit, /topics, /sse, /mcp
│   ├── Dockerfile.caddy          # Caddy + caddy-ratelimit plugin
│   ├── cloud-init.yml            # VPS bootstrap
│   └── *.tf                      # Terraform (provider-agnostic)
├── docs/
│   └── CAPACITY.md               # Capacity planning per VPS spec
├── claude_desktop_config.example.json
├── docker-compose.yml            # Dev (single mcp-server)
├── docker-compose.prod.yml       # Prod (db + 2 mcp-server + caddy)
├── Dockerfile
└── requirements.txt

📜 Data Sources & License

This project aggregates data from multiple sources under different licenses. Please read NOTICE.md in full before redistributing.

SourceLicenseNote
Source codeMITFree to use, fork, modify
SuttaCentral bilara-dataCC0Public domain
Thai translations (Dhīranando, Jayasāro)CC0Via SuttaCentral
Dictionary of Buddhism by Somdet Phra Buddhaghosacariya (P. A. Payutto)Dhamma Dāna⚠️ Non-commercial use only
PTS / DPPN / Dhammika DictionariesPublic Domain / CC

⚠️ If you plan to fork or redistribute

  • ✅ Use in free / dhamma-dāna / educational projects — allowed
  • ✅ Run on your own machine / personal use — allowed
  • Do not use in any paid product or service (because of the Payutto dictionary)
  • Do not modify the dictionary content

For commercial use: remove the dictionary component, or contact Wat Nyanavesakavan for permission.

🙏 Credits & Attribution

See CREDITS.md for contributor details and NOTICE.md for license terms.

Gratitude to:

  • Somdet Phra Buddhaghosacariya (P. A. Payutto) + Wat Nyanavesakavan
  • SuttaCentral and the Thai & English translators
  • 84000.org

Sādhu 🙏 — May the sharing of this Dhamma bring benefit and happiness to all beings.