elastic-mcp

elastic-mcp

Small production-oriented MCP server for diagnosing incidents from Elasticsearch logs with unknown schema. It provides tools for log discovery, retrieval, and issue diagnosis.

Category
Visit Server

README

MCP Elasticsearch Logs

Servidor MCP pequeno y orientado a produccion para diagnosticar incidencias desde logs en Elasticsearch con esquema desconocido.

Que hace

  • Conexion a Elasticsearch con cliente async oficial.
  • Descubrimiento dinamico de schema con _field_caps + validacion opcional con documento reciente.
  • Tools MCP enfocadas en diagnostico de logs.
  • Respuesta normalizada (no devuelve hits crudos como salida principal).

Tools soportadas

  • ping
  • discover_log_schema
  • get_latest_logs
  • get_logs_for_service
  • get_logs_by_correlation_id
  • diagnose_issue

Referencia detallada de cada tool en tools.md.

Variables de entorno

  • ELASTICSEARCH_URL (requerida)
  • ELASTICSEARCH_API_KEY (opcional, preferida si el cluster usa auth)
  • ELASTICSEARCH_USERNAME (opcional)
  • ELASTICSEARCH_PASSWORD (opcional)
  • ELASTICSEARCH_INDEX_PATTERN (default: logs-*)
  • ELASTICSEARCH_VERIFY_CERTS (default: true)
  • ELASTICSEARCH_CA_CERTS (opcional)

Reglas de autenticacion:

  1. Si existe ELASTICSEARCH_API_KEY, se usa esa.
  2. Si no, y existen ELASTICSEARCH_USERNAME + ELASTICSEARCH_PASSWORD, se usa basic auth.
  3. Si no hay credenciales, el cliente conecta sin autenticacion.

Como funciona el schema discovery

  1. Consulta _field_caps sobre el index pattern configurado.
  2. Detecta campos candidatos para timestamp, message, level, service y correlation.
  3. Aplica listas ordenadas de prioridad.
  4. Si hay sample document, prioriza campos realmente poblados.
  5. Devuelve schema parcial (null en lo no encontrado).

Filtro temporal

Se soporta:

  • last relativo (15m, 1h, 24h, 7d)
  • start/end explicitos (ISO datetime)

Reglas:

  • last no se puede combinar con start/end.
  • formatos invalidos se rechazan.
  • start > end se rechaza.

Ejecucion local

python3.14 -m venv .venv
source .venv/bin/activate
pip install --upgrade pip
pip install -e ".[dev]"

Configura entorno (ejemplo):

cp .env.example .env

Arranque en stdio (default):

mcp-elastic-logs

Arranque en red (streamable-http):

python -m mcp_elastic_logs.server --transport streamable-http --host 0.0.0.0 --port 8093

Ejecucion con Docker

  1. Preparar variables:
cp .env.example .env
  1. Build de imagen:
docker build -t mcp-elastic-logs:latest .
  1. Ejecutar contenedor:
docker run --rm -p 8093:8093 --env-file .env mcp-elastic-logs:latest

Ejecucion con Docker Compose

docker compose up --build

El servicio queda escuchando en http://localhost:8093 con transporte streamable-http.

Entorno de test (Elastic + Kibana + Logstash + MCP)

Tambien tienes un stack de test completo en docker-compose.test.yml, basado en tu plantilla, con un servicio extra seed-logs que carga documentos de ejemplo en logs-test-000001 para poder probar tools inmediatamente.

Arranque:

docker compose -f docker-compose.test.yml up --build

Servicios disponibles:

  • Elasticsearch: http://localhost:9200
  • Kibana: http://localhost:5601
  • MCP server: http://localhost:8093

Nota: este stack de test usa Elasticsearch con seguridad deshabilitada (xpack.security.enabled=false). El MCP puede conectar sin credenciales en ese escenario, asi que el compose de test no necesita valores dummy.

Configuracion de cliente MCP (ejemplo)

{
  "mcpServers": {
    "elastic-logs": {
      "command": "mcp-elastic-logs",
      "env": {
        "ELASTICSEARCH_URL": "https://localhost:9200",
        "ELASTICSEARCH_API_KEY": "<your-api-key>",
        "ELASTICSEARCH_INDEX_PATTERN": "logs-*",
        "ELASTICSEARCH_VERIFY_CERTS": "false"
      }
    }
  }
}

Documentacion auxiliar

  • tools.md: detalle de tools, parametros y comportamiento.
  • Agents.md: objetivo del proyecto, stack usado y guia de lectura.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured