Logo di Logchef MCP Server

Logchef MCP Server

Community
mr-karan

MCP server for Logchef

Autoremr-karan
Repositorylogchef-mcp
LinguaGo
Fork
3
Stelle
7
Strumenti disponibili
0
Tipo di trasportostdio, streamable-http
Categorie
LicenzaApache-2.0
Link
  • Collega gli strumenti ai flussi di lavoro IA

    Logchef MCP Server mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • 0 strumenti disponibili

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni quando forniti dal server.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse open source

    7 stelle e 3 fork nel repository collegato.

Logchef MCP Server

A Model Context Protocol (MCP) server that connects AI assistants to your Logchef instance.

Logchef is a powerful log management platform that stores logs in ClickHouse, providing fast querying and analysis capabilities. This MCP server enables AI assistants to interact with your Logchef deployment, making log analysis and troubleshooting more accessible through natural conversation.

What You Can Do

With this MCP server, you can ask AI assistants to help you:

  • Explore your log infrastructure: See what teams you belong to and what log sources are available
  • Query logs effectively: Execute ClickHouse SQL queries to find specific log entries, errors, or patterns
  • Understand your data: Get schema information to know what fields are available in your logs
  • Analyze log patterns: Generate histograms and time-series data for trend analysis
  • Manage saved queries: Create, browse, and update frequently-used queries pinned to a source
  • Administer teams and users: Handle team membership, user management, and source configuration (admin users)

Tool Categories

The server provides tools organized into logical categories that can be enabled or disabled as needed:

Profile & Metadata

Core user and server information including team memberships and server version details.

Source Management

Access to log sources across your teams, including schema exploration and source listing.

Log Analysis

The core querying capabilities including SQL execution, histogram generation, and saved query management.

Administration

Team management, user administration, source configuration, and API token management (requires admin privileges).

Use the --disable-<category> flag to turn off tool categories you don't need. For example, --disable-admin removes all administrative tools.

Tools

See docs/tools.md for the full reference including resources, prompts, and annotations.

ToolCategoryDescription
get_profileProfileGet current user profile
get_teamsProfileList teams you belong to
get_metaProfileServer version and config
get_sourcesSourcesAll accessible sources across teams
get_team_sourcesSourcesSources for a specific team
query_logsLogsExecute ClickHouse SQL (max 100 rows)
get_source_schemaLogsColumn names and types for a source
get_log_histogramLogsTime-series histogram with optional grouping
list_saved_queriesLogsList saved queries (optionally filtered by source_id)
create_saved_queryLogsSave a new query bound to a source
get_saved_queryLogsGet a saved query by ID
update_saved_queryLogsUpdate an existing saved query (creator-only)
delete_saved_queryLogsDelete a saved query (creator-only)
query_logchefqlLogchefQLExecute LogchefQL query (max 500 rows)
translate_logchefqlLogchefQLTranslate LogchefQL to SQL
validate_logchefqlLogchefQLValidate LogchefQL syntax
get_field_valuesInvestigateTop values for a field in a time range
get_log_contextInvestigateSurrounding logs around a timestamp
list_alertsInvestigateAlert rules for a source
get_alert_historyInvestigateAlert evaluation history
compare_windowsAnalysisCompare query results across two time windows
top_valuesAnalysisTop values for multiple fields in one call
generate_queryDiscoverNatural language to SQL (requires AI enabled)
get_all_field_dimensionsDiscoverBulk field values for all LowCardinality fields
get_query_telemetryTelemetryQuery performance from system.query_log
list_all_teamsAdminList all teams (admin only)
get_teamAdminGet team details
create_teamAdminCreate a team (admin only)
update_teamAdminUpdate team info
delete_teamAdminDelete a team (admin only)
list_team_membersAdminList team members
add_team_memberAdminAdd user to team
remove_team_memberAdminRemove user from team
link_source_to_teamAdminGrant team access to a source
unlink_source_from_teamAdminRevoke team access to a source
list_all_usersAdminList all users (admin only)
get_userAdminGet user details (admin only)
create_userAdminCreate a user (admin only)
update_userAdminUpdate user info (admin only)
delete_userAdminDelete a user (admin only)
list_api_tokensAdminList your API tokens
create_api_tokenAdminCreate an API token
delete_api_tokenAdminDelete an API token
list_all_sourcesAdminList all sources (admin only)
create_sourceAdminCreate a source (admin only)
validate_source_connectionAdminTest ClickHouse connectivity (admin only)
delete_sourceAdminDelete a source (admin only)
get_admin_source_statsAdminSource table stats (admin only)

