About Sounio Compiler
Sounio Compiler is a local MCP server that lets agent tools use the checked Sounio compiler to check, compile, run, and test programs. It uses stdio only and returns structured diagnostics alongside resources for standard-library context and error explanations.
Key features
- 01Check .sio files and return diagnostics
- 02Compile valid files to local artifacts
- 03Run programs and capture output and exit code
- 04Run tests by file or directory
- 05Expose standard-library and error resources
- 06Return structured diagnostic content
Use cases
- 01Check and iteratively fix generated Sounio code
- 02Compile valid programs to local artifacts
- 03Run Sounio programs and inspect results
- 04Automate Sounio test suites
MCP support
The server exposes compiler check, compile, run, and test tools, plus standard-library and error-explanation resources, to agent tools over local MCP stdio. It has no HTTP transport or remote execution path.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMESounio MCP Server
sounio-mcp-server exposes the checked Sounio compiler to agentic tools over
local Model Context Protocol stdio transport. It is intentionally local-only:
no HTTP transport, no OAuth, no token handling, and no remote execution path.
Install
pip install -e tools/mcp
python -m sounio_mcp.server --transport stdio
Claude Code:
claude --mcp-server sounio=python:-m:sounio_mcp.server
The server resolves souc through scripts/lib/resolve_souc.sh, which in this
checkout resolves to the checked self-hosted launcher (bin/souc on supported
hosts). The server rejects source paths outside /workspace/sounio.
Tool calls return both MCP text content and structuredContent. The text content
keeps the prompt's shell examples simple; structuredContent lets typed MCP
clients consume the result without reparsing JSON text.
Tools
sounio_check
Type-checks a .sio file and returns diagnostics normalised from
souc check --json.
Example:
{
"source_path": "tests/fixtures/broken_dose.sio"
}
The response includes two diagnostic views:
diagnostics: agent-friendly records with string severity, one-basedline/column, spans, related notes, and warnings.diagnostic_envelope: the CC-1/CC-2 sharedsounio.diagnostic.v1envelope validated againsttools/shared/diagnostic_schema.json.
sounio_compile
Runs sounio_check, then compiles a valid file to a local artefact.
Example:
{
"source_path": "examples/hello.sio",
"target": "elf",
"optimization": "default"
}
Targets are accepted as elf, macho, ptx, metal, or wasm. The current
checked launcher is strongest for host-native ELF; other targets are passed
through to the compiler target flag and reported honestly if unsupported.
sounio_run
Runs souc run, captures stdout/stderr/exit code, and reports compile_error,
runtime_error, timeout, or ok.
Example:
{
"source_path": "examples/hello.sio",
"args": [],
"timeout_sec": 30
}
Environment overrides are allowed only for non-sensitive keys. Keys containing tokens, secrets, credentials, proxies, or auth material are rejected.
sounio_test
Runs a Sounio test directory or file programmatically using the checked compiler.
Example:
{
"test_pattern": "tests/run-pass",
"test_filter": "hello"
}
The test runner understands the existing //@ run-pass, //@ compile-fail,
//@ check-only, //@ expect-stdout, //@ expect-stdout-contains,
//@ error-pattern, and //@ ignore annotations.
Resources
sounio://stdlib/{module}returns stdlib README/source context.sounio://errors/{error_code}returns compiler error explanations traced to current compiler source or committed compile-failure evidence.
Examples:
sounio://stdlib/stats
sounio://stdlib/clinical
sounio://errors/E070
Error -> Fix Loop
The loop is deliberately thin:
- Agent writes or edits a
.siofile. - Agent calls
sounio_check. - Diagnostics are injected into the next prompt.
- Agent revises the file.
- Agent repeats until diagnostics are empty or the iteration budget is reached.
The reproducible local demonstration is:
PYTHONPATH=tools/mcp python3 tools/mcp/examples/llmloop_recipe.py \
--fixtures 'tests/fixtures/broken/*.sio' \
--max-iter 10 \
--seed 1729
Current fixture benchmark:
- fixtures: 20
- agent model:
deterministic-fixture-agent-v0.1 - seed:
1729 - convergence rate:
1.0 - average iterations:
1.0
This is a local recipe for the LLMloop pattern, not a claim about a hosted model. It exists so Claude Code, Cursor, ChatGPT via MCP, and CLI agents can close the same check/fix/re-check loop using the real Sounio compiler.
Cross-Agent Use
- CC-1 owns
tools/shared/diagnostic_schema.json; MCP consumes the samesouc check --jsonshape and keeps the LSP-compatiblerangefields. - Cx-1 should use
sounio_checkas the canonical validation method for generated dataset examples. - Cx-2 can use
sounio_runas the HumanEval/MultiPL-E execution harness once translated.siofiles are produced.
Quality Notes
- No compiler binary is modified.
- No remote MCP transport is implemented.
- Error catalogue entries are trace-backed; unknown codes return an explicit "not promoted yet" resource instead of invented explanations.
- The checked launcher's
compilecompatibility mode may exit zero even when an artefact is not emitted, sosounio_compileverifies output existence. - The focused Python gate covers direct tools, schema validation, one-shot
JSON-RPC, and an actual
mcpPython SDK client session over stdio.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.