Sounio Compiler

io.github.agourakis82由 GitHub 账号 agourakis82 发布v0.1.0更新于 Oct 24, 2026

Check, compile, run, and test Sounio programs locally.

已验证STDIO仅桌面开发者工具AI 与机器学习

概览

AI 生成的概览

本地 MCP 服务器,让助手调用 Sounio 编译器对 .sio 程序做类型检查、编译、运行和测试。

可以做什么
  • 对 .sio 文件做类型检查,返回带行列位置和备注的规范化诊断信息
  • 将检查通过的文件编译为本地产物,目标可选 elf、macho、ptx、metal 或 wasm
  • 运行程序并捕获标准输出、标准错误和退出码,支持超时
  • 按 run-pass、compile-fail 等注解运行 Sounio 测试文件或目录
  • 以资源形式读取标准库模块说明和编译器错误解释
适用场景
适合助手编写或修改 Sounio 源码时,需要真实编译器参与检查、修复、再检查的循环,或在本地运行 Sounio 测试与示例的场景。
运行要求
以本地 stdio 进程运行,从 PyPI 安装(pip install sounio-mcp-server),用 python -m sounio_mcp.server 启动。需要本地 Sounio 代码库,并通过其启动脚本解析到 souc 编译器;源码路径必须位于 /workspace/sounio 内。未声明认证、令牌或环境变量。
安装前请注意
它会在本机执行编译和程序运行,运行不可信的 .sio 代码存在本地执行风险。运行时的环境变量覆盖仅限非敏感键,含令牌、密钥、凭据、代理或认证信息的键会被拒绝。编译兼容模式可能未产出产物却返回零退出码,因此会校验产物是否存在。不会向远程服务发送数据。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Sounio Compiler,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Sounio 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

bash
pip install -e tools/mcppython -m sounio_mcp.server --transport stdio

Claude Code:

bash
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:

json
{  "source_path": "tests/fixtures/broken_dose.sio"}

The response includes two diagnostic views:

  • diagnostics: agent-friendly records with string severity, one-based line/column, spans, related notes, and warnings.
  • diagnostic_envelope: the CC-1/CC-2 shared sounio.diagnostic.v1 envelope validated against tools/shared/diagnostic_schema.json.

sounio_compile

Runs sounio_check, then compiles a valid file to a local artefact.

Example:

json
{  "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:

json
{  "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:

json
{  "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:

text
sounio://stdlib/statssounio://stdlib/clinicalsounio://errors/E070

Error -> Fix Loop

The loop is deliberately thin:

  1. Agent writes or edits a .sio file.
  2. Agent calls sounio_check.
  3. Diagnostics are injected into the next prompt.
  4. Agent revises the file.
  5. Agent repeats until diagnostics are empty or the iteration budget is reached.

The reproducible local demonstration is:

bash
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 same souc check --json shape and keeps the LSP-compatible range fields.
  • Cx-1 should use sounio_check as the canonical validation method for generated dataset examples.
  • Cx-2 can use sounio_run as the HumanEval/MultiPL-E execution harness once translated .sio files 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 compile compatibility mode may exit zero even when an artefact is not emitted, so sounio_compile verifies output existence.
  • The focused Python gate covers direct tools, schema validation, one-shot JSON-RPC, and an actual mcp Python SDK client session over stdio.

来源:tools/mcp/README.md,提交 9dc32e1

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.0最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分