Skip to content

Add stdio transport entry point#19

Open
JohnEchevesteMM wants to merge 6 commits into
kolide:mainfrom
JohnEchevesteMM:main
Open

Add stdio transport entry point#19
JohnEchevesteMM wants to merge 6 commits into
kolide:mainfrom
JohnEchevesteMM:main

Conversation

@JohnEchevesteMM
Copy link
Copy Markdown

Summary

Adds a kolide-mcp-stdio console script that runs the existing MCP server over stdio, alongside the existing HTTP transport. Both modes share the same Server instance, tool handlers, and reporting-tables registry — this change is purely additive.

Motivation

The current HTTP-only design requires users of stdio-only clients (Claude Desktop, Claude Code, and any MCP client without HTTP support) to keep a long-running HTTP server alive and bridge to it with mcp-remote. That's two extra moving parts — a background process to supervise plus an npx subprocess — for a use case the MCP SDK already supports natively.

With this change, those clients can launch the server as a subprocess on demand, with no port, no MCP_AUTH_TOKEN, and no mcp-remote dependency. HTTP mode continues to work exactly as before for Cursor, VS Code, and shared deployments.

Changes

  • src/kolide_mcp/server.py — new main_stdio() entry point. Reuses the existing server object via mcp.server.stdio.stdio_server(), mirrors the HTTP lifespan (loads the reporting-tables registry on startup, closes the HTTP client on shutdown), and validates KOLIDE_API_VERSION before launch. Skips the MCP_AUTH_TOKEN check because stdio inherits the parent process's trust boundary — a bearer token on a subprocess pipe would be meaningless.
  • src/kolide_mcp/logging_config.py — route the default log stream from stdout to stderr. Required for stdio correctness (stdout is the JSON-RPC channel); invisible to HTTP clients, which never read the server's stdout. Optional file logging via MCP_LOG_FILE is unaffected.
  • pyproject.toml — register the kolide-mcp-stdio console script.
  • README.md — updated intro and Features list to reflect dual-transport support; added a "Which mode should I use?" comparison table; added a Claude Code config example (both claude mcp add and JSON config forms).

Compatibility

  • No changes to existing HTTP behavior, configuration, auth, or tool surface.
  • No new runtime dependencies (mcp.server.stdio ships with the existing mcp requirement).
  • Both modes can run simultaneously as independent processes.

JohnEchevesteMM and others added 2 commits May 15, 2026 16:01
Adds `kolide-mcp-stdio` console script that runs the existing MCP server
over stdio, so clients like Claude Desktop and Claude Code can launch it
as a subprocess instead of requiring a long-running HTTP server plus the
mcp-remote bridge.

- server.py: new `main_stdio()` runs `server` via `mcp.server.stdio`,
  reusing all tool handlers and the reporting-tables registry. Skips
  MCP_AUTH_TOKEN since stdio inherits the parent process's trust boundary.
- logging_config.py: route logs to stderr instead of stdout so they
  don't corrupt the JSON-RPC channel under stdio transport.
- pyproject.toml: register the `kolide-mcp-stdio` script.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Update intro and Features list to reflect dual-transport support
- Add side-by-side comparison of HTTP vs stdio mode with guidance on
  when to choose each
- Document the `kolide-mcp-stdio` entry point
- Add a Claude Code MCP config example (both `claude mcp add` CLI and
  JSON config forms)

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 15, 2026

CLA assistant check
All committers have signed the CLA.

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@cacab cacab left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions. Overall this looks awesome!

Comment thread README.md Outdated
Comment thread src/kolide_mcp/server.py
Comment thread src/kolide_mcp/server.py Outdated
JohnEchevesteMM and others added 3 commits May 21, 2026 09:21
Co-authored-by: Caitlin Cabrera <46205451+cacab@users.noreply.github.com>
- Set _request_ip to "stdio" in main_stdio so audit logs show a meaningful
  src field instead of "unknown" for stdio tool calls
- Fix MCP_LOG_FILE docs: logs go to stderr (not stdout) in stdio mode

Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
@JohnEchevesteMM JohnEchevesteMM requested a review from cacab May 21, 2026 16:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants