Milvus Vector Database MCP server

Integrates with Milvus vector database to enable vector search, full-text search, and hybrid queries for semantic search and knowledge retrieval workflows.
Back to servers
Provider
Zilliz
Release date
Mar 18, 2025
Language
Python
Stats
122 stars

This MCP server for Milvus provides a seamless way to integrate Milvus vector database capabilities with LLM applications that support the Model Context Protocol. It enables AI applications to access, search, and manage vector data for enhanced contextual capabilities.

Installation

Prerequisites

Before installing the MCP server, ensure you have:

  • Python 3.10 or higher
  • A running Milvus instance (local or remote)
  • uv installed (recommended for running the server)

Running the Server

The recommended way to use this MCP server is to run it directly with uv without installation:

git clone https://github.com/zilliztech/mcp-server-milvus.git
cd mcp-server-milvus
uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:19530

Alternatively, you can set environment variables in the .env file and run:

uv run src/mcp_server_milvus/server.py

Note: The .env file takes precedence over command line arguments.

Server Modes

Stdio Mode (Default)

Communicates with the client via standard input/output:

uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:19530

SSE Mode

Uses HTTP Server-Sent Events for communication, allowing multiple clients to connect:

uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://localhost:19530 --port 8000

To debug in SSE mode, after starting the service:

mcp dev src/mcp_server_milvus/server.py

Then access the MCP Inspector at http://127.0.0.1:6274 for testing.

Client Configuration

Claude Desktop Configuration

For SSE Mode

  1. Install Claude Desktop from https://claude.ai/download
  2. Open the configuration file at ~/Library/Application Support/Claude/claude_desktop_config.json
  3. Add the following configuration:
{
  "mcpServers": {
    "milvus-sse": {
      "url": "http://your_sse_host:port/sse",
      "disabled": false,
      "autoApprove": []
    }
  }
}

For Stdio Mode

  1. Open the configuration file at the same location
  2. Add the following configuration:
{
  "mcpServers": {
    "milvus": {
      "command": "/PATH/TO/uv",
      "args": [
        "--directory",
        "/path/to/mcp-server-milvus/src/mcp_server_milvus",
        "run",
        "server.py",
        "--milvus-uri",
        "http://localhost:19530"
      ]
    }
  }
}

Cursor Configuration

  1. Open Cursor Settings > MCP
  2. Click on Add new global MCP server
  3. Edit the mcp.json file that appears

For Stdio Mode

{
  "mcpServers": {
    "milvus": {
      "command": "/PATH/TO/uv",
      "args": [
        "--directory",
        "/path/to/mcp-server-milvus/src/mcp_server_milvus",
        "run",
        "server.py",
        "--milvus-uri",
        "http://127.0.0.1:19530"
      ]
    }
  }
}

For SSE Mode

Start the service:

uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://your_sse_host --port port

Then add to mcp.json:

{
    "mcpServers": {
      "milvus-sse": {
        "url": "http://your_sse_host:port/sse",
        "disabled": false,
        "autoApprove": []
      }
    }
}

Available Tools

Search and Query Operations

  • milvus_text_search: Search for documents using full text search

    • Parameters: collection_name, query_text, limit (default: 5), output_fields, drop_ratio
  • milvus_vector_search: Perform vector similarity search

    • Parameters: collection_name, vector, vector_field (default: "vector"), limit (default: 5), output_fields, filter_expr, metric_type (default: "COSINE")
  • milvus_hybrid_search: Perform hybrid search

    • Parameters: collection_name, query_text, text_field, vector, vector_field, limit, output_fields, filter_expr
  • milvus_query: Query collection using filter expressions

    • Parameters: collection_name, filter_expr, output_fields, limit (default: 10)

Collection Management

  • milvus_list_collections: List all collections in the database

  • milvus_create_collection: Create a new collection

    • Parameters: collection_name, collection_schema, index_params
  • milvus_load_collection: Load a collection into memory

    • Parameters: collection_name, replica_number (default: 1)
  • milvus_release_collection: Release a collection from memory

    • Parameters: collection_name
  • milvus_get_collection_info: Get detailed information about a collection

    • Parameters: collection_name

Data Operations

  • milvus_insert_data: Insert data into a collection

    • Parameters: collection_name, data
  • milvus_delete_entities: Delete entities based on filter

    • Parameters: collection_name, filter_expr

Environment Variables

  • MILVUS_URI: Milvus server URI
  • MILVUS_TOKEN: Optional authentication token
  • MILVUS_DB: Database name (defaults to "default")

Troubleshooting

Common Issues

Connection Errors

  • Verify your Milvus instance is running
  • Check the URI is correct
  • Ensure no firewall rules are blocking the connection
  • Try using 127.0.0.1 instead of localhost

Authentication Issues

  • Verify your MILVUS_TOKEN is correct
  • Check if authentication is required
  • Ensure you have correct permissions

Tool Not Found

  • Restart the application
  • Check server logs for errors
  • Verify the MCP server is running
  • Press the refresh button in MCP settings (for Cursor)

If you continue to experience issues, check the GitHub Issues or join the Zilliz Community Discord for support.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later