MCP Request and Response Logger and Inspector: Claude Code Prompt

MCPMCP

MCP Request and Response Logger and Inspector: Claude Code Prompt

Build a logging middleware for MCP servers that captures all tool calls with timing, inputs, and outputs for debugging

Write the TypeScript logging middleware for the MCP server in [YOUR_PROJECT].

Requirements:
**Log format** (JSON per line):
{ timestamp, tool, input, output, duration_ms, error, caller_identity, request_id }

Redact the
TLDR

Logging and inspection middleware for MCP servers. Captures all tool call inputs, outputs, duration, and errors to structured JSON log files. Includes a CLI command to tail and filter logs by tool or time.

How to use

  1. 1

    Start by replacing [YOUR_PROJECT] with the actual name of your project to ensure the logging middleware is correctly tailored to your specific MCP setup.

  2. 2

    Use the provided log format to maintain consistency in your logs, making it easier to analyze and troubleshoot issues later.

  3. 3

    After implementing the wrapWithLogging function, test it thoroughly to confirm that all required fields are being logged accurately, especially the redacted ones.

Frequently asked questions

What is the MCP Request and Response Logger and Inspector: Claude Code Prompt prompt used for?

Logging and inspection middleware for MCP servers. Captures all tool call inputs, outputs, duration, and errors to structured JSON log files. Includes a CLI command to tail and filter logs by tool or time.

How do I get the best results from this testing & debug prompt?

Paste the prompt into Claude Code, Cursor, fill in every bracketed placeholder with your specific information, then submit. The more detail you add to each placeholder, the more targeted the output. You can continue in the same conversation to refine tone, length, or focus without restarting from scratch.

Does this prompt work with Claude Code?

Yes. This prompt is optimized for Claude Code and also works well with Cursor. The structured format with a defined role and numbered steps produces consistent results across all major instruction-following models, so you can use whichever tool you prefer.

How do I access this mcp prompt?

This testing & debug prompt is available through TopFreePrompts with a Lucy+ licence. You can get access with a one-time Lucy+ purchase for $109, or a $15/month plan you can cancel anytime. Both options give access to the full library of 1,000,000+ prompts across all categories.

More MCP Prompts

View all

Related Prompts

View all