Elasticsearch MCP server for AI agents

Live

API KEY

SEARCH AND DATA

Search

Elasticsearch gives your agent search and data access in your cluster: run Query DSL, SQL, and ES|QL queries, read and write documents, inspect indices and mappings, and check cluster health.

  • Per-user credentials: each call uses the actual user's API key, never a shared bot.
  • Encrypted per-tenant vault: AES-256, resolved at request time, never in LLM context.
  • Scoped before every call: pre-call scope check, 90-day SIEM-exportable audit chain.
Elasticsearch
agent · Acme Q3
Run
How many documents in the orders index have status failed?
S
elasticsearch_count
96ms
Search agent
The orders index has 318 documents with status failed.
Sources: Elasticsearch orders index, 1 count
elasticsearch
318 documents
18:29
Message Claude...

Tools your search agent reaches for on Elasticsearch, scoped per user.

CALL ANY TOOL
25 tools for search and data in Elasticsearch: run Query DSL, SQL, and ES|QL queries, read and write documents, inspect indices and mappings, and check cluster health.
elasticsearch_aliases_list
List aliases
List index aliases in the cluster as JSON. Returns one row per alias with alias, index, filter, routing and is_write_index. Use Update Aliases to add, move or remove aliases.
Parameters
Name
Type
Required
Description
h
string
Optional
Columns to return. Example: alias,index,is_write_index.
s
string
Optional
Columns to sort by. Example: alias.
elasticsearch_aliases_update
Update aliases
elasticsearch_cluster_health_get
Get cluster health
elasticsearch_cluster_info_get
Get cluster info
elasticsearch_count
Count
elasticsearch_delete_by_query
Query delete by
elasticsearch_document_add
Add document
elasticsearch_document_delete
Delete document
elasticsearch_document_get
Get document
elasticsearch_document_index
Document index
elasticsearch_document_update
Update document
elasticsearch_documents_get_many
Documents get many
elasticsearch_esql_query
Query esql
elasticsearch_field_capabilities_get
Get field capabilities
elasticsearch_index_create
Create index
elasticsearch_index_delete
Delete index
elasticsearch_index_get
Get index
elasticsearch_index_mapping_get
Get index mapping
elasticsearch_index_mapping_update
Update index mapping
elasticsearch_index_refresh
Refresh index
elasticsearch_index_settings_get
Get index settings
elasticsearch_indices_list
List indices
elasticsearch_search
Search
elasticsearch_sql_query
Query sql
elasticsearch_update_by_query
Query update by
Build your Agent
Same auth pattern across LangChain, OpenAI, Anthropic, and Google ADK.
Python · LlamaIndex
import { ScalekitClient } from "@scalekit-sdk/node";
import { createReactAgent } from "@langchain/langgraph/prebuilt";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

// Elasticsearch tools scoped to this user
const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["elasticsearch"], toolNames: [
    "elasticsearch_search",
    "elasticsearch_count",
    "elasticsearch_document_get"] },
  pageSize: 100,
});

const agent = createReactAgent({ llm, tools });
await agent.invoke({ messages: [{ role: "user", content: "Search the logs index for errors, count the failed orders, and fetch the order document for this ID" }] });
import OpenAI from "openai";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const openai = new OpenAI();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["elasticsearch"] }, pageSize: 100,
});

const res = await openai.chat.completions.create({
  model: "gpt-5",
  messages: [{ role: "user", content: "Search the logs index for errors, count the failed orders, and fetch the order document for this ID" }],
  tools,
});

// Execute the tool call with the user's vaulted Elasticsearch API key
await sk.tools.executeTool(res.choices[0].message.tool_calls[0], "user_123");
import Anthropic from "@anthropic-ai/sdk";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);
const anthropic = new Anthropic();

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["elasticsearch"] }, pageSize: 100,
});

const msg = await anthropic.messages.create({
  model: "claude-sonnet-5",
  max_tokens: 1024,
  messages: [{ role: "user", content: "Search the logs index for errors, count the failed orders, and fetch the order document for this ID" }],
  tools,
});

// Tool call runs with the user's vaulted Elasticsearch API key
await sk.tools.executeTool(msg.content, "user_123");
import { Agent } from "@google/adk/agents";
import { ScalekitClient } from "@scalekit-sdk/node";

const sk = new ScalekitClient(env.SCALEKIT_ENV_URL, env.SCALEKIT_CLIENT_ID, env.SCALEKIT_CLIENT_SECRET);

const { tools } = await sk.tools.listScopedTools("user_123", {
  filter: { connectionNames: ["elasticsearch"] }, pageSize: 100,
});

const agent = new Agent({
  name: "search_agent",
  model: "gemini-2.5-pro",
  instruction: "Elasticsearch tools scoped to this user",
  tools,
});

