mcp-server-milvus 0.1.1.dev0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mcp-server-milvus might be problematic. Click here for more details.

@@ -0,0 +1,15 @@
1
+ {
2
+ "mcpServers": {
3
+ "milvus": {
4
+ "command": "/path/to/uv",
5
+ "args": [
6
+ "--directory",
7
+ "/path/to/mcp-server-milvus/src/mcp_server_milvus",
8
+ "run",
9
+ "server.py",
10
+ "--milvus-uri",
11
+ "http://127.0.0.1:19530"
12
+ ]
13
+ }
14
+ }
15
+ }
@@ -0,0 +1 @@
1
+ package-lock.json linguist-generated=true
@@ -0,0 +1,300 @@
1
+ # Logs
2
+ logs
3
+ *.log
4
+ npm-debug.log*
5
+ yarn-debug.log*
6
+ yarn-error.log*
7
+ lerna-debug.log*
8
+ .pnpm-debug.log*
9
+
10
+ # Diagnostic reports (https://nodejs.org/api/report.html)
11
+ report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
12
+
13
+ # Runtime data
14
+ pids
15
+ *.pid
16
+ *.seed
17
+ *.pid.lock
18
+
19
+ # Directory for instrumented libs generated by jscoverage/JSCover
20
+ lib-cov
21
+
22
+ # Coverage directory used by tools like istanbul
23
+ coverage
24
+ *.lcov
25
+
26
+ # nyc test coverage
27
+ .nyc_output
28
+
29
+ # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
30
+ .grunt
31
+
32
+ # Bower dependency directory (https://bower.io/)
33
+ bower_components
34
+
35
+ # node-waf configuration
36
+ .lock-wscript
37
+
38
+ # Compiled binary addons (https://nodejs.org/api/addons.html)
39
+ build/Release
40
+
41
+ # Dependency directories
42
+ node_modules/
43
+ jspm_packages/
44
+
45
+ # Snowpack dependency directory (https://snowpack.dev/)
46
+ web_modules/
47
+
48
+ # TypeScript cache
49
+ *.tsbuildinfo
50
+
51
+ # Optional npm cache directory
52
+ .npm
53
+
54
+ # Optional eslint cache
55
+ .eslintcache
56
+
57
+ # Optional stylelint cache
58
+ .stylelintcache
59
+
60
+ # Microbundle cache
61
+ .rpt2_cache/
62
+ .rts2_cache_cjs/
63
+ .rts2_cache_es/
64
+ .rts2_cache_umd/
65
+
66
+ # Optional REPL history
67
+ .node_repl_history
68
+
69
+ # Output of 'npm pack'
70
+ *.tgz
71
+
72
+ # Yarn Integrity file
73
+ .yarn-integrity
74
+
75
+ # dotenv environment variable files
76
+ .env
77
+ .env.development.local
78
+ .env.test.local
79
+ .env.production.local
80
+ .env.local
81
+
82
+ # parcel-bundler cache (https://parceljs.org/)
83
+ .cache
84
+ .parcel-cache
85
+
86
+ # Next.js build output
87
+ .next
88
+ out
89
+
90
+ # Nuxt.js build / generate output
91
+ .nuxt
92
+ dist
93
+
94
+ # Gatsby files
95
+ .cache/
96
+ # Comment in the public line in if your project uses Gatsby and not Next.js
97
+ # https://nextjs.org/blog/next-9-1#public-directory-support
98
+ # public
99
+
100
+ # vuepress build output
101
+ .vuepress/dist
102
+
103
+ # vuepress v2.x temp and cache directory
104
+ .temp
105
+ .cache
106
+
107
+ # Docusaurus cache and generated files
108
+ .docusaurus
109
+
110
+ # Serverless directories
111
+ .serverless/
112
+
113
+ # FuseBox cache
114
+ .fusebox/
115
+
116
+ # DynamoDB Local files
117
+ .dynamodb/
118
+
119
+ # TernJS port file
120
+ .tern-port
121
+
122
+ # Stores VSCode versions used for testing VSCode extensions
123
+ .vscode-test
124
+
125
+ # yarn v2
126
+ .yarn/cache
127
+ .yarn/unplugged
128
+ .yarn/build-state.yml
129
+ .yarn/install-state.gz
130
+ .pnp.*
131
+
132
+ build/
133
+
134
+ gcp-oauth.keys.json
135
+ .*-server-credentials.json
136
+
137
+ # Byte-compiled / optimized / DLL files
138
+ __pycache__/
139
+ *.py[cod]
140
+ *$py.class
141
+
142
+ # C extensions
143
+ *.so
144
+
145
+ # Distribution / packaging
146
+ .Python
147
+ build/
148
+ develop-eggs/
149
+ dist/
150
+ downloads/
151
+ eggs/
152
+ .eggs/
153
+ lib/
154
+ lib64/
155
+ parts/
156
+ sdist/
157
+ var/
158
+ wheels/
159
+ share/python-wheels/
160
+ *.egg-info/
161
+ .installed.cfg
162
+ *.egg
163
+ MANIFEST
164
+
165
+ # PyInstaller
166
+ # Usually these files are written by a python script from a template
167
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
168
+ *.manifest
169
+ *.spec
170
+
171
+ # Installer logs
172
+ pip-log.txt
173
+ pip-delete-this-directory.txt
174
+
175
+ # Unit test / coverage reports
176
+ htmlcov/
177
+ .tox/
178
+ .nox/
179
+ .coverage
180
+ .coverage.*
181
+ .cache
182
+ nosetests.xml
183
+ coverage.xml
184
+ *.cover
185
+ *.py,cover
186
+ .hypothesis/
187
+ .pytest_cache/
188
+ cover/
189
+
190
+ # Translations
191
+ *.mo
192
+ *.pot
193
+
194
+ # Django stuff:
195
+ *.log
196
+ local_settings.py
197
+ db.sqlite3
198
+ db.sqlite3-journal
199
+
200
+ # Flask stuff:
201
+ instance/
202
+ .webassets-cache
203
+
204
+ # Scrapy stuff:
205
+ .scrapy
206
+
207
+ # Sphinx documentation
208
+ docs/_build/
209
+
210
+ # PyBuilder
211
+ .pybuilder/
212
+ target/
213
+
214
+ # Jupyter Notebook
215
+ .ipynb_checkpoints
216
+
217
+ # IPython
218
+ profile_default/
219
+ ipython_config.py
220
+
221
+ # pyenv
222
+ # For a library or package, you might want to ignore these files since the code is
223
+ # intended to run in multiple environments; otherwise, check them in:
224
+ # .python-version
225
+
226
+ # pipenv
227
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
228
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
229
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
230
+ # install all needed dependencies.
231
+ #Pipfile.lock
232
+
233
+ # poetry
234
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
235
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
236
+ # commonly ignored for libraries.
237
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
238
+ #poetry.lock
239
+
240
+ # pdm
241
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
242
+ #pdm.lock
243
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
244
+ # in version control.
245
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
246
+ .pdm.toml
247
+ .pdm-python
248
+ .pdm-build/
249
+
250
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
251
+ __pypackages__/
252
+
253
+ # Celery stuff
254
+ celerybeat-schedule
255
+ celerybeat.pid
256
+
257
+ # SageMath parsed files
258
+ *.sage.py
259
+
260
+ # Environments
261
+ .env
262
+ .venv
263
+ env/
264
+ venv/
265
+ ENV/
266
+ env.bak/
267
+ venv.bak/
268
+
269
+ # Spyder project settings
270
+ .spyderproject
271
+ .spyproject
272
+
273
+ # Rope project settings
274
+ .ropeproject
275
+
276
+ # mkdocs documentation
277
+ /site
278
+
279
+ # mypy
280
+ .mypy_cache/
281
+ .dmypy.json
282
+ dmypy.json
283
+
284
+ # Pyre type checker
285
+ .pyre/
286
+
287
+ # pytype static type analyzer
288
+ .pytype/
289
+
290
+ # Cython debug symbols
291
+ cython_debug/
292
+
293
+ .DS_Store
294
+
295
+ # PyCharm
296
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
297
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
298
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
299
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
300
+ #.idea/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,330 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-server-milvus
3
+ Version: 0.1.1.dev0
4
+ Summary: MCP server for Milvus
5
+ Requires-Python: >=3.10
6
+ Requires-Dist: click>=8.0.0
7
+ Requires-Dist: dotenv>=0.9.9
8
+ Requires-Dist: mcp[cli]>=1.1.2
9
+ Requires-Dist: pymilvus>=2.5.1
10
+ Requires-Dist: ruff>=0.11.0
11
+ Description-Content-Type: text/markdown
12
+
13
+ # MCP Server for Milvus
14
+
15
+ > 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.
16
+
17
+ This repository contains a MCP server that provides access to [Milvus](https://milvus.io/) vector database functionality.
18
+
19
+ ![MCP with Milvus](Claude_mcp+1080.gif)
20
+
21
+ ## Prerequisites
22
+
23
+ Before using this MCP server, ensure you have:
24
+
25
+ - Python 3.10 or higher
26
+ - A running [Milvus](https://milvus.io/) instance (local or remote)
27
+ - [uv](https://github.com/astral-sh/uv) installed (recommended for running the server)
28
+
29
+ ## Usage
30
+
31
+ 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.
32
+
33
+ If you want to clone the repository:
34
+
35
+ ```bash
36
+ git clone https://github.com/zilliztech/mcp-server-milvus.git
37
+ cd mcp-server-milvus
38
+ ```
39
+
40
+ Then you can run the server directly:
41
+
42
+ ```bash
43
+ uv run src/mcp_server_milvus/server.py --milvus-uri http://localhost:19530
44
+ ```
45
+
46
+ 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:
47
+
48
+ ```bash
49
+ uv run src/mcp_server_milvus/server.py
50
+ ```
51
+
52
+ ### Important: the .env file will have higher priority than the command line arguments.
53
+
54
+ ## Supported Applications
55
+
56
+ This MCP server can be used with various LLM applications that support the Model Context Protocol:
57
+
58
+ - **Claude Desktop**: Anthropic's desktop application for Claude
59
+ - **Cursor**: AI-powered code editor with MCP support
60
+ - **Custom MCP clients**: Any application implementing the MCP client specification
61
+
62
+ ## Usage with Claude Desktop
63
+
64
+ 1. Install Claude Desktop from https://claude.ai/download
65
+ 2. Open your Claude Desktop configuration:
66
+
67
+ - macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
68
+
69
+ 3. Add the following configuration:
70
+
71
+ ```json
72
+ {
73
+ "mcpServers": {
74
+ "milvus": {
75
+ "command": "/PATH/TO/uv",
76
+ "args": [
77
+ "--directory",
78
+ "/path/to/mcp-server-milvus/src/mcp_server_milvus",
79
+ "run",
80
+ "server.py",
81
+ "--milvus-uri",
82
+ "http://localhost:19530"
83
+ ]
84
+ }
85
+ }
86
+ }
87
+ ```
88
+
89
+ 4. Restart Claude Desktop
90
+
91
+ ## Usage with Cursor
92
+
93
+ [Cursor also supports MCP](https://docs.cursor.com/context/model-context-protocol) tools. You can add the Milvus MCP server to Cursor in two ways:
94
+
95
+ ### Option 1: Using Cursor Settings UI
96
+
97
+ 1. Go to `Cursor Settings` > `Features` > `MCP`
98
+ 2. Click on the `+ Add New MCP Server` button
99
+ 3. Fill out the form:
100
+
101
+ - **Type**: Select `stdio` (since you're running a command)
102
+ - **Name**: `milvus`
103
+ - **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`
104
+
105
+ > ⚠️ Note: Use `127.0.0.1` instead of `localhost` to avoid potential DNS resolution issues.
106
+
107
+ ### Option 2: Using Project-specific Configuration (Recommended)
108
+
109
+ Create a `.cursor/mcp.json` file in your project root:
110
+
111
+ 1. Create the `.cursor` directory in your project root:
112
+
113
+ ```bash
114
+ mkdir -p /path/to/your/project/.cursor
115
+ ```
116
+
117
+ 2. Create a `mcp.json` file with the following content:
118
+
119
+ ```json
120
+ {
121
+ "mcpServers": {
122
+ "milvus": {
123
+ "command": "/PATH/TO/uv",
124
+ "args": [
125
+ "--directory",
126
+ "/path/to/mcp-server-milvus/src/mcp_server_milvus",
127
+ "run",
128
+ "server.py",
129
+ "--milvus-uri",
130
+ "http://127.0.0.1:19530"
131
+ ]
132
+ }
133
+ }
134
+ }
135
+ ```
136
+
137
+ 3. Restart Cursor or reload the window
138
+
139
+ 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.
140
+
141
+ ### Verifying the Integration
142
+
143
+ To verify that Cursor has successfully integrated with your Milvus MCP server:
144
+
145
+ 1. Open Cursor Settings > Features > MCP
146
+ 2. Check that "Milvus" appears in the list of MCP servers
147
+ 3. Verify that the tools are listed (e.g., milvus_list_collections, milvus_vector_search, etc.)
148
+ 4. If the server is enabled but shows an error, check the Troubleshooting section below
149
+
150
+ ## Available Tools
151
+
152
+ The server provides the following tools:
153
+
154
+ ### Search and Query Operations
155
+
156
+ - `milvus_text_search`: Search for documents using full text search
157
+
158
+ - Parameters:
159
+ - `collection_name`: Name of collection to search
160
+ - `query_text`: Text to search for
161
+ - `limit`: Maximum results (default: 5)
162
+ - `output_fields`: Fields to include in results
163
+ - `drop_ratio`: Proportion of low-frequency terms to ignore (0.0-1.0)
164
+
165
+ - `milvus_vector_search`: Perform vector similarity search on a collection
166
+
167
+ - Parameters:
168
+ - `collection_name`: Name of collection to search
169
+ - `vector`: Query vector
170
+ - `vector_field`: Field containing vectors to search (default: "vector")
171
+ - `limit`: Maximum results (default: 5)
172
+ - `output_fields`: Fields to include in results
173
+ - `metric_type`: Distance metric (COSINE, L2, IP) (default: "COSINE")
174
+
175
+ - `milvus_query`: Query collection using filter expressions
176
+ - Parameters:
177
+ - `collection_name`: Name of collection to query
178
+ - `filter_expr`: Filter expression (e.g. 'age > 20')
179
+ - `output_fields`: Fields to include in results
180
+ - `limit`: Maximum results (default: 10)
181
+
182
+ ### Collection Management
183
+
184
+ - `milvus_list_collections`: List all collections in the database
185
+
186
+ - `milvus_create_collection`: Create a new collection with specified schema
187
+
188
+ - Parameters:
189
+ - `collection_name`: Name for the new collection
190
+ - `collection_schema`: Collection schema definition
191
+ - `index_params`: Optional index parameters
192
+
193
+ - `milvus_load_collection`: Load a collection into memory for search and query
194
+
195
+ - Parameters:
196
+ - `collection_name`: Name of collection to load
197
+ - `replica_number`: Number of replicas (default: 1)
198
+
199
+ - `milvus_release_collection`: Release a collection from memory
200
+ - Parameters:
201
+ - `collection_name`: Name of collection to release
202
+
203
+ ### Data Operations
204
+
205
+ - `milvus_insert_data`: Insert data into a collection
206
+
207
+ - Parameters:
208
+ - `collection_name`: Name of collection
209
+ - `data`: Dictionary mapping field names to lists of values
210
+
211
+ - `milvus_delete_entities`: Delete entities from a collection based on filter expression
212
+ - Parameters:
213
+ - `collection_name`: Name of collection
214
+ - `filter_expr`: Filter expression to select entities to delete
215
+
216
+ ## Environment Variables
217
+
218
+ - `MILVUS_URI`: Milvus server URI (can be set instead of --milvus-uri)
219
+ - `MILVUS_TOKEN`: Optional authentication token
220
+ - `MILVUS_DB`: Database name (defaults to "default")
221
+
222
+ ## Development
223
+
224
+ To run the server directly:
225
+
226
+ ```bash
227
+ uv run server.py --milvus-uri http://localhost:19530
228
+ ```
229
+
230
+ ## Examples
231
+
232
+ ### Using Claude Desktop
233
+
234
+ #### Example 1: Listing Collections
235
+
236
+ ```
237
+ What are the collections I have in my Milvus DB?
238
+ ```
239
+
240
+ Claude will then use MCP to check this information on your Milvus DB.
241
+
242
+ ```
243
+ I'll check what collections are available in your Milvus database.
244
+
245
+ Here are the collections in your Milvus database:
246
+
247
+ 1. rag_demo
248
+ 2. test
249
+ 3. chat_messages
250
+ 4. text_collection
251
+ 5. image_collection
252
+ 6. customized_setup
253
+ 7. streaming_rag_demo
254
+ ```
255
+
256
+ #### Example 2: Searching for Documents
257
+
258
+ ```
259
+ Find documents in my text_collection that mention "machine learning"
260
+ ```
261
+
262
+ Claude will use the full-text search capabilities of Milvus to find relevant documents:
263
+
264
+ ```
265
+ I'll search for documents about machine learning in your text_collection.
266
+
267
+ > View result from milvus-text-search from milvus (local)
268
+
269
+ Here are the documents I found that mention machine learning:
270
+ [Results will appear here based on your actual data]
271
+ ```
272
+
273
+ ### Using Cursor
274
+
275
+ #### Example: Creating a Collection
276
+
277
+ In Cursor, you can ask:
278
+
279
+ ```
280
+ Create a new collection called 'articles' in Milvus with fields for title (string), content (string), and a vector field (128 dimensions)
281
+ ```
282
+
283
+ Cursor will use the MCP server to execute this operation:
284
+
285
+ ```
286
+ I'll create a new collection called 'articles' with the specified fields.
287
+
288
+ Collection 'articles' has been created successfully with the following schema:
289
+ - title: string
290
+ - content: string
291
+ - vector: float vector[128]
292
+ ```
293
+
294
+ ## Troubleshooting
295
+
296
+ ### Common Issues
297
+
298
+ #### Connection Errors
299
+
300
+ If you see errors like "Failed to connect to Milvus server":
301
+
302
+ 1. Verify your Milvus instance is running: `docker ps` (if using Docker)
303
+ 2. Check the URI is correct in your configuration
304
+ 3. Ensure there are no firewall rules blocking the connection
305
+ 4. Try using `127.0.0.1` instead of `localhost` in the URI
306
+
307
+ #### Authentication Issues
308
+
309
+ If you see authentication errors:
310
+
311
+ 1. Verify your `MILVUS_TOKEN` is correct
312
+ 2. Check if your Milvus instance requires authentication
313
+ 3. Ensure you have the correct permissions for the operations you're trying to perform
314
+
315
+ #### Tool Not Found
316
+
317
+ If the MCP tools don't appear in Claude Desktop or Cursor:
318
+
319
+ 1. Restart the application
320
+ 2. Check the server logs for any errors
321
+ 3. Verify the MCP server is running correctly
322
+ 4. Press the refresh button in the MCP settings (for Cursor)
323
+
324
+ ### Getting Help
325
+
326
+ If you continue to experience issues:
327
+
328
+ 1. Check the [GitHub Issues](https://github.com/zilliztech/mcp-server-milvus/issues) for similar problems
329
+ 2. Join the [Zilliz Community Discord](https://discord.gg/zilliz) for support
330
+ 3. File a new issue with detailed information about your problem