MCP Search Server MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
pip install -r requirements.txt
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add mcp-search-server -- python "<FULL_PATH_TO_MCPSERVER>/dist/index.js"

Replace <FULL_PATH_TO_MCPSERVER>/dist/index.js with the actual folder you prepared in step 1.

README.md

An MCP server that provides semantic search capabilities via OpenSearch.

MCP Search Server

A Model Context Protocol (MCP) server built with FastMCP that provides semantic search capabilities by integrating with an OpenSearch-based search service. This server uses Server-Sent Events (SSE) transport and includes comprehensive validation, error handling, and Docker support.

Features

  • FastMCP Integration: Built on FastMCP framework with SSE transport
  • Pydantic Validation: Comprehensive input/output validation
  • Docker Support: Multi-stage Dockerfile and docker-compose configuration
  • Retry Logic: Automatic retry with exponential backoff
  • Structured Logging: JSON and console logging support
  • Health Checks: Built-in health monitoring
  • Type Safety: Full type hints throughout the codebase
  • Security: Non-root user in Docker container
  • Configurable: Environment-based configuration

Architecture

┌─────────────────┐          ┌──────────────────┐          ┌─────────────────┐
│   MCP Client    │   SSE    │  MCP Search      │   HTTP   │ Search Service  │
│  (Claude/App)   │ ────────►│     Server       │ ────────►│  (OpenSearch)   │
└─────────────────┘          └──────────────────┘          └─────────────────┘
                                      │
                                      │
                                      ▼
                              ┌──────────────┐
                              │  Docker      │
                              │  Network     │
                              │ test_network │
                              └──────────────┘

Prerequisites

  • Python 3.11+
  • Docker and Docker Compose (for containerized deployment)
  • Search service running on search_service:8008 (or configured URL)

Quick Start

Local Development

  1. Clone the repository

    cd d:\projects\DeepResearch\MCPSearch
    
  2. Install dependencies

    pip install -r requirements.txt
    
  3. Configure environment

    cp mcp/.env.example mcp/.env
    # Edit mcp/.env with your configuration
    
  4. Run the server

    cd mcp
    python server.py
    

The server will start on http://0.0.0.0:8080

Docker Deployment

  1. Build and run with Docker Compose

    docker-compose up -d --build
    
  2. Check logs

    docker logs -f mcp_search_server
    
  3. Check health

    curl http://localhost:8080/health
    

Configuration

All configuration is managed through environment variables. Edit mcp/.env or set environment variables directly.

Environment Variables

Variable Default Description
SEARCH_SERVICE_URL http://search_service:8008 Base URL of the search service
SEARCH_TIMEOUT 30 HTTP request timeout in seconds
MCP_SERVER_HOST 0.0.0.0 Server bind address
MCP_SERVER_PORT 8080 Server port
DEFAULT_USER_ID system Default user ID for requests
LOG_LEVEL INFO Logging level (DEBUG, INFO, WARNING, ERROR)
LOG_FORMAT json Log format (json or console)
MAX_RETRIES 3 Maximum retry attempts for failed requests
RETRY_DELAY 1.0 Base delay between retries in seconds

Example .env File

# Search Service Configuration
SEARCH_SERVICE_URL=http://search_service:8008
SEARCH_TIMEOUT=30

# MCP Server Configuration
MCP_SERVER_HOST=0.0.0.0
MCP_SERVER_PORT=8080

# Default Values
DEFAULT_USER_ID=system

# Logging Configuration
LOG_LEVEL=INFO
LOG_FORMAT=json

# Request Configuration
MAX_RETRIES=3
RETRY_DELAY=1.0

Usage

Available Tools

`search_documents`

Search for documents in OpenSearch indices using the integrated search service.

Parameters:

  • query (string, required): Search query text (minimum 1 character)
  • user_id (string, required): User identifier for tracking
  • indices (array of strings, required): OpenSearch indices to search
  • filters (object, optional): Search filters
    • categories (array of strings): Filter by categories
    • date_from (string): Start date (ISO format)
    • date_to (string): End date (ISO format)
    • tags (array of strings): Filter by tags
    • metadata (object): Additional metadata filters

Returns:

{
  "results": [
    {
      "id": "doc_123",
      "score": 0.95,
      "index": "documents",
      "source": {
        "title": "Document Title",
        "content": "Document content..."
      },
      "highlights": {
        "content": ["...highlighted <em>text</em>..."]
      }
    }
  ],
  "query_expanded": "query with synonyms",
  "processing_time_ms": 45.2,
  "request_id": "req_abc123"
}

Example Usage

Basic Search:

{
  "query": "machine learning",
  "user_id": "user123",
  "indices": ["documents"]
}

Advanced Search with Filters:

{
  "query": "deep learning",
  "user_id": "researcher_001",
  "indices": ["research_papers", "articles"],

Tools (1)

search_documentsSearch for documents in OpenSearch indices using the integrated search service.

Environment Variables

SEARCH_SERVICE_URLBase URL of the search service
SEARCH_TIMEOUTHTTP request timeout in seconds
MCP_SERVER_HOSTServer bind address
MCP_SERVER_PORTServer port
DEFAULT_USER_IDDefault user ID for requests
LOG_LEVELLogging level (DEBUG, INFO, WARNING, ERROR)
LOG_FORMATLog format (json or console)
MAX_RETRIESMaximum retry attempts for failed requests
RETRY_DELAYBase delay between retries in seconds

Configuration

claude_desktop_config.json
{ "mcpServers": { "mcp-search": { "command": "python", "args": ["/path/to/server.py"], "env": { "SEARCH_SERVICE_URL": "http://search_service:8008" } } } }

Try it

Search for documents related to 'machine learning' in the 'research_papers' index.
Find articles from the last month that mention 'deep learning' for user researcher_001.
Search for documents tagged with 'AI' in the 'documents' index.
Perform a search for 'OpenSearch architecture' and filter by the 'technical' category.

Frequently Asked Questions

What are the key features of MCP Search Server?

FastMCP framework integration with SSE transport. Comprehensive Pydantic input/output validation. Automatic retry logic with exponential backoff. Built-in health monitoring and structured logging. Multi-stage Docker support for containerized deployment.

What can I use MCP Search Server for?

Enabling semantic search capabilities within Claude for internal document repositories.. Integrating OpenSearch-based knowledge bases into AI-assisted research workflows.. Standardizing document retrieval across multiple indices with consistent filtering logic.. Monitoring and logging search request performance in production environments..

How do I install MCP Search Server?

Install MCP Search Server by running: pip install -r requirements.txt

What MCP clients work with MCP Search Server?

MCP Search Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep MCP Search Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare