Grav v1.14.0

The MCP server

mcp_server/server.py is a Model Context Protocol server that gives an AI assistant (such as Claude Code or Claude Desktop) access to the Grav compiler. The assistant can then check, run and test Grav code, and look things up in the standard library and these docs, instead of guessing.

It is a single Python file using only the standard library.

Tools

ToolDoes
grav_to_ctranslates Grav source to C
grav_checktype-checks source text, a file, or a project folder
grav_runbuilds and runs a program, with arguments and standard input
grav_testruns test blocks, optionally filtered
grav_lib_searchfinds standard-library classes, functions and methods by name or doc text
grav_lib_moduleshows a module's documentation and declarations
grav_docssearches this documentation by topic
grav_packageslists, adds, installs, updates or removes packages, or creates a project

grav_check, grav_run and grav_test take source text (source) or a file or project folder (path). Source text is compiled on its own, outside any project. To use a project's packages and files from it, pass that folder as project: the text is then compiled as a file in that folder, so import "grav-db" and relative imports resolve as they do in the project's own files.

Setup

Build the compiler first. In this repository, a project-scoped .mcp.json already registers the server, so Claude Code offers to start it when run from the repository root (claude mcp list shows it).

The server finds the compiler through the GRAVC environment variable, falling back to build/gravc in the repository. grav_run also needs a C compiler. See mcp_server/README.md for other clients.

Edit this page on GitHub