spanlog
Search spanlog JSON log files for one request's lines, recent failures and slow calls
spanlog is an MCP server for developer tools. It runs locally on your machine and is started by your AI client.
- Platforms
- CLI
- Runs
- Locally
- Version
- 0.1.0
- Listing updated
Similar MCP servers
Install
Run in a terminal
claude mcp add spanlog-mcp -- npx -y @spanlog/mcpAdd to claude_desktop_config.json
{
"mcpServers": {
"spanlog-mcp": {
"command": "npx",
"args": [
"-y",
"@spanlog/mcp"
]
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"spanlog-mcp": {
"command": "npx",
"args": [
"-y",
"@spanlog/mcp"
]
}
}
}Add to .vscode/mcp.json
{
"servers": {
"spanlog-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@spanlog/mcp"
]
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"spanlog-mcp": {
"command": "npx",
"args": [
"-y",
"@spanlog/mcp"
]
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"spanlog-mcp": {
"command": "npx",
"args": [
"-y",
"@spanlog/mcp"
]
}
}
}Using several servers? Build one config file with the MCP config generator.
About spanlog
Instead of pasting a whole log into a chat, an assistant asks for exactly what it needs and gets matching lines back. The server reads only the files named with --file at startup, never writes to them, and exposes no tool that takes a path. Files are re-read on each call, so lines written after startup are found.
Results use one line per entry, with time in UTC, level, service, request id and message, ending in a count of entries and malformed lines skipped. find_request returns every line of one request with error stack frames. failures lists the newest failures first, showing up to three stack-bearing failed lines per request plus its request line. slowest ranks lines by duration and can filter by action.
It works only with logs from spanlog's built-in JSON writer in Node.js, Go or Python, and anything else counts as malformed. The time window for failures and slowest ends at the newest log line, so old files remain searchable. Node.js 22.13 or later is required.
Tools this server provides (3)
Taken from the project documentation; the running server may differ.
- find_request
- Every line of one request by reqId, with error stack frames
- failures
- Newest failures, newest first, with stacks
- slowest
- Lines with the longest duration, longest first
What it does
- Request trace
- Return every line of one request id in file order with stack frames.
- Newest failures
- List recent failures grouped by request with stacks.
- Slowest lines
- Rank lines by duration with limit, service and action filters.
- Read-only by design
- Only files named at startup are read, and no tool accepts a path.
- Time windows
- Limit results to the last N minutes before the newest line.
Good for
- Trace why one order request returned a 500
- Surface the latest errors after a deploy
- Find the slowest database queries or calls
- Give an assistant log access without exposing other files
spanlog FAQ
Which logs does spanlog read?
Files written by spanlog's JSON writer in Node.js, Go or Python.
Can spanlog modify my logs?
No. It only reads the files given with --file.
How do I run spanlog?
npx -y @spanlog/mcp --file /var/log/shop/app.log, using absolute paths.
How do I add spanlog to Claude Code?
Run this command in your terminal: claude mcp add spanlog-mcp -- npx -y @spanlog/mcp
What are the best alternatives to spanlog?
The closest alternatives to spanlog are SpanHound, Oldweb Logs and Super Log.
Where this comes from
- Description: written from the project's README.
- Install steps: from the official MCP Registry entry.
