How MCP Works in Elastic
MCP Servers are external processes that Elastic connects to through the Model Context Protocol. The MCP Hub manages these connections and provides two main capabilities:- Tools: Executable functions that Elastic can call using the
use_mcp_toolcommand - Resources: Data sources and content that Elastic can access using the
access_mcp_resourcecommand
Configuration
MCP Settings File
Elastic stores MCP server configurations in a file calledelastic_mcp_settings.json located in your Elastic settings directory. This file is automatically created when you first use MCP features.
Basic Configuration Structure
Configuration Options
- command: The executable command to start the server
- args: Array of command-line arguments
- env: Environment variables (used for API keys, connection strings, etc.)
- disabled: Set to
trueto disable the server without removing it - autoApprove: Array of tool names that don’t require user approval
Getting Started
1. Access MCP Settings
From the Elastic Copilot extension:- Click the MCP Server tab
- Click Edit MCP Settings
- The
elastic_mcp_settings.jsonfile will open in VS Code
2. Add Your First Server
Start with the MCP installer to easily add more servers:- Windows
- Mac & Linux
3. Save and Connect
After saving the file:- Elastic automatically detects the changes
- The server is downloaded and started
- You’ll see the connection status in the MCP settings UI
Pre-configured Server Examples
Elastic comes with example configurations for popular MCP servers. Here are some servers you can easily add:Database Servers
Development Tools
Cloud & Automation
How Elastic Uses MCP Servers
Automatic Integration
When you ask Elastic to perform tasks that require external capabilities, it automatically:- Detects the need for external tools (e.g., “query my database”, “create a GitHub issue”)
- Checks available servers for tools that can fulfill the request
- Requests permission to use the appropriate MCP tool (unless auto-approved)
- Executes the tool and incorporates the results into its response
Tool Usage
Elastic uses MCP servers through two main commands:use_mcp_tool: Execute a function provided by an MCP serveraccess_mcp_resource: Read data from an MCP server resource
Auto-Approval
Configure tools that don’t require user approval:Creating Custom MCP Servers
Elastic can help you create custom MCP servers when you need specific functionality:When to Create Custom Servers
Ask Elastic to create a custom MCP server when you need:- Integration with APIs not covered by existing servers
- Custom data processing or transformation tools
- Specialized workflow automation
- Company-specific integrations
How Elastic Creates Servers
When you ask Elastic to “add a tool” or create custom functionality, it will:- Analyze your requirements and determine if an MCP server is needed
- Create the server code in your configured MCP servers directory
- Handle authentication setup including API keys and tokens
- Add the server configuration to your
elastic_mcp_settings.json - Test the connection and verify functionality
Example: Creating a Weather Server
You can ask Elastic: “Add a tool to get weather forecasts for cities” Elastic will:- Create a custom weather MCP server
- Guide you through getting an API key from OpenWeatherMap
- Configure the server in your settings
- Test the integration
Security and Permissions
Environment Variables
Store sensitive information like API keys in environment variables:MCP Servers extend Elastic’s capabilities beyond code assistance into a complete development ecosystem. Start with pre-built servers and gradually add custom integrations as your needs grow.