Connect your AI agent to the Raku knowledge base over MCP

From a file to a source

An AI agent will answer a Raku question with the same confidence whether it read the docs or remembered them wrong. Naming a source is not enough either — a real page can be cited for something it does not say. So I asked one for the page, the section, and the passage it was leaning on: how does an action class share state between grammar rules?

I searched the collection and opened the grammars page, then the section I expected. Wrong one, and I knew it within seconds. The answer was under "Always succeed" assertion[1], in the Digifier and Devanagari example: the action class declares has @!numbers. succ pushes a new empty element and digit appends to the last one, so both methods write to the same array. That is how the state gets from one rule to the next.

Next to it, Attributes in grammars adds a limit worth knowing. Grammar attributes can only be reached from methods, and changing one inside a method called from a token changes it for that token's own match object alone.

The answer is small. I can still trace every step that produced it: question, page, section, the example itself. I guessed the wrong section first, and the collection made that easy to see.

Where the collection ends

What it reads is the document collection made available through the knowledge base: the Raku documentation, module documentation from both ecosystems — p6c and zef — and the examples repository. It does not necessarily include every page on the site.

Ask it about Raku and it answers. Ask it about the tooling around Raku and you find the edge quickly. I searched it for the offline bundle that ships with this very server. Back came the Raku MCP modules — MCP, MCP::Server, MCP::Client — none of which package anything. After them came modules that had simply matched my words: Sparrowdo::Ruby::Bundler drives Ruby's Bundler from Raku, and App::InstallerMaker::WiX builds MSI installers for Raku applications.

Every hit was Raku. None of them was about packaging this server, because the collection does not hold that.

Installing it

Before writing this I ran the install myself, and not on the setup I had been using all along. Fresh bundle from release data-2026-09-11, wired into Codex — not Claude Code, which the page was written for. It found the grammars page. It named "Always succeed" assertion and quoted the passage back.

It travels as raku-kb-mcp-offline.tar.gz, attached to every data release, with the search index already built. These three lines are the ones I ran for that release; the MCP page keeps the current ones:

tar xzf raku-kb-mcp-offline.tar.gz
cd raku-kb-mcp && npm install
claude mcp add raku-kb -- node "$PWD/bin/raku-kb-mcp.mjs"

The third line is for Claude Code; other clients point at the same file with their own command or config. The page has both, and a prompt you can paste to check the connection.

That run exposed one correction. The page used to ask the agent for the lines it relied on, and the server returns page text without line numbers. It asks for a quote now.

What actually changes

The amount of text the agent can see stays the same. In the grammar run it went from question to page to section to the lines of an example, and every step was visible — including the one where I had guessed wrong. When the source is there, I can check it. When it isn't, the agent has a plain reason to say it doesn't know.

[1]That section sits under Special tokens on the same page, between sym and Methods in grammars.

The Camelia image is copyright 2009 by Larry Wall. "Raku" is a trademark of the Yet Another Society. All rights reserved.

Built with Podlite — the markup and publishing tools behind this site.