Repository navigation
Description
Part of #1049 / Depends on #1038
Summary
Add a command that relays standard I/O MCP messages to a running KHI server for MCP clients that cannot connect using a URL.
Background
Some MCP clients only support launching a configured command as a child process and communicating over standard I/O. KHI is a resident application used in a browser and holds inspection data in memory. Even if a client launches KHI as a separate process, it cannot reach the KHI data opened by the user in the browser. This has low priority because it is unnecessary for clients that can connect directly over HTTP.
Specification
- The
khi mcpsubcommand only performs relaying without starting KHI itself. - Specify the destination using the
--mcp-server-urlflag or theKHI_SERVER_URLenvironment variable, with a default ofhttp://127.0.0.1:8080. - The relay destination is
/mcp/ssefrom MCP: Server foundation and HTTP transport #1038. Relay messages as-is without changing their contents.
Client configuration example
{
"mcpServers": {
"khi": {
"command": "khi",
"args": ["mcp", "--mcp-server-url", "http://127.0.0.1:8080"]
}
}
}Message written to standard input
{"jsonrpc":"2.0","id":3,"method":"resources/read","params":{"uri":"khi://inspections"}}The message returned to standard output is the exact response from the KHI server.
{"jsonrpc":"2.0","id":3,"result":{"contents":[{"uri":"khi://inspections","mimeType":"text/markdown","text":"# Inspections\n\n..."}]}}If the target KHI is not running, write the following to standard error and exit with code 1:
Error: failed to connect to KHI server at http://127.0.0.1:8080/mcp/sse: connection refused (please start KHI first)
Acceptance criteria
- Tools and resources of a running KHI can be used from stdio-only clients via
khi mcp. - If the target KHI is not running, exit with an error that explains the cause.
Related code
cmd/: Command entrypoint.pkg/server/mcp/: Added in MCP: Server foundation and HTTP transport #1038.
Activity
Ackberry commentedon Nov 20, 2026
Hi @kyasbal , can I take this issue?
kyasbal commentedon Nov 20, 2026
yes, you can