nateai
March 1, 2025, 9:43am
1
Wondering if anyone can point me to how to get logging in my MCP server.
When I run in manually with node it all works fine. But when I point the IDE at it the logging does not come through. I presume cursor is spinning up a virtual environment or something and the log directory is in there instead.
hard to debug anything without it.
Running as :
Command
node C:\git\mcp-template\dist\index.js
2nd Q
Is there a way to programmatically add the configs? I know about the project level MCP but more after global config. I searched everywhere but seems to be internal to the IDE?
1 Like
Plus one on this. Where are the MCP logs? I get an infinite generation message and no insight into issues.
murich
March 18, 2025, 3:17am
3
Part of my .cursorrules:
Locating Cursor MCP Logs
When MCP fails, follow these steps to locate and analyze the logs:
Primary MCP Log Location :
~/Library/Application Support/Cursor/logs/[SESSION_ID]/window[N]/exthost/anysphere.cursor-always-local/Cursor MCP.log
Where:
[SESSION_ID]
is a timestamp-based directory like “20250313T140544”
[N]
is the window number (1, 2, 3, etc.)
Session Directories :
Log sessions are organized by date in directories with format: YYYYMMDDTHHMMSS
The most recent sessions are the ones with the latest timestamps
Example: ~/Library/Application Support/Cursor/logs/20250313T140544/
Related Log Files :
Filesync logs: window[N]/exthost/anysphere.cursor-always-local/Filesync.log
Retrieval logs: window[N]/exthost/anysphere.cursor-retrieval/Cursor Indexing & Retrieval.log
Window renderer logs: window[N]/renderer.log
Common MCP Error Patterns
JSON Parsing Errors :
Look for: Client error for command '/path/to/script': Unexpected token 'X', "..." is not valid JSON
Cause: MCP scripts outputting non-JSON text that Cursor expects to be JSON
Fix: Ensure your script outputs only valid JSON when communicating with Cursor
Connection Errors :
Look for: Error connecting to MCP server
or Connection refused
Cause: MCP server script not running or permissions issues
Fix: Check script permissions, execution state, network connectivity
Tool Execution Errors :
Look for: Failed to execute tool 'tool_name'
Cause: Internal errors in MCP tool implementation
Fix: Debug the tool code, check parameter parsing
Manual Log Analysis Commands
Use these terminal commands to search for errors:
Find recent error logs :
find ~/Library/Application\ Support/Cursor/logs -type f -name "Cursor MCP.log" -mtime -3 | xargs grep -l "\[error\]"
Find errors for specific MCP server :
find ~/Library/Application\ Support/Cursor/logs -type f -name "Cursor MCP.log" | xargs grep -l "jira-final" | xargs grep "\[error\]"
View full context of errors :
grep -A 5 -B 2 "\[error\]" [path-to-specific-log-file]
Check successful tool calls for comparison :
grep "Successfully called tool" [path-to-specific-log-file]
3 Likes
Blaise
March 20, 2025, 7:52pm
4
Thank you so much for this!