feat: per-service remote/local routing, lifecycle logging, and preconnect#26
Merged
Merged
Conversation
9 features, 3 fixes, and 2 infra changes since 0.2.0. Initializes VERSION file for pre-PR hook enforcement. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…nect
Adds `source` field to service config ("local", "remote", "remote-local")
for per-service control over whether calls route through a remote daemon
or stay local. Default when MCP2CLI_REMOTE_URL is set: remote-local
(try remote with 3x retry + exponential backoff, fall back to local).
Adds 4-event request lifecycle logging to structured JSON output:
request_in → mcp_call_start → mcp_call_end → response_out.
Also adds:
- Pool preconnect at startup (MCP2CLI_PRECONNECT=1)
- Stderr log rotation (10MB max, single backup)
- Version from package.json in /health and /metrics endpoints
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Fixes 2 CRITICAL, 4 HIGH, 8 MEDIUM findings from review swarm:
- fetchRemote checks response body for app errors + skips retry on 401/403
- Remote connect timeout split to 10s (down from 60s)
- Error-path mcp_call_end uses resolved tool name
- preconnectAll has 15s per-service timeout + batches of 4
- request_in log sanitizes params via exported sanitizeParams
- Stderr rotation uses async I/O, initializes counter from file size
- ServiceSource/SourceSchema re-exported from config barrel
- Dead metrics methods removed (onConnect/onDisconnect/onHealthCheckFailure)
- package.json imports use `with { type: "json" }` consistently
- Retry constants configurable via MCP2CLI_REMOTE_RETRIES/BACKOFF_MS
- Graceful drain on shutdown (server.stop() without force)
- Test assertions updated for response_out event format
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
|
Claude encountered an error —— View job I'll analyze this and get back to you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
sourcefield in services.json controls whether calls route through a remote daemon ("remote"), stay local ("local"), or try remote first with local fallback ("remote-local")request_in→mcp_call_start→mcp_call_end→response_outMCP2CLI_PRECONNECT=1— all services hot on boot/healthand/metricsendpointsTest plan
proxmox→ CT 216,qmd→ local,open-brain→ remote-local/healthand/metricsendpoints🤖 Generated with Claude Code