Claude Prompt for MCP Servers
Step-by-step diagnostic playbook for an MCP server that works in isolation but fails inside VS Code with MCP extension. Covers stdio quirks, none (local-only) refresh, schema rejection, and perf.
More prompts for MCP Servers.
Opinionated recipe for turning an existing send email via SendGrid API into a clean MCP tool. Focus: tight schema, JWT bearer token flow, retries, and Zod-backed input validation.
Opinionated recipe for turning an existing invoke AWS Lambda API into a clean MCP tool. Focus: tight schema, JWT bearer token flow, retries, and TypeBox-backed input validation.
Opinionated recipe for turning an existing create Linear issue API into a clean MCP tool. Focus: tight schema, API key in header flow, retries, and Zod-backed input validation.
Opinionated recipe for turning an existing query BigQuery API into a clean MCP tool. Focus: tight schema, OAuth 2.0 authorization code flow flow, retries, and ArkType-backed input validation.
Opinionated recipe for turning an existing search Notion pages API into a clean MCP tool. Focus: tight schema, JWT bearer token flow, retries, and Zod-backed input validation.
Production MCP server exposing query Elasticsearch index over WebSocket. Tested with custom host via MCP SDK — includes auth (JWT bearer token), schema validation (TypeBox), error handling, and host-specific install instructions.
You are an on-call agent platform engineer. An MCP server works locally (responds to `mcp inspector`) but behaves badly inside VS Code with MCP extension on stdio with none (local-only). Produce a full diagnostic playbook and a hardening patch. **Observed symptoms (pick any that apply):** intermittent "tool not found", tool call hangs >30s, auth works on first call then fails, resources render empty, model ignores tool even when clearly needed, server silently exits under VS Code with MCP extension. ## Part 1 — Diagnostic ladder Walk through these in order, each with exact commands to run: 1. **Is the server process alive under VS Code with MCP extension?** - Where VS Code with MCP extension logs MCP server stdout/stderr (exact path) - How to tail them live - Crash vs. zombie vs. healthy signatures 2. **Is the transport handshake succeeding?** - For stdio: what the `initialize` request/response looks like - Common transport-specific failure modes (stdio quirks) - How to capture the wire traffic (mcp inspector, proxy, curl -N for SSE, wscat for WebSocket) 3. **Is tool discovery working?** - `tools/list` response — is your tool present with the right schema? - Are input schemas rejected by VS Code with MCP extension as invalid? (common JSON Schema pitfalls) - Description length limits and truncation behavior in VS Code with MCP extension 4. **Is none (local-only) surviving the session?** - Token expiry within a long session - 401 retry behavior - Credential-in-env vs. credential-in-request-header for this host 5. **Is the model choosing the tool?** - Is the tool description clear enough for the model? (rewrite rules) - Does the tool name conflict with built-ins? - Is the model instead hallucinating an answer? 6. **Is the tool actually returning useful content?** - Content types VS Code with MCP extension renders vs. silently drops - Max result size before truncation ## Part 2 — Hardening patch Produce a diff-style set of changes covering: - Idempotency keys on destructive tool calls - Per-tool timeout with clean cancellation - Structured error envelope (`isError: true`, machine-readable code, human message) - Retry logic on the upstream with exponential backoff + jitter - Graceful none (local-only) refresh mid-session - Health check endpoint (if stdio supports it) - Concurrency cap (don't let the model hammer a fragile upstream) - PII redaction in logs - Graceful SIGTERM that drains in-flight calls ## Part 3 — Regression harness Create a test suite that runs in CI and would have caught each of the symptoms above: - Scripted MCP client session replaying a failing trace - Fault injection: force upstream to 500, force slow response, force none (local-only) expiry - Golden-trajectory tests: given prompt X, assert tool sequence Y ## Part 4 — Rollout - How to canary this fix for 1% of VS Code with MCP extension users first - Rollback procedure - What to communicate in release notes ## Part 5 — Post-incident Draft a 1-page postmortem template the team can fill in. Include a contributing factors section and action items owner field. Write real bash/curl commands, real config JSON, and real code for the hardening patch. No stubs.