Skip to content

feat: stdio MCP wrapper for managed tool sidecars (#179)#180

Merged
mostlydev merged 1 commit intomasterfrom
issue-179-stdio-mcp-wrapper
Apr 28, 2026
Merged

feat: stdio MCP wrapper for managed tool sidecars (#179)#180
mostlydev merged 1 commit intomasterfrom
issue-179-stdio-mcp-wrapper

Conversation

@mostlydev
Copy link
Copy Markdown
Owner

Summary

  • Adds the shared ghcr.io/mostlydev/claw-mcp-stdio wrapper image so any stdio MCP server (npx packages, uvx, anything stdio JSON-RPC) can be exposed as a pod-internal Streamable HTTP /mcp endpoint compatible with the v0.11.0 cllama MCP client. No cllama changes.
  • New pod surface x-claw.mcp-stdio: {command, args} declares what the wrapper spawns; compose emission injects CLAW_MCP_STDIO_COMMAND/ARGS on the sidecar. New pod surface x-claw.describe-file lets operators supply a deterministic v2 descriptor snapshot from the pod directory.
  • Wrapper handles initialize caching, MCP-Session-Id minting/validation, JSON-RPC id multiplexing, child restart with exponential backoff, and optional bearer auth. Stdio creds (e.g. PERPLEXITY_API_KEY) stay in the wrapper container env, never reach agent containers.
  • Hermetic TestSpikeMCPStdio brings up the full stack (wrapper + cllama + clawdash + agent) in Docker against an in-tree Node echo MCP server. Real-world examples/perplexity-stdio/ template included.

Plan: docs/plans/2026-04-28-issue-179-stdio-mcp-wrapper.md

Closes #179

Test plan

  • go vet ./...
  • go vet -tags spike ./...
  • go test ./...
  • go test -tags integration ./...
  • go test -tags spike -run TestSpikeMCPStdio ./cmd/claw/... (22s, full Docker pod)
  • TestSpikeRollCall regression (deferred to release flow — needs live Discord/provider creds)

Add `claw-mcp-stdio` shared wrapper image that exposes a stdio MCP server
behind a pod-internal Streamable HTTP /mcp endpoint compatible with the
v0.11.0 cllama MCP client. New pod surfaces:

- `x-claw.mcp-stdio: {command, args}` declares the child command; compose
  emission injects CLAW_MCP_STDIO_COMMAND/ARGS on the wrapper service.
- `x-claw.describe-file` lets operators supply a deterministic v2
  descriptor snapshot from the pod directory (highest-priority descriptor
  source ahead of image/build-context discovery).

Wrapper handles initialize caching, MCP-Session-Id minting/validation,
JSON-RPC id multiplexing, child restart with exponential backoff, and
optional bearer auth. Stdio creds stay in wrapper env. Hermetic spike
TestSpikeMCPStdio brings up wrapper + cllama + agent in Docker. cllama
is unchanged.

Closes #179
@mostlydev mostlydev merged commit e8c209a into master Apr 28, 2026
1 check passed
@mostlydev mostlydev deleted the issue-179-stdio-mcp-wrapper branch April 28, 2026 16:04
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.

Provide first-class stdio MCP wrapper for managed MCP sidecars

1 participant