MCP Server for Milvus
by stephen37
Model Context Protocol Servers for Milvus
What is MCP Server for Milvus
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:
git clone https://github.com/zilliztech/mcp-server-milvus.git
cd mcp-server-milvus
Then you can run the server directly:
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:
uv run src/mcp_server_milvus/server.py
Important: the .env file will have higher priority than the command line arguments.
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
-
Install Claude Desktop from https://claude.ai/download
-
Open your Claude Desktop configuration:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- macOS:
-
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"
]
}
}
}
- Restart Claude Desktop
Usage with Cursor
Cursor also supports MCP tools. You can add the Milvus MCP server to Cursor in two ways:
Option 1: Using Cursor Settings UI
-
Go to
Cursor Settings
>Features
>MCP
-
Click on the
+ Add New MCP Server
button -
Fill out the form:
- Type: Select
stdio
(since you're running a command) - Name:
milvus
- Command:
/PATH/TO/uv --directory /path/to/mcp-server-milvus/src/mcp_server_milvus run server.py --milvus-uri http://127.0.0.1:19530
โ ๏ธ Note: Use
127.0.0.1
instead oflocalhost
to avoid potential DNS resolution issues. - Type: Select
Option 2: Using Project-specific Configuration (Recommended)
Create a .cursor/mcp.json
file in your project root:
-
Create the
.cursor
directory in your project root:mkdir -p /path/to/your/project/.cursor
-
Create a
mcp.json
file with the following content:{ "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" ] } } }
-
Restart Cursor or reload the window
After adding the server, you may need to press the refresh button in the MCP settings to populate the tool list. The Agent will automatically use the Milvus tools when relevant to your queries.
Verifying the Integration
To verify that Cursor has successfully integrated with your Milvus MCP server:
- Open Cursor Settings > Features > MCP
- Check that "Milvus" appears in the list of MCP servers
- Verify that the 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
: Maximum results (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 containing vectors to search (default: "vector")limit
: Maximum results (default: 5)output_fields
: Fields to include in resultsmetric_type
: Distance metric (COSINE, L2, IP) (default: "COSINE")
- 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
: Maximum results (default: 10)
- Parameters:
Collection Management
-
milvus_list_collections
: List all collections in the database -
milvus_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:
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:
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":
- 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
Leave a Comment
Comments section will be available soon. Stay tuned!
Frequently Asked Questions
What is MCP?
MCP (Model Context Protocol) is an open protocol that standardizes how applications provide context to LLMs. Think of MCP like a USB-C port for AI applications, providing a standardized way to connect AI models to different data sources and tools.
What are MCP Servers?
MCP Servers are lightweight programs that expose specific capabilities through the standardized Model Context Protocol. They act as bridges between LLMs like Claude and various data sources or services, allowing secure access to files, databases, APIs, and other resources.
How do MCP Servers work?
MCP Servers follow a client-server architecture where a host application (like Claude Desktop) connects to multiple servers. Each server provides specific functionality through standardized endpoints and protocols, enabling Claude to access data and perform actions through the standardized protocol.
Are MCP Servers secure?
Yes, MCP Servers are designed with security in mind. They run locally with explicit configuration and permissions, require user approval for actions, and include built-in security features to prevent unauthorized access and ensure data privacy.
Related MCP Servers
21st.dev Magic AI Agent
It's like v0 but in your Cursor/WindSurf/Cline. 21st dev Magic MCP server for working with your frontend like Magic
Requirements:
A Model Context Protocol Server for connecting with Adfin APIs
AgentQL MCP Server
Model Context Protocol server that integrates AgentQL's data extraction capabilities.
AgentRPC
A universal RPC layer for AI agents. Connect to any function, any language, any framework, in minutes.
Aiven MCP Server
Model Context Protocol server for Aiven
IoTDB MCP Server
Apache IoTDB MCP Server
Apify Model Context Protocol (MCP) Server
Model Context Protocol (MCP) Server for Apify's Actors
APIMatic Validator MCP Server
APIMatic Validator MCP Server for validating OpenAPI specs via APIMatic's API with MCP
๐ Audiense Insights MCP Server
Audiense Insights MCP Server is a server based on the Model Context Protocol (MCP) that allows Claude and other MCP-compatible clients to interact with your Audiense Insights account
Bankless Onchain MCP Server
Bringing the bankless onchain API to MCP
Submit Your MCP Server
Share your MCP server with the community
Submit Now