The stdout-mcp-server captures and manages application logs through a named pipe system, making them available for debugging in environments like Cursor IDE. It lets you monitor multiple applications in real-time and provides an MCP interface to query, filter, and analyze logs.
The server creates a named pipe and monitors it for incoming logs. Applications can write to this pipe using standard output redirection, and the server maintains a history of these logs. Through MCP tools, you can then query and analyze the captured output.
\\.\pipe\stdout_pipe
/tmp/stdout_pipe
Cursor > Settings > MCP Servers
name: stdout-mcp-server
type: command
command: npx stdout-mcp-server
For macOS/Linux:
{
"mcpServers": {
"stdio-mcp-server": {
"command": "npx",
"args": [
"stdio-mcp-server"
]
}
}
}
For Windows:
{
"mcpServers": {
"mcp-installer": {
"command": "cmd.exe",
"args": ["/c", "npx", "stdio-mcp-server"]
}
}
}
To send your application's output to the pipe:
# Unix/MacOS
your_application > /tmp/stdout_pipe
# Windows (PowerShell)
your_application > \\.\pipe\stdout_pipe
You can redirect logs from multiple sources simultaneously:
# Application 1
app1 > /tmp/stdout_pipe &
# Application 2
app2 > /tmp/stdout_pipe &
Your AI can use the get-logs
tool to retrieve and filter logs:
// Get last 50 logs
get-logs()
// Get last 100 logs containing "error"
get-logs({ lines: 100, filter: "error" })
// Get logs since a specific timestamp
get-logs({ since: 1648675200000 }) // Unix timestamp in milliseconds
Retrieve logs from the named pipe with optional filtering:
Parameters:
lines
(optional, default: 50): Number of log lines to returnfilter
(optional): Text to filter logs bysince
(optional): Timestamp to get logs afterExample response:
{
content: [{
type: "text",
text: "[2024-03-20T10:15:30.123Z] Application started\n[2024-03-20T10:15:31.456Z] Connected to database"
}]
}
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.