Python Elasticsearch MCP server implementation with quick setup instructions
The mcp
project provides a Python-based implementation of an Elasticsearch MCP (Model Context Protocol) server, enabling seamless integration between AI applications and data sources through a standardized protocol. This MCP server acts as the bridge for various AI tools like Claude Desktop, Continue, Cursor, etc., to access specific datasets or external tools via a unified framework.
The core feature of this repository lies in its ability to transform complex interaction needs between AI applications and data sources into simple protocol-based interactions. The server leverages Elasticsearch for efficient data indexing and retrieval, ensuring that AI clients can quickly access the necessary information they need without requiring direct interaction with the underlying database management system.
The implementation details of the MCP protocol in this project follow a strict structure:
The architecture of the mcp
server is designed with modularity and scalability in mind:
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
graph TD
A[MCP Server] --> B[Elasticsearch]
B --> C[Data Source 1]
B --> D[Data Source 2]
A --> E[MCP Client Interface]
C --> F[Prompt Database]
D --> G[Tool Execution Gateway]
style A fill:#f3e5f5
style B fill:#e8f5e8
style C fill:#f0f8ff
style D fill:#f0f8ff
To get started, ensure you have the necessary prerequisites installed:
Once the dependencies are in place, follow these steps:
.env
file appropriately based on your setup.make add-claude-config
and make run
to start the server.Here’s an example of how you might configure the MCP server:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
}
}
}
An author uses Claude Desktop (an MCP client) to draft an essay on climate change. The author interacts with several sources through the MCP protocol to gather relevant data points:
# Example of calling the MCP server from Claude Desktop
server = mcp_client('your-server-name', api_key='your-api-key')
response = server.get_data('source-id:climate-change-research')
content = response.data['text']
A data scientist uses Continue (another MCP client) to analyze survey responses stored in Elasticsearch:
# Example of calling the MCP server from Continue
server = mcp_client('your-server-name', api_key='your-api-key')
responses = server.get_data('source-id:survey_responses')
analysis_result = perform_analysis(responses)
print(analysis_result)
The server supports a variety of clients, ensuring broad compatibility and flexibility in AI application integration. Some notable compatibility include:
The following table outlines the current state of MCP client compatibility with the server:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
For advanced usage, the server supports:
{
"mcpServers": {
"[server-name]": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-[name]"],
"env": {
"API_KEY": "your-api-key"
}
},
"customPolicies": [
{
"api_key": "admin-api-key",
"policies": {
"*": true
}
},
{
"api_key": "user-api-key",
"policies": {
"source-id:weather_data": true,
"other-source": false
}
}
]
}
}
Q: How do I integrate my custom tool with the MCP server?
Q: Can all AI clients access the same data sources?
Q: How do I troubleshoot connection issues with my MCP server?
.env
file for correct configurations and ensure your Elasticsearch instance is running properly.Q: Does the server support multi-tenancy out of the box?
Q: Can I enhance data security further than what’s provided by default?
Contributions are welcome! Follow these steps to contribute:
git checkout -b feature-name
.By leveraging the mcp
server, developers can significantly enhance their AI applications by providing a robust and scalable framework for integrating with diverse data sources and tools.
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods