Documentation
¶
Overview ¶
Package mcpserver exposes OK's tool registry as an MCP server over stdio. Any MCP client (Claude Code, Cursor, VS Code extensions) can connect and call OK's built-in tools (bash, read_file, write_file, edit_file, grep, glob, web_fetch, task, ask, todo_write, complete_step) plus all configured plugin tools — turning OK into a drop-in code-agent backend.
Protocol: JSON-RPC 2.0, one message per line (NDJSON), matching the MCP spec (https://spec.modelcontextprotocol.io). stdin/stdout are the JSON-RPC channel; all diagnostics go to stderr.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RegistryAdapter ¶
type RegistryAdapter struct {
// contains filtered or unexported fields
}
RegistryAdapter adapts a *tool.Registry to ToolProvider.
func NewRegistryAdapter ¶
func NewRegistryAdapter(reg *tool.Registry) *RegistryAdapter
func (*RegistryAdapter) CallTool ¶
func (a *RegistryAdapter) CallTool(ctx context.Context, name string, args json.RawMessage) (string, bool, error)
func (*RegistryAdapter) ListTools ¶
func (a *RegistryAdapter) ListTools() []ToolInfo
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server runs the MCP stdio server. It reads JSON-RPC requests from r, writes responses to w, and dispatches tool calls through the ToolProvider.
type ToolInfo ¶
type ToolInfo struct {
Name string `json:"name"`
Description string `json:"description"`
InputSchema json.RawMessage `json:"inputSchema"`
}
ToolInfo describes one tool for the MCP tools/list response.
type ToolProvider ¶
type ToolProvider interface {
// ListTools returns every available tool's name + description + schema.
ListTools() []ToolInfo
// CallTool executes a tool by name with the given JSON args.
CallTool(ctx context.Context, name string, args json.RawMessage) (string, bool, error)
}
ToolProvider is the minimal interface the MCP server needs from the caller. The caller (cli/mcp_serve.go) builds the full registry from config.