๐ Easysearch MCP Server
An MCP server that enables AI agents to operate INFINI Easysearch, which is compatible with Elasticsearch/OpenSearch APIs.
โจ Features
- ๐ง 121 Tools: Covering all functions such as cluster, index, document, search, and monitoring.
- ๐ Plug-and-Play: Supporting MCP clients like Kiro and Claude Desktop.
- ๐ Secure Connection: Supporting HTTPS and basic authentication.
- โก High Performance: Based on the httpx asynchronous HTTP client.
๐ฆ Installation
git clone https://github.com/cloudsmithy/easysearch-mcp-server.git
cd easysearch-mcp-server
pip install -e .
๐ Quick Start
1. Configure the MCP Client
Kiro (.kiro/settings/mcp.json):
{
"mcpServers": {
"easysearch": {
"command": "python3",
"args": ["-m", "easysearch_mcp.server"],
"cwd": "/path/to/easysearch-mcp-server/src",
"env": {
"EASYSEARCH_URL": "https://localhost:9200",
"EASYSEARCH_USER": "admin",
"EASYSEARCH_PASSWORD": "your-password",
"PYTHONPATH": "/path/to/easysearch-mcp-server/src"
}
}
}
}
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"easysearch": {
"command": "python3",
"args": ["-m", "easysearch_mcp.server"],
"cwd": "/path/to/easysearch-mcp-server/src",
"env": {
"EASYSEARCH_URL": "https://localhost:9200",
"EASYSEARCH_USER": "admin",
"EASYSEARCH_PASSWORD": "your-password",
"PYTHONPATH": "/path/to/easysearch-mcp-server/src"
}
}
}
}
โ ๏ธ Important Note
Replace /path/to/easysearch-mcp-server with the actual project path.
2. Start Using
After configuration, the AI agent can directly operate Easysearch:
- "Check the cluster health status"
- "Create a products index"
- "Search for products with a price greater than 100"
- "Count the number of orders in each category"
Tool List
Cluster Management (8)
| Tool |
Description |
cluster_health |
Cluster health status |
cluster_stats |
Cluster statistical information |
cluster_state |
Detailed cluster state |
cluster_settings |
Get cluster settings |
cluster_update_settings |
Update cluster settings |
cluster_pending_tasks |
Pending tasks |
cluster_allocation_explain |
Shard allocation explanation |
cluster_reroute |
Manually route shards |
Index Management (25)
| Tool |
Description |
index_create |
Create an index |
index_delete |
Delete an index |
index_exists |
Check if an index exists |
index_get |
Get index details |
index_get_mapping |
Get mapping |
index_put_mapping |
Update mapping |
index_get_settings |
Get settings |
index_put_settings |
Update settings |
index_open |
Open an index |
index_close |
Close an index |
index_refresh |
Refresh an index |
index_flush |
Flush to disk |
index_forcemerge |
Force merge segments |
index_clear_cache |
Clear the cache |
index_stats |
Index statistics |
index_segments |
Segment information |
index_recovery |
Recovery status |
index_shard_stores |
Shard storage information |
index_set_readonly |
Set read-only (precondition for clone/split/shrink) |
index_prepare_for_shrink |
Prepare for shrinking (precondition for shrink) |
index_create_with_write_alias |
Create an index with a writable alias (precondition for rollover) |
index_clone |
Clone an index |
index_split |
Split an index |
index_shrink |
Shrink an index |
index_rollover |
Rollover an index |
Alias Management (4)
| Tool |
Description |
alias_get |
Get an alias |
alias_create |
Create an alias |
alias_delete |
Delete an alias |
alias_actions |
Batch alias operations |
Template Management (3)
| Tool |
Description |
template_get |
Get a template |
template_create |
Create a template |
template_delete |
Delete a template |
Document Operations (11)
| Tool |
Description |
doc_index |
Write a document |
doc_get |
Get a document |
doc_exists |
Check if a document exists |
doc_delete |
Delete a document |
doc_update |
Update a document |
doc_bulk |
Batch operations |
doc_bulk_simple |
Simplified batch writing |
doc_mget |
Batch retrieval |
doc_source |
Get the document source |
doc_delete_by_query |
Delete by query |
doc_update_by_query |
Update by query |
Search Functions (15)
| Tool |
Description |
search |
DSL search |
search_simple |
Simple keyword search |
search_template |
Template search |
msearch |
Multiple search |
count |
Document count |
validate_query |
Validate a query |
explain |
Explain scoring |
aggregate |
Aggregation query |
aggregate_simple |
Simplified aggregation |
scroll_start |
Start a scroll search |
scroll_next |
Get the next batch |
scroll_clear |
Clear the scroll context |
field_caps |
Field capabilities |
knn_search |
Vector search |
sql_query |
SQL query |
CAT API (19)
| Tool |
Description |
cat_health |
Cluster health |
cat_nodes |
Node list |
cat_indices |
Index list |
cat_shards |
Shard distribution |
cat_allocation |
Disk allocation |
cat_thread_pool |
Thread pool status |
cat_master |
Master node information |
cat_segments |
Segment information |
cat_count |
Document count |
cat_recovery |
Recovery status |
cat_pending_tasks |
Pending tasks |
cat_aliases |
Alias list |
cat_templates |
Template list |
cat_plugins |
Plugin list |
cat_fielddata |
Fielddata usage |
cat_nodeattrs |
Node attributes |
cat_repositories |
Snapshot repositories |
cat_snapshots |
Snapshot list |
cat_tasks |
Task list |
Node Management (5)
| Tool |
Description |
nodes_info |
Node information |
nodes_stats |
Node statistics |
nodes_hot_threads |
Hot threads |
nodes_usage |
Feature usage statistics |
nodes_reload_secure_settings |
Reload secure settings |
Snapshot Management (10)
| Tool |
Description |
snapshot_repo_create |
Create a repository |
snapshot_repo_get |
Get a repository |
snapshot_repo_delete |
Delete a repository |
snapshot_repo_verify |
Verify a repository |
snapshot_create |
Create a snapshot |
snapshot_get |
Get a snapshot |
snapshot_status |
Snapshot status |
snapshot_delete |
Delete a snapshot |
snapshot_restore |
Restore a snapshot |
snapshot_clone |
Clone a snapshot |
Snapshot Lifecycle Management SLM (6)
| Tool |
Description |
slm_policy_create |
Create a policy |
slm_policy_get |
Get a policy |
slm_policy_delete |
Delete a policy |
slm_policy_explain |
Explain a policy |
slm_policy_start |
Start a policy |
slm_policy_stop |
Stop a policy |
Task Management (3)
| Tool |
Description |
tasks_list |
Task list |
tasks_get |
Task details |
tasks_cancel |
Cancel a task |
Ingest Pipeline (6)
| Tool |
Description |
pipeline_get |
Get a Pipeline |
pipeline_create |
Create a Pipeline |
pipeline_delete |
Delete a Pipeline |
pipeline_simulate |
Simulate a Pipeline |
ingest_stats |
Ingest statistics |
ingest_processor_grok |
Grok pattern list |
ILM Index Lifecycle Management (5)
| Tool |
Description |
ilm_policy_get |
Get an ILM policy |
ilm_policy_create |
Create an ILM policy |
ilm_policy_delete |
Delete an ILM policy |
ilm_add_policy |
Bind an ILM policy to an index |
ilm_remove_policy |
Remove an ILM policy from an index |
Others (1)
| Tool |
Description |
reindex |
Reindex |
๐ป Usage Examples
Cluster Monitoring
Check the cluster health status
โ cluster_health()
View all nodes
โ cat_nodes()
View the thread pool status
โ cat_thread_pool()
View indices sorted by size
โ cat_indices(sort_by="store.size", order="desc")
Index Operations
Create an index
โ index_create("products",
mappings={"properties": {"name": {"type": "text"}, "price": {"type": "float"}}},
settings={"number_of_shards": 3})
Write a document
โ doc_index("products", {"name": "iPhone", "price": 999})
Batch writing
โ doc_bulk_simple("products", [
{"name": "iPad", "price": 799},
{"name": "MacBook", "price": 1299}
])
Search Queries
Simple search
โ search_simple("products", "iPhone")
DSL search
โ search("products", query={
"bool": {
"must": [{"match": {"name": "phone"}}],
"filter": [{"range": {"price": {"lte": 1000}}}]
}
})
Aggregation statistics
โ aggregate("orders", aggs={
"by_status": {"terms": {"field": "status"}},
"avg_amount": {"avg": {"field": "amount"}}
})
SQL query
โ sql_query("SELECT * FROM products WHERE price > 500 ORDER BY price DESC")
Index Cloning/Splitting/Shrinking
# Clone an index (need to set read-only first)
โ index_set_readonly("my-index", True)
โ index_clone("my-index", "my-index-clone")
โ index_set_readonly("my-index", False)
# Shrink an index (need to prepare)
โ index_prepare_for_shrink("my-index")
โ index_shrink("my-index", "my-index-shrunk", {"index.number_of_shards": 1})
# Rollover an index (need a writable alias)
โ index_create_with_write_alias("logs-000001", "logs")
โ index_rollover("logs", conditions={"max_docs": 1000000})
Environment Variables
| Variable |
Description |
Default Value |
EASYSEARCH_URL |
Easysearch address |
https://localhost:9200 |
EASYSEARCH_USER |
Username |
admin |
EASYSEARCH_PASSWORD |
Password |
- |
Development
git clone https://github.com/cloudsmithy/easysearch-mcp-server.git
cd easysearch-mcp-server
pip install -e .
pytest
black src/
ruff check src/
Compatibility Testing
All 121 tools have been tested and verified on INFINI Easysearch:
| Category |
Number of Tools |
Status |
| Cluster Management |
8 |
โ
All passed |
| Index Management |
25 |
โ
All passed |
| Alias Management |
4 |
โ
All passed |
| Template Management |
3 |
โ
All passed |
| Document Operations |
11 |
โ
All passed |
| Search Functions |
15 |
โ
All passed |
| CAT API |
19 |
โ
All passed |
| Node Management |
5 |
โ
All passed |
| Snapshot Management |
10 |
โ
All passed |
| SLM |
6 |
โ
All passed |
| Task Management |
3 |
โ
All passed |
| Ingest Pipeline |
6 |
โ
All passed |
| ILM |
5 |
โ
All passed |
| Others |
1 |
โ
All passed |
โ ๏ธ Important Note
The snapshot and SLM functions require the server to configure path.repo to create a repository.
๐ License
MIT License