MCP server for Milvus vector database operations
This Milvus MCP server has 12 well-named tools with consistent verb-first naming (list_, get_, search_, query_, count_, create_, insert_, delete_) and structured input schemas. However, the server suffers from significant gaps in parameter descriptions, missing output schema documentation, and weak error handling guidance. Most tools have brief, generic descriptions that lack context about when to use them versus similar tools (e.g., search_collection vs vector_search vs hybrid_search). Several parameters lack descriptions entirely or are too generic. Output structures are not documented, forcing LLMs to infer result shapes. Error handling is basic, exceptions are caught and wrapped in ValueError but provide minimal recovery guidance. The code shows no permission gating, no audit logging, and secrets (Milvus URI/token) are passed as parameters rather than injected server-side. Overall, this is a functional but mediocre implementation that lands squarely in the C/D range.
Count entities in a collection, optionally filtered.
Create a new collection with the specified schema.
Delete entities from a collection based on filter expression.
Get detailed information about a collection.
Get statistics about a collection.
Perform hybrid search combining vector similarity and attribute filtering.
Insert data into a collection.
Output schemas not documented for any tool. LLMs cannot infer result structure (e.g., does search_collection return {results: [...], count: int} or just a flat array?). This forces agents to guess at downstream field names and risks broken tool chains.
Parameter descriptions are missing or too generic. Examples: 'schema' param in create_collection says 'Collection schema definition' (23 chars) but does not explain required/optional fields, valid data types, or example structure. 'data' param in insert_data says 'Dictionary mapping field names to lists of values' (49 chars) but does not clarify if all fields are required, what field names are valid, or data type constraints.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-22 | D | 56 | 2026-07-28+ | v2 |
| 2026-03-09 | F | 22 | - | v1 |
List all collections in the database.
Perform vector similarity search with multiple query vectors.
Query collection using filter expressions.
Perform full text search on a collection.
Perform vector similarity search on a collection.
Credentials (uri, token) exposed as tool parameters instead of server-side secret injection. Secrets will appear in agent logs, traces, and prompt history. MilvusConnector.__init__ should read uri and token from environment variables or a secure config, not from tool parameters.
No permission gating on destructive tools. delete_entities will delete without checking if the calling agent/user has authority to do so. add a permission check: 'if not has_permission(user, 'write:milvus'): raise PermissionError(...)' before execution.
Error handling provides no recovery guidance. All exceptions raise ValueError with a brief message (e.g., 'Failed to list collections: {str(e)}'). LLMs cannot determine if the error is retryable, if they should ask the user for clarification, or if it is unrecoverable. Add error classification: retryable (e.g., timeout), user-fixable (e.g., invalid collection name), fatal (e.g., authentication failure).
No pagination support for list-returning tools (list_collections, search_collection, query_collection, multi_vector_search). Large result sets blow context windows and degrade LLM reasoning. Add page/offset and limit params, and return a total_count or next_cursor in the response.
No confirmation or dry-run for destructive operations. delete_entities immediately deletes without asking the agent to confirm. For a DELETE tool, add a 'dry_run' parameter (default true) so agents can validate before committing, or require explicit confirm=true.
Ambiguous tool naming creates decision burden for LLM. Three search tools exist (search_collection, vector_search, hybrid_search) but descriptions do not clearly distinguish when to use each. search_collection does full-text search on sparse field, vector_search does vector similarity, hybrid_search combines both, but the docs do not say this upfront. Add: 'Use search_collection for keyword/text queries. Use vector_search for embedding-based similarity. Use hybrid_search when you need both keyword and vector filtering in one call.'
No validation examples in parameter descriptions. The metric_type param in vector_search lists '(COSINE, L2, IP)' inline but does not mark it as an enum constraint in the JSON Schema (if enum is missing from schema, score that schema 0). Similarly, drop_ratio in search_collection says 'Proportion of low-frequency terms to ignore (0.0-1.0)' but has no minValue/maxValue constraints in schema.
No audit logging. Tool calls are not logged with caller identity, timestamp, parameters, or outcome. For compliance and debugging, add: logging.info(f'User={user_id} called {tool_name} with {params} at {timestamp}, result={outcome}').
No input validation or sanitization. filter_expr params in query_collection, count_entities, vector_search, hybrid_search, and multi_vector_search accept raw strings. If these are passed to Milvus without validation, they could be exploited for injection attacks (e.g., 'pk == 1; DROP COLLECTION' passed as filter_expr). Add validation: reject filter_expr with SQL keywords, validate syntax against Milvus filter expression grammar, or pre-escape dangerous characters.