Serves Bau operations over the Model Context Protocol.
Procs
proc formatMcpResponse(response: string): string {....raises: [], tags: [], forbids: [].}
- Format a JSON-RPC response body as one MCP stdio message.
proc handleRequest(line: string; projectDir: string): string {. ...raises: [Exception], tags: [ReadIOEffect, WriteIOEffect, RootEffect, ReadDirEffect, ReadEnvEffect, WriteEnvEffect, WriteDirEffect, ExecIOEffect, TimeEffect], forbids: [].}
-
Handle one JSON-RPC request body for Bau's MCP server.
Notifications return an empty string because they do not produce responses.
proc mcpServerLoop(projectDir: string) {. ...raises: [IOError, OSError, Exception, IOError], tags: [ReadIOEffect, WriteIOEffect, RootEffect, ReadDirEffect, ReadEnvEffect, WriteEnvEffect, WriteDirEffect, ExecIOEffect, TimeEffect], forbids: [].}
- Run the stdio MCP server loop for a project directory.
proc readMcpMessage(input: Stream): string {. ...raises: [IOError, OSError, ValueError], tags: [ReadIOEffect], forbids: [].}
-
Read one MCP message from a stream.
Supports MCP's newline-delimited JSON messages and legacy Content-Length framed messages.