MCP CosmosDB
Server Configuration
Describes the environment variables required to run the server.
| Name | Required | Description | Default |
|---|---|---|---|
| COSMOS_CONNECTIONS | No | An inline JSON string containing an array of connection configurations for multi-connection support. | |
| COSMOS_DATABASE_ID | No | The Azure CosmosDB database ID used for legacy single-connection mode. | |
| DB_ALLOW_MODIFICATIONS | No | Enables or disables write operations (create, update, delete, upsert). Set to 'true' to allow modifications. Defaults to 'false'. | false |
| COSMOS_CONNECTIONS_FILE | No | Path to an external JSON file containing an array of connection configurations. This is the highest priority configuration method. | |
| COSMOS_CONNECTION_STRING | No | The Azure CosmosDB connection string used for legacy single-connection mode. | |
| COSMOS_MAX_RETRY_WAIT_TIME | No | Optional configuration to increase the maximum retry wait time for CosmosDB requests. |
Capabilities
Features and capabilities supported by this server
| Capability | Details |
|---|---|
| tools | {} |
Tools
Functions exposed to the LLM to take actions
| Name | Description |
|---|---|
| mcp_list_connectionsA | List all available CosmosDB connections configured in this MCP server. Use this to discover which connection_id values you can use. Each connection points to a different CosmosDB account/database. |
| mcp_list_databasesA | List all databases in the CosmosDB account. Use this to discover available databases before querying containers. Returns database IDs, timestamps, and ETags. |
| mcp_list_containersA | List all containers in the connected CosmosDB database. Use this to discover available containers and their partition key configurations before querying data. Returns container IDs, partition key paths, and indexing policies. |
| mcp_get_container_definitionA | Get detailed configuration of a specific container including partition key, indexing policy, and throughput settings. Use this to understand the container structure before writing queries. Example: mcp_get_container_definition({container_id: 'users', connection_id: 'athlete'}) |
| mcp_get_container_statsA | Get statistical information about a container including document count, estimated size, and partition key distribution. Use this for capacity planning and performance analysis. Example: mcp_get_container_stats({container_id: 'orders', sample_size: 500}) |
| mcp_cosmos_queryA | Execute a CosmosDB SQL query against a container. Use this for complex queries with JOINs, aggregations, or custom SQL syntax. ⚠️ IMPORTANT - AVOID SELECT *:
COSMOSDB SQL SYNTAX EXAMPLES:
PARAMETERS: Use @paramName syntax and provide values in the 'parameters' object. Example: query="SELECT TOP 10 c.id, c.type FROM c WHERE c.type = @type", parameters={type: "order"} |
| mcp_get_documentsA | Get documents from a container with simple filters and ordering. Use this for basic queries without complex SQL syntax. FOR COMPLEX QUERIES: Use mcp_cosmos_query instead. THIS TOOL IS BEST FOR:
Example: mcp_get_documents({container_id: 'users', limit: 10, order_by: '_ts', order_direction: 'DESC', connection_id: 'athlete'}) Example: mcp_get_documents({container_id: 'users', limit: 50, filter_conditions: {status: 'active'}}) |
| mcp_get_document_by_idA | Get a single document by its ID and partition key. This is the most efficient way to retrieve a specific document. IMPORTANT: Both document_id and partition_key are required for a point read in CosmosDB. The partition_key type must match your container's partition key type. Example: mcp_get_document_by_id({container_id: 'users', document_id: 'user-123', partition_key: 'user-123', connection_id: 'athlete'}) |
| mcp_analyze_schemaA | Analyze the schema/structure of documents in a container. Samples documents to discover field names, data types, and frequency. Use this to understand the data model before writing queries. |
| mcp_create_documentB | Create a new document in a CosmosDB container. REQUIREMENTS:
Example: mcp_create_document({ container_id: 'users', document: {id: 'user-456', email: 'test@example.com', status: 'active'}, partition_key: 'user-456', connection_id: 'athlete' }) |
| mcp_update_documentA | Update (replace) an existing document in a CosmosDB container. NOTE: This performs a full document replacement. Include ALL fields you want to keep. For partial updates, first get the document with mcp_get_document_by_id, modify it, then update. Example: mcp_update_document({ container_id: 'users', document_id: 'user-456', document: {id: 'user-456', email: 'new@example.com', status: 'inactive'}, partition_key: 'user-456', connection_id: 'athlete' }) |
| mcp_delete_documentA | Delete a document from a CosmosDB container. WARNING: This operation is irreversible. The document will be permanently deleted. Example: mcp_delete_document({ container_id: 'users', document_id: 'user-456', partition_key: 'user-456', connection_id: 'athlete' }) |
| mcp_upsert_documentA | Create or update a document in a CosmosDB container (upsert operation). If a document with the same id and partition key exists, it will be replaced. If it doesn't exist, a new document will be created. Example: mcp_upsert_document({ container_id: 'users', document: {id: 'user-456', email: 'test@example.com', lastUpdated: '2024-01-15'}, partition_key: 'user-456', connection_id: 'athlete' }) |
Prompts
Interactive templates invoked by user choice
| Name | Description |
|---|---|
No prompts | |
Resources
Contextual data attached and managed by the client
| Name | Description |
|---|---|
No resources | |
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/hendrickcastro/MCPCosmosDB'
If you have feedback or need assistance with the MCP directory API, please join our Discord server