Skip to main content
Glama
Elasticsearch MCP Server

Elasticsearch MCP Server

by jesee
README.md
# Elasticsearch MCP Server

Elasticsearch MCP 服务器,支持 Claude Code、VSCode (Cline)、Cursor 等工具。

## 安装

```bash
npm install -g es-mcp-server
```

## 配置

### 环境变量

| 变量 | 说明 | 默认值 |
|------|------|--------|
| `ES_HOST` | ES 地址 | `localhost:9200` |
| `ES_USERNAME` | 用户名 | - |
| `ES_PASSWORD` | 密码 | - |
| `ES_API_KEY` | API Key | - |

### Claude Code 配置

```json
{
  "mcpServers": {
    "elasticsearch": {
      "command": "es-mcp-server",
      "env": {
        "ES_HOST": "localhost:9200"
      }
    }
  }
}
```

### VSCode (Cline) 配置

路径: `~/.config/Code/User/globalStorage/hybridtalentcomputing.cline-chinese/settings/cline_chinese_mcp_settings.json`

```json
{
  "mcpServers": {
    "elasticsearch": {
      "command": "es-mcp-server",
      "env": {
        "ES_HOST": "localhost:9200"
      }
    }
  }
}
```

### Cursor 配置

```json
{
  "mcpServers": {
    "elasticsearch": {
      "command": "es-mcp-server",
      "env": {
        "ES_HOST": "localhost:9200"
      }
    }
  }
}
```

## 可用工具

| 工具 | 说明 |
|------|------|
| `es_health_check` | 集群健康检查 |
| `es_list_indices` | 列出所有索引 |
| `es_create_index` | 创建索引 |
| `es_delete_index` | 删除索引 |
| `es_index_document` | 索引文档 |
| `es_get_document` | 获取文档 |
| `es_search` | 搜索文档 |
| `es_update_document` | 更新文档 |
| `es_delete_document` | 删除文档 |
| `es_cluster_info` | 集群信息 |

## 使用示例

### 搜索文档

```json
{
  "index": "user_info",
  "query": {
    "match": { "content": "总监" }
  },
  "size": 10
}
```

### 索引文档

```json
{
  "index": "products",
  "document": {
    "name": "iPhone",
    "price": 999
  }
}
```

## 许可证

MIT

TDQS

B3.1/5.0

Scored across 10 tools

Disambiguation5/5

Each tool has a distinct, non-overlapping purpose: cluster info/health, index CRUD, document CRUD, listing, and search. No ambiguity exists.

Naming Consistency5/5

All tools follow a consistent 'es_verb_noun' pattern in snake_case, making them predictable and easy to understand (e.g., es_create_index, es_delete_document).

Tool Count5/5

With 10 tools, the set is well-scoped for basic Elasticsearch operations. Each tool serves a specific function, and the count is neither too few nor excessive.

Completeness4/5

The tools cover essential CRUD for indices and documents, plus cluster health and search. Missing operations like bulk indexing or mapping updates are minor gaps, but core workflows are supported.