lmmcp
lmmcp is a pure-Go Model Context Protocol (MCP) bridge and LMScript host exposing stdio, Streamable HTTP, and HTTP+SSE MCP servers over REST, CLI, and JSON-lines stdio. It provides typed _lmcode_ functions (mcp_server, mcp_call, mcp_read) alongside the 226 standard lmcode_std_v3 REST and CLI interfaces.
Quick reference
git clone https://github.com/lmctl-ai/lmmcp.git
cd lmmcp && CGO_ENABLED=0 go build -o lmmcp ./cmd/lmmcp
./lmmcp --version
./lmmcp --lmcode-schema
./lmmcp --lmcode-signatures
| Interface or flag | Signature or syntax | Purpose |
|---|---|---|
| CLI host bytecode | lmmcp --config config.json --lmcode prog.dslb | Execute compiled LMScript bytecode against configured MCP servers with dry-run preview and LMCODE_RETURN support. |
| CLI schema and signatures | lmmcp --lmcode-schema [--json] | --lmcode-signatures | Print embedded JSON schema or all 242 canonical host and lmcode_std_v3 signatures. |
| CLI MCP client actions | lmmcp servers|tools|call|resources|read|templates|prompts|prompt (--config FILE | --url ORIGIN) | Discover and invoke MCP tools, resources, templates, and prompts in-process or against a running lmmcp serve gateway. |
| CLI REST and stdio servers | lmmcp serve --config FILE [--listen 127.0.0.1:8080] | lmmcp stdio --config FILE | lmmcp openapi | Serve the loopback HTTP REST gateway, concurrent JSON-lines REST over stdio, or print the OpenAPI 3.1 document. |
| MCPServer handle | mcp_server(name: string) -> MCPServer | Acquire a typed handle to a configured MCP server with .tools(), .call(), .resources(), .templates(), .read(), .prompts(), and .prompt() methods. |
| Global MCP functions | mcp_servers() | mcp_tools(s) | mcp_call(s, tool, Json) | mcp_resources(s) | mcp_templates(s) | mcp_read(s, uri) | mcp_prompts(s) | mcp_prompt(s, name, Json) -> Json | Dispatch MCP discovery, tool execution, resource reads, and prompt rendering directly from _lmcode_ and receive {ok, data|error} Json envelopes. |
| Standard REST and CLI | RestGet..RestOptions, RestHandler, CliCommand, CliOption | Expose _lmcode_ functions as HTTP routes (:param) or stateless CLI flags and commands via rest_serve and rest_cli. |
p = _lmcode_ schema="examples/schema.json";
let srv = mcp_server("fixture");
let tools = srv.tools();
let reply = srv.call("echo", json_parse("{\"text\":\"hello from lmcode\"}"));
@"/call/:tool"
fn get_call(x: RestExchange) -> void implements RestGet {
let res = mcp_call("fixture", x.param("tool"), json_parse("{\"text\":\"hi\"}"));
x.json(res.to_json());
}
rest_config("session", "global");
let route_out = rest_cli(str_split("/call/echo", " "));
$return = json_parse("{\"direct\":" + reply.to_json() + ",\"route\":" + route_out + "}");
end _lmcode_
r = run_lmcode(p, {command: ["lmmcp", "--config", ARGV[0], "--lmcode", "$DSLFILE"]});
require(r.ok, json_stringify(r));
Documentation pages
- Skill — agent authoring rules, CLI and _lmcode_ commands, secret-suppression and destination safety rules, exit codes, and verification steps.
- Guide — bridge architecture, MCP transport revisions (stdio, Streamable HTTP, legacy SSE), cancellation and session lifecycle, and standard REST and CLI interfaces.
- Reference — complete CLI commands and flags, REST endpoints, MCPServer and mcp_* signatures, standard lmcode_std_v3 interfaces, and exit codes.