Kibana MCP Server

Kibana MCP Server

Enables AI assistants to interact with Kibana dashboards, visualizations, and Elasticsearch data through read-only resources and executable tools for searching logs, exporting dashboards, and querying data.

Category
访问服务器

README

Kibana MCP Server

A Model Context Protocol (MCP) server that enables AI assistants to interact with Kibana dashboards, visualizations, and Elasticsearch data through a standardized interface.

Features

  • Resources: Read-only access to Kibana dashboards, visualizations, data views, and saved searches
  • Tools: Execute searches, export dashboards, and query Elasticsearch data
  • Dual Transport: Supports both stdio (local) and HTTP/SSE (containerized) transports
  • Docker Support: Production-ready containerization with Docker and Podman
  • Authentication: API key and username/password authentication
  • Type-Safe: Built with TypeScript for enhanced reliability

Architecture

┌─────────────────┐
│   AI Assistant  │
│  (Claude, etc.) │
└────────┬────────┘
         │ MCP Protocol
         │
┌────────▼────────┐      ┌─────────────┐
│   MCP Server    │─────▶│   Kibana    │
│  (This Server)  │      │   REST API  │
└─────────────────┘      └──────┬──────┘
                                │
                         ┌──────▼──────┐
                         │Elasticsearch│
                         └─────────────┘

Quick Start

Using Docker/Podman (Recommended)

  1. Clone and configure:

    git clone <repository-url>
    cd kibana-mcp-poc
    cp .env.example .env
    # Edit .env with your Kibana credentials
    
  2. Run with Docker Compose:

    docker-compose up --build
    
  3. Or with Podman:

    podman build -t kibana-mcp .
    podman run -p 3000:3000 --env-file .env kibana-mcp
    
  4. Verify it's running:

    curl http://localhost:3000/health
    

Local Development

  1. Install dependencies:

    npm install
    
  2. Configure environment:

    cp .env.example .env
    # Edit .env with your Kibana credentials
    
  3. Run in development mode:

    # Stdio mode (for Claude Desktop)
    npm run dev
    
    # HTTP mode (for testing)
    npm run dev:http
    
  4. Build and run production:

    npm run build
    npm start        # stdio mode
    npm start:http   # HTTP mode
    

Configuration

Environment Variables

Create a .env file based on .env.example:

# Kibana Configuration (required)
KIBANA_URL=https://your-kibana-instance.com
KIBANA_API_KEY=your_api_key_here

# Alternative: Username/Password Authentication
# KIBANA_USERNAME=your_username
# KIBANA_PASSWORD=your_password

# Server Configuration
MCP_TRANSPORT=http           # or stdio
HTTP_PORT=3000               # Port for HTTP server
LOG_LEVEL=info               # debug, info, warn, error

Authentication Methods

API Key (Recommended):

KIBANA_URL=https://kibana.example.com
KIBANA_API_KEY=your_base64_encoded_api_key

Username/Password:

KIBANA_URL=https://kibana.example.com
KIBANA_USERNAME=admin
KIBANA_PASSWORD=your_password

MCP Capabilities

Resources (Read-Only Data)

  • kibana://dashboards - List all dashboards
  • kibana://dashboard/{id} - Get specific dashboard
  • kibana://visualizations - List all visualizations
  • kibana://data-views - List all data views
  • kibana://saved-searches - List saved searches

Tools (Executable Functions)

list_dashboards

List dashboards with optional search and pagination.

{
  "search": "security",
  "page": 1,
  "perPage": 20
}

get_dashboard

Get detailed information about a specific dashboard.

{
  "id": "dashboard-id-here"
}

export_dashboard

Export dashboard with all dependencies.

{
  "id": "dashboard-id-here",
  "includeReferences": true
}

search_logs

Query Elasticsearch data through Kibana.

{
  "index": "logs-*",
  "query": {
    "match": {
      "message": "error"
    }
  },
  "size": 10,
  "sort": [{"@timestamp": "desc"}]
}

Other Tools

  • list_visualizations - List visualizations
  • get_visualization - Get visualization details
  • list_data_views - List available data views

Connecting to AI Assistants

Claude Code

Claude Code connects to MCP servers running over HTTP/SSE. You have two options:

Option 1: Using Docker (Recommended)

  1. Start the server:

    docker-compose up -d
    
  2. Add to Claude Code settings (~/.config/claude-code/settings.json on Linux/macOS or %APPDATA%\claude-code\settings.json on Windows):

    {
      "mcpServers": {
        "kibana": {
          "url": "http://localhost:3000"
        }
      }
    }
    
  3. Restart Claude Code to load the new MCP server.

Option 2: Direct Configuration with Environment Variables

