Click on "Install 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., "@gerbil-mcpevaluate (map 1+ '(1 2 3)) importing :std/sugar"
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.
gerbil-mcp
An MCP (Model Context Protocol) server that gives AI assistants live access to a Gerbil Scheme environment. It lets Claude (or any MCP client) evaluate expressions, look up module exports, check syntax, expand macros, and search symbols against a real gxi runtime — instead of guessing from training data.
Prerequisites
Node.js >= 18
Gerbil Scheme installed with
gxiavailable (tested with v0.19+)
Install
Configure
Claude Code
Add the MCP server using the CLI (user scope — available across all projects):
Or for a single project only:
This writes the config to ~/.claude.json (user scope) or .mcp.json in the project root (project scope). Start a new Claude Code session to pick up the server.
Other MCP clients
Any MCP-compatible client can connect using the stdio transport. The server reads JSON-RPC from stdin and writes to stdout:
Environment Variables
Variable | Default | Description |
|
| Path to the |
|
| Gerbil installation directory (used for module listing) |
Tools
gerbil_eval
Evaluate a Gerbil Scheme expression and return the result.
Parameter | Type | Required | Description |
| string | yes | Gerbil expression to evaluate |
| string[] | no | Modules to import first |
gerbil_module_exports
List all exported symbols from a Gerbil module.
Parameter | Type | Required | Description |
| string | yes | Module path (e.g. |
gerbil_check_syntax
Validate Gerbil code without evaluating it. Uses the Gerbil expander.
Parameter | Type | Required | Description |
| string | yes | Code to check |
| string[] | no | Modules for macro context |
gerbil_expand_macro
Show the core-expanded form of a Gerbil expression.
Parameter | Type | Required | Description |
| string | yes | Expression to expand |
| string[] | no | Modules for macro definitions |
gerbil_apropos
Search for symbols matching a pattern across all Gambit/Gerbil namespaces.
Parameter | Type | Required | Description |
| string | yes | Substring to match |
gerbil_list_std_modules
List available standard library modules by scanning the Gerbil installation.
Parameter | Type | Required | Description |
| string | no | Filter by prefix (e.g. |
How It Works
Each tool invokes gxi -e as a subprocess — no persistent REPL, no state between calls. This avoids the complexity of managing gxi's interactive mode (which has banners, prompts, and debug REPL behavior that complicate scripted usage).
Expressions are wrapped in error-handling code that uses with-catch to trap exceptions and output structured markers (GERBIL-MCP-RESULT: / GERBIL-MCP-ERROR:) that the TypeScript layer parses.
User input is injected via (read (open-input-string ...)) rather than string interpolation, letting Scheme's reader handle all quoting. Subprocess execution uses execFile (not exec) to avoid shell injection.
Project Structure
License
MIT