mcpField
O
OpenSearch MCP Server

OpenSearch MCP Server

Local
github.com/rithin-pullela-awsDatabases1Updated 75w ago

About OpenSearch MCP Server

OpenSearch MCP Server is an archived MCP server that exposes four OpenSearch tools for listing indices, retrieving mappings and settings, searching with query DSL, and inspecting shards. It supports stdio and SSE transports.

Key features

  1. 01List OpenSearch indices
  2. 02Retrieve index mappings and settings
  3. 03Search with query DSL
  4. 04Inspect shard information
  5. 05Support stdio and SSE transports

Use cases

  1. 01List indices in an OpenSearch instance
  2. 02Review an index's mappings and settings
  3. 03Run a query DSL search
  4. 04Check shard information

MCP support

It exposes four OpenSearch tools to MCP clients over stdio or SSE. The repository is archived; the project has moved to opensearch-mcp-server-py.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"opensearch-mcp-server-rithin-pullela-aws": {
"command": "uvx",
"args": [
"test-opensearch-mcp"
],
"env": {
"OPENSEARCH_URL": "<OPENSEARCH_URL>",
"OPENSEARCH_USERNAME": "<OPENSEARCH_USERNAME>",
"OPENSEARCH_PASSWORD": "<OPENSEARCH_PASSWORD>",
"AWS_REGION": "<AWS_REGION>",
"AWS_ACCESS_KEY": "<AWS_ACCESS_KEY>",
"AWS_SECRET_ACCESS_KEY": "<AWS_SECRET_ACCESS_KEY>",
"AWS_SESSION_TOKEN": "<AWS_SESSION_TOKEN>"
}
}
}
}
Run commanduvx test-opensearch-mcp
Environment variables to set
OPENSEARCH_URL
OPENSEARCH_USERNAME
OPENSEARCH_PASSWORDSecret
AWS_REGION
AWS_ACCESS_KEYSecret
AWS_SECRET_ACCESS_KEYSecret
AWS_SESSION_TOKENSecret

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
pypitest-opensearch-mcp

Tools

No tool list yet

Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.

Details

From the project 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
{
    "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
  1. Install required packages
pip install langchain langchain-mcp-adapters langchain-openai
  1. Set up OpenAI API key
export OPENAI_API_KEY="<your-openai-key>"
  1. 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:

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.