Skip to content
cajulang

Caju for AI assistants

caju mcp is a Model Context Protocol server built into the caju command. Claude Code, Claude Desktop, Cursor and other assistants use the compiler through tools with structured results: they read the language reference, look up the standard library, and check, run and test code.

$ claude mcp add caju -- caju mcp

CLI or MCP: measured

The same three tasks, done by Claude Code with only the caju command in a shell, or with only the MCP tools. Same model, same prompt, an empty directory with the task's files; each result checked afterwards.

cli5/6Correct
mcp6/6Correct
Turns3.3×
cli30.3
mcp9.2
Compiler calls10.5×
cli17.8
mcp1.7
Input tokens (thousands)4.2×
cli540
mcp129
Time (s)4×
cli48.6
mcp12.2
Cost (US$)2.1×
cli0.168
mcp0.079
TaskCorrectTurnsCompiler callsTime (s)
Write a programThe 5 most frequent words of a text, sorted by count and then alphabetically.
cli2/2161023.7
mcp2/25.51.59.7
Go to CajuA program written in Go style must become valid Caju and print two given lines.
cli1/2533188.1
mcp2/2101.512
Write testsAt least 4 tests for a stack module that has a hidden bug.
cli2/22212.534
mcp2/212214.8

It reads before it writes

With MCP, every run began with caju_reference and caju_docs, then wrote the program once. Most programs were right the first time.

Without it, the compiler is the manual

With the CLI, the assistant learned Caju from error messages: caju --help, then small probe programs, one construct at a time, rewriting after each error. One run hit the 40-turn limit still probing the syntax.

Errors point at the fix

A diagnostic with line, column and stage takes the assistant straight to the line to change, instead of reading and guessing from text.

It went looking for the server

In a first round where caju mcp was not blocked, CLI runs found it in caju --help and spoke JSON-RPC to it from the shell to read the reference.

Two runs per task and mode, one model and small tasks: the direction is clear, the exact ratios are not. The CLI runs could not use other shell commands. Programs, logs summary and method in bench/mcp of the language repository. bench/mcp/RESULTS.md

A real session

An assistant (Claude Sonnet 5.5) converting a Go-style program to Caju with the MCP tools. It is one of the runs of the comparison below, shortened, in its original English.

Task

main.caju was written in Go style, but it must be a valid program in the Caju programming language. Rewrite it so that it prints exactly "CASHEW, MANGO" and "total: 16.00".

Step 1 of 9

Five tools

Checking, running and testing answer with JSON, so the assistant never parses the compiler's text output. The code graph tools answer with one short line per symbol, instead of whole files: the graph lives in the server's memory and answers in about 2 ms.

Type-checks without generating code. Every error comes with its file, line, column and stage (syntax, type, link...).

Request · caju_check
{ "files": {
    "main.caju": "x := 1\nx = \"a\"\n"
} }
Response · caju_check
{ "ok": false, "diagnostics": [ {
    "file": "main.caju", "line": 2, "col": 5, "stage": "type",
    "message": "\"x\" (line 1) is int, but got str"
} ] }

Set it up

It comes with the caju command: there is nothing else to install.

Claude Code
claude mcp add caju -- caju mcp
Claude Desktop, Cursor, VS Code and other clients
{
  "mcpServers": {
    "caju": { "command": "caju", "args": ["mcp"] }
  }
}

Use the full path of caju (~/.local/bin/caju with the installer) if the client does not see your PATH. The server reads JSON-RPC messages on its standard input, one per line.

Why a new language needs this

An assistant has never seen Caju while it learned, and Caju looks enough like Go to be written as Go. The server gives it the real reference, the real names of the library and exact positions for every error, so it stops guessing.