MCP Server for Milvus logo

MCP Server for Milvus

Organization
zilliztech

Model Context Protocol Servers for Milvus

Publisherzilliztech
Repositorymcp-server-milvus
LanguagePython
Forks
70
Stars
245
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseApache-2.0
Links
  • Connect tools to AI workflows

    MCP Server for Milvus exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    245 stars and 70 forks from the linked repository.

MCP Server for Milvus

The Model Context Protocol (MCP) is an open protocol that enables seamless integration between LLM applications and external data sources and tools. Whether you're building an AI-powered IDE, enhancing a chat interface, or creating custom AI workflows, MCP provides a standardized way to connect LLMs with the context they need.

This repository contains a MCP server that provides access to Milvus vector database functionality.

MCP with Milvus

Prerequisites

Before using this MCP server, ensure you have:

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

Usage

The recommended way to use this MCP server is to run it directly with uv without installation. This is how both Claude Desktop and Cursor are configured to use it in the examples below.

If you want to clone the repository:

bash
git clone https://github.com/zilliztech/mcp-server-milvus.git
cd mcp-server-milvus

Then you can run the server directly:

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

Alternatively you can change the .env file in the src/mcp_server_milvus/ directory to set the environment variables and run the server with the following command:

bash
uv run src/mcp_server_milvus/server.py

Important: the .env file will have higher priority than the command line arguments.

Running Modes

The server supports two running modes: stdio (default) and SSE (Server-Sent Events).

Stdio Mode (Default)

  • Description: Communicates with the client via standard input/output. This is the default mode if no mode is specified.

  • Usage:

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

SSE Mode

  • Description: Uses HTTP Server-Sent Events for communication. This mode allows multiple clients to connect via HTTP and is suitable for web-based applications.

  • Usage:

    bash
    uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://localhost:19530 --port 8000
    • --sse: Enables SSE mode.
    • --port: Specifies the port for the SSE server (default: 8000).
  • Debugging in SSE Mode:

    If you want to debug in SSE mode, after starting the SSE service, enter the following command:

    bash
    mcp dev src/mcp_server_milvus/server.py

    The output will be similar to:

    plaintext
    % mcp dev src/mcp_server_milvus/merged_server.py
    Starting MCP inspector...
    ⚙️ Proxy server listening on port 6277
    🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀

    You can then access the MCP Inspector at http://127.0.0.1:6274 for testing.

Streamable HTTP Mode

  • Description: Uses HTTP with streaming support for communication. This is the recommended transport for production deployments and supports both stateful and stateless operation.

  • Usage:

    bash
    uv run src/mcp_server_milvus/server.py --streamable-http --milvus-uri http://localhost:19530 --port 8000
    • --streamable-http: Enables Streamable HTTP mode.
    • --port: Specifies the port for the server (default: 8000).
    • --stateless: Optional flag for stateless mode (no session persistence).
  • Stateless Mode:

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

Supported Applications

This MCP server can be used with various LLM applications that support the Model Context Protocol:

  • Claude Desktop: Anthropic's desktop application for Claude
  • Cursor: AI-powered code editor with MCP support
  • Custom MCP clients: Any application implementing the MCP client specification

Usage with Claude Desktop

Configuration for Different Modes

SSE Mode Configuration

Follow these steps to configure Claude Desktop for SSE mode:

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

Streamable HTTP Mode Configuration

json
{
  "mcpServers": {
    "milvus-streamable-http": {
      "url": "http://your_host:port/mcp",
      "disabled": false,
      "autoApprove": []
    }
  }
}
  1. Restart Claude Desktop to apply the changes.

Stdio Mode Configuration

For stdio mode, follow these steps:

  1. Install Claude Desktop from https://claude.ai/download.
  2. Open your Claude Desktop configuration file:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  3. Add the following configuration for stdio mode:
json
{
  "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"
      ]
    }
  }
}
  1. Restart Claude Desktop to apply the changes.

Usage with Cursor

Cursor also supports MCP tools. You can integrate your Milvus MCP server with Cursor by following these steps:

Integration Steps

  1. Open Cursor Settings > MCP
  2. Click on Add new global MCP server
  3. After clicking, it will automatically redirect you to the mcp.json file, which will be created if it doesn’t exist

Configuring the mcp.json File

For Stdio Mode:

Overwrite the mcp.json file with the following content:

