This repository contains a MCP server that provides access to Milvus vector database functionality. 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) The recommended way to use this MCP server is to run it directly with uv without installation. This is how both Claude Desktop and
Add this skill
npx mdskills install zilliztech/mcp-server-milvusComprehensive MCP server for Milvus vector database with extensive tools and excellent setup docs
1# MCP Server for Milvus23> 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.45This repository contains a MCP server that provides access to [Milvus](https://milvus.io/) vector database functionality.6789## Prerequisites1011Before using this MCP server, ensure you have:1213- Python 3.10 or higher14- A running [Milvus](https://milvus.io/) instance (local or remote)15- [uv](https://github.com/astral-sh/uv) installed (recommended for running the server)1617## Usage1819The 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.2021If you want to clone the repository:2223```bash24git clone https://github.com/zilliztech/mcp-server-milvus.git25cd mcp-server-milvus26```2728Then you can run the server directly:2930```bash31uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:1953032```3334Alternatively 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:3536```bash37uv run src/mcp_server_milvus/server.py38```3940### Important: the .env file will have higher priority than the command line arguments.4142### Running Modes4344The server supports two running modes: **stdio** (default) and **SSE** (Server-Sent Events).4546### Stdio Mode (Default)4748- **Description**: Communicates with the client via standard input/output. This is the default mode if no mode is specified.4950- Usage:5152 ```bash53 uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:1953054 ```5556### SSE Mode5758- **Description**: Uses HTTP Server-Sent Events for communication. This mode allows multiple clients to connect via HTTP and is suitable for web-based applications.5960- **Usage:**6162 ```bash63 uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://localhost:19530 --port 800064 ```6566 - `--sse`: Enables SSE mode.67 - `--port`: Specifies the port for the SSE server (default: 8000).6869- **Debugging in SSE Mode:**7071 If you want to debug in SSE mode, after starting the SSE service, enter the following command:7273 ```bash74 mcp dev src/mcp_server_milvus/server.py75 ```7677 The output will be similar to:7879 ```plaintext80 % mcp dev src/mcp_server_milvus/merged_server.py81 Starting MCP inspector...82 ⚙️ Proxy server listening on port 627783 🔍 MCP Inspector is up and running at http://127.0.0.1:6274 🚀84 ```8586 You can then access the MCP Inspector at `http://127.0.0.1:6274` for testing.8788## Supported Applications8990This MCP server can be used with various LLM applications that support the Model Context Protocol:9192- **Claude Desktop**: Anthropic's desktop application for Claude93- **Cursor**: AI-powered code editor with MCP support94- **Custom MCP clients**: Any application implementing the MCP client specification9596## Usage with Claude Desktop9798### Configuration for Different Modes99100#### SSE Mode Configuration101102Follow these steps to configure Claude Desktop for SSE mode:1031041. Install Claude Desktop from https://claude.ai/download.1052. Open your Claude Desktop configuration file:106 - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`1073. Add the following configuration for SSE mode:108109```json110{111 "mcpServers": {112 "milvus-sse": {113 "url": "http://your_sse_host:port/sse",114 "disabled": false,115 "autoApprove": []116 }117 }118}119```1201214. Restart Claude Desktop to apply the changes.122123#### Stdio Mode Configuration124125For stdio mode, follow these steps:1261271. Install Claude Desktop from https://claude.ai/download.1282. Open your Claude Desktop configuration file:129 - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`1303. Add the following configuration for stdio mode:131132```json133{134 "mcpServers": {135 "milvus": {136 "command": "/PATH/TO/uv",137 "args": [138 "--directory",139 "/path/to/mcp-server-milvus/src/mcp_server_milvus",140 "run",141 "server.py",142 "--milvus-uri",143 "http://localhost:19530"144 ]145 }146 }147}148```1491504. Restart Claude Desktop to apply the changes.151152## Usage with Cursor153154[Cursor also supports MCP](https://docs.cursor.com/context/model-context-protocol) tools. You can integrate your Milvus MCP server with Cursor by following these steps:155156### Integration Steps1571581. Open `Cursor Settings` > `MCP`1592. Click on `Add new global MCP server`1603. After clicking, it will automatically redirect you to the `mcp.json` file, which will be created if it doesn’t exist161162### Configuring the `mcp.json` File163164#### For Stdio Mode:165166Overwrite the `mcp.json` file with the following content:167168```json169{170 "mcpServers": {171 "milvus": {172 "command": "/PATH/TO/uv",173 "args": [174 "--directory",175 "/path/to/mcp-server-milvus/src/mcp_server_milvus",176 "run",177 "server.py",178 "--milvus-uri",179 "http://127.0.0.1:19530"180 ]181 }182 }183}184```185186#### For SSE Mode:1871881. Start the service by running the following command:189190 ```bash191 uv run src/mcp_server_milvus/server.py --sse --milvus-uri http://your_sse_host --port port192 ```193194 > **Note**: Replace `http://your_sse_host` with your actual SSE host address and `port` with the specific port number you’re using.1951962. Once the service is up and running, overwrite the `mcp.json` file with the following content:197198 ```json199 {200 "mcpServers": {201 "milvus-sse": {202 "url": "http://your_sse_host:port/sse",203 "disabled": false,204 "autoApprove": []205 }206 }207 }208 ```209210### Completing the Integration211212After completing the above steps, restart Cursor or reload the window to ensure the configuration takes effect.213214## Verifying the Integration215216To verify that Cursor has successfully integrated with your Milvus MCP server:2172181. Open `Cursor Settings` > `MCP`2192. Check if "milvus" or "milvus-sse" appear in the list(depending on the mode you have chosen)2203. Confirm that the relevant tools are listed (e.g., milvus_list_collections, milvus_vector_search, etc.)2214. If the server is enabled but shows an error, check the Troubleshooting section below222223## Available Tools224225The server provides the following tools:226227### Search and Query Operations228229- `milvus_text_search`: Search for documents using full text search230231 - Parameters:232 - `collection_name`: Name of collection to search233 - `query_text`: Text to search for234 - `limit`: The maximum number of results to return (default: 5)235 - `output_fields`: Fields to include in results236 - `drop_ratio`: Proportion of low-frequency terms to ignore (0.0-1.0)237- `milvus_vector_search`: Perform vector similarity search on a collection238 - Parameters:239 - `collection_name`: Name of collection to search240 - `vector`: Query vector241 - `vector_field`: Field name for vector search (default: "vector")242 - `limit`: The maximum number of results to return (default: 5)243 - `output_fields`: Fields to include in results244 - `filter_expr`: Filter expression245 - `metric_type`: Distance metric (COSINE, L2, IP) (default: "COSINE")246- `milvus_hybrid_search`: Perform hybrid search on a collection247 - Parameters:248 - `collection_name`: Name of collection to search249 - `query_text`: Text query for search250 - `text_field`: Field name for text search251 - `vector`: Vector of the text query252 - `vector_field`: Field name for vector search253 - `limit`: The maximum number of results to return254 - `output_fields`: Fields to include in results255 - `filter_expr`: Filter expression256- `milvus_text_similarity_search`: Perform text similarity search on a collection257 > **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](https://milvus.io/docs/embedding-function-overview.md#Embedding-Function-Overview) for more details.258 - Parameters:259 - `collection_name`: Name of collection to search260 - `query_text`: Text query for similarity search261 - `anns_field`: Field name for text search262 - `limit`: The maximum number of results to return (default: 5)263 - `output_fields`: Fields to include in results264 - `metric_type`: Distance metric (COSINE, L2, IP) (default: "COSINE")265 - `filter_expr`: Optional filter expression266- `milvus_query`: Query collection using filter expressions267 - Parameters:268 - `collection_name`: Name of collection to query269 - `filter_expr`: Filter expression (e.g. 'age > 20')270 - `output_fields`: Fields to include in results271 - `limit`: The maximum number of results to return (default: 10)272273### Collection Management274275- `milvus_list_collections`: List all collections in the database276277- `milvus_create_collection`: Create a new collection with quick setup or customized schema278279 - Parameters:280 - `collection_name`: Name for the new collection281 - `auto_id`: whether to auto generate id, default to True282 - `dimension`: vector dimension, default to 768; for quick setup and will be ignored if `field_schema` is provided283 - `primary_field_name`: name of the primary field, default to "id"; for quick setup and will be ignored if `field_schema` is provided284 - `vector_field_name`: name of the vector field, default to "vector"; for quick setup and will be ignored if `field_schema` is provided285 - `metric_type`: metric type, default to "COSINE"; for quick setup and will be ignored if `field_schema` is provided286 - `field_schema`: List of field schema, each element is a dictionary with the following keys:287 - `name`: name of the field288 - `type`: type of the field289 - `index_params`: Optional list of index parameters, each element is a dictionary with the following keys:290 - `field_name`: name of the field to index291 - `index_type`: index type292 - `**kwargs`: other optional index parameters293 - `other_kwargs`: Additional keyword arguments for the collection creation294295- `milvus_load_collection`: Load a collection into memory for search and query296297 - Parameters:298 - `collection_name`: Name of collection to load299 - `replica_number`: Number of replicas (default: 1)300301- `milvus_release_collection`: Release a collection from memory302 - Parameters:303 - `collection_name`: Name of collection to release304305- `milvus_get_collection_info`: Lists detailed information like schema, properties, collection ID, and other metadata of a specific collection.306 - Parameters:307 - `collection_name`: Name of the collection to get detailed information about308309### Data Operations310311- `milvus_insert_data`: Insert data into a collection312313 - Parameters:314 - `collection_name`: Name of collection315 - `data`: Dictionary mapping field names to lists of values316317- `milvus_delete_entities`: Delete entities from a collection based on filter expression318 - Parameters:319 - `collection_name`: Name of collection320 - `filter_expr`: Filter expression to select entities to delete321322## Environment Variables323324- `MILVUS_URI`: Milvus server URI (can be set instead of --milvus-uri)325- `MILVUS_TOKEN`: Optional authentication token326- `MILVUS_DB`: Database name (defaults to "default")327328## Development329330To run the server directly:331332```bash333uv run server.py --milvus-uri http://localhost:19530334```335336## Examples337338### Using Claude Desktop339340#### Example 1: Listing Collections341342```343What are the collections I have in my Milvus DB?344```345346Claude will then use MCP to check this information on your Milvus DB.347348```349I'll check what collections are available in your Milvus database.350351Here are the collections in your Milvus database:3523531. rag_demo3542. test3553. chat_messages3564. text_collection3575. image_collection3586. customized_setup3597. streaming_rag_demo360```361362#### Example 2: Searching for Documents363364```365Find documents in my text_collection that mention "machine learning"366```367368Claude will use the full-text search capabilities of Milvus to find relevant documents:369370```371I'll search for documents about machine learning in your text_collection.372373> View result from milvus-text-search from milvus (local)374375Here are the documents I found that mention machine learning:376[Results will appear here based on your actual data]377```378379### Using Cursor380381#### Example: Creating a Collection382383In Cursor, you can ask:384385```386Create a new collection called 'articles' in Milvus with fields for title (string), content (string), and a vector field (128 dimensions)387```388389Cursor will use the MCP server to execute this operation:390391```392I'll create a new collection called 'articles' with the specified fields.393394Collection 'articles' has been created successfully with the following schema:395- title: string396- content: string397- vector: float vector[128]398```399400## Troubleshooting401402### Common Issues403404#### Connection Errors405406If you see errors like "Failed to connect to Milvus server":4074081. Verify your Milvus instance is running: `docker ps` (if using Docker)4092. Check the URI is correct in your configuration4103. Ensure there are no firewall rules blocking the connection4114. Try using `127.0.0.1` instead of `localhost` in the URI412413#### Authentication Issues414415If you see authentication errors:4164171. Verify your `MILVUS_TOKEN` is correct4182. Check if your Milvus instance requires authentication4193. Ensure you have the correct permissions for the operations you're trying to perform420421#### Tool Not Found422423If the MCP tools don't appear in Claude Desktop or Cursor:4244251. Restart the application4262. Check the server logs for any errors4273. Verify the MCP server is running correctly4284. Press the refresh button in the MCP settings (for Cursor)429430### Getting Help431432If you continue to experience issues:4334341. Check the [GitHub Issues](https://github.com/zilliztech/mcp-server-milvus/issues) for similar problems4352. Join the [Zilliz Community Discord](https://discord.gg/zilliz) for support4363. File a new issue with detailed information about your problem437
Full transparency — inspect the skill content before installing.