{
  "mcpServers": {
    "kibana": {
      "url": "http://localhost:3000",
      "env": {
        "KIBANA_URL": "https://your-kibana.com",
        "KIBANA_API_KEY": "your-api-key",
        "MCP_TRANSPORT": "http",
        "HTTP_PORT": "3000"
      }
    }
  }
}

Then start the server manually:

npm run start:http

Verification: In Claude Code, type /mcp to see available servers. You should see "kibana" in the list with resources and tools.

Amazon Q Developer

Amazon Q Developer also supports MCP servers via HTTP/SSE transport.

Setup with Docker

  1. Start the Kibana MCP server:

    docker run -d \
      --name kibana-mcp \
      -p 3000:3000 \
      -e KIBANA_URL=https://your-kibana.com \
      -e KIBANA_API_KEY=your-api-key \
      -e MCP_TRANSPORT=http \
      kibana-mcp:latest
    
  2. Configure Amazon Q Developer:

    Edit your Amazon Q configuration file (location varies by IDE):

    VS Code (settings.json):

    {
      "amazonQ.mcp.servers": {
        "kibana": {
          "url": "http://localhost:3000/sse"
        }
      }
    }
    

    JetBrains IDEs (Settings → Tools → Amazon Q):

    • Add MCP Server
    • Name: kibana
    • URL: http://localhost:3000/sse
  3. Restart your IDE to activate the connection.

Alternative: MCP Proxy for stdio

If your tool requires stdio transport, use mcp-proxy to bridge:

# Install mcp-proxy globally
npm install -g @modelcontextprotocol/mcp-proxy

# Start the HTTP server
docker-compose up -d

# Run proxy in stdio mode
mcp-proxy stdio http://localhost:3000/sse

Then configure Amazon Q to use the proxy as a stdio command:

{
  "command": "mcp-proxy",
  "args": ["stdio", "http://localhost:3000/sse"]
}

Claude Desktop (stdio mode)

For local Claude Desktop app (not Claude Code), use stdio transport:

Add to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "kibana": {
      "command": "node",
      "args": ["/path/to/kibana-mcp-poc/dist/index.js"],
      "env": {
        "KIBANA_URL": "https://your-kibana.com",
        "KIBANA_API_KEY": "your-api-key"
      }
    }
  }
}

Generic HTTP/SSE Clients

Connect any MCP client to the HTTP server at:

http://localhost:3000/sse

The server exposes these endpoints:

  • GET /health - Health check
  • GET /info - Server information
  • GET /sse - SSE connection endpoint for MCP protocol

Docker Deployment

Build Image

docker build -t kibana-mcp:latest .

Run Container

docker run -d \
  --name kibana-mcp \
  -p 3000:3000 \
  -e KIBANA_URL=https://your-kibana.com \
  -e KIBANA_API_KEY=your-api-key \
  kibana-mcp:latest

Docker Compose

# Start
docker-compose up -d

# View logs
docker-compose logs -f

# Stop
docker-compose down

Development

Project Structure

kibana-mcp-poc/
├── src/
│   ├── index.ts              # Stdio entry point
│   ├── http-server.ts        # HTTP/SSE entry point
│   ├── server.ts             # Core MCP server logic
│   ├── kibana/
│   │   ├── client.ts         # Kibana API client
│   │   ├── types.ts          # TypeScript types
│   │   └── auth.ts           # Authentication
│   ├── resources/
│   │   └── index.ts          # MCP resources
│   └── tools/
│       └── index.ts          # MCP tools
├── Dockerfile
├── docker-compose.yml
└── package.json

Adding New Tools

  1. Define the tool schema in src/tools/index.ts
  2. Implement the handler in the tools/call request handler
  3. Add corresponding Kibana client method if needed

Testing

# Health check
curl http://localhost:3000/health

# Server info
curl http://localhost:3000/info

# Test with MCP Inspector
npx @modelcontextprotocol/inspector dist/index.js

Security

  • Container Isolation: Runs as non-root user (mcpuser)
  • Minimal Base Image: Uses node:20-slim to reduce attack surface
  • Secret Management: Environment variables for credentials
  • API Authentication: Supports API keys and basic auth
  • RBAC: Respects Kibana's role-based access control

Troubleshooting

Connection Issues

# Check if Kibana is accessible
curl -I https://your-kibana.com/api/status

# Verify authentication
curl -H "Authorization: ApiKey YOUR_KEY" \
     -H "kbn-xsrf: true" \
     https://your-kibana.com/api/status

Container Issues

# View logs
docker logs kibana-mcp-server

# Shell into container
docker exec -it kibana-mcp-server /bin/sh

# Rebuild without cache
docker-compose build --no-cache

Contributing

Contributions are welcome! Please follow these guidelines:

  1. Use TypeScript for all new code
  2. Follow existing code style
  3. Add tests for new features
  4. Update documentation

License

MIT

Resources

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选