Getting Started

Prerequisites

You'll need:

Generating an API Token

  1. Log into your Logchef instance
  2. Navigate to your profile settings
  3. Create a new API token with the permissions you need
  4. Copy the token for use in the MCP server configuration

Installation

Choose one of the following installation methods:

  • Docker image: Use the pre-built Docker image.

    Important: The Docker image's entrypoint is configured to run the MCP server in SSE mode by default, but most users will want to use STDIO mode for direct integration with AI assistants like Claude Desktop:

    1. STDIO Mode: For stdio mode you must explicitly override the default with -t stdio and include the -i flag to keep stdin open:
    bash
    docker pull ghcr.io/mr-karan/logchef-mcp:latest
    docker run --rm -i -e LOGCHEF_URL=http://localhost:5173 -e LOGCHEF_API_KEY=<your_api_token> ghcr.io/mr-karan/logchef-mcp:latest -t stdio
    1. SSE Mode: In this mode, the server runs as an HTTP server that clients connect to. You must expose port 8000 using the -p flag:
    bash
    docker pull ghcr.io/mr-karan/logchef-mcp:latest
    docker run --rm -p 8000:8000 -e LOGCHEF_URL=http://localhost:5173 -e LOGCHEF_API_KEY=<your_api_token> ghcr.io/mr-karan/logchef-mcp:latest
    1. Streamable HTTP Mode: In this mode, the server operates as an independent process that can handle multiple client connections. You must expose port 8000 using the -p flag:
    bash
    docker pull ghcr.io/mr-karan/logchef-mcp:latest
    docker run --rm -p 8000:8000 -e LOGCHEF_URL=http://localhost:5173 -e LOGCHEF_API_KEY=<your_api_token> ghcr.io/mr-karan/logchef-mcp:latest -t streamable-http
  • Download binary: Download the latest release of logchef-mcp from the releases page and place it in your $PATH.

  • Build from source: If you have a Go toolchain installed you can also build and install it from source:

    bash
    just build

    Or manually:

    bash
    go build -o logchef-mcp.bin ./cmd/logchef-mcp
  1. Add the server configuration to your client configuration file. For example, for Claude Desktop:

    If using the binary:

    json
    {
      "mcpServers": {
        "logchef": {
          "command": "logchef-mcp.bin",
          "args": [],
          "env": {
            "LOGCHEF_URL": "http://localhost:5173",
            "LOGCHEF_API_KEY": "<your_api_token>"
          }
        }
      }
    }

Note: if you see Error: spawn logchef-mcp.bin ENOENT in Claude Desktop, you need to specify the full path to logchef-mcp.bin.

If using Docker:

json
{
  "mcpServers": {
    "logchef": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "LOGCHEF_URL",
        "-e",
        "LOGCHEF_API_KEY",
        "ghcr.io/mr-karan/logchef-mcp:latest",
        "-t",
        "stdio"
      ],
      "env": {
        "LOGCHEF_URL": "http://localhost:5173",
        "LOGCHEF_API_KEY": "<your_api_token>"
      }
    }
  }
}

Note: The -t stdio argument is essential here because it overrides the default SSE mode in the Docker image.

Using VSCode with remote MCP server

If you're using VSCode and running the MCP server remotely, you can configure it to connect via HTTP or SSE transport. Make sure your .vscode/settings.json includes the following:

For HTTP transport (recommended):

json
"mcp": {
  "servers": {
    "logchef": {
      "type": "http",
      "url": "http://localhost:8000/mcp",
      "headers": {
        "X-Logchef-URL": "https://your-logchef-instance.com",
        "X-Logchef-API-Key": "your_api_token_here"
      }
    }
  }
}

For SSE transport:

json
"mcp": {
  "servers": {
    "logchef": {
      "type": "sse",
      "url": "http://localhost:8000/sse"
    }
  }
}

Using HTTP Headers for Authentication

When running the MCP server in SSE or streamable-http mode, you can pass Logchef credentials via HTTP headers instead of environment variables. This is useful when the server needs to handle multiple clients with different Logchef instances or API keys.

The server recognizes these headers:

  • X-Logchef-URL: The Logchef instance URL
  • X-Logchef-API-Key: The API token for authentication

Example configuration for clients that support custom headers:

json
{
  "mcpServers": {
    "logchef": {
      "type": "http",
      "url": "http://localhost:8000/mcp",
      "headers": {
        "X-Logchef-URL": "https://your-logchef-instance.com",
        "X-Logchef-API-Key": "your_api_token_here"
      }
    }
  }
}

