Elasticsearch MCP security

What an Elasticsearch MCP connection can read and change, how API key and user permissions limit it, and how to lock it down across the Agent Builder endpoint and the deprecated repository server.

On this page

Does the Elasticsearch MCP server meet our access control requirement?

Access control for AI clients querying Elasticsearch is supported through the Agent Builder MCP endpoint in Elastic 9.2.0+ and Elasticsearch Serverless projects, where API keys can be scoped to specific indices and OAuth 2.1 gives each person their own live permissions. The older elastic/mcp-server-elasticsearch repository server is deprecated and only receives critical security updates, so it should not be the basis for a new approval. Your team's decision is therefore less about whether the control exists and more about whether your configuration enforces it for every client.

For API key access, the key itself is the control. Elastic's docs say tools run with the scope assigned to the key and advise restricting it to only the indices and data you want to expose. Its example key grants read and view_index_metadata on indices, the feature_agentBuilder.read application privilege and a 30 day expiration. Confirm that the privilege is granted, because without feature_agentBuilder.read a client receives a 403 Forbidden error when connecting. Review every index pattern in the role, since a broad wildcard silently widens what the agent can read.

The main trade-off is identity. One shared API key means one shared identity, so every caller acts with the same permissions and your audit trail shows one actor. If you need per-person permissions, evaluate OAuth 2.1 and confirm with Elastic how it maps users to roles in your deployment. Also write a migration plan for any workload still on the repository server, with an owner and a cutover date, and confirm the current Elastic documentation before you rely on either authentication path. Elastic's Agent Builder MCP server documentation lists the built-in tools not exposed through MCP, which should be part of the same review.

Access capabilities by server and authentication path

This table compares the Agent Builder MCP endpoint, under its API key and OAuth 2.1 paths, with the deprecated elastic/mcp-server-elasticsearch server. Read each row as a question to put to your Elastic contact: what scope a connection gets, who it acts as, and whether it will keep receiving fixes.

CapabilityAgent Builder MCP endpointDeprecated elastic/mcp-server-elasticsearch
Update statusCurrent vendor path, superseding the deprecated server (Elastic 9.2.0+ and Serverless projects)Deprecated; receives only critical security updates, so a migration plan is needed
Read scopeTools run with the scope of the API key, or of the signed-in user under OAuth; restrict keys to the indices you want exposedConfirm with Elastic and the repository README how index access is scoped and whether it can be narrowed beyond the connecting credential
API key pathSupported; example key grants read and view_index_metadata on indices, the feature_agentBuilder.read privilege and a 30 day expirationConfirm key type, privileges and expiration support in the repository documentation
OAuth 2.1 pathSupported; each person acts with their own live permissionsNot documented as an option in the supplied facts; verify before assuming it is available
Per-user identityAPI key: one shared key means one shared identity for all callers. OAuth: each person's own identityConfirm whether individual callers can be distinguished or whether all calls share one identity
403 gate on feature_agentBuilder.readWithout the privilege, the client receives 403 Forbidden when connecting to the MCP endpointNot applicable as a documented gate; confirm the authorization model with Elastic
Missing toolsSome built-in tools are unavailable, including platform.core.create_visualization and most cases tools, because their results only work in Agent Builder chatConfirm which tools the deprecated server exposes and whether any overlap with the Agent Builder set
Logging and auditConfirm with Elastic which MCP calls are logged, by which identity, and how logs are retainedConfirm audit behavior of the deprecated server in your deployment

How the Agent Builder MCP endpoint enforces access

Access to the Agent Builder MCP server is decided by the identity the MCP client presents on each request, so that identity is the first control to review. The client calls the Kibana endpoint at {KIBANA_URL}/api/agent_builder/mcp, or at {KIBANA_URL}/s/{SPACE_ID}/api/agent_builder/mcp when the deployment uses a custom Kibana space, and authenticates with either an API key or OAuth 2.1. Before any tool runs, the endpoint checks the caller. A client without the feature_agentBuilder.read application privilege receives a 403 Forbidden response, so the privilege is a gate that reviewers can confirm in the role definition. Confirm the exact space path your team will use, because a client pointed at the wrong space path is a configuration issue, not a security control.

Tool execution follows the permissions of the credential, not the permissions of the agent or the client application. Elastic's documentation states that tools execute with the scope assigned to the API key and recommends restricting the key to only the indices and data you want to expose. An example key from Elastic grants read and view_index_metadata on selected indices, the feature_agentBuilder.read privilege and a 30 day expiration. Treat that example as a starting point to tighten, not a template to copy, and check each index pattern in the role before issuing the key. Any ES|QL query an agent runs is bounded by the same index privileges, so a broad index pattern in the key is a broad read path for every connected agent.

