Skip to main content

Crate weirdnet_mcp

Crate weirdnet_mcp 

Source
Expand description

A small Model Context Protocol tools server.

The crate speaks MCP’s JSON-RPC 2.0 messages and knows nothing about HTTP or the app: a front end (an axum POST /mcp route, a gRPC bridge, a test) passes each decoded message to Server::handle with the caller’s bearer token, and the app implements Tools::call. The server is stateless, so it fits MCP’s streamable HTTP transport with JSON responses.

  • ToolSpec / Param: static tool tables with readOnlyHint, destructiveHint and openWorldHint annotations, and an auth flag that adds “Requires a bearer token.” to the description.
  • args: typed argument getters with uniform error messages.
  • stdio: the <app>ctl mcp loop that forwards stdio messages to a remote server.

Modules§

args
Argument getters with uniform messages (missing string argument "name").
codes
JSON-RPC error codes used here.
stdio
The stdio bridge behind <app>ctl mcp: read one JSON-RPC message per line, forward it, write the reply on its own line. Transport failures become a JSON-RPC internal error for requests that have an id; notifications get nothing.

Structs§

Param
One tool parameter.
Server
The MCP server.
ServerInfo
What initialize reports.
ToolError
A tool failure, reported to the model as an isError result (not a JSON-RPC error).
ToolSpec
A tool.

Enums§

ParamType
JSON Schema type of a parameter.

Constants§

PROTOCOL_VERSIONS
Protocol versions this server negotiates, newest first.

Traits§

Tools
The app side: runs a tool.

Functions§

rpc_err
A JSON-RPC error.
rpc_ok
A JSON-RPC success.
tool_error
A failed tool result.
tool_ok
A successful tool result: pretty JSON text plus structuredContent.