If headers are not provided, the server will fall back to environment variables (LOGCHEF_URL and LOGCHEF_API_KEY).

Debug Mode

You can enable debug mode for the Logchef transport by adding the -debug flag to the command. This will provide detailed logging of HTTP requests and responses between the MCP server and the Logchef API, which can be helpful for troubleshooting.

To use debug mode with the Claude Desktop configuration, update your config as follows:

If using the binary:

json
{
  "mcpServers": {
    "logchef": {
      "command": "logchef-mcp.bin",
      "args": ["-debug"],
      "env": {
        "LOGCHEF_URL": "http://localhost:5173",
        "LOGCHEF_API_KEY": "<your_api_token>"
      }
    }
  }
}

If using Docker:

json
{
  "mcpServers": {
    "logchef": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "-e",
        "LOGCHEF_URL",
        "-e",
        "LOGCHEF_API_KEY",
        "ghcr.io/mr-karan/logchef-mcp:latest",
        "-t",
        "stdio",
        "-debug"
      ],
      "env": {
        "LOGCHEF_URL": "http://localhost:5173",
        "LOGCHEF_API_KEY": "<your_api_token>"
      }
    }
  }
}

Note: As with the standard configuration, the -t stdio argument is required to override the default SSE mode in the Docker image.

Tool Configuration

You can selectively enable or disable tool categories using command-line flags:

  • --enabled-tools: Comma-separated list of tool categories to enable (default: all)
  • --disable-profile: Disable profile management tools
  • --disable-sources: Disable source management tools
  • --disable-logs: Disable log querying tools
  • --disable-logchefql: Disable LogchefQL tools
  • --disable-investigate: Disable investigation tools
  • --disable-admin: Disable admin tools
  • --disable-analysis: Disable analysis tools (compare_windows, top_values)
  • --disable-telemetry: Disable telemetry tools
  • --disable-discover: Disable discovery tools (AI query generation, field dimensions)

Example with selective tool enabling:

json
{
  "mcpServers": {
    "logchef": {
      "command": "logchef-mcp.bin",
      "args": ["--enabled-tools", "profile,logs"],
      "env": {
        "LOGCHEF_URL": "http://localhost:5173",
        "LOGCHEF_API_KEY": "<your_api_token>"
      }
    }
  }
}

Working with Logchef Through AI

This MCP server enables you to interact with your Logchef logs through natural conversation with AI assistants. Here's how it typically works:

Discovery Workflow

  1. "What log sources do I have access to?" → The AI uses get_sources to show your available sources
  2. "What data is in the nginx source?" → The AI calls get_source_schema to explain the log structure
  3. "Show me recent errors" → The AI constructs and executes a ClickHouse query using query_logs

Practical Examples

  • Troubleshooting: "Find all 500 errors in the last hour from the web service logs"
  • Analysis: "Show me a histogram of log volume over the past day"
  • Investigation: "What are the most common error messages in the database logs?"
  • Monitoring: "Create a saved query for tracking API response times"

AI-Assisted Query Building

The AI assistant understands ClickHouse SQL and can help you:

  • Build complex queries with proper syntax
  • Optimize queries for better performance
  • Explain what fields are available in your log data
  • Suggest useful queries based on common log analysis patterns

Since Logchef uses ClickHouse as the storage backend, you get the full power of ClickHouse's analytical capabilities through natural language interaction.

Development

This project is written in Go and uses Just as a command runner for common development tasks.

Prerequisites

  • Go 1.21 or later
  • A running Logchef instance for testing
  • Valid Logchef API credentials

Quick Start

bash
# Install dependencies
just deps

# Run in STDIO mode (default for development)
just run

# Run in SSE mode for web-based clients
just run-sse

# Build the binary
just build

# Run tests
just test

Environment Variables

For development, set these environment variables:

bash
export LOGCHEF_URL=http://localhost:5173  # Your Logchef instance URL
export LOGCHEF_API_KEY=your_api_token_here

Docker Development

Build and test the Docker image locally:

bash
# Build development image
just build-image

# Test GoReleaser Docker setup
just build-goreleaser-image

# Run in different modes
just docker-run-stdio
just docker-run-sse

Testing & Verification

Test the server with your Logchef instance:

bash
# Build and run with your credentials
just build
LOGCHEF_URL=http://localhost:5173 LOGCHEF_API_KEY=your_token ./dist/logchef-mcp

