elastic-security-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@elastic-security-mcpshow me recent Elastic Security alerts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Elastic Security MCP
Elastic Security MCP is a Python server for the Model Context Protocol (MCP). It gives AI agents a controlled interface to Elasticsearch, Kibana Security, Fleet, and Elastic Defend.
The server is designed for investigation first: its default toolset is read-only, and response or administration actions are disabled unless the operator explicitly enables them.
Capabilities
The default toolset covers common analyst and platform-engineering workflows:
Detection content: find detection rules, retrieve rules by stable or internal ID, preview a rule, and list installed integrations.
Search and investigation: Elasticsearch Query DSL, EQL, ES|QL, endpoint log searches, alert retrieval, and threat-indicator lookups.
Cluster operations: cluster health, health reports, shard-allocation explanations, snapshot status, index statistics, and ILM explanations.
Data discovery: data streams, indices, mappings, field availability, and representative document samples.
Endpoint and Fleet visibility: endpoint status, agents, agent policies, response-action history, and individual action details.
Case management: cases, comments, and activity history.
Related MCP server: opensearch-mcp-server-py
Safety model
Read-only tools are available by default.
State-changing and endpoint-response tools are omitted until the corresponding environment flag is enabled.
Every state-changing or endpoint action requires
confirm=truein the tool call.Endpoint actions require a non-empty
comment, which Elastic records with the action.Elasticsearch and Kibana permissions remain the source of truth. Use a dedicated, least-privilege service account.
The server intentionally does not expose remote command or script execution, endpoint file retrieval, or memory-dump actions.
Requirements
Python 3.10 or later
Access to Elasticsearch; Kibana is required for Security, Fleet, and endpoint tools
Installation
git clone <your-repository-url>
cd MCP_elastic
uv sync --extra devCreate a local configuration file:
# macOS or Linux
cp .env.example .env
# Windows PowerShell
Copy-Item .env.example .envSet at least ELASTICSEARCH_URL and one Elasticsearch authentication method in .env. Do not commit this file. For a deployed server, use the MCP client's secret management or process environment instead.
Run the server
uv run elastic-security-mcpThe server uses standard input and output, so an MCP client starts it as a subprocess.
MCP client configuration
MCP clients use different configuration formats, but the command and environment are equivalent to the following:
{
"mcpServers": {
"elastic-security": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/MCP_elastic",
"run",
"elastic-security-mcp"
],
"env": {
"ELASTICSEARCH_URL": "https://your-cluster.example:9243",
"ELASTICSEARCH_API_KEY": "your-api-key",
"KIBANA_URL": "https://your-kibana.example:5601",
"KIBANA_SPACE": "default"
}
}
}
}On Windows, use the absolute Windows path to the repository. Keep credentials in the client secret store or environment where possible.
Optional action tools
Action tools must be enabled by the server operator. All of them require confirm=true.
Area | Tools | Required environment setting |
Device containment |
|
|
Process control |
| Response actions plus |
Endpoint evidence collection |
| Response actions plus |
Cases |
|
|
Alert triage |
|
|
Detection-rule activation |
|
|
Fleet lifecycle |
|
|
preview_detection_rule is always read-only. Alert assignment uses Kibana user profile IDs, and rule activation uses the internal rule id returned by search_detection_rules, not the stable rule_id.
Configuration
Variable | Required | Description |
| Yes | Elasticsearch base URL. |
| One auth method | Elasticsearch API key. |
| One auth method | Alternative basic authentication. |
| For Kibana tools | Kibana base URL. |
| No | Separate Kibana API key; otherwise the Elasticsearch key is reused. |
| No | Alternative Kibana basic authentication. |
| No | Kibana space; defaults to |
| No | TLS validation; defaults to |
| No | HTTP request timeout; defaults to |
| No | Permits |
| No | Maximum results returned by bounded search tools; defaults to |
| No | Enables device isolation and release. |
| No | Enables process termination and suspension. |
| No | Enables process listing and malware scans. |
| No | Enables case creation, comments, and updates. |
| No | Enables alert status, tag, and assignment updates. |
| No | Enables Fleet diagnostics and lifecycle changes. |
| No | Enables detection-rule activation changes. |
| No | Writes a local JSONL audit trail for Kibana mutations. |
Detection-rule changes can update the API key assigned to those rules. Ensure that the credential used by this MCP server has the correct, least-privilege permissions before enabling rule actions.
Audit logging
Set ELASTIC_MCP_AUDIT_LOG_PATH to retain a local record of Kibana mutation requests:
ELASTIC_MCP_AUDIT_LOG_PATH=./logs/elastic-security-mcp-audit.jsonlEach line contains a timestamp, request method, path, outcome, and HTTP status when available. Request bodies and credentials are not written to the log. Protect the log directory because resource identifiers can still be sensitive operational data.
Development
uv run pytest
uv run ruff check .
uv run ruff format --check .The test suite covers configuration validation, safety helpers, audit-log behavior, and MCP stdio tool registration. It does not make requests to a live Elastic deployment.
Before a public release
Choose and add a license before publishing a reusable public repository. MIT and Apache-2.0 are common options, but the choice should match the intended maintenance and contribution model.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/AndreuCrespo/elastic-security-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server