MCP Server for Elasticsearch - schema discovery, search, CRUD operations
Project description
Elasticsearch Client MCP
MCP Server for Elasticsearch - 支持 ES 6/7/8 版本,连接管理,搜索和 CRUD 操作。
配置
MCP 配置(~/.claude/settings.json)
在 mcpServers 中配置连接信息:
{
"mcpServers": {
"elasticsearch-client": {
"command": "uvx",
"args": ["elasticsearch-client-mcp-py"],
"env": {
"ES_CONNECTIONS": "[{\"name\":\"my_es\",\"env\":\"prod\",\"url\":\"http://your-es-host:9200\",\"username\":\"elastic\",\"password\":\"your_password\"}]"
},
"type": "stdio"
}
}
}
ES_CONNECTIONS 格式:
[
{
"name": "连接名称",
"env": "环境(dev/prod/test)",
"description": "可选描述",
"url": "http://es-host:9200",
"username": "elastic",
"password": "密码",
"safety": {
"read_only": false,
"max_search_size": 100,
"confirm_delete": false,
"allow_delete_index": true,
"allow_create_index": true
}
}
]
profile.json - 权限配置
权限配置存储在 ~/.config/elasticsearch-client-mcp/profile.json:
{
"_last_connection": "prod_finance",
"_connection_cache": {},
"_envs": {
"prod": {
"safety": {
"read_only": true,
"max_search_size": 50,
"confirm_delete": true,
"allow_delete_index": false,
"allow_create_index": false,
"risk_check": true
}
},
"dev": {
"safety": {
"read_only": false,
"max_search_size": 100,
"confirm_delete": false,
"allow_delete_index": true,
"allow_create_index": true,
"risk_check": true
}
}
}
}
safety 配置说明:
read_only: 只读模式,拒绝写操作max_search_size: 最大搜索条数confirm_delete: 删除时需要确认allow_delete_index: 是否允许删除索引allow_create_index: 是否允许创建索引
优先级:
- MCP env 中的
safety配置(优先) - profile.json 中对应 env 的 safety
Tools
list_connections- 列出所有连接get_current_connection- 获取当前连接select_connection- 选择连接es_search- 搜索文档 (from/size 分页)es_scroll- 滚动查询es_scroll_next- 滚动下一页es_scroll_clear- 清除滚动es_index_doc- 索引文档es_update_doc- 更新文档es_delete_doc- 删除文档es_bulk- 批量操作es_create_index- 创建索引es_delete_index- 删除索引es_index_exists- 检查索引是否存在es_get_index_mapping- 获取索引 mappinges_list_indices- 列出所有索引
版本兼容
自动检测 ES 版本 (6/7/8),适配对应的 API:
- ES 8: 移除 _type
- ES 7: scroll / search_after
- ES 6: scroll (注意 _type 处理)
安装
uv pip install -e .
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file elasticsearch_client_mcp_py-1.0.1-py3-none-any.whl.
File metadata
- Download URL: elasticsearch_client_mcp_py-1.0.1-py3-none-any.whl
- Upload date:
- Size: 16.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9366e8c8397002548db4d68a9206e0ecc84acc58fc03e406073fb8e72e97bd9
|
|
| MD5 |
0fe9c5fc447f053b24fa3f6234cf64b4
|
|
| BLAKE2b-256 |
77bade4ecc4876e0fe4e36de14627862df28ffbc1a858f78d7a7e9bdcfeb56e7
|