Skip to main content
RapidDev - Software Development Agency
mcp-tutorial

How to view MCP server logs for debugging

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.

What you'll learn

  • Where MCP server logs are stored for each host application
  • How to view logs in real time with tail -F
  • How to read and interpret common log entries
  • How to add useful logging to your own MCP servers
Book a free consultation
4.9Clutch rating
600+Happy partners
17+Countries served
190+Team members
Beginner7 min read5 minClaude Desktop, Cursor, all MCP serversMarch 2026RapidDev Engineering Team
TL;DR

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

1

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.

typescript
1# List all MCP log files
2ls -la ~/Library/Logs/Claude/mcp*.log
3
4# View the last 20 lines of all MCP logs
5tail -n 20 ~/Library/Logs/Claude/mcp*.log
6
7# Watch logs in real time (most useful for debugging)
8tail -n 20 -F ~/Library/Logs/Claude/mcp*.log
9
10# Search for errors in logs
11grep -i error ~/Library/Logs/Claude/mcp*.log | tail -20

Expected result: You see the MCP server's stderr output including startup messages and any errors.

2

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.

typescript
1# PowerShell list MCP log files
2Get-ChildItem "$env:APPDATA\Claude\logs\mcp*"
3
4# View last 20 lines
5Get-Content -Tail 20 "$env:APPDATA\Claude\logs\mcp*.log"
6
7# Watch in real time
8Get-Content -Tail 20 -Wait "$env:APPDATA\Claude\logs\mcp*.log"
9
10# Or open the folder in File Explorer
11explorer "$env:APPDATA\Claude\logs"

Expected result: You can see MCP server log files on Windows and read their contents.

3

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.

typescript
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 panel
4# 3. Select 'MCP' or your specific server name
5# 4. Logs appear in real time as the server runs
6
7# You can also check the Developer Tools console:
8# Help Toggle Developer Tools Console tab
9# Filter for 'mcp' to see MCP-related messages

Expected result: Cursor's Output panel shows real-time MCP server logs.

4

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.

typescript
1// Useful logging patterns for MCP servers
2
3// Startup logging
4console.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"}`);
9
10// 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`);
16
17// Error logging
18console.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.

5

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.

typescript
1# Common log patterns and what they mean:
2
3# GOOD Server started successfully:
4# "Server starting..."
5# "API_KEY: SET"
6# "MCP server connected and ready."
7
8# BAD Missing dependency:
9# "Error: Cannot find module 'some-package'"
10# Fix: npm install some-package
11
12# BAD Missing environment variable:
13# "FATAL: API_KEY environment variable is required"
14# Fix: Add API_KEY to your host config env block
15
16# 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 port
19
20# BAD Permission denied:
21# "Error: EACCES: permission denied, open '/path/to/file'"
22# Fix: Check file permissions or use a different path

Expected result: You can quickly identify the type of error from log patterns and know the appropriate fix.

Complete working example

src/well-logged-server.ts
1import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3import { z } from "zod";
4
5function 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}
10
11log("INFO", "Server starting", {
12 name: "well-logged-server",
13 version: "1.0.0",
14 nodeVersion: process.version,
15 apiKeySet: !!process.env.API_KEY,
16});
17
18const server = new McpServer({
19 name: "well-logged-server",
20 version: "1.0.0",
21});
22
23server.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 });
30
31 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);
49
50const 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.

ChatGPT Prompt

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.

MCP Prompt

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.

RapidDev

Talk to an Expert

Our team has built 600+ apps. Get personalized help with your project.

Book a free consultation

Need help with your project?

Our experts have built 600+ apps and can accelerate your development. Book a free consultation — no strings attached.

Book a free consultation

We put the rapid in RapidDev

Need a dedicated strategic tech and growth partner? Discover what RapidDev can do for your business! Book a call with our team to schedule a free, no-obligation consultation. We'll discuss your project and provide a custom quote at no cost.