
Research
/Security News
60 Malicious Ruby Gems Used in Targeted Credential Theft Campaign
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
elasticsearch-mcp
Advanced tools
Secure MCP server for Elasticsearch integration with comprehensive tools and Elastic Cloud support
Model Context Protocol server for Elasticsearch integration with comprehensive security and performance features
elasticsearch-mcp is a Model Context Protocol (MCP) server that provides standardized, secure tools for interacting with Elasticsearch clusters. Built with TypeScript and optimized for Elastic Cloud environments, it offers comprehensive data management capabilities with enterprise-grade security features.
npm install elasticsearch-mcp
# Set your Elasticsearch credentials
export ELASTIC_CLOUD_ID="your-cloud-id"
export ELASTIC_API_KEY="your-api-key"
# Start the MCP server
npx elasticsearch-mcp
Add to your Claude Desktop MCP configuration:
{
"mcpServers": {
"elasticsearch-mcp": {
"command": "npx",
"args": ["elasticsearch-mcp"],
"env": {
"ELASTIC_CLOUD_ID": "your-cloud-id",
"ELASTIC_API_KEY": "your-api-key"
}
}
}
}
import { ElasticMCPServer } from 'elasticsearch-mcp';
const server = new ElasticMCPServer();
await server.start();
Tool | Description | Use Cases |
---|---|---|
fetch_indices | List and filter Elasticsearch indices | Index management, monitoring |
search_elasticsearch | Advanced search with aggregations | Data analysis, querying |
create_index | Create indices with mappings/settings | Schema management |
insert_data | Insert documents with validation | Data ingestion |
update_document | Update documents with scripts | Data modification |
delete_document | Delete by ID or query | Data cleanup |
export_to_csv | Stream data to CSV files | Reporting, data export |
{
"tool": "search_elasticsearch",
"arguments": {
"index": "sales-data",
"query": {
"range": {
"date": {
"gte": "2024-01-01",
"lte": "2024-12-31"
}
}
},
"aggregations": {
"monthly_sales": {
"date_histogram": {
"field": "date",
"calendar_interval": "month"
},
"aggs": {
"total_revenue": {
"sum": { "field": "amount" }
}
}
}
}
}
}
{
"tool": "export_to_csv",
"arguments": {
"index": "user-analytics",
"query": {
"bool": {
"filter": [
{ "term": { "status": "active" } },
{ "range": { "last_login": { "gte": "2024-01-01" } } }
]
}
},
"fields": ["user_id", "email", "last_login", "country"],
"filename": "active_users_2024.csv",
"compress": true,
"maxRows": 100000
}
}
{
"tool": "create_index",
"arguments": {
"name": "product-catalog",
"mappings": {
"properties": {
"name": { "type": "text", "analyzer": "standard" },
"price": { "type": "float" },
"category": { "type": "keyword" },
"created_at": { "type": "date" },
"tags": { "type": "keyword" },
"description": { "type": "text" }
}
},
"settings": {
"number_of_shards": 1,
"number_of_replicas": 1,
"analysis": {
"analyzer": {
"product_analyzer": {
"type": "standard",
"stopwords": "_english_"
}
}
}
},
"aliases": ["products", "catalog"]
}
}
Variable | Description | Required | Example |
---|---|---|---|
ELASTIC_CLOUD_ID | Elastic Cloud deployment ID | Yes* | deployment:dXMtY2VudHJhbDE= |
ELASTIC_API_KEY | Elasticsearch API key | Yes* | VnVhQ2ZHY0JDZGJrU... |
ELASTIC_NODE | Self-hosted Elasticsearch URL | Yes* | https://localhost:9200 |
ELASTIC_USERNAME | Basic auth username | No | elastic |
ELASTIC_PASSWORD | Basic auth password | No | changeme |
LOG_LEVEL | Logging level | No | info |
LOG_FORMAT | Log output format | No | text |
MAX_CONCURRENT_REQUESTS | Request concurrency limit | No | 10 |
*Either ELASTIC_CLOUD_ID
or ELASTIC_NODE
is required
Create .env
file:
# Elastic Cloud (recommended)
ELASTIC_CLOUD_ID=your-deployment-id
ELASTIC_API_KEY=your-api-key
# Logging
LOG_LEVEL=info
LOG_FORMAT=json
# Performance
MAX_CONCURRENT_REQUESTS=10
REQUEST_TIMEOUT_MS=30000
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MCP Client │◄──►│Elasticsearch MCP│◄──►│ Elasticsearch │
│ (Claude, etc.) │ │ Server │ │ Cluster │
└─────────────────┘ └─────────────────┘ └─────────────────┘
│
┌─────────────┐
│ Tools │
│ │
│ • fetch │
│ • search │
│ • create │
│ • insert │
│ • update │
│ • delete │
│ • export │
└─────────────┘
# Clone repository
git clone https://github.com/RajwardhanShinde/elk-mcp.git
cd elk-mcp
# Install dependencies
npm install
# Set up environment
cp .env.example .env
# Edit .env with your Elasticsearch credentials
# Run in development mode
npm run dev
# Run tests
npm test
# Build for production
npm run build
elasticsearch-mcp/
├── src/
│ ├── tools/ # MCP tool implementations
│ ├── elasticsearch/ # ES client and connection management
│ ├── validation/ # Input validation schemas
│ ├── errors/ # Error handling utilities
│ ├── config.ts # Configuration management
│ ├── logger.ts # Structured logging
│ └── server.ts # Main MCP server
├── tests/ # Comprehensive test suite
├── docs/ # Documentation
└── build/ # Compiled output
We welcome contributions! Please see our Contributing Guide for details.
Connection Failed
# Check credentials
echo $ELASTIC_CLOUD_ID
echo $ELASTIC_API_KEY
# Test connection
curl -H "Authorization: ApiKey $ELASTIC_API_KEY" \\
"$ELASTIC_NODE/_cluster/health"
Permission Denied
Tool Validation Errors
See Troubleshooting Guide for more details.
This project is licensed under the MIT License - see the LICENSE file for details.
Built with ❤️ for the Elasticsearch and MCP communities
FAQs
Secure MCP server for Elasticsearch integration with comprehensive tools and Elastic Cloud support
We found that elasticsearch-mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.
Research
/Security News
Two npm packages masquerading as WhatsApp developer libraries include a kill switch that deletes all files if the phone number isn’t whitelisted.