json
{
  "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:

  1. Start the service by running the following command:

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

    Note: Replace http://your_sse_host with your actual SSE host address and port with the specific port number you’re using.

  2. Once the service is up and running, overwrite the mcp.json file with the following content:

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

For Streamable HTTP Mode:

  1. Start the service:

    bash
    uv run src/mcp_server_milvus/server.py --streamable-http --milvus-uri http://your_host --port port
  2. Update mcp.json:

    json
    {
      "mcpServers": {
        "milvus-streamable-http": {
          "url": "http://your_host:port/mcp",
          "disabled": false,
          "autoApprove": []
        }
      }
    }

Completing the Integration

After completing the above steps, restart Cursor or reload the window to ensure the configuration takes effect.

Verifying the Integration

To verify that Cursor has successfully integrated with your Milvus MCP server:

  1. Open Cursor Settings > MCP
  2. Check if "milvus", "milvus-sse", or "milvus-streamable-http" appear in the list (depending on the mode you have chosen)
  3. Confirm that the relevant tools are listed (e.g., milvus_list_collections, milvus_vector_search, etc.)
  4. If the server is enabled but shows an error, check the Troubleshooting section below

Available Tools

The server provides the following tools:

Search and Query Operations

  • milvus_text_search: Search for documents using full text search

    • Parameters:
      • collection_name: Name of collection to search
      • query_text: Text to search for
      • limit: The maximum number of results to return (default: 5)
      • output_fields: Fields to include in results
      • drop_ratio: Proportion of low-frequency terms to ignore (0.0-1.0) (default: 0.2)
  • milvus_vector_search: Perform vector similarity search on a collection

    • Parameters:
      • collection_name: Name of collection to search
      • vector: Query vector
      • vector_field: Field name for vector search (default: "vector")
      • limit: The maximum number of results to return (default: 5)
      • output_fields: Fields to include in results
      • filter_expr: Filter expression
      • metric_type: Distance metric (COSINE, L2, IP) (default: "COSINE")
      • radius: Optional lower bound for range search (default: None)
      • range_filter: Optional upper bound for range search (default: None)
  • milvus_hybrid_search: Perform hybrid search on a collection

    • Parameters:
      • collection_name: Name of collection to search
      • query_text: Text query for search
      • text_field: Field name for text search
      • vector: Vector of the text query
      • vector_field: Field name for vector search
      • limit: The maximum number of results to return (default: 5)
      • output_fields: Fields to include in results
      • filter_expr: Filter expression
      • sparse_radius: Optional lower bound for sparse range search (default: None)
      • sparse_range_filter: Optional upper bound for sparse range search (default: None)
      • dense_radius: Optional lower bound for dense range search (default: None)
      • dense_range_filter: Optional upper bound for dense range search (default: None)
  • milvus_text_similarity_search: Perform text similarity search on a collection

    Note: This tool is only supported in Milvus 2.6.0 and above. And you need to set the embedding function at the Milvus server. See Embedding Function for more details.

    • Parameters:
      • collection_name: Name of collection to search
      • query_text: Text query for similarity search
      • anns_field: Field name for text search
      • limit: The maximum number of results to return (default: 5)
      • output_fields: Fields to include in results
      • metric_type: Distance metric (COSINE, L2, IP) (default: "COSINE")
      • filter_expr: Optional filter expression
      • radius: Optional lower bound for range search (default: None)
      • range_filter: Optional upper bound for range search (default: None)
  • milvus_query: Query collection using filter expressions

    • Parameters:
      • collection_name: Name of collection to query
      • filter_expr: Filter expression (e.g. 'age > 20')
      • output_fields: Fields to include in results
      • limit: The maximum number of results to return (default: 10)

Collection Management

  • milvus_list_collections: List all collections in the database

  • milvus_create_collection: Create a new collection with quick setup or customized schema

    • Parameters:
      • collection_name: Name for the new collection
      • auto_id: whether to auto generate id, default to True
      • dimension: vector dimension, default to 768; for quick setup and will be ignored if field_schema is provided
      • primary_field_name: name of the primary field, default to "id"; for quick setup and will be ignored if field_schema is provided
      • vector_field_name: name of the vector field, default to "vector"; for quick setup and will be ignored if field_schema is provided
      • metric_type: metric type, default to "COSINE"; for quick setup and will be ignored if field_schema is provided
      • field_schema: List of field schema, each element is a dictionary with the following keys:
        • name: name of the field
        • type: type of the field
      • index_params: Optional list of index parameters, each element is a dictionary with the following keys:
        • field_name: name of the field to index
        • index_type: index type
        • **kwargs: other optional index parameters
      • other_kwargs: Additional keyword arguments for the collection creation
  • milvus_load_collection: Load a collection into memory for search and query

    • Parameters:
      • collection_name: Name of collection to load
      • replica_number: Number of replicas (default: 1)
  • milvus_release_collection: Release a collection from memory

    • Parameters:
      • collection_name: Name of collection to release
  • milvus_get_collection_info: Lists detailed information like schema, properties, collection ID, and other metadata of a specific collection.

    • Parameters:
      • collection_name: Name of the collection to get detailed information about

Data Operations

  • milvus_insert_data: Insert data into a collection

    • Parameters:
      • collection_name: Name of collection
      • data: Dictionary mapping field names to lists of values
  • milvus_delete_entities: Delete entities from a collection based on filter expression

    • Parameters:
      • collection_name: Name of collection
      • filter_expr: Filter expression to select entities to delete

Environment Variables

  • MILVUS_URI: Milvus server URI (can be set instead of --milvus-uri)
  • MILVUS_TOKEN: Optional authentication token
  • MILVUS_DB: Database name (defaults to "default")

Development

To run the server directly:

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

Examples

Using Claude Desktop

Example 1: Listing Collections

What are the collections I have in my Milvus DB?

Claude will then use MCP to check this information on your Milvus DB.

I'll check what collections are available in your Milvus database.

Here are the collections in your Milvus database:

1. rag_demo
2. test
3. chat_messages
4. text_collection
5. image_collection
6. customized_setup
7. streaming_rag_demo

Example 2: Searching for Documents

Find documents in my text_collection that mention "machine learning"

Claude will use the full-text search capabilities of Milvus to find relevant documents:

I'll search for documents about machine learning in your text_collection.

> View result from milvus-text-search from milvus (local)

Here are the documents I found that mention machine learning:
[Results will appear here based on your actual data]

Using Cursor

Example: Creating a Collection

In Cursor, you can ask:

Create a new collection called 'articles' in Milvus with fields for title (string), content (string), and a vector field (128 dimensions)

Cursor will use the MCP server to execute this operation:

I'll create a new collection called 'articles' with the specified fields.

Collection 'articles' has been created successfully with the following schema:
- title: string
- content: string
- vector: float vector[128]

Troubleshooting

Common Issues

Connection Errors

If you see errors like "Failed to connect to Milvus server":

  1. Verify your Milvus instance is running: docker ps (if using Docker)
  2. Check the URI is correct in your configuration
  3. Ensure there are no firewall rules blocking the connection
  4. Try using 127.0.0.1 instead of localhost in the URI

Authentication Issues

If you see authentication errors:

  1. Verify your MILVUS_TOKEN is correct
  2. Check if your Milvus instance requires authentication
  3. Ensure you have the correct permissions for the operations you're trying to perform

Tool Not Found

If the MCP tools don't appear in Claude Desktop or Cursor:

  1. Restart the application
  2. Check the server logs for any errors
  3. Verify the MCP server is running correctly
  4. Press the refresh button in the MCP settings (for Cursor)

Getting Help

If you continue to experience issues:

  1. Check the GitHub Issues for similar problems
  2. Join the Milvus Community Discord for support
  3. File a new issue with detailed information about your problem

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "zilliztech-mcp-server-milvus": {
      "command": "",
      "args": []
    }
  }
}

Use MCP Server for Milvus MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once MCP Server for Milvus is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add MCP Server for Milvus as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the MCP Server for Milvus MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "zilliztech-mcp-server-milvus": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-server-milvus"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the MCP Server for Milvus MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the MCP Server for Milvus MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Server for Milvus to help me with this task?
MCP Server for Milvus
Sure. I read it.
Here is what I found using MCP Server for Milvus.

Option 2: Add an MCP server URL

Use this when MCP Server for Milvus is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for MCP Server for Milvus.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the MCP Server for Milvus connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the MCP Server for Milvus tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the MCP Server for Milvus tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use MCP Server for Milvus to help me with this task?
MCP Server for Milvus
Sure. I read it.
Here is what I found using MCP Server for Milvus.

Frequently asked questions

What is the MCP Server for Milvus MCP server used for?

MCP Server for Milvus is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use MCP Server for Milvus MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use MCP Server for Milvus with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use MCP Server for Milvus MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With MCP Server for Milvus connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect MCP Server for Milvus MCP to TypingMind?

MCP Server for Milvus can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does MCP Server for Milvus MCP provide in TypingMind?

MCP Server for Milvus exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use MCP Server for Milvus MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If MCP Server for Milvus requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