opensearch-mcp-server
Allows LangChain agents to use OpenSearch MCP tools via SSE transport.
Provides tools to list indices, retrieve index mappings, search using DSL, and get shard information.
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., "@opensearch-mcp-serverlist all indices"
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.
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
Related MCP server: Elastic MCP Server
User Guide
Installation
Install from PyPI:
pip install test-opensearch-mcpConfiguration
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 sseClaude 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-openaiSet 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 sseExample 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
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- Alicense-qualityDmaintenance* Index Management Tools: * List all indices in OpenSearch cluster * Get index mapping * Get index settings * Cluster Management Tools: * Get cluster health status * Get cluster statistics * Document Tools: * Search documents2MIT
- FlicenseBquality-maintenanceProvides comprehensive tools for managing Elasticsearch clusters, including security management, search operations, and index administration. It enables users to monitor cluster health, handle InfoSec tasks, and execute complex queries using Elasticsearch Query DSL and ES|QL.37
- Flicense-qualityDmaintenanceEnables LLMs to interact with OpenSearch clusters to monitor cluster health, manage indices, and perform data searches. It provides a standardized interface for real-time OpenSearch operations within MCP-compatible environments like Open WebUI.
- Alicense-qualityCmaintenanceProvides tools to query Elasticsearch indices, retrieve mappings, execute searches, and get cluster health stats.4MIT
Related MCP Connectors
Search your Obsidian vault to quickly find notes by title or keyword, summarize related content, a…
Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.
Search and fetch Wikidata entities, execute SPARQL queries, and resolve external identifiers.
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/rithinpullela/opensearch-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server