Provides access to Milvus vector database functionality, including vector similarity search, text search, collection management, and data operations for AI applications.
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.
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:
Then you can run the server directly:
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:
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:
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:
--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:The output will be similar to:You can then access the MCP Inspector at
http://127.0.0.1:6274
for testing.
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:
- Install Claude Desktop from https://claude.ai/download.
- Open your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- macOS:
- Add the following configuration for SSE mode:
- Restart Claude Desktop to apply the changes.
Stdio Mode Configuration
For stdio mode, follow these steps:
- Install Claude Desktop from https://claude.ai/download.
- Open your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- macOS:
- Add the following configuration for stdio mode:
- 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
- Open
Cursor Settings
>MCP
- Click on
Add new global MCP server
- 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:
For SSE Mode:
- Start the service by running the following command:
Note: Replace
http://your_sse_host
with your actual SSE host address andport
with the specific port number you’re using. - Once the service is up and running, overwrite the
mcp.json
file with the following content:
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:
- Open
Cursor Settings
>MCP
- Check if "milvus" or "milvus-sse" appear in the list(depending on the mode you have chosen)
- Confirm that the relevant tools are listed (e.g., milvus_list_collections, milvus_vector_search, etc.)
- 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 searchquery_text
: Text to search forlimit
: The maximum number of results to return (default: 5)output_fields
: Fields to include in resultsdrop_ratio
: Proportion of low-frequency terms to ignore (0.0-1.0)
- Parameters:
milvus_vector_search
: Perform vector similarity search on a collection- Parameters:
collection_name
: Name of collection to searchvector
: Query vectorvector_field
: Field name for vector search (default: "vector")limit
: The maximum number of results to return (default: 5)output_fields
: Fields to include in resultsfilter_expr
: Filter expressionmetric_type
: Distance metric (COSINE, L2, IP) (default: "COSINE")
- Parameters:
milvus_hybrid_search
: Perform hybrid search on a collection- Parameters:
collection_name
: Name of collection to searchquery_text
: Text query for searchtext_field
: Field name for text searchvector
: Vector of the text queryvector_field
: Field name for vector searchlimit
: The maximum number of results to returnoutput_fields
: Fields to include in resultsfilter_expr
: Filter expression
- Parameters:
milvus_query
: Query collection using filter expressions- Parameters:
collection_name
: Name of collection to queryfilter_expr
: Filter expression (e.g. 'age > 20')output_fields
: Fields to include in resultslimit
: The maximum number of results to return (default: 10)
- Parameters:
Collection Management
milvus_list_collections
: List all collections in the databasemilvus_create_collection
: Create a new collection with specified schema- Parameters:
collection_name
: Name for the new collectioncollection_schema
: Collection schema definitionindex_params
: Optional index parameters
- Parameters:
milvus_load_collection
: Load a collection into memory for search and query- Parameters:
collection_name
: Name of collection to loadreplica_number
: Number of replicas (default: 1)
- Parameters:
milvus_release_collection
: Release a collection from memory- Parameters:
collection_name
: Name of collection to release
- Parameters:
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
- Parameters:
Data Operations
milvus_insert_data
: Insert data into a collection- Parameters:
collection_name
: Name of collectiondata
: Dictionary mapping field names to lists of values
- Parameters:
milvus_delete_entities
: Delete entities from a collection based on filter expression- Parameters:
collection_name
: Name of collectionfilter_expr
: Filter expression to select entities to delete
- Parameters:
Environment Variables
MILVUS_URI
: Milvus server URI (can be set instead of --milvus-uri)MILVUS_TOKEN
: Optional authentication tokenMILVUS_DB
: Database name (defaults to "default")
Development
To run the server directly:
Examples
Using Claude Desktop
Example 1: Listing Collections
Claude will then use MCP to check this information on your Milvus DB.
Example 2: Searching for Documents
Claude will use the full-text search capabilities of Milvus to find relevant documents:
Using Cursor
Example: Creating a Collection
In Cursor, you can ask:
Cursor will use the MCP server to execute this operation:
Troubleshooting
Common Issues
Connection Errors
If you see errors like "Failed to connect to Milvus server":
- Verify your Milvus instance is running:
docker ps
(if using Docker) - Check the URI is correct in your configuration
- Ensure there are no firewall rules blocking the connection
- Try using
127.0.0.1
instead oflocalhost
in the URI
Authentication Issues
If you see authentication errors:
- Verify your
MILVUS_TOKEN
is correct - Check if your Milvus instance requires authentication
- 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:
- Restart the application
- Check the server logs for any errors
- Verify the MCP server is running correctly
- Press the refresh button in the MCP settings (for Cursor)
Getting Help
If you continue to experience issues:
- Check the GitHub Issues for similar problems
- Join the Zilliz Community Discord for support
- File a new issue with detailed information about your problem
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
An integration server implementing the Model Context Protocol that enables LLM applications to interact with Milvus vector database functionality, allowing vector search, collection management, and data operations through natural language.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that enables LLMs to interact with Salesforce data through SOQL queries, SOSL searches, and various API operations including record management.Last updated -1053PythonMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.Last updated -340TypeScriptMIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact directly with MongoDB databases, allowing users to query collections, inspect schemas, and manage data through natural language.Last updated -340MIT License
- -securityAlicense-qualityA Model Context Protocol server that enables LLMs to interact with databases (currently MongoDB) through natural language, supporting operations like querying, inserting, deleting documents, and running aggregation pipelines.Last updated -TypeScriptMIT License