Nft Log Analyser

by mashish

295 downloads
Not rated
GitHub

About

AI-powered log analysis MCP server. Scans 500MB+ log files locally, analyses errors with Ollama + CrewAI agents, and automatically files structured GitHub Issues. 100% local — no logs leave your machine.

Details

Author
mashish
Downloads
295
Categories
Other, AI, Security, Developer Tools

- 100%

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Nft Log Analyser
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install system dependencies (Ollama, ripgrep), clone the repository, and set up a Python 3.11+ virtual environment. Configure environment variables (GITHUB_PAT, GITHUB_REPO_OWNER, GITHUB_REPO_NAME, OLLAMA_BASE_URL, OLLAMA_MODEL) then register the server with a compatible MCP client (e.g., Claude Desktop via claude_desktop_config.json). Use natural language commands or the analyze_log_file tool to start analysis.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "nft log analyser": {
            "nft-log-analyzer": {
                "command": "python",
                "args": [
                    "/path/to/nft-log-analyzer/mcp_server/server.py"
                ],
                "env": {
                    "GITHUB_PAT": "your_github_pat",
                    "GITHUB_REPO_OWNER": "your-username",
                    "GITHUB_REPO_NAME": "your-repo",
                    "OLLAMA_BASE_URL": "http://localhost:11434",
                    "OLLAMA_MODEL": "deepseek-r1:14b"
                }
            }
        }
    }
}

McpServers

{
    "nft-log-analyzer": {
        "command": "python",
        "args": [
            "/path/to/nft-log-analyzer/mcp_server/server.py"
        ],
        "env": {
            "GITHUB_PAT": "your_github_pat",
            "GITHUB_REPO_OWNER": "your-username",
            "GITHUB_REPO_NAME": "your-repo",
            "OLLAMA_BASE_URL": "http://localhost:11434",
            "OLLAMA_MODEL": "deepseek-r1:14b"
        }
    }
}

🔍 NFT Log Analyzer

> AI-powered log analysis that automatically files GitHub Issues — 100% local via Ollama, zero data leaves your machine.

Python
Ollama
MCP
License

---

What It Does

Point it at any log file and it will:

1. Scan 500MB+ files in seconds using ripgrep
2. Parse error patterns, deduplicate repeated events
3. Analyse using local LLM (Ollama + deepseek-r1:14b) via CrewAI agents
4. Compose structured GitHub Issues with root cause and suggested fixes
5. File Issues automatically to your repo — skipping duplicates

All processing happens locally on your machine. Raw log content never leaves your system.

---

Architecture

Claude Desktop / Cursor / LangChain
         ↓  MCP (stdio or HTTP+SSE)
   MCP Log Analyzer Server
         ↓
   ripgrep pre-filter (2-4s on 500MB)
         ↓
   mmap streaming parser + deduplicator
         ↓
   CrewAI agents → Ollama (local LLM)
         ↓
   GitHub Issues API

---

Requirements

| Requirement | Version | Notes |
|---|---|---|
| Python | 3.11+ | 3.14 not supported |
| Ollama | Latest | brew install ollama |
| deepseek-r1:14b | — | ~9GB download |
| ripgrep | Latest | brew install ripgrep |
| RAM | 16GB min | 32GB recommended |
| macOS | Ventura 13+ | Apple Silicon recommended |

---

Quick Start

1. Install system dependencies

brew install ollama ripgrep
brew services start ollama
ollama pull deepseek-r1:14b   # ~9GB — start this first

2. Clone and set up Python environment

git clone https://github.com/YOUR_ORG/mcp-log-analyzer
cd mcp-log-analyzer

/opt/homebrew/bin/python3.11 -m venv .venv
source .venv/bin/activate

pip install --upgrade pip
pip install mcp "crewai>=0.80.0" crewai-tools langchain-ollama \
litellm fastapi uvicorn httpx httpx-sse \
structlog loguru pydantic python-dotenv \
tenacity rich typer

3. Configure environment

