opensearch-mcp-server
Enables interaction with OpenSearch clusters, providing tools to list indices, retrieve mappings, search using query DSL, and get shard information.
README
NOTICE: This project has been graduated and moved to the opensearch-mcp-server-py repository. See you there! This repository is now archived.
OpenSearch MCP Server
A minimal Model Context Protocol (MCP) server for OpenSearch exposing 4 tools over stdio and sse server.
Available tools
- ListIndexTool: Lists all indices in OpenSearch.
- IndexMappingTool: Retrieves index mapping and setting information for an index in OpenSearch.
- SearchIndexTool: Searches an index using a query written in query domain-specific language (DSL) in OpenSearch.
- GetShardsTool: Gets information about shards in OpenSearch.
More tools coming soon. Click here
User Guide
Installation
Install from PyPI:
pip install test-opensearch-mcp
Configuration
Authentication Methods:
- Basic Authentication
export OPENSEARCH_URL="<your_opensearch_domain_url>"
export OPENSEARCH_USERNAME="<your_opensearch_domain_username>"
export OPENSEARCH_PASSWORD="<your_opensearch_domain_password>"
- IAM Role Authentication
export OPENSEARCH_URL="<your_opensearch_domain_url>"
export AWS_REGION="<your_aws_region>"
export AWS_ACCESS_KEY="<your_aws_access_key>"
export AWS_SECRET_ACCESS_KEY="<your_aws_secret_access_key>"
export AWS_SESSION_TOKEN="<your_aws_session_token>"
Running the Server
# Stdio Server
python -m mcp_server_opensearch
# SSE Server
python -m mcp_server_opensearch --transport sse
Claude Desktop Integration
- Using the Published PyPI Package (Recommended)
{
"mcpServers": {
"opensearch-mcp-server": {
"command": "uvx",
"args": [
"test-opensearch-mcp"
],
"env": {
// Required
"OPENSEARCH_URL": "<your_opensearch_domain_url>",
// For Basic Authentication
"OPENSEARCH_USERNAME": "<your_opensearch_domain_username>",
"OPENSEARCH_PASSWORD": "<your_opensearch_domain_password>",
// For IAM Role Authentication
"AWS_REGION": "<your_aws_region>",
"AWS_ACCESS_KEY": "<your_aws_access_key>",
"AWS_SECRET_ACCESS_KEY": "<your_aws_secret_access_key>",
"AWS_SESSION_TOKEN": "<your_aws_session_token>"
}
}
}
}
- Using the Installed Package (via pip):
{
"mcpServers": {
"opensearch-mcp-server": {
"command": "python", // Or full path to python with PyPI package installed
"args": [
"-m",
"mcp_server_opensearch"
],
"env": {
// Required
"OPENSEARCH_URL": "<your_opensearch_domain_url>",
// For Basic Authentication
"OPENSEARCH_USERNAME": "<your_opensearch_domain_username>",
"OPENSEARCH_PASSWORD": "<your_opensearch_domain_password>",
// For IAM Role Authentication
"AWS_REGION": "<your_aws_region>",
"AWS_ACCESS_KEY": "<your_aws_access_key>",
"AWS_SECRET_ACCESS_KEY": "<your_aws_secret_access_key>",
"AWS_SESSION_TOKEN": "<your_aws_session_token>"
}
}
}
}
LangChain Integration
The OpenSearch MCP server can be easily integrated with LangChain using the SSE server transport
Prerequisites
- Install required packages
pip install langchain langchain-mcp-adapters langchain-openai
- Set up OpenAI API key
export OPENAI_API_KEY="<your-openai-key>"
- Ensure OpenSearch MCP server is running in SSE mode
python -m mcp_server_opensearch --transport sse
Example Integration Script
import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_openai import ChatOpenAI
from langchain.agents import AgentType, initialize_agent
# Initialize LLM (can use any LangChain-compatible LLM)
model = ChatOpenAI(model="gpt-4o")
async def main():
# Connect to MCP server and create agent
async with MultiServerMCPClient({
"opensearch-mcp-server": {
"transport": "sse",
"url": "http://localhost:9900/sse", # SSE server endpoint
"headers": {
"Authorization": "Bearer secret-token",
}
}
}) as client:
tools = client.get_tools()
agent = initialize_agent(
tools=tools,
llm=model,
agent=AgentType.OPENAI_FUNCTIONS,
verbose=True, # Enables detailed output of the agent's thought process
)
# Example query
await agent.ainvoke({"input": "List all indices"})
if __name__ == "__main__":
asyncio.run(main())
Notes:
- The script is compatible with any LLM that integrates with LangChain and supports tool calling
- Make sure the OpenSearch MCP server is running before executing the script
- Configure authentication and environment variables as needed
Development
Interested in contributing? Check out our:
- Development Guide - Setup your development environment
- Contributing Guidelines - Learn how to contribute
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。