The authentication choice determines whose permissions apply. With an API key, one shared key means one shared identity, so every caller acts with the same permissions and the audit trail shows the key, not the person. With OAuth 2.1, each person acts with their own live permissions, so changes to that user's roles take effect for their agent sessions. For teams where access should differ by person, OAuth is the stronger fit, and the decision should be recorded before rollout. Confirm with your Elastic administrator which options your deployment exposes, and whether the Elasticsearch Serverless or Elastic 9.2.0+ deployment you run includes both paths.

Decisions to make before connecting a client

Before any AI client reaches the Agent Builder MCP endpoint, the team has to settle who the client acts as, what data it can touch, and whether it can change anything. Each choice below changes how well actions can be attributed and how much damage a misused credential can do.

Shared API key or per-person OAuth

With API key authentication, one shared key means one shared identity, so every caller acts with the same permissions and audit entries cannot separate one person from another. With OAuth 2.1, each person acts with their own live permissions, which is what most reviewers expect for attribution. Ask which path the team will use, who can create keys, and whether a single shared key is acceptable for a named purpose.

MCP server docs

Index scope of the API key

Elastic states that tools run with the scope assigned to the API key and advises limiting the key to only the indices and data you want to expose. A key granted broad read access exposes everything that identity can reach through the MCP tools. Check each index pattern against data classification before creating the key, and confirm that index-level privileges are applied as intended in the target cluster.

API key docs

Key expiration and rotation

Elastic's example MCP key uses a 30 day expiration. That value is an example, not a policy, but it shows that keys can be time-bound. A shorter lifetime limits how long a leaked key remains useful, while a longer one means more rotation work for the platform team. Confirm the expiration your policy requires, who owns rotation, and how a revoked key is cut off from active client sessions.

Example key expiration
30 days

Kibana space the endpoint targets

The endpoint is {KIBANA_URL}/api/agent_builder/mcp by default, or {KIBANA_URL}/s/{SPACE_ID}/api/agent_builder/mcp for a custom space. Pointing a client at a space limits which agents, tools and data views the connection presents. Decide which space each team or client uses, and confirm that the key's privileges match that space so a client cannot reach content in other spaces.

Which Agent Builder tools to expose

Some built-in tools are not available through the MCP server, such as platform.core.create_visualization and most cases tools, because their results only work in Agent Builder chat. The remaining tools are what an external client can call, including ES|QL queries. Review the tool list against the client's purpose and remove tools the use case does not need, so the connection exposes the smallest set of capabilities.

Whether writes are needed at all

An MCP connection is most often used to search and analyze, and a read-only key with read and view_index_metadata on the intended indices keeps the blast radius small. If a use case needs writes, treat it as a separate approval with its own key, index scope and owner. Ask the vendor which operations a given key can perform and confirm them in a test cluster before approval.

How the answer changes by deployment situation

Elasticsearch Serverless projects are one of the two environments where the Elastic Agent Builder MCP endpoint is documented as available, so a team on Serverless does not need to start from the deprecated repository server. The endpoint sits at the Kibana URL of the project, under /api/agent_builder/mcp, or under /s/{SPACE_ID}/api/agent_builder/mcp when the team uses a custom Kibana space. Reviewers should confirm which space the agent reaches, because a client pointed at the wrong space changes what it can see.

  • Endpoint choice: Use the Agent Builder MCP endpoint, not the repository server, for any new connection.
  • Space path: Record whether the client uses the default path or a space-specific path, and confirm the space name in the review record.
  • Authentication options: Confirm whether the team will use API keys or OAuth 2.1 before configuring any client.
  • Key scope: For API keys, restrict the key to the indices and data the agent needs, because tools run with the key's assigned scope.
  • Application privilege: Check that the identity holds feature_agentBuilder.read, since clients without it receive a 403 Forbidden error.

Before approval, ask the platform team to show the endpoint URL, the space in use and the exact privileges on the key or user the client will use.

Request path from MCP client to Elasticsearch data

The request starts at an MCP host such as Claude Desktop and reaches the Agent Builder MCP endpoint in Kibana. The client authenticates with either an API key or OAuth 2.1, and the endpoint runs Agent Builder tools with the permissions of that caller. Those tools then query Elasticsearch indices, so the scope of the key or the user's own access decides what data is reachable. Check the key's index privileges and the feature_agentBuilder.read privilege before connecting.

Credential choice determines the identity every Agent Builder tool call runs under.

Order of work to lock down the connection

