1
1
# Elasticsearch MCP Server
2
- [ ![ smithery badge] ( https://smithery.ai/badge/@elastic/mcp-server-elasticsearch )] ( https://smithery.ai/server/@elastic/mcp-server-elasticsearch )
3
2
4
3
This repository contains experimental features intended for research and evaluation and are not production-ready.
5
4
@@ -22,31 +21,54 @@ This server connects agents to your Elasticsearch data using the Model Context P
22
21
23
22
* An Elasticsearch instance
24
23
* Elasticsearch authentication credentials (API key or username/password)
24
+ * Docker (or an OCI runtime)
25
25
* MCP Client (e.g. Claude Desktop)
26
26
27
27
## Demo
28
28
29
- https://github.com/user-attachments/assets/5dd292e1-a728-4ca7-8f01-1380d1bebe0c
29
+ < https://github.com/user-attachments/assets/5dd292e1-a728-4ca7-8f01-1380d1bebe0c >
30
30
31
31
## Installation & Setup
32
32
33
- ### Installing via Smithery
33
+ ### Using Docker
34
34
35
- To install Elasticsearch MCP Server for Claude Desktop automatically via [ Smithery] ( https://smithery.ai/server/@elastic/mcp-server-elasticsearch ) :
35
+ 1 . ** Configure MCP Client**
36
+ * Open your MCP Client. See the [ list of MCP Clients] ( https://modelcontextprotocol.io/clients ) , here we are configuring Claude Desktop.
37
+ * Go to ** Settings > Developer > MCP Servers**
38
+ * Click ` Edit Config ` and add a new MCP Server with the following configuration:
36
39
37
- ``` bash
38
- npx -y @smithery/cli install @elastic/mcp-server-elasticsearch --client claude
39
- ```
40
+ ``` json
41
+ {
42
+ "mcpServers" : {
43
+ "elasticsearch-mcp-server" : {
44
+ "command" : " docker" ,
45
+ "args" : [
46
+ " run" , " --rm" , " -i" ,
47
+ " -e" , " ES_URL" ,
48
+ " -e" , " ES_API_KEY" ,
49
+ " docker.elastic.co/mcp/elasticsearch" , " stdio"
50
+ ],
51
+ "env" : {
52
+ "ES_URL" : " <your-elasticsearch-url>" ,
53
+ "ES_API_KEY" : " <your-api-key>"
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
40
59
41
- ### Using the Published NPM Package
60
+ 2 . ** Start a Conversation**
61
+ * Open a new conversation in your MCP Client
62
+ * The MCP server should connect automatically
63
+ * You can now ask questions about your Elasticsearch data
42
64
43
- > [ !TIP ]
44
- > The easiest way to use Elasticsearch MCP Server is through the published npm package.
65
+
66
+ ### Using the Published NPM Package
45
67
46
68
1 . ** Configure MCP Client**
47
- - Open your MCP Client. See the [ list of MCP Clients] ( https://modelcontextprotocol.io/clients ) , here we are configuring Claude Desktop.
48
- - Go to ** Settings > Developer > MCP Servers**
49
- - Click ` Edit Config ` and add a new MCP Server with the following configuration:
69
+ * Open your MCP Client. See the [ list of MCP Clients] ( https://modelcontextprotocol.io/clients ) , here we are configuring Claude Desktop.
70
+ * Go to ** Settings > Developer > MCP Servers**
71
+ * Click ` Edit Config ` and add a new MCP Server with the following configuration:
50
72
51
73
``` json
52
74
{
@@ -58,18 +80,19 @@ npx -y @smithery/cli install @elastic/mcp-server-elasticsearch --client claude
58
80
" @elastic/mcp-server-elasticsearch"
59
81
],
60
82
"env" : {
61
- "ES_URL" : " your-elasticsearch-url" ,
62
- "ES_API_KEY" : " your-api-key"
83
+ "ES_URL" : " <your-elasticsearch-url>" ,
84
+ "ES_API_KEY" : " <your-api-key>" ,
85
+ "OTEL_LOG_LEVEL" : " none"
63
86
}
64
87
}
65
88
}
66
89
}
67
90
```
68
91
69
92
2 . ** Start a Conversation**
70
- - Open a new conversation in your MCP Client
71
- - The MCP server should connect automatically
72
- - You can now ask questions about your Elasticsearch data
93
+ * Open a new conversation in your MCP Client
94
+ * The MCP server should connect automatically
95
+ * You can now ask questions about your Elasticsearch data
73
96
74
97
### Configuration Options
75
98
@@ -78,14 +101,16 @@ The Elasticsearch MCP Server supports configuration options to connect to your E
78
101
> [ !NOTE]
79
102
> You must provide either an API key or both username and password for authentication.
80
103
81
- | Environment Variable | Description | Required |
82
- | ---------------------| -------------| ----------|
83
- | ` ES_URL ` | Your Elasticsearch instance URL | Yes |
84
- | ` ES_API_KEY ` | Elasticsearch API key for authentication | No |
85
- | ` ES_USERNAME ` | Elasticsearch username for basic authentication | No |
86
- | ` ES_PASSWORD ` | Elasticsearch password for basic authentication | No |
87
- | ` ES_CA_CERT ` | Path to custom CA certificate for Elasticsearch SSL/TLS | No |
88
- | ` ES_PATH_PREFIX ` | Path prefix for Elasticsearch instance exposed at a non-root path | No |
104
+ | Environment Variable | Description | Required |
105
+ | ----------------------| -----------------------------------------------------------------------| ----------|
106
+ | ` ES_URL ` | Your Elasticsearch instance URL | Yes |
107
+ | ` ES_API_KEY ` | Elasticsearch API key for authentication | No |
108
+ | ` ES_USERNAME ` | Elasticsearch username for basic authentication | No |
109
+ | ` ES_PASSWORD ` | Elasticsearch password for basic authentication | No |
110
+ | ` ES_CA_CERT ` | Path to custom CA certificate for Elasticsearch SSL/TLS | No |
111
+ | ` ES_SSL_SKIP_VERIFY ` | Set to '1' or 'true' to skip SSL certificate verification | No |
112
+ | ` ES_PATH_PREFIX ` | Path prefix for Elasticsearch instance exposed at a non-root path | No |
113
+ | ` ES_VERSION ` | Server assumes Elasticsearch 9.x. Set to ` 8 ` target Elasticsearch 8.x | No |
89
114
90
115
### Developing Locally
91
116
@@ -111,9 +136,9 @@ The Elasticsearch MCP Server supports configuration options to connect to your E
111
136
```
112
137
113
138
4 . ** Run locally in Claude Desktop App**
114
- - Open ** Claude Desktop App**
115
- - Go to ** Settings > Developer > MCP Servers**
116
- - Click ` Edit Config ` and add a new MCP Server with the following configuration:
139
+ * Open ** Claude Desktop App**
140
+ * Go to ** Settings > Developer > MCP Servers**
141
+ * Click ` Edit Config ` and add a new MCP Server with the following configuration:
117
142
118
143
``` json
119
144
{
@@ -147,23 +172,6 @@ The Elasticsearch MCP Server supports configuration options to connect to your E
147
172
🔍 MCP Inspector is up and running at http://localhost:5173 🚀
148
173
```
149
174
150
- #### Docker image
151
-
152
- A ` Dockerfile ` is available if you would like to build and run the server in a container. To build, run:
153
-
154
- ``` sh
155
- docker build -t mcp-server-elasticsearch .
156
- ```
157
-
158
- And to run, rather than using the ` npx ` command above or a custom ` node ` or ` npm ` command, run:
159
-
160
- ``` sh
161
- docker run -i \
162
- -e ES_URL=< url> \
163
- -e ES_API_KEY=< key> \
164
- mcp-server-elasticsearch
165
- ```
166
-
167
175
## Contributing
168
176
169
177
We welcome contributions from the community! For details on how to contribute, please see [ Contributing Guidelines] ( /docs/CONTRIBUTING.md ) .
0 commit comments