MCP server for AI agents
Dhamma.Gift has an MCP server: connect it to Claude, ChatGPT, Gemini, Grok, Cursor or another AI assistant, and the assistant works with the Pali Canon itself, on the same texts and the same search engine as the site:
- Six Pali editions, line by line: the Mahāsaṅgīti beside Siam Rath (Thailand), Buddha Jayanti (Sri Lanka), Chaṭṭha Saṅgāyana (Myanmar), the printed Mahāsaṅgīti of 2005 and PTS, for the whole canon, with the differing words marked and each edition's license.
- Translations aligned with the Pali, segment by segment, in many languages; Dhamma.Gift's own Russian translation from the Pali, Ṭhānissaro Bhikkhu's English and others.
- A dictionary by the Suttas: where the Suttas and the Vinaya themselves define a term (the Pali line and its place), its other uses, the similes built on it; the Digital Pali Dictionary; 20+ Sanskrit dictionaries (Monier-Williams, Edgerton's Buddhist Hybrid Sanskrit and others).
- Search by words, phrases and regular expressions over the Suttas and the Vinaya, the suttas that
define a term first;
kata.*dukkha,vucc.*dukkhafind the canon's own definitions. - Uposatha days by the Suttas (by the real moon) for any place, as in the Uposatha calendar.
- A link to the line for every quote, and a link to the Compare view with all the editions.
With the server comes a short instruction for the assistant: a teaching is checked against the Suttas and the Vinaya (AN 4.180), a term means what the Suttas define it as, every quoted line is linked.
1. Copy the address
https://api.dhamma.gift/mcp
Streamable HTTP, no login, read-only. Listed in the official MCP registry as gift.dhamma/pali-canon; also described in the API docs.
2. Add it to your app
Menus as of December 2026; the apps rename them from time to time.
- Claude
- ChatGPT
- Gemini
- Grok
- Other
- Open claude.ai in a browser and sign in.
- In the left sidebar: Customize → Connectors (older layout: your name → Settings → Connectors).
- Add custom connector. Name: Dhamma.Gift, URL: the address above.
- No sign-in is needed; leave the rest empty. Add.
- Start a new chat, click + and check that Dhamma.Gift is on.
Added once on the web, it also works in the Claude apps for phone and desktop. The free plan allows one
custom connector. In Claude Code: claude mcp add --transport http dhamma-gift https://api.dhamma.gift/mcp
- Open chatgpt.com in a browser and sign in.
- Settings → Plugins (or chatgpt.com/plugins), then Browse directory.
- Add (top right) → Custom MCP server. Name: Dhamma.Gift.
- Connection: Server URL, the address above. Authentication: No authentication.
- Confirm and add it.
- Start a new chat and choose Dhamma.Gift in the + menu.
The Gemini website and phone app cannot use outside tools yet. On a computer:
- Gemini CLI:
gemini mcp add --transport http dhamma-gift https://api.dhamma.gift/mcp - Antigravity: in
~/.gemini/config/mcp_config.json, inside"mcpServers", add"dhamma-gift": { "serverUrl": "https://api.dhamma.gift/mcp" }, then quit Antigravity and open it again.
- Open grok.com/connectors and sign in.
- New Connector → Custom.
- The address above, no authentication. Save.
- Start a new chat with the connector on.
Custom connectors may need a paid Grok plan.
Any app that takes a remote MCP server (Streamable HTTP): the address above, no authentication. Cursor and others: add a remote (HTTP) MCP server with this address.
3. Ask
In plain words, in any language. For example:
- Using Dhamma.Gift, how do the Suttas themselves define dukkha? Quote the Pali with links.
- Using Dhamma.Gift, find the simile of the turtle and quote the Pali with an English translation.
- Using Dhamma.Gift, compare the editions of SN 56.11: where do they differ?
- Using Dhamma.Gift, what does the dictionary say about upādāna: where do the Suttas define it, and what does the Sanskrit say?
- Using Dhamma.Gift, when are the next Uposatha days in Bangkok?
What it can do there, tool by tool: below. An assistant can still misread a text: check what it says against the lines it links.
Tools
| Tool | What it does |
|---|---|
search | Keyword, substring or regular-expression search over the Suttas and the Vinaya (the Abhidhamma on request, scope). Returns a list of the matching suttas (id, title, number of matches, number of similes, reader link): suttas that define the term first, then those named after it, then by how often it occurs. include_segments adds the matched Pali lines, include_translations with langs adds translations. |
get_text | A sutta by id (mn1, dn22, sn56.11): the Pali, and translations when langs is given; editions adds the whole text in the other editions, line by line. |
compare_editions | The canon's editions compared line by line: the Mahāsaṅgīti beside Siam Rath (Thailand), Buddha Jayanti (Sri Lanka), Chaṭṭha Saṅgāyana (Myanmar), the printed Mahāsaṅgīti of 2005 and the PTS editions, for the whole canon (the gaps of each edition: Compare). A sutta, a line or a range: first a summary per edition (name, license, lines present, missing, differing), then the lines that differ, word by word. Case, punctuation and ṁ/ṃ do not count. |
compare_translations | One segment (e.g. mn129:21.3) in the Pali, every edition and every available translation side by side. |
list_structure | What exists: collections, books with sutta counts, translation languages and translators; with a prefix (mn, sn56) the list of suttas under it. |
dictionary | A word in the Dictionary: dg — where the Suttas and the Vinaya define the term (the definition line and its segment ids), broader and Vinaya uses, similes and metaphors on it, and what a word stands for when it is the image of a simile (vammika → the body, MN 23); dpd — the Digital Pali Dictionary's meanings for the form; sanskrit — 20+ dictionaries of the Cologne Digital Sanskrit Lexicon (give the Sanskrit form in IAST: duḥkha, tṛṣṇā). |
uposatha | The Uposatha days by the Suttas (the 8th and the 14th/15th of each half-month, by the real moon) for the next N days at a place (lat, lon, time zone; default Bodh Gaya): the begin at the eve's sunset, dawn, noon and the end, with a link to the calendar. |
get_text, compare_editions and compare_translations also return compare_link: the text in the reader's
Compare view, every edition beside the translation (e.g. https://dhamma.gift/sn56.11?mode=multi).
How it behaves
- The search is literal: it matches letters, not meaning. For a topic the assistant tries the Pali and
translation words itself (
kacchapa,kummo, turtle, черепаха) and merges the results. At least 3 letters per query; diacritics are ignored (kacchapfindsmahākacchapa). - Every answer carries reader links:
https://dhamma.gift/mn129for the sutta,https://dhamma.gift/mn129:21.3for the exact segment. - Answers are Pali only unless the assistant asks for translations (
include_translations,langs). Sujato's English is left out unless asked for by name; machine (AI) translations are hidden, as in the search on the site. - One query lists up to 40 suttas by default;
limittakes a number or"all". The answer always gives the true number of matching suttas and says when the list was cut. - Regular expressions work as in the site search. Patterns such as
kata.*dukkha("Katamañca … dukkhaṁ?") andvucc.*dukkha("idaṁ vuccati … dukkhaṁ") find where the canon defines a term.
Under the hood
Our server. core/mcp-server.js in the dg-node repository, mounted as POST /mcp in dg-fastify.js
(GET and DELETE answer 405: it is stateless, every request gets its own server object, no sessions).
search and get_text are thin wrappers over the functions behind /search and /api/text; compare_translations
and list_structure read dg.db directly (read-only). compare_editions reads the editions' texts aligned to the
Mahāsaṅgīti segments and marks the differing words (core/edition-diff.js). dictionary reads the project's glossary
(dg-glossary.json) and the DPD data the Dictionary uses; the Sanskrit part asks the Cologne Digital Sanskrit Lexicon's
API at each call. uposatha runs the same code as the Uposatha calendar (uposatha-core.js with the Astronomy Engine).
With the tool descriptions the server sends an instruction for the agent: the principles (check against the Suttas and
the Vinaya, terms by the Suttas' own definitions, ordinary sense of words, the grammar), how to find a definition
with regex, the project's renderings of the key terms, what the site has, and the hard rule to link every line it names.
The plan and open questions (ranking, a stdio mode for the offline app, a separate mcp. subdomain) are in
docs/MCP_PLAN.md of the repository.