# spanlog

> spanlog is an MCP server for developer tools. Search spanlog JSON log files for one request's lines, recent failures and slow calls. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Platforms:** CLI
- **Repository:** https://github.com/chaugiakhang193/spanlog/tree/HEAD/mcp
- **MCP Registry name:** io.github.chaugiakhang193/spanlog-mcp
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-15

## About

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.

## Features

- **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

## Install

### Claude Code (Terminal)

```sh
claude mcp add spanlog-mcp -- npx -y @spanlog/mcp
```

### Claude Desktop (claude_desktop_config.json)

```json
{
  "mcpServers": {
    "spanlog-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@spanlog/mcp"
      ]
    }
  }
}
```

### Cursor (~/.cursor/mcp.json)

```json
{
  "mcpServers": {
    "spanlog-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@spanlog/mcp"
      ]
    }
  }
}
```

### VS Code (.vscode/mcp.json)

```json
{
  "servers": {
    "spanlog-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@spanlog/mcp"
      ]
    }
  }
}
```

### Windsurf (~/.codeium/windsurf/mcp_config.json)

```json
{
  "mcpServers": {
    "spanlog-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@spanlog/mcp"
      ]
    }
  }
}
```

### Other clients (your client's MCP settings (most use this shape))

```json
{
  "mcpServers": {
    "spanlog-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@spanlog/mcp"
      ]
    }
  }
}
```

## Tools

- `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

## 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.

## Alternatives

- [SpanHound](https://ai-powered.com/mcp/spanhound): SpanHound is an open-source MCP server for developer tools.
- [Oldweb Logs](https://ai-powered.com/mcp/oldweb-logs): Oldweb Logs is a free MCP server for developer tools.
- [Super Log](https://ai-powered.com/mcp/super-log): Super Log is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/spanlog
