papertrail-mcp-server

MartinKlefas/papertrail-mcp-server

3.2

If you are the rightful owner of papertrail-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Papertrail MCP Agent for Cursor is a tool that integrates Papertrail logs with Cursor's agent using the `mcp.server.fastmcp` library, ensuring maximum compatibility and efficiency.

Tools
3
Resources
0
Prompts
0

Papertrail MCP Agent for Cursor

This MCP tool exposes Papertrail logs to Cursor's agent using the mcp.server.fastmcp library for maximum compatibility.

Endpoints

1. /tools/get_logs_by_time

Fetch logs based on a time range and optional system name or ID.

Payload:
{
  "time_from": "1 hour ago",
  "time_to": "30 minutes ago",
  "system": "backend-server",
  "query": "error"
}

2. /tools/list_groups

Lists all saved log groups (saved searches) available in Papertrail.

Response:
[
  { "id": 123, "name": "backend" },
  { "id": 456, "name": "frontend" }
]

3. /tools/logs_by_group_name

Fetch logs from a group by its human-readable name. This internally resolves the name to the group ID.

Payload:
{
  "group_name": "backend",
  "time_from": "1 hour ago",
  "query": "exception"
}

Getting Started

  1. Clone this repo and create a virtual environment:
cd papertrail-mcp-server
python -m venv .venv
.venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt
  1. Set your Papertrail API token (in environment variables):

You can either:

  • Add it to your system/user env vars, or
  • Add this line to a .env file here for it to load in-code:
# Add to .env
PAPERTRAIL_API_TOKEN = "your-token-here"
  1. Update Cursor MCP Configuration:

In your project's .cursor/mcp.json adjust the paths to reflect where you've cloned this repo.

The below is structured for windows:

{
  "mcpServers": {
    "papertrail-logs": {
      "command": "**project path**\\**venv path**\\uv",
      "args": [
        "run",
        "--directory", "**project path**",
        "papertrail_agent.py"
      ]
    }
  }
}

The below will work on *nix systems:

{
  "mcpServers": {
    "papertrail-logs": {
      "command": "**project path**/**venv path**/uv",
      "args": [
        "run",
        "--directory", "**project path**",
        "papertrail_agent.py"
      ]
    }
  }
}

⚠️ Make sure this file is located in your Cursor project root under .cursor/mcp.json.

  1. Save & Accept prompt for new agent:

You should get a prompt in the bottom left to enable the agent, you'll likely be taken to the settings screen and it should show that there are 4 tools available:

Settings screen showing enabled tool

  1. Use in Cursor (Agent mode):

Ask things like:

"Get logs from the backend group from 1 hour ago to now with keyword error"