MCP server
Documented from docs/MCP.md in the repository.
Surp ships two MCP stdio servers with the same tool names:
- Rust-native binary:
surp-mcp - Python-native module:
python -m surp.mcpor the Python package scriptsurp-mcp-python
Both servers expose Surp directly through library APIs. They do not shell out to surp-cli.
Transports
The servers implement local stdio MCP JSON-RPC. Logs are structured JSON on stderr only; stdout is reserved for MCP protocol messages.
Security
File tools are constrained by environment variables:
SURP_MCP_ROOTS: allowed filesystem roots, separated by the platform path separator. Defaults to the process current directory.SURP_MCP_READ_ONLY=1: disables writes.SURP_MCP_MAX_INPUT_BYTES: maximum file or base64 input size. Default: 16 MiB.SURP_MCP_MAX_INLINE_BYTES: maximum inline response payload. Default: 4 MiB.SURP_MCP_MAX_TEXT_BYTES: maximum text input size. Default: 4 MiB.
Decode tools default to strict limits for untrusted MCP inputs.
Tools
General:
surp_capabilities
Stable v1 Surp:
surp_v1_encode_jsonsurp_v1_decodesurp_v1_text_parsesurp_v1_text_prettysurp_v1_text_to_binarysurp_v1_binary_to_textsurp_v1_inspectsurp_v1_validatesurp_v1_query
RFC-001:
surp_rfc001_parse_ctnsurp_rfc001_normalize_ctnsurp_rfc001_compile_ctnsurp_rfc001_decode_cbfsurp_rfc001_cbf_to_ctnsurp_rfc001_inspect_cbfsurp_rfc001_query_ctnsurp_rfc001_query_cbf
Resources
surp://capabilitiessurp://formats/v1surp://formats/rfc001surp://securitysurp://examples/v1surp://examples/rfc001
Examples
Encode JSON to v1 Surp:
1 2 3 4 5 6 7
{
"name": "surp_v1_encode_json",
"arguments": {
"value": {"name": "Alice", "tags": ["admin", "ops"]},
"dedup": true
}
}
Validate returned bytes:
1 2 3 4 5 6
{
"name": "surp_v1_validate",
"arguments": {
"data_base64": "..."
}
}
Compile RFC-001 CTN:
1 2 3 4 5 6 7
{
"name": "surp_rfc001_compile_ctn",
"arguments": {
"text": "User\n name = \"Alice\"\n tags = [\"admin\", \"ops\"]",
"with_symtab": true
}
}
Query RFC-001 CTN:
1 2 3 4 5 6 7 8
{
"name": "surp_rfc001_query_ctn",
"arguments": {
"text": "User\n name = \"Alice\"\n tags = [\"admin\", \"ops\"]",
"query": ".tags[-1]",
"as_ctn": true
}
}
Format Boundaries
Stable v1 .surp and RFC-001 CBF .crb are different binary formats. Use surp_v1_* tools for v1 data and surp_rfc001_* tools for RFC-001 CTN/CBF/CQL.
The MCP server exposes implemented behavior only. RFC-001 features not implemented in surp-core, such as full CSL, witness cryptography, full CQL pipelines, stream chunk framing, CPC RPC, DB pages, migrations, CBF index generation, and schema hash generation, are documented as gaps rather than advertised as tools.