MCP server logs are captured from the server's stderr output by the host application. Claude Desktop on macOS stores them at ~/Library/Logs/Claude/mcp*.log, and on Windows at %APPDATA%\Claude\logs\. Cursor shows logs in the Output panel under the MCP channel. Use tail -n 20 -F ~/Library/Logs/Claude/mcp*.log to watch logs in real time while debugging connection or runtime errors.
Viewing MCP Server Logs
When an MCP server fails to start, crashes during operation, or produces unexpected results, the logs are your primary debugging tool. MCP hosts capture everything the server writes to stderr and store it in log files. This tutorial shows you exactly where to find these logs on every platform and how to interpret them.
Prerequisites
- An MCP host (Claude Desktop or Cursor) with at least one server configured
- Terminal access on your machine
Step-by-step guide
Find Claude Desktop logs on macOS
Find Claude Desktop logs on macOS
Claude Desktop on macOS writes MCP server logs to the ~/Library/Logs/Claude/ directory. Each server gets its own log file named with a pattern like mcp-server-{name}.log or mcp*.log. These files contain everything the server writes to stderr, including startup messages, runtime errors, and debug information.
1# List all MCP log files2ls -la ~/Library/Logs/Claude/mcp*.log34# View the last 20 lines of all MCP logs5tail -n 20 ~/Library/Logs/Claude/mcp*.log67# Watch logs in real time (most useful for debugging)8tail -n 20 -F ~/Library/Logs/Claude/mcp*.log910# Search for errors in logs11grep -i error ~/Library/Logs/Claude/mcp*.log | tail -20Expected result: You see the MCP server's stderr output including startup messages and any errors.
Find Claude Desktop logs on Windows
Find Claude Desktop logs on Windows
On Windows, Claude Desktop stores MCP logs in the %APPDATA%\Claude\logs\ directory. Open this folder in File Explorer or use PowerShell to read the log files. The file names follow the same pattern as macOS.
1# PowerShell — list MCP log files2Get-ChildItem "$env:APPDATA\Claude\logs\mcp*"34# View last 20 lines5Get-Content -Tail 20 "$env:APPDATA\Claude\logs\mcp*.log"67# Watch in real time8Get-Content -Tail 20 -Wait "$env:APPDATA\Claude\logs\mcp*.log"910# Or open the folder in File Explorer11explorer "$env:APPDATA\Claude\logs"Expected result: You can see MCP server log files on Windows and read their contents.
View MCP logs in Cursor
View MCP logs in Cursor
Cursor shows MCP server output in its Output panel. Open the Output panel with View > Output (or Cmd+Shift+U on macOS, Ctrl+Shift+U on Windows), then select 'MCP' or your specific server name from the dropdown in the top-right of the panel. This shows the server's stderr output in real time.
1# Steps to view MCP logs in Cursor:2# 1. Open Output panel: View → Output (Cmd+Shift+U)3# 2. Click the dropdown in the top-right of the Output panel4# 3. Select 'MCP' or your specific server name5# 4. Logs appear in real time as the server runs67# You can also check the Developer Tools console:8# Help → Toggle Developer Tools → Console tab9# Filter for 'mcp' to see MCP-related messagesExpected result: Cursor's Output panel shows real-time MCP server logs.
Add useful logging to your own MCP server
Add useful logging to your own MCP server
When building your own MCP server, add structured logging that helps with debugging. Log server startup, tool call invocations (with timing), errors with full context, and environment variable status. Always use console.error (Node.js) or print(..., file=sys.stderr) (Python) since stdout is reserved for JSON-RPC protocol messages.
1// Useful logging patterns for MCP servers23// Startup logging4console.error(`[${new Date().toISOString()}] Server starting...`);5console.error(` Name: my-mcp-server`);6console.error(` Version: 1.0.0`);7console.error(` Node.js: ${process.version}`);8console.error(` API_KEY: ${process.env.API_KEY ? "SET" : "MISSING"}`);910// Tool call logging (inside tool handler)11console.error(`[${new Date().toISOString()}] Tool call: search`);12console.error(` Input: ${JSON.stringify(params)}`);13const startTime = Date.now();14// ... tool logic ...15console.error(` Duration: ${Date.now() - startTime}ms`);1617// Error logging18console.error(`[${new Date().toISOString()}] ERROR in tool 'search':`);19console.error(` Message: ${error.message}`);20console.error(` Stack: ${error.stack}`);Expected result: Your server produces structured, timestamped log output that makes debugging straightforward.
Interpret common log patterns
Interpret common log patterns
Understanding what log entries mean speeds up debugging significantly. Startup errors usually indicate missing dependencies or environment variables. Connection errors point to transport issues. Tool execution errors show problems in your tool handler code. If you encounter persistent log patterns you cannot interpret, the RapidDev team has experience debugging complex MCP server configurations.
1# Common log patterns and what they mean:23# GOOD — Server started successfully:4# "Server starting..."5# "API_KEY: SET"6# "MCP server connected and ready."78# BAD — Missing dependency:9# "Error: Cannot find module 'some-package'"10# Fix: npm install some-package1112# BAD — Missing environment variable:13# "FATAL: API_KEY environment variable is required"14# Fix: Add API_KEY to your host config env block1516# BAD — Port already in use (HTTP transport):17# "Error: listen EADDRINUSE :::3000"18# Fix: Kill the other process on port 3000 or use a different port1920# BAD — Permission denied:21# "Error: EACCES: permission denied, open '/path/to/file'"22# Fix: Check file permissions or use a different pathExpected result: You can quickly identify the type of error from log patterns and know the appropriate fix.
Complete working example
1import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";2import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";3import { z } from "zod";45function log(level: string, message: string, meta?: Record<string, unknown>) {6 const timestamp = new Date().toISOString();7 const metaStr = meta ? ` ${JSON.stringify(meta)}` : "";8 console.error(`[${timestamp}] [${level}] ${message}${metaStr}`);9}1011log("INFO", "Server starting", {12 name: "well-logged-server",13 version: "1.0.0",14 nodeVersion: process.version,15 apiKeySet: !!process.env.API_KEY,16});1718const server = new McpServer({19 name: "well-logged-server",20 version: "1.0.0",21});2223server.tool(24 "example",25 "An example tool with good logging",26 { input: z.string() },27 async ({ input }) => {28 const start = Date.now();29 log("INFO", "Tool called: example", { input });3031 try {32 const result = input.toUpperCase();33 log("INFO", "Tool completed: example", {34 durationMs: Date.now() - start,35 });36 return { content: [{ type: "text", text: result }] };37 } catch (error) {38 log("ERROR", "Tool failed: example", {39 error: (error as Error).message,40 durationMs: Date.now() - start,41 });42 return {43 content: [{ type: "text", text: `Error: ${(error as Error).message}` }],44 isError: true,45 };46 }47 }48);4950const transport = new StdioServerTransport();51await server.connect(transport);52log("INFO", "Server connected and ready");Common mistakes when viewing MCP server logs for debugging
Why it's a problem: Looking for logs in the wrong location
How to avoid: macOS Claude Desktop: ~/Library/Logs/Claude/. Windows: %APPDATA%\Claude\logs\. Cursor: Output panel → MCP dropdown.
Why it's a problem: Not using real-time log tailing when debugging
How to avoid: Use tail -F to watch logs in real time. Start the tail before restarting the host so you catch startup errors.
Why it's a problem: Logging to stdout instead of stderr
How to avoid: Use console.error() in Node.js and print(..., file=sys.stderr) in Python. Stdout is reserved for JSON-RPC messages.
Why it's a problem: Not including timestamps in log messages
How to avoid: Add ISO timestamps to every log line. Without them, you cannot correlate events or measure timing.
Best practices
- Use tail -n 20 -F ~/Library/Logs/Claude/mcp*.log during all debugging sessions
- Include timestamps, log levels, and context in every log message
- Log tool call names and durations to identify slow operations
- Log environment variable presence (not values) at startup for configuration verification
- Log errors with full stack traces for faster debugging
- Keep a terminal window open with log tailing while developing MCP servers
Still stuck?
Copy one of these prompts to get a personalized, step-by-step explanation.
Where are MCP server log files stored on [macOS / Windows]? How do I view them in real time? My MCP server is failing and I need to find the error message.
Help me add structured logging to my MCP server. I want timestamps, log levels, tool call tracking, and error logging — all to stderr. Show me a reusable logging utility for TypeScript.
Frequently asked questions
Do MCP logs contain sensitive information?
They can, depending on what the server logs. Well-designed servers should never log full API keys, tokens, or user data. If your server handles sensitive information, review your logging code to ensure secrets are not exposed.
How large do MCP log files get?
Log files grow continuously while the server runs. Claude Desktop typically rotates logs, but they can reach several megabytes during heavy use. Delete old log files periodically if disk space is a concern.
Can I redirect MCP logs to a custom file?
Not through the host configuration. The host captures stderr and writes it to its own log location. However, your server can write to a custom log file in addition to stderr using a logging library with multiple transports.
Why are my logs empty?
If the log files exist but are empty, the server may be crashing before it produces any output, or it may be writing all output to stdout (which goes to the protocol stream, not logs). Check that you are using console.error, not console.log.
Can I view logs from a remote MCP server?
For remote servers using Streamable HTTP, logs are on the remote machine. Check your hosting platform's log viewer (Railway dashboard, Render dashboard, Vercel function logs). Stderr output from the server process appears in the platform's log stream.
Talk to an Expert
Our team has built 600+ apps. Get personalized help with your project.
Book a free consultation