This sequence takes the connection from an unreviewed setup to one where the identity, the permissions, the space and the tools are each confirmed before any agent reads or changes data. It also sets the migration and renewal points so the setup does not drift after approval.

  1. Confirm the Elastic version or Serverless project

    The platform engineering lead checks which Elastic deployment the team runs. The Agent Builder MCP endpoint is documented for Elastic 9.2.0 and later and for Elasticsearch Serverless projects, so a deployment on an earlier release does not have this path and the team should not plan around it. Done when the deployment version or project type is written into the review record, along with the Kibana URL that will host the endpoint.

  2. Choose the authentication path

    The security lead and the platform owner decide between API keys and OAuth 2.1, the two paths Elastic documents for the Agent Builder MCP server. API keys mean one shared identity, so every caller acts with the same permissions. OAuth means each person acts with their own live permissions. Done when the decision, and the reason for it, is recorded and the team confirms which path their MCP client supports.

  3. Create a narrowly scoped key or configure OAuth

    The Elasticsearch administrator creates the credential. For an API key, the tools run with the key's scope, so the key should be limited to the indices and data the use case needs, with read and view_index_metadata as the starting point in Elastic's example, plus the feature_agentBuilder.read application privilege. Elastic's example key also carries a 30 day expiration, which the team should review rather than accept by default. For OAuth, the administrator confirms that each user's own roles are the intended limit. Done when the key's privileges and index patterns are exported and a second reviewer has approved them.

  4. Verify the 403 behavior without the privilege

    The tester connects a client using a test credential that lacks the feature_agentBuilder.read application privilege. Elastic documents that a client without this privilege gets a 403 Forbidden error when it connects to the MCP endpoint. If the connection succeeds, the privilege model is not behaving as the review assumed and the team stops before going further. Done when the 403 is captured in a test log and the team has confirmed that the privilege is the gate.

  5. Confirm space targeting

    The Kibana administrator checks which endpoint the clients use. The default endpoint is {KIBANA_URL}/api/agent_builder/mcp, while a custom Kibana space uses {KIBANA_URL}/s/{SPACE_ID}/api/agent_builder/mcp. The team confirms that clients for each group point to the intended space and that no client points to the default space by accident. Done when a written list maps each client configuration to its endpoint and space.

  6. Test which tools run

    The tester calls the tools each client is expected to use, such as an ES|QL query, and records the results against the key's scope. The tester also confirms which built-in Agent Builder tools are unavailable through MCP, such as platform.core.create_visualization and most cases tools, so the team does not assume they are present. Done when the test results show that reads return only the approved indices and that the unavailable tools are documented as out of the review's scope.

  7. Plan migration off the deprecated server

    The platform owner inventories any clients still using the elastic/mcp-server-elasticsearch repository. The README says that server is deprecated and receives only critical security updates, and that the Agent Builder MCP endpoint supersedes it. Each client is mapped to a replacement, with an owner and a cutover plan. Done when the inventory lists every client on the deprecated server and each has a signed-off migration path.

  8. Set key expiration and review dates

    The security lead sets a renewal and review date for every credential and for the permission review, and confirms who receives the expiration notice. Because the example key expires after 30 days, the team should decide the expiry for its own keys and record it. Done when each key has a named owner, an expiration date in the register and a scheduled review that reconfirms the index scope and the client list.

Evidence a security reviewer asks for

This table lists the Elastic settings a reviewer should be able to point to for the Agent Builder MCP endpoint and the deprecated repository server. Each row names where the control lives and what to confirm in your own cluster before approving a connection. Read it as an evidence checklist: a control is only proven once the live configuration and its logs match what is written.

ControlWhere it comes from in ElasticWhat to confirm
Key role definitionsRole descriptors assigned to the API key or user, set in Elasticsearch security settingsEach role lists only the indices and privileges the agent needs, and no role grants broader index access than the use case requires
Key expiration settingsAPI key expiration set when the key is created, shown in the key's metadataThe key has a defined expiration, the Elastic example uses 30 days, and your policy sets the rotation owner and renewal process
The feature_agentBuilder.read grantApplication privilege assigned through a role, required to reach the MCP endpointOnly approved clients hold this privilege, and a test client without it receives a 403 Forbidden response
OAuth configurationOAuth 2.1 path documented for the Agent Builder MCP server, as an alternative to API keysEach user signs in with their own identity, and the team knows which permissions apply per person and how sessions end
The space used by the endpointDefault endpoint at the Kibana URL, or a custom space path under the space identifierClients point only to the intended space, and the space's permissions match the data the agent may see
Migration plan for the repository serverElastic's README marks elastic/mcp-server-elasticsearch as deprecated with critical security updates onlyA dated plan exists to move each client to the Agent Builder endpoint, and an owner tracks any remaining use of the deprecated server
Elasticsearch audit log samplesAudit logging in the Elasticsearch cluster, recording authentication and access eventsSample entries show which API key or user made each MCP request, and your team can trace a request to its identity and target index
Shared key identityAPI key authentication means one shared key carries one identity for all callersIf several people or agents share a key, the evidence records that shared identity, and the team accepts the reduced attribution or moves to OAuth

Questions buyers ask before approving Elasticsearch MCP access

Is the deprecated Elastic repository MCP server still safe to use?

