{"id":24311657,"url":"https://github.com/cr7258/elasticsearch-mcp-server","last_synced_at":"2026-02-02T15:21:48.742Z","repository":{"id":271688453,"uuid":"914165286","full_name":"cr7258/elasticsearch-mcp-server","owner":"cr7258","description":"A Model Context Protocol (MCP) server implementation that provides Elasticsearch and OpenSearch interaction.","archived":false,"fork":false,"pushed_at":"2025-12-15T15:02:14.000Z","size":739,"stargazers_count":230,"open_issues_count":7,"forks_count":48,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-18T18:49:06.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cr7258.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-01-09T04:20:03.000Z","updated_at":"2025-12-18T17:53:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"155f01c7-2763-4dad-9b52-8e2b3e114103","html_url":"https://github.com/cr7258/elasticsearch-mcp-server","commit_stats":null,"previous_names":["cr7258/elasticsearch-mcp-server"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/cr7258/elasticsearch-mcp-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr7258%2Felasticsearch-mcp-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr7258%2Felasticsearch-mcp-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr7258%2Felasticsearch-mcp-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr7258%2Felasticsearch-mcp-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cr7258","download_url":"https://codeload.github.com/cr7258/elasticsearch-mcp-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cr7258%2Felasticsearch-mcp-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29014050,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-02T14:58:54.169Z","status":"ssl_error","status_checked_at":"2026-02-02T14:58:51.285Z","response_time":58,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-17T07:12:38.759Z","updated_at":"2026-02-02T15:21:48.736Z","avatar_url":"https://github.com/cr7258.png","language":"Python","funding_links":[],"categories":["Databases","サーバー実装","📚 Projects (1974 total)","Community Servers","MCP 服务器精选列表","Legend","🤖 AI/ML","Search","APIs and HTTP Requests","MCP Servers","Uncategorized","Table of Contents","カテゴリ","Mcp Server Directories \u0026 Lists","🗄️ Databases","🗂️ Extensions by Category"],"sub_categories":["Search Engines","🗄️ \u003ca name=\"databases\"\u003e\u003c/a\u003eデータベース","MCP Servers","🗄️ 数据库交互","🗄️ \u003ca name=\"databases\"\u003e\u003c/a\u003eDatabases","🗄️ Databases","Uncategorized","Search","🗄️ \u003ca name=\"database--sql\"\u003e\u003c/a\u003eデータベース・SQL"],"readme":"\n\u003c!-- mcp-name: io.github.cr7258/elasticsearch-mcp-server --\u003e\n\n# Elasticsearch/OpenSearch MCP Server\n\n[![MseeP.ai Security Assessment Badge](https://mseep.net/pr/cr7258-elasticsearch-mcp-server-badge.png)](https://mseep.ai/app/cr7258-elasticsearch-mcp-server)\n\n[![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/cr7258/elasticsearch-mcp-server)](https://archestra.ai/mcp-catalog/cr7258__elasticsearch-mcp-server)\n\n[MCP Official Registry]( https://registry.modelcontextprotocol.io/v0/servers?search=io.github.cr7258/elasticsearch-mcp-server)\n\n## Overview\n\nA Model Context Protocol (MCP) server implementation that provides Elasticsearch and OpenSearch interaction. This server enables searching documents, analyzing indices, and managing cluster through a set of tools.\n\n\u003ca href=\"https://glama.ai/mcp/servers/b3po3delex\"\u003e\u003cimg width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/b3po3delex/badge\" alt=\"Elasticsearch MCP Server\" /\u003e\u003c/a\u003e\n\n## Demo\n\nhttps://github.com/user-attachments/assets/f7409e31-fac4-4321-9c94-b0ff2ea7ff15\n\n## Features\n\n### General Operations\n\n- `general_api_request`: Perform a general HTTP API request. Use this tool for any Elasticsearch/OpenSearch API that does not have a dedicated tool.\n\n### Index Operations\n\n- `list_indices`: List all indices.\n- `get_index`: Returns information (mappings, settings, aliases) about one or more indices.\n- `create_index`: Create a new index.\n- `delete_index`: Delete an index.\n- `create_data_stream`: Create a new data stream (requires matching index template).\n- `get_data_stream`: Get information about one or more data streams.\n- `delete_data_stream`: Delete one or more data streams and their backing indices.\n\n### Document Operations\n\n- `search_documents`: Search for documents.\n- `index_document`: Creates or updates a document in the index.\n- `get_document`: Get a document by ID.\n- `delete_document`: Delete a document by ID.\n- `delete_by_query`: Deletes documents matching the provided query.\n\n### Cluster Operations\n\n- `get_cluster_health`: Returns basic information about the health of the cluster.\n- `get_cluster_stats`: Returns high-level overview of cluster statistics.\n\n### Alias Operations\n\n- `list_aliases`: List all aliases.\n- `get_alias`: Get alias information for a specific index.\n- `put_alias`: Create or update an alias for a specific index.\n- `delete_alias`: Delete an alias for a specific index.\n\n### Analyzer Operations\n\n- `analyze_text`: Analyze text using a specified analyzer or custom analysis chain. Useful for debugging search queries and understanding how text is tokenized.\n\n## Configure Environment Variables\n\nThe MCP server supports the following environment variables:\n\n### Basic Authentication (Username/Password)\n- `ELASTICSEARCH_USERNAME`: Username for basic authentication\n- `ELASTICSEARCH_PASSWORD`: Password for basic authentication\n- `OPENSEARCH_USERNAME`: Username for OpenSearch basic authentication\n- `OPENSEARCH_PASSWORD`: Password for OpenSearch basic authentication\n\n### API Key Authentication (Elasticsearch only) - Recommended\n- `ELASTICSEARCH_API_KEY`: API key for [Elasticsearch](https://www.elastic.co/docs/deploy-manage/api-keys/elasticsearch-api-keys) or [Elastic Cloud](https://www.elastic.co/docs/deploy-manage/api-keys/elastic-cloud-api-keys) Authentication.\n\n### Connection Settings\n- `ELASTICSEARCH_HOSTS` / `OPENSEARCH_HOSTS`: Comma-separated list of hosts (default: `https://localhost:9200`)\n- `VERIFY_CERTS`: Whether to verify SSL certificates (default: `false`)\n- `REQUEST_TIMEOUT`: Request timeout in seconds (optional, uses client default if not set)\n\n### MCP Server Authentication (HTTP Transports Only)\n\nWhen running the MCP server with HTTP-based transports (SSE or Streamable HTTP), you can enable Bearer token authentication to protect the server from unauthorized access.\n\n- `MCP_API_KEY`: API key for MCP server authentication. Clients must include `Authorization: Bearer \u003cMCP_API_KEY\u003e` header.\n\n**Important Security Notes:**\n- Authentication is **only applicable** for HTTP transports (`sse`, `streamable-http`). The `stdio` transport uses local process communication and doesn't require authentication.\n- If `MCP_API_KEY` is **not set**, the MCP server will be accessible **without authentication**. This is a security risk when exposing the server over a network.\n- For production deployments with HTTP transports, **always set `MCP_API_KEY`**.\n\n```bash\n# Generate a secure API key (example using openssl)\nexport MCP_API_KEY=$(openssl rand -base64 32)\n\n# Or set a custom API key\nexport MCP_API_KEY=\"your-secure-api-key-here\"\n```\n\n### Disable High-Risk Operations\n\n- `DISABLE_HIGH_RISK_OPERATIONS`: Set to `true` to disable all write operations (default: `false`)\n- `DISABLE_OPERATIONS`: Comma-separated list of specific operations to disable (optional, uses default write operations list if not set)\n\nWhen `DISABLE_HIGH_RISK_OPERATIONS` is set to true, all MCP tools that perform write operations are completely hidden from the MCP client. In this mode, the following MCP tools are disabled by default.\n\n- **Index Operations:**\n  - `create_index`\n  - `delete_index`\n  \n- **Document Operations:**\n  - `index_document`\n  - `delete_document`\n  - `delete_by_query`\n  \n- **Data Stream Operations:**\n  - `create_data_stream`\n  - `delete_data_stream`\n  \n- **Alias Operations:**\n  - `put_alias`\n  - `delete_alias`\n  \n- **General API Operations:**\n  - `general_api_request`\n\nOptionally, you can specify a comma-separated list of operations to disable in the `DISABLE_OPERATIONS` environment variable.\n\n```bash\n# Disable High-Risk Operations\nexport DISABLE_HIGH_RISK_OPERATIONS=true\n# Disable specific operations only\nexport DISABLE_OPERATIONS=\"delete_index,delete_document,delete_by_query\"\n```\n\n## Start Elasticsearch/OpenSearch Cluster\n\nStart the Elasticsearch/OpenSearch cluster using Docker Compose:\n\n```bash\n# For Elasticsearch\ndocker-compose -f docker-compose-elasticsearch.yml up -d\n\n# For OpenSearch\ndocker-compose -f docker-compose-opensearch.yml up -d\n```\n\nThe default Elasticsearch username is `elastic` and password is `test123`. The default OpenSearch username is `admin` and password is `admin`.\n\nYou can access Kibana/OpenSearch Dashboards from http://localhost:5601.\n\n## Stdio\n\n### Option 1: Using uvx\n\nUsing `uvx` will automatically install the package from PyPI, no need to clone the repository locally. Add the following configuration to 's config file `claude_desktop_config.json`.\n\n```json\n// For Elasticsearch with username/password\n{\n  \"mcpServers\": {\n    \"elasticsearch-mcp-server\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"elasticsearch-mcp-server\"\n      ],\n      \"env\": {\n        \"ELASTICSEARCH_HOSTS\": \"https://localhost:9200\",\n        \"ELASTICSEARCH_USERNAME\": \"elastic\",\n        \"ELASTICSEARCH_PASSWORD\": \"test123\"\n      }\n    }\n  }\n}\n\n// For Elasticsearch with API key\n{\n  \"mcpServers\": {\n    \"elasticsearch-mcp-server\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"elasticsearch-mcp-server\"\n      ],\n      \"env\": {\n        \"ELASTICSEARCH_HOSTS\": \"https://localhost:9200\",\n        \"ELASTICSEARCH_API_KEY\": \"\u003cYOUR_ELASTICSEARCH_API_KEY\u003e\"\n      }\n    }\n  }\n}\n\n// For OpenSearch\n{\n  \"mcpServers\": {\n    \"opensearch-mcp-server\": {\n      \"command\": \"uvx\",\n      \"args\": [\n        \"opensearch-mcp-server\"\n      ],\n      \"env\": {\n        \"OPENSEARCH_HOSTS\": \"https://localhost:9200\",\n        \"OPENSEARCH_USERNAME\": \"admin\",\n        \"OPENSEARCH_PASSWORD\": \"admin\"\n      }\n    }\n  }\n}\n```\n\n### Option 2: Using uv with local development\n\nUsing `uv` requires cloning the repository locally and specifying the path to the source code. Add the following configuration to Claude Desktop's config file `claude_desktop_config.json`.\n\n```json\n// For Elasticsearch with username/password\n{\n  \"mcpServers\": {\n    \"elasticsearch-mcp-server\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\",\n        \"path/to/elasticsearch-mcp-server\",\n        \"run\",\n        \"elasticsearch-mcp-server\"\n      ],\n      \"env\": {\n        \"ELASTICSEARCH_HOSTS\": \"https://localhost:9200\",\n        \"ELASTICSEARCH_USERNAME\": \"elastic\",\n        \"ELASTICSEARCH_PASSWORD\": \"test123\"\n      }\n    }\n  }\n}\n\n// For Elasticsearch with API key\n{\n  \"mcpServers\": {\n    \"elasticsearch-mcp-server\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\",\n        \"path/to/elasticsearch-mcp-server\",\n        \"run\",\n        \"elasticsearch-mcp-server\"\n      ],\n      \"env\": {\n        \"ELASTICSEARCH_HOSTS\": \"https://localhost:9200\",\n        \"ELASTICSEARCH_API_KEY\": \"\u003cYOUR_ELASTICSEARCH_API_KEY\u003e\"\n      }\n    }\n  }\n}\n\n// For OpenSearch\n{\n  \"mcpServers\": {\n    \"opensearch-mcp-server\": {\n      \"command\": \"uv\",\n      \"args\": [\n        \"--directory\",\n        \"path/to/elasticsearch-mcp-server\",\n        \"run\",\n        \"opensearch-mcp-server\"\n      ],\n      \"env\": {\n        \"OPENSEARCH_HOSTS\": \"https://localhost:9200\",\n        \"OPENSEARCH_USERNAME\": \"admin\",\n        \"OPENSEARCH_PASSWORD\": \"admin\"\n      }\n    }\n  }\n}\n```\n\n## SSE\n\n### Option 1: Using uvx\n\n```bash\n# export environment variables (with username/password)\nexport ELASTICSEARCH_HOSTS=\"https://localhost:9200\"\nexport ELASTICSEARCH_USERNAME=\"elastic\"\nexport ELASTICSEARCH_PASSWORD=\"test123\"\n\n# OR export environment variables (with API key)\nexport ELASTICSEARCH_HOSTS=\"https://localhost:9200\"\nexport ELASTICSEARCH_API_KEY=\"\u003cYOUR_ELASTICSEARCH_API_KEY\u003e\"\n\n# By default, the SSE MCP server will serve on http://127.0.0.1:8000/sse\nuvx elasticsearch-mcp-server --transport sse\n\n# The host, port, and path can be specified using the --host, --port, and --path options\nuvx elasticsearch-mcp-server --transport sse --host 0.0.0.0 --port 8000 --path /sse\n```\n\n### Option 2: Using uv\n\n```bash\n# By default, the SSE MCP server will serve on http://127.0.0.1:8000/sse\nuv run src/server.py elasticsearch-mcp-server --transport sse\n\n# The host, port, and path can be specified using the --host, --port, and --path options\nuv run src/server.py elasticsearch-mcp-server --transport sse --host 0.0.0.0 --port 8000 --path /sse\n```\n\n## Streamable HTTP\n\n### Option 1: Using uvx\n\n```bash\n# export environment variables (with username/password)\nexport ELASTICSEARCH_HOSTS=\"https://localhost:9200\"\nexport ELASTICSEARCH_USERNAME=\"elastic\"\nexport ELASTICSEARCH_PASSWORD=\"test123\"\n\n# OR export environment variables (with API key)\nexport ELASTICSEARCH_HOSTS=\"https://localhost:9200\"\nexport ELASTICSEARCH_API_KEY=\"\u003cYOUR_ELASTICSEARCH_API_KEY\u003e\"\n\n# By default, the Streamable HTTP MCP server will serve on http://127.0.0.1:8000/mcp\nuvx elasticsearch-mcp-server --transport streamable-http\n\n# The host, port, and path can be specified using the --host, --port, and --path options\nuvx elasticsearch-mcp-server --transport streamable-http --host 0.0.0.0 --port 8000 --path /mcp\n```\n\n### Option 2: Using uv\n\n```bash\n# By default, the Streamable HTTP MCP server will serve on http://127.0.0.1:8000/mcp\nuv run src/server.py elasticsearch-mcp-server --transport streamable-http\n\n# The host, port, and path can be specified using the --host, --port, and --path options\nuv run src/server.py elasticsearch-mcp-server --transport streamable-http --host 0.0.0.0 --port 8000 --path /mcp\n```\n\n## Compatibility\n\nThe MCP server is compatible with Elasticsearch 7.x, 8.x, and 9.x. By default, it uses the Elasticsearch 8.x client (without a suffix).\n\n| MCP Server | Elasticsearch |\n| --- | --- |\n| elasticsearch-mcp-server-es7 | Elasticsearch 7.x |\n| elasticsearch-mcp-server | Elasticsearch 8.x |\n| elasticsearch-mcp-server-es9 | Elasticsearch 9.x |\n| opensearch-mcp-server | OpenSearch 1.x, 2.x, 3.x |\n\n To use the Elasticsearch 7.x client, run the `elasticsearch-mcp-server-es7` variant. For Elasticsearch 9.x, use `elasticsearch-mcp-server-es9`. For example:\n\n```bash\nuvx elasticsearch-mcp-server-es7\n```\n\nIf you want to run different Elasticsearch variants (e.g., 7.x or 9.x) locally, simply update the `elasticsearch` dependency version in `pyproject.toml`, then start the server with:\n\n```bash\nuv run src/server.py elasticsearch-mcp-server\n```\n\n## License\n\nThis project is licensed under the Apache License Version 2.0 - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr7258%2Felasticsearch-mcp-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcr7258%2Felasticsearch-mcp-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcr7258%2Felasticsearch-mcp-server/lists"}