Skip to main content

OpenSearch MCP Server

A minimal Model Context Protocol (MCP) server for OpenSearch exposing 4 tools over stdio and sse server.

Available tools

  • list_indices: Lists all indices in OpenSearch.
  • get_index_mapping: Gets the mapping for specified index.
  • search_index: Searches an index using a query.
  • get_shards: Gets information about shards in OpenSearch cluster.

More tools coming soon

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>"

Usage

Running with Python:

  • Stdio Server
python -m mcp_server_opensearch
  • SSE Server
python -m mcp_server_opensearch --transport sse

Running with UV:

Note: These commands must be run from the src directory of the project.

  • Stdio Server
uv run python -m mcp_server_opensearch 
  • SSE Server
uv run python -m mcp_server_opensearch --transport sse

Claude Desktop Integration

Using the Published PyPI Package

{
    "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>"
            }
        }
    }
}

Using Local Clone:

{
    "mcpServers": {
        "opensearch-mcp-server": {
            "command": "uv", # Or full path to uv
            "args": [
                "--directory",
                "path/to/the/clone/mcp-server",
                "run",
                "--",
                "python",
                "-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>"
            }
        }
    }
}

Development

Environment Setup:

  1. Create & activate a virtual environment
uv venv 
source .venv/bin/activate
  1. Install dependencies
uv sync # Install from uv.lock

Managing Dependencies:

  • Add new dependencies:
uv add <package-name>

Note: This automatically updates the pyproject.toml, uv.lock, and installs in virtual environment

  • Update after manual pyproject.toml changes:
uv lock 
uv sync

Metadata

Release files for test-opensearch-mcp 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for test-opensearch-mcp 0.1.3
File Size Uploaded
test_opensearch_mcp-0.1.3.tar.gz 11.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for test-opensearch-mcp 0.1.3
File Interpreter ABI Platform
test_opensearch_mcp-0.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 24.1 kB

Release files / test_opensearch_mcp-0.1.3.tar.gz

Download URL test_opensearch_mcp-0.1.3.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
85fac10a70485b7185062fe521aa0032608ac45021b4cfcbb2ed15c070205ab2
BLAKE2b-256 checksum
How to use checksums
620e8aec66a38072d10fda48845b6aeff0365eaefd3abda8858a02415e2d35c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.0

Release files / test_opensearch_mcp-0.1.3-py3-none-any.whl

Download URL test_opensearch_mcp-0.1.3-py3-none-any.whl
Size 12.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ef333d0548ad58936cc06da51f29b3e1f29d2c7d1e527827d8ce14c62c8cc43
BLAKE2b-256 checksum
How to use checksums
89f5fafae3662ca14c99749ffdcc9abe7f866103027e1e3b2911e67c0e83ac92
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.0

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page