---
name: iblai-connect-elastic-security
description: "Read and write Elastic Security data through the Kibana Security APIs and expose it to an ibl.ai agent as an MCP tool. Use when the user asks an agent to work with Elastic Security data, or to set up an Elastic Security MCP connection on ibl.ai."
metadata:
  kind: guide
---

# Elastic Security connector for AI agents

> A starting point maintained on ibl.ai at https://ibl.ai/developer/connectors/elastic-security — not part of the iblai/base repository. Checked against Elastic N.V.'s documentation on October 20, 2026; test it against your own Elastic Security setup before you rely on it.

Elastic Security runs SIEM and endpoint protection on Elasticsearch and Kibana. It stores security events, detection rules and the alerts they raise, cases, and Elastic Defend endpoints that accept response actions.

## Auth & conventions

- **API:** Kibana Security APIs (REST). Kibana endpoints for detection alerts (/api/detection_engine/signals/search and /status), cases (/api/cases/_find and more) and endpoint response actions (/api/endpoint/action/isolate). Prefix /s/{space_id} for a non-default space.
- **Base URL:** {KIBANA_URL}/api/ (custom space: {KIBANA_URL}/s/{space_id}/api/)
- **Access:** Issued by your administrator. Calls run against the customer's own Kibana (self-managed, Elastic Cloud or Serverless). An admin creates an API key whose privileges decide which alerts, cases and actions it can use.
- **Auth:** Elastic API key (Authorization: ApiKey); OAuth 2.1 (Agent Builder MCP server, Serverless only). Send Authorization: ApiKey {key}; the key carries the privileges it was created with. Reading cases needs read privileges for the Cases feature in Kibana.
- **Limits:** An isolate request takes 1 to 250 endpoint IDs and up to 50 alert or case IDs, with comments up to 30,000 characters.
- Keep Elastic Security credentials in environment variables or the ibl.ai credential store. Never print a token in chat and never commit one to a file.
- Destructive or outward-facing calls are marked **Confirm with the user first** — do.

## Reads

- **Detection alerts** — POST /api/detection_engine/signals/search with an Elasticsearch query, e.g. by kibana.alert.workflow_status.
- **Cases** — GET /api/cases/_find to search cases; needs Cases feature read privileges.
- **Alerts attached to a case** — Read the alerts linked to a case, with its comments.
- **Endpoint action status** — Check the state of isolate and other response actions sent to endpoints.

## Writes

- **Set alert status** — POST /api/detection_engine/signals/status to open, acknowledged or in-progress.
- **Close alerts** — Same endpoint with status closed, optionally with a reason. **Confirm with the user first.**
- **Create or update cases** — Open a case, add comments or attach alerts.
- **Isolate an endpoint** — POST /api/endpoint/action/isolate for 1-250 endpoint_ids; release with unisolate. **Confirm with the user first.**

## Expose it to an ibl.ai agent (MCP)

Elastic N.V. publishes an official MCP server, Elastic Agent Builder MCP server (https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/mcp-server). Register it below as-is, or host your own server that wraps the calls in this skill.

First install the ibl.ai platform skills and connect your organization (writes `IBLAI_ORG`, `IBLAI_USERNAME` and `IBLAI_API_KEY` to `.env`):

```bash
npx skills add iblai/base --all
# then, in your coding agent:
/iblai-api-login
```

Every call below sends `Authorization: Api-Token $IBLAI_API_KEY`.

1. **Register the server** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-servers/` with `name`, `url`, `transport` (`sse` | `websocket` | `streamable_http`) and `auth_type` (`none` | `token` | `oauth2`). Capture the returned `id`.
   - For an API key or service credential use `auth_type=token` with `auth_scope=platform` for one key across the organization, or scope it to a single agent for one key per agent.
2. **Create the connection** — `POST https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mcp-server-connections/` with `server`, `scope` (`platform` | `mentor` | `user`), `auth_type`, and either `credentials` + `authorization_scheme` or a `connected_service` id for OAuth. Credentials are masked on read; never send a masked value back.
3. **Enable it on the agent** — `GET https://api.iblai.app/dm/api/ai-mentor/orgs/$IBLAI_ORG/users/$IBLAI_USERNAME/mentors/{agent_id}/settings/`, add `mcp-tool` to `tool_slugs` and the server id to `mcp_servers`, then `PATCH` the full lists back. They are replaced, not merged.

Full reference: https://ibl.ai/developer/platform/mcp/mcp-connections and the `/iblai-api-agent-mcp` skill.

## Example prompts

- "List open detection alerts from the last 24 hours grouped by rule name"
- "Summarize case 'Phishing wave March' with its attached alerts"
- "Acknowledge every alert for host web-03 and note why in the case"
- "Draft a weekly report of alerts closed per rule and analyst"

## Guardrails

- Security events, alerts and cases reveal an organization's systems, users and weaknesses. Use least-privilege API keys and confirm every isolation or closure with a person.
- Request the narrowest Elastic Security scopes or role the task needs, and prefer a read-only credential for agents that only answer questions.
- Return the fields the user asked for, not whole records; do not paste personal data into chat that the user did not request.
- Before any write, show the user exactly what will change and wait for a yes.
- Respect the documented limits above: page through results and back off on rate-limit responses instead of retrying in a loop.

## References

- Search detection alerts API: https://www.elastic.co/docs/api/doc/kibana/operation/operation-searchalerts
- Isolate an endpoint API: https://www.elastic.co/docs/api/doc/kibana/operation/operation-endpointisolateaction
- Agent Builder MCP server: https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/mcp-server
- Elastic Agent Builder MCP server: https://www.elastic.co/docs/explore-analyze/ai-features/agent-builder/mcp-server
- This connector on ibl.ai: https://ibl.ai/developer/connectors/elastic-security
- ibl.ai MCP server connections: https://ibl.ai/developer/platform/mcp/mcp-connections
