Elasticsearch MCP Server

by FynnianB

340 downloads
Not rated
GitHub

About

Elasticsearch Integration with MCP - Multi-team and multi-environment support

Details

Author
FynnianB
Downloads
340
Categories
Database

- Multi-team and multi-environment Elasticsearch configuration
- Exception search with flexible filtering and frequency sorting
- Deep exception analysis with cause and solution suggestions
- Trend analysis for exception patterns and service health
- Log search with message, service, and time-range filters
- Supports API key and username/password authentication

Install with npm install, create a teams-config.json file based on the example, and set environment variables (LOG_LEVEL, TEAMS_CONFIG_PATH, PORT, HTTP_PATH_PREFIX). Run in STDIO mode with npm run dev or in HTTP mode with npm run start-http.

Elasticsearch MCP Server

A Model Context Protocol (MCP) server for Elasticsearch integration with multi-team and multi-environment support. This server allows AI assistants to search exceptions, analyze patterns, and query logs across different teams and environments in a secure and organized way.

Features

- Multi-Team Support: Configure multiple teams with their own Elasticsearch clusters
- Multi-Environment Support: Support for development, staging, production environments per team
- Exception Search: Flexible exception search with filtering and frequency sorting
- Exception Analysis: Deep analysis of specific exceptions with cause and solution suggestions
- Trend Analysis: Analyze exception patterns, frequency trends, and service health
- Log Search: Search application logs with various filters
- Connection Testing: Test Elasticsearch connections for teams and environments
- Flexible Authentication: Support for API keys and username/password authentication
- HTTP and STDIO Transport: Support for both HTTP+SSE and STDIO transport protocols

Installation

npm install

Configuration

Environment Variables

- LOG_LEVEL: Logging level (default: info) - handled directly by the logger
- HTTP_PATH_PREFIX: HTTP path prefix (default: /)
- TEAMS_CONFIG_PATH: Path to teams configuration file (optional)
- PORT: HTTP server port (default: 3000)

Teams Configuration

Create a teams-config.json file based on teams-config.example.json:

{
  "server": {
    "name": "elasticsearch-mcp",
    "version": "1.0.0"
  },
  "teams": {
    "team-alpha": {
      "teamId": "team-alpha",
      "teamName": "Team Alpha",
      "defaultEnvironment": "production",
      "environments": {
        "staging": {
          "node": "https://alpha-staging-es.company.com",
          "apiKey": "your-api-key"
        },
        "production": {
          "node": "https://alpha-prod-es.company.com",
          "apiKey": "your-api-key"
        }
      },
      "indexPatterns": {
        "exceptions": ["alpha-logs-", "alpha-exceptions-"],
        "applications": ["alpha-apm-", "alpha-metrics-"],
        "logs": ["alpha-app-logs-*"]
      },
      "maxSearchResults": 50,
      "allowedOperations": ["search_exceptions", "analyze_exception", "analyze_trends", "search_logs", "test_connection"]
    }
  }
}

Configuration Options

- teamId: Unique identifier for the team
- teamName: Human-readable team name
- defaultEnvironment: Default environment to use when none specified
- environments: Elasticsearch connection configurations per environment
- node: Elasticsearch cluster URL
- apiKey: API key for authentication (optional)
- username/password: Basic authentication (optional)
- maxRetries: Maximum retry attempts (default: 3)
- requestTimeout: Request timeout in milliseconds (default: 30000)
- indexPatterns: Index patterns for different data types
- exceptions: Patterns for exception/error logs
- applications: Patterns for application metrics/APM data
- logs: Patterns for general application logs
- maxSearchResults: Maximum number of results to return (default: 50)
- allowedOperations: List of allowed operations for this team (optional)

Usage

STDIO Mode (for MCP clients)

```bash
npm run dev

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.