Documentation
¶
Overview ¶
Package mcp is a minimal Model Context Protocol server over the stdio transport (newline-delimited JSON-RPC 2.0) — enough to expose RunLore tools to MCP clients such as HolmesGPT, kagent, or Claude Desktop. It implements initialize, tools/list, tools/call, and ping; tool handlers return plain text. Deliberately dependency-free (no SDK) to keep the single static binary.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a minimal MCP server. Construct with NewServer, AddTool, then Serve.
func NewServer ¶
NewServer creates a server advertising name/version. A nil logger discards logs (logs MUST NOT go to the stdout MCP channel — pass a stderr logger).
func (*Server) AddTool ¶
AddTool registers (or replaces) a tool, preserving first-seen order for tools/list.
func (*Server) Serve ¶
Serve reads newline-delimited JSON-RPC requests from in and writes one response line per request to out, until in is exhausted or ctx is cancelled. Notifications (no id) get no response. json.Encoder writes compact, single-line JSON + a newline — exactly the stdio framing MCP expects.
type Tool ¶
type Tool struct {
Name string
Description string
InputSchema json.RawMessage
Handler func(ctx context.Context, args json.RawMessage) (string, error)
}
Tool is an MCP tool: a name, a description, a JSON-Schema for its arguments, and a handler returning text (an error is surfaced to the client as an MCP tool error).