Skip to content

Commit 84b0646

Browse files
authored
Merge branch 'main' into feat/query-profiler-tool
2 parents 852bebc + 60d6974 commit 84b0646

File tree

10 files changed

+8880
-1552
lines changed

10 files changed

+8880
-1552
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 3 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
dist
22
node_modules
33
yarn.lock
4+
.env
5+
.idea
6+
.vscode

Dockerfile

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,19 @@
1+
# Copyright Elasticsearch B.V. and contributors
2+
# SPDX-License-Identifier: Apache-2.0
13
FROM cgr.dev/chainguard/wolfi-base:latest
24

35
RUN apk --no-cache add nodejs npm
46

57
WORKDIR /app
6-
COPY . ./
7-
RUN npm install && npm run build
88

9-
ENTRYPOINT ["npm", "start"]
9+
# Install dependencies (Docker build cache friendly)
10+
COPY package.json package-lock.json tsconfig.json ./
11+
RUN touch index.ts && npm install
12+
13+
COPY *.ts run-docker.sh ./
14+
RUN npm run build
15+
16+
# Future-proof the CLI and require the "stdio" argument
17+
ENV RUNNING_IN_CONTAINER="true"
18+
19+
ENTRYPOINT ["./run-docker.sh"]

README.md

Lines changed: 54 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# Elasticsearch MCP Server
2-
[![smithery badge](https://smithery.ai/badge/@elastic/mcp-server-elasticsearch)](https://smithery.ai/server/@elastic/mcp-server-elasticsearch)
32

43
This repository contains experimental features intended for research and evaluation and are not production-ready.
54

@@ -22,31 +21,54 @@ This server connects agents to your Elasticsearch data using the Model Context P
2221

2322
* An Elasticsearch instance
2423
* Elasticsearch authentication credentials (API key or username/password)
24+
* Docker (or an OCI runtime)
2525
* MCP Client (e.g. Claude Desktop)
2626

2727
## Demo
2828

29-
https://github.com/user-attachments/assets/5dd292e1-a728-4ca7-8f01-1380d1bebe0c
29+
<https://github.com/user-attachments/assets/5dd292e1-a728-4ca7-8f01-1380d1bebe0c>
3030

3131
## Installation & Setup
3232

33-
### Installing via Smithery
33+
### Using Docker
3434

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:
3639

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+
```
4059

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
4264

43-
> [!TIP]
44-
> The easiest way to use Elasticsearch MCP Server is through the published npm package.
65+
66+
### Using the Published NPM Package
4567

4668
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:
5072

5173
```json
5274
{
@@ -58,18 +80,19 @@ npx -y @smithery/cli install @elastic/mcp-server-elasticsearch --client claude
5880
"@elastic/mcp-server-elasticsearch"
5981
],
6082
"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"
6386
}
6487
}
6588
}
6689
}
6790
```
6891

6992
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
7396

7497
### Configuration Options
7598

@@ -78,14 +101,16 @@ The Elasticsearch MCP Server supports configuration options to connect to your E
78101
> [!NOTE]
79102
> You must provide either an API key or both username and password for authentication.
80103
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 |
89114

90115
### Developing Locally
91116

@@ -111,9 +136,9 @@ The Elasticsearch MCP Server supports configuration options to connect to your E
111136
```
112137

113138
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:
117142

118143
```json
119144
{
@@ -147,23 +172,6 @@ The Elasticsearch MCP Server supports configuration options to connect to your E
147172
🔍 MCP Inspector is up and running at http://localhost:5173 🚀
148173
```
149174

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-
167175
## Contributing
168176

169177
We welcome contributions from the community! For details on how to contribute, please see [Contributing Guidelines](/docs/CONTRIBUTING.md).

docs/CONTRIBUTING.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,14 @@ Please note that this project follows the [Elastic's Open Source Community Code
2828
npm run build
2929
```
3030

31+
To build the Docker image, run:
32+
33+
```sh
34+
npm run build-docker-image
35+
```
36+
37+
This builds a multi-architecture image for amd64 and arm64. If you don't have a configuration that allows multi-architecture builds, simply run `docker build -t mcp/elasticsearch` .
38+
3139
## Start Elasticsearch
3240

3341
You can use either:

0 commit comments

Comments
 (0)