Mcp
AI
Stdio MCP client for an external MCP server.
Use Port for raw CLI tools (line/packet/stream bytes). Use Mcp when the child speaks MCP JSON-RPC over stdio (newline-delimited framing). Use Mcp.Server when this process is the MCP server. Use Acp for newline-delimited Agent Client Protocol (e.g. agent acp, acp-bridge). Inside Server.application, connect from init and drive call from update; HTTP handle should reach the core with Process.call / Process.send, never call Mcp directly.
Types
Event
type Event
= Ready
| Notification String Value
| Closed StringLifecycle and async traffic from the MCP session.
Examples
Mcp.ReadyValues
connect
connect : String -> List Setting -> Cmd msgSpawn the MCP server process. Forces binary+stream; pass Port.args, Port.env, and Port.cd as needed.
Examples
Mcp.connect "npx" [ Port.args [ "-y", "some-mcp-server" ] ]call
call : String -> Value -> (Result String Value -> msg) -> Cmd msgJSON-RPC request. The reply is tagged into msg.
Examples
Mcp.call "tools/list" JE.null GotToolsnotify
notify : String -> Value -> Cmd msgJSON-RPC notification (no reply).
Examples
Mcp.notify "notifications/initialized" JE.nullsubscribe
subscribe : (Event -> msg) -> Sub msgDeliver Event values into the running program.
Examples
Mcp.subscribe GotMcp