cp .env.example .env
nano .env   # fill in your values
GITHUB_PAT=ghp_your_token_here
GITHUB_REPO_OWNER=your-username
GITHUB_REPO_NAME=your-repo
OLLAMA_BASE_URL=http://localhost:11434
OLLAMA_MODEL=deepseek-r1:14b
CREWAI_TELEMETRY_OPT_OUT=true
OTEL_SDK_DISABLED=true
OLLAMA_KEEP_ALIVE=-1

4. Create a GitHub PAT

Go to: github.com → Settings → Developer settings → Personal access tokens → Tokens (classic)

Enable scope: repo (full)

5. Register with Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "mcp-log-analyzer": {
      "command": "/path/to/mcp-log-analyzer/.venv/bin/python",
      "args": ["/path/to/mcp-log-analyzer/mcp_server/server.py"],
      "env": {
        "GITHUB_PAT": "ghp_your_token",
        "GITHUB_REPO_OWNER": "your-username",
        "GITHUB_REPO_NAME": "your-repo",
        "OLLAMA_BASE_URL": "http://localhost:11434",
        "OLLAMA_MODEL": "deepseek-r1:14b"
      }
    }
  }
}

Restart Claude Desktop. You should see the 🔨 tools icon appear.

---

Usage

Via Claude Desktop (natural language)

analyze the log file at /var/log/app.log and file GitHub issues for any errors
use analyze_log_file with path="/var/log/app.log" dry_run=true
check status of job abc12345

Via Python CLI

source .venv/bin/activate

python3 -c "
from dotenv import load_dotenv
load_dotenv()
from mcp_server.tools.analyze_tool import analyze_log_file
import asyncio, json

result = asyncio.run(analyze_log_file({
'path': '/var/log/app.log',
'severity': 'ERROR',
'dry_run': False
}))
print(result[0].text)
"

---

MCP Tools Reference

ping

Health check — verifies the server and Ollama are running.
{}

Returns: "mcp-log-analyzer online — Ollama: deepseek-r1:14b"

---

analyze_log_file

Start async log analysis. Returns a job ID immediately — pipeline runs in background.

| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| path | string | ✅ | — | Absolute path to log file |
| severity | string | — | ERROR | Minimum severity: WARN, ERROR, CRITICAL |
| dry_run | boolean | — | false | Preview issues without filing to GitHub |

Returns:

{
"job_id": "abc12345",
"status": "started",
"message": "Analysis started. Check progress with get_job_status('abc12345')."
}

---

get_job_status

Check the status of a running analysis job.

| Parameter | Type | Required | Description |
|---|---|---|---|
| job_id | string | ✅ | Job ID returned by analyze_log_file |

Returns (running):

{
"status": "running",
"job_id": "abc12345",
"lines_filtered": 487,
"chunks": 1
}

Returns (done):

{
"status": "done",
"job_id": "abc12345",
"lines_filtered": 487,
"unique_events": 4,
"chunks": 1,
"issues_filed": 2,
"github_issues": [
{
"title": "[CRITICAL][minting-service] DB connection pool exhausted (x117)",
"url": "https://github.com/your-org/your-repo/issues/42",
"number": 42
}
]
}

---

Compatible MCP Clients

| Client | Transport | Config |
|---|---|---|
| Claude Desktop | stdio | claude_desktop_config.json |
| Claude Code CLI | stdio | .mcp.json in project root |
| Cursor | stdio or HTTP+SSE | .cursor/mcp.json |
| LangChain | HTTP+SSE | url: http://localhost:8000/sse |
| n8n | HTTP+SSE | HTTP Request node → SSE |

HTTP+SSE Transport (for Cursor, LangChain, n8n)

python mcp_server/server.py --transport sse --port 8000

---

Customising with Skills

Skills are plain English .md files that teach the agents your stack's error patterns. Three built-in skills ship with the project:

| Skill | Purpose |
|---|---|
| skills/nft-app-errors.skill.md | NFT/blockchain error classification |
| skills/infrastructure-errors.skill.md | Infrastructure error classification |
| skills/bug-composition.skill.md | GitHub Issue format rules |

Writing your own skill

Create skills/my-stack-errors.skill.md:

```markdown

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.