await agent.run("Search the logs index for errors, count the failed orders, and fetch the order document for this ID");
Try these prompts
Copy any prompt into your agent. Each maps directly to a Elasticsearch tool. Click to copy, paste into your agent, done.
Search and query
Copy the prompt
Copied
Search the logs index for errors in the last hour.
Copy the prompt
Copied
Run an ES|QL query that counts orders by status.
Copy the prompt
Copied
Run a SQL query on the products index.
Documents
Copy the prompt
Copied
Get the document with this ID from the orders index.
Copy the prompt
Copied
Update this document to set status to shipped.
Copy the prompt
Copied
Add a new document to the notes index.
Cluster and indices
Copy the prompt
Copied
Check the health of my cluster.
Copy the prompt
Copied
List my indices and their sizes.
Copy the prompt
Copied
Show the mapping of the orders index.
SEE HOW AUTH WORKS
Each user connects their own Elasticsearch API key once, and Scalekit sends it with every call. Keys stay vaulted, every call is scope checked, and every action is logged.
1
Authorize
Your user connects
Elasticsearch
once. We tie it to their identity and the access they approved, with no shared bot account and no org-wide access
Who:
user ‘A’
when:
Once per user
access:
Limited to user
2
Store
Their
Elasticsearch
credential lives in a vault scoped to them. User A's data is never reachable by an agent acting for user B, even on the same connection
vault:
encrypted
scope:
per-user
tenants:
isolated
3
Resolve
When your agent calls a
Elasticsearch
tool, we fetch the right credential server-side. It never touches your agent, never appears in the LLM context, never shows up in your logs
speed:
~40ms
check:
before every call
seen by:
nobody
4
Audit
Every
Elasticsearch
tool call is logged: who triggered it, which tool ran, what came back. 90 days of history, tied to the user who authorized it
history:
90 days
export:
SIEM-ready
logged:
every call
Test other agents
See the same per-user auth pattern across other database and search connectors.
Engineering Teams
DevOps assistant agent
Polls GitHub for failing checks and stale PRs, opens Linear issues for the ones that need work, and posts a daily digest to Slack. It acts as the engineer, not a shared service account.
Test other agents
See the same per-user auth pattern across other database and search connectors.
ENGINEERING
DevOps assistant agent
Poll GitHub for failing checks and stale pull requests, open Linear issues for the ones that need work, and digest to Slack.
Why Scalekit
Secure your agent's access. Connectors ship in minutes
01.
Shared tokens break per-user analytics
A shared Elasticsearch API key looks fine in a demo. In production every document write and delete looks like one service account, and you cannot tell which user triggered it. Scalekit resolves the credential of the actual user who triggered the agent, never a shared bot.
// shared key
audit → bot_service_account

// scalekit
audit → user_abc ✓
02.
Authentication is not authorization
03.
Multi-tenancy is architectural
04.
Elasticsearch today. Ten connectors tomorrow.
“Our agents act across Salesforce, Gong, Google Drive, and more, on behalf of every customer. Scalekit behind the scenes meant we can keep adding tools without ever rebuilding how credentials or tool calling work.”
Venu Madhav Kattagoni
Head of Engineering / Von
FAQs
Frequently Asked Questions
Does the agent access Elasticsearch as the user or through a shared key?
As the user. Each user connects their own Elasticsearch API key once, and Scalekit sends it with every call. Audit logs attribute every document write and delete to that user, not a shared service account.
Where is the Elasticsearch API key stored?
In Scalekit's managed AES-256 token vault, namespaced per tenant. To rotate it, the user reconnects with a new API key. Revocation is a single dashboard action. Credentials never appear in prompts, logs, or LLM context.
Can I limit what the agent does in Elasticsearch?
Yes. Filter by tool name in listScopedTools to expose only what you want, for example the search, count, and get tools without elasticsearch_index_delete, elasticsearch_delete_by_query, or elasticsearch_document_delete. Scalekit also enforces scope checks before every API call.
What happens when a user revokes Elasticsearch access?
The connection is invalidated on the next tool call. Subsequent requests for that user fail closed with a clear error. Other users in the tenant remain unaffected. The event is logged for audit.
Which query languages can the agent use in Elasticsearch?
elasticsearch_search takes the Query DSL, elasticsearch_sql_query runs Elasticsearch SQL, and elasticsearch_esql_query runs ES|QL piped queries. elasticsearch_count counts the documents that match a query.
Start in your coding agent
Up and running in one command
Install the Scalekit skill in your editor of choice. Connector, auth, tools, prompt, all wired up
Claude Code REPL
/plugin marketplace add scalekit-inc/claude-code-authstack
/plugin install agentkit@scalekit-auth-stack
Cursor Code REPL
# ~/.cursor/mcp.json
{
""mcpServers"": {
""elasticsearch"": {
""url"": ""https://mcp.scalekit.com/elasticsearch"",
""headers"": { ""Authorization"": ""Bearer $SCALEKIT_TOKEN"" }
}
}
}
Codex Code REPL
# ~/.codex/config.toml
[mcp_servers.elasticsearch]
url = ""https://mcp.scalekit.com/elasticsearch""
auth_env = ""SCALEKIT_TOKEN""
Copilot Code REPL
# .vscode/mcp.json
{
""servers"": {
""elasticsearch"": {
""url"": ""https://mcp.scalekit.com/elasticsearch"",
""type"": ""http""
}
}
}