# Check version info
just show-version

# Test basic functionality
just help

Contributing

Contributions are welcome! When adding new tools or features:

  1. Follow the existing patterns for tool definition and client methods
  2. Add appropriate error handling and validation
  3. Update the tools table in this README
  4. Test with a real Logchef instance

Please open an issue to discuss larger changes before implementing them.

License

This project is licensed under the Apache License, Version 2.0.

The design of this repository was inspired by mcp-grafana.

Installazione

TypingMind
Prerequisiti:

Node.js 18+

{
  "mcpServers": {
    "mr-karan-logchef-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "logchef-mcp"
      ]
    }
  }
}

Usa MCP Logchef MCP Server con più modelli IA

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso Logchef MCP Server, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Puoi eseguire MCP localmente sul tuo dispositivo o connetterti all'URL di un server MCP remoto.

Opzione 1: usa il connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura MCP.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura MCP e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con Questo dispositivo selezionato
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi Logchef MCP Server come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di Logchef MCP Server.
  4. Salva l'elenco dei server.
  5. Aggiorna per verificare che il connettore sia ancora pronto.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "mr-karan-logchef-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "logchef-mcp"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di Logchef MCP Server, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di Logchef MCP Server.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare Logchef MCP Server per aiutarmi con questa attività?
Logchef MCP Server
Certo. Ho letto.
Ecco cosa ho trovato con Logchef MCP Server.

Opzione 2: aggiungi l'URL di un server MCP

Usa questo metodo se Logchef MCP Server è già ospitato in remoto o se il tuo team vuole un unico connettore condiviso accessibile a più utenti.

1

Apri Connettori MCP

In TypingMind, vai su Plugin, apri Connettori MCP e scegli Aggiungi URL.

  1. Apri TypingMind nel tuo browser.
  2. Vai a Plugin.
  3. Apri Connettori MCP.
  4. Fai clic su Aggiungi URL.
Modulo di TypingMind per aggiungere l'URL di un server MCP personalizzato
2

Incolla l'URL del server

Inserisci URL del tuo server nel campo URL del server. Aggiungi un nome per la connessione, una descrizione, un'icona, header HTTP personalizzati o le impostazioni del client OAuth se richiesti dal server.

  1. Incolla URL del tuo server nel campo URL del server.
  2. Inserisci un nome per la connessione a Logchef MCP Server.
  3. Aggiungi una descrizione e un'icona per riconoscere più facilmente la connessione.
  4. Aggiungi header HTTP personalizzati o i dati del client OAuth se il server richiede l'autenticazione.
3

Crea la connessione

Fai clic su Crea connessione, poi torna all'elenco dei plugin e verifica che la nuova connessione MCP sia attiva.

  1. Fai clic su Crea connessione.
  2. Torna all'elenco dei connettori MCP.
  3. Verifica che la connessione Logchef MCP Server risulti attiva.
  4. Aggiorna l'elenco dei plugin se la connessione non appare subito.
4

Cambia modello senza riconnetterti

Avvia una chat con il tuo modello preferito, abilita gli strumenti di Logchef MCP Server dalla sezione Plugin e passa a un altro modello quando serve. La connessione MCP rimane disponibile nell'area di lavoro di TypingMind.

  1. Avvia una nuova chat in TypingMind.
  2. Seleziona il modello IA che vuoi usare.
  3. Abilita gli strumenti di Logchef MCP Server dalla sezione Plugin.
  4. Chiedi al modello di usare lo strumento quando serve.
  5. Passa a un altro modello IA e riutilizza la stessa connessione MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare Logchef MCP Server per aiutarmi con questa attività?
Logchef MCP Server
Certo. Ho letto.
Ecco cosa ho trovato con Logchef MCP Server.

Domande frequenti

A cosa serve il server MCP Logchef MCP Server?

Logchef MCP Server è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare Logchef MCP Server MCP con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare Logchef MCP Server con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP Logchef MCP Server con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando Logchef MCP Server, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego Logchef MCP Server MCP a TypingMind?

Puoi collegare Logchef MCP Server a TypingMind con il connettore MCP locale oppure aggiungendo l'URL di un server MCP remoto. Usa il connettore locale quando il server deve accedere a file, app o risorse private sul tuo dispositivo; usa invece l'URL del server quando il server MCP è ospitato in remoto.

Quali strumenti offre Logchef MCP Server MCP in TypingMind?

Logchef MCP Server mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare Logchef MCP Server MCP?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se Logchef MCP Server richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