The repository server, elastic/mcp-server-elasticsearch, is licensed Apache-2.0 and its README says it is deprecated and will only receive critical security updates from here on. That makes it a poor choice for a new rollout and a risk to carry for existing use. Treat it as a temporary state with a dated migration plan, not as the long-term design. Ask Elastic in writing which Elastic versions and deployment types still receive critical fixes for that server, and how long those fixes are expected to continue.

Do we need API keys or OAuth for the Agent Builder MCP endpoint?

Neither is optional. The Agent Builder MCP server supports two authentication paths: API keys and OAuth 2.1. The choice changes who the agent acts as. An API key runs with the scope assigned to that key, and Elastic advises restricting it to only the indices and data you want to expose. Clients also need the feature_agentBuilder.read application privilege, because without it the client gets a 403 Forbidden error when connecting. Confirm with Elastic which path your deployment and client support, and document which one each team uses.

How does one shared API key affect audit trails?

A shared key means one shared identity, so every caller acts with the same permissions and the activity cannot be attributed to a person through the key alone. With OAuth, each person acts with their own live permissions, which gives you per-user attribution and lets access change when a user's rights change. For audit, issue one key per client or team where possible, record who holds each key, and check with Elastic and your own Kibana and Elasticsearch audit settings what is logged for each identity before you sign off.

Can our own team configure the MCP connection without outside help?

Often yes, if the team already administers Elasticsearch security and Kibana spaces. The work is mostly role design: creating a key or OAuth client, limiting index access, granting the Agent Builder application privilege, and choosing between the shared Kibana endpoint and a per-space endpoint. The harder part is proving the result. Your team should test what a connected client can read and change, confirm that unavailable tools behave as documented, and review the findings with security staff. If the team lacks that depth, an outside security review can test the configuration and deliver a findings report with fixes and a retest.

What drives the effort and cost of this rollout?

The main drivers are the number of MCP clients, the number of indices each client needs, and whether you must migrate off the repository server. Each client needs its own key or OAuth setup and its own review. Index scope adds effort because each key should be narrowed to exact indices, which requires mapping which data each use case really needs. Migration adds work when existing agents depend on the repository server's tools, since some Agent Builder tools differ. Costs are one-time for setup, review and migration, and recurring for key rotation, role changes and retesting after upgrades. Ask any partner for a written scope that lists each of these items.

What should we request from Elastic in writing before approval?

Ask Elastic to confirm in writing the following: which Elastic version or Serverless project your deployment runs, which authentication paths the Agent Builder MCP server supports for that version, the exact privileges a key needs, how long key and OAuth credentials last, and which built-in tools are unavailable through MCP, including platform.core.create_visualization and most cases tools. Also ask for the support window and security update commitments for the repository server during your migration period, and for how audit events from MCP calls are recorded. Keep those answers with your approval record.

Which Elasticsearch MCP endpoint should we connect to?

Use the Agent Builder MCP endpoint, which is {KIBANA_URL}/api/agent_builder/mcp, or {KIBANA_URL}/s/{SPACE_ID}/api/agent_builder/mcp for a custom Kibana space. The endpoint is available in Elastic 9.2.0 and later and in Elasticsearch Serverless projects, according to the repository README. Using a space-specific endpoint helps separate teams and data, so a client connected to one space is easier to limit than one on the shared endpoint. Confirm your version before you plan the rollout.

How DeployOpen helps tighten an Elasticsearch MCP rollout

DeployOpen approaches Elasticsearch MCP security as a fixed-scope review of the connection you actually plan to run, from the MCP endpoint and API key or OAuth setup through the Elasticsearch privileges behind it. The work covers security testing of the setup, delivery of fixes with a retest, and handover of documentation your security and compliance teams can review.

How we scope

  • Confirm which MCP path you plan to use: the Agent Builder MCP endpoint or the deprecated elastic/mcp-server-elasticsearch server.
  • Inventory the Elasticsearch indices, spaces and Kibana features each planned client would reach.
  • Agree in writing which clients, identity model (shared API key or per-user OAuth) and tests are in scope.

How we build

  • Harden API key scopes so they grant only the indices and privileges the use case needs.
  • Verify the feature_agentBuilder.read privilege is granted only to intended keys and that expiration is set.
  • Test prompt injection, tool access and data exposure through each MCP client you approve.

How we hand over

  • Deliver a findings report with severity, reproduction steps and the specific fix for each issue.
  • Document the agreed key scopes, space layout, tool exclusions and any migration plan off the deprecated server.
  • Provide evidence your compliance team can review, while noting that independent auditors issue any attestation.

How we support

  • Retest the connection after fixes are applied and record what changed.
  • Offer ongoing support, upgrades and continuous testing as a retainer after the fixed-scope engagement.
  • Re-review scopes when new clients, spaces or Elastic releases change what the connection can reach.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.