je_web_runner.mcp_server.server

WebRunner MCP server:用 Model Context Protocol (JSON-RPC 2.0) 把 WR_* 動作對外開放。 WebRunner MCP server. Exposes a curated subset of WebRunner actions and helper utilities as MCP tools so any MCP-compatible client (Claude, IDE plugins, etc.) can drive WebRunner.

Transport: ndjson over stdio (one JSON object per line). Run via:

python -m je_web_runner.mcp_server

Supported methods: initialize, tools/list, tools/call, resources/list, ping, shutdown.

Functions

build_default_tools()

Construct the default tool list shipped with the server.

make_default_server()

serve_stdio([stdin, stdout, server])

主迴圈:每行一個 JSON-RPC 2.0 訊息,直到 stdin EOF Read newline-delimited JSON-RPC messages from stdin until EOF and write responses to stdout.

Classes

McpServer(tools, ...)

JSON-RPC 2.0 server that speaks the MCP wire protocol over stdio.

Tool(name, description, input_schema, handler)

Exceptions

McpServerError

Raised when the server encounters a fatal protocol error.

class je_web_runner.mcp_server.server.McpServer(tools: Dict[str, ~je_web_runner.mcp_server.server.Tool]=<factory>, initialized: bool = False)

Bases: object

JSON-RPC 2.0 server that speaks the MCP wire protocol over stdio.

handle(message: Dict[str, Any]) Dict[str, Any] | None
initialized: bool = False
register(tool: Tool) None
tools: Dict[str, Tool]
exception je_web_runner.mcp_server.server.McpServerError

Bases: WebRunnerException

Raised when the server encounters a fatal protocol error.

class je_web_runner.mcp_server.server.Tool(name: 'str', description: 'str', input_schema: 'Dict[str, Any]', handler: 'Callable[[Dict[str, Any]], Any]')

Bases: object

description: str
handler: Callable[[Dict[str, Any]], Any]
input_schema: Dict[str, Any]
name: str
schema() Dict[str, Any]
je_web_runner.mcp_server.server.build_default_tools() List[Tool]

Construct the default tool list shipped with the server.

je_web_runner.mcp_server.server.make_default_server() McpServer
je_web_runner.mcp_server.server.serve_stdio(stdin: TextIO | None = None, stdout: TextIO | None = None, server: McpServer | None = None) None

主迴圈:每行一個 JSON-RPC 2.0 訊息,直到 stdin EOF Read newline-delimited JSON-RPC messages from stdin until EOF and write responses to stdout.