Azure Cosmos DB MCP Server
Used for configuration of Azure Cosmos DB credentials through environment variables in a .env file.
Required runtime environment for the MCP server, with version 14 or higher needed to run the Azure Cosmos DB integration.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Azure Cosmos DB MCP Servershow me the top 5 products by sales this week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Azure Cosmos DB MCP Server
What is this? ๐ค
This is a server that lets your LLMs (like Claude) talk directly to your Azure Cosmos DB data! Think of it as a friendly translator that sits between your AI assistant and your database, making sure they can chat securely and efficiently.
Quick Example
You: "What were our top 10 customers last month?"
Claude: *queries your Azure Cosmos DB database and gives you the answer in plain English*Related MCP server: Couchbase MCP Server
How Does It Work? ๐ ๏ธ
This server leverages the Model Context Protocol (MCP), a versatile framework that acts as a universal translator between AI models and databases. Although MCP is built to support any AI model, it is currently accessible as a developer preview in Claude Desktop.
Here's all you need to do:
Set up project (see below)
Add your project details to Claude Desktop's config file
Start chatting with your Azure Cosmos DB data naturally!
What Can It Do? ๐
Run Azure Cosmos DB queries by just asking questions in plain English
Quick Start ๐
Prerequisites
Node.js 14 or higher
Azure Cosmos DB NOSQL account or Azure Cosmos DB Emulator
Claude Desktop
Set up project
Obtain Azure Cosmos DB NOSQL account URI and the KEY from the keys section and create an '.env' file with the below key and replace the values
COSMOSDB_URI=
COSMOSDB_KEY= Getting Started
Install Dependencies
Run the following command in the root folder to install all necessary dependencies:npm installBuild the Project
Compile the project by running:npm run buildStart the Server
Navigate to thedistfolder and start the server:npm startConfirmation Message
You should see the following message:Azure Cosmos DB Server running on stdio
Add your project details to Claude Destkop's config file
Open Claude Desktop and Navigate to File -> Settings -> Developer -> Edit Config and open the claude_desktop_config file and replace with the values below,
{
"mcpServers": {
"cosmosdb": {
"command": "node",
"args": [ "C:/Cosmos/azure-cosmos-mcp/dist/index.js" ] // Your Path for the Azure Cosmos DB MCP server file,
"env": {
"COSMOSDB_URI": "Your Cosmos DB Account URI",
"COSMOSDB_KEY": "Your Cosmos DB KEY"
}
}
}
}
You should now have successfully configured the MCP server for Azure Cosmos DB with Claude Desktop. This setup allows you to seamlessly interact with Azure Cosmos DB through the MCP server as shown below.
https://github.com/user-attachments/assets/ae3a14f3-9ca1-415d-8645-1c8367fd6943
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Trademarks
This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.
Available Tools
4 toolsget_itemC
Retrieves an item from a Azure Cosmos DB container by its ID
| Name | Required | Description | Default |
|---|---|---|---|
| containerName | Yes | Name of the container | |
| id | Yes | ID of the item to retrieve |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a retrieval operation but doesn't mention error handling (e.g., what happens if container doesn't exist or ID is invalid), authentication requirements, rate limits, or whether this is a read-only operation. The description is minimal and lacks important behavioral context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that gets straight to the point with zero waste. It's appropriately sized for a simple retrieval operation and front-loads the essential information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a database retrieval tool with no annotations and no output schema, the description is insufficient. It doesn't explain what format the item is returned in, error conditions, authentication needs, or how this differs from sibling tools. The description should provide more context given the complexity of database operations.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents both parameters ('containerName' and 'id'). The description adds minimal value by mentioning these parameters in context ('by its ID'), but doesn't provide additional semantics beyond what the schema already states. Baseline 3 is appropriate when schema does the heavy lifting.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Retrieves') and resource ('an item from a Azure Cosmos DB container'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'query_container' which might also retrieve items, so it lacks specific sibling distinction.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'query_container' or 'update_item'. It mentions retrieving by ID but doesn't explain when ID-based retrieval is preferred over query-based approaches or what happens if the ID doesn't exist.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
put_itemC
Inserts or replaces an item in a Azure Cosmos DB container
| Name | Required | Description | Default |
|---|---|---|---|
| containerName | Yes | Name of the container | |
| item | Yes | Item to insert into the container |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'inserts or replaces', hinting at mutation, but fails to detail critical aspects like required permissions, whether operations are idempotent, error handling for missing containers, or rate limits. This leaves significant gaps for safe and effective tool invocation.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, direct sentence that efficiently conveys the core action without unnecessary words. It is front-loaded with the key information, making it easy to parse quickly, which is ideal for concise tool descriptions.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a database mutation tool with no annotations and no output schema, the description is insufficient. It lacks details on behavioral traits (e.g., side effects, error responses), usage context relative to siblings, and return values, making it incomplete for reliable agent operation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 100% description coverage, clearly documenting both parameters ('containerName' and 'item'). The description adds no additional semantic context beyond what the schema provides, such as format examples or constraints, so it meets the baseline for adequate but not enhanced parameter understanding.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Inserts or replaces') and the target resource ('an item in a Azure Cosmos DB container'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'update_item' (which might handle partial updates) or 'get_item' (which retrieves), leaving room for ambiguity in tool selection.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'update_item' or 'query_container'. It lacks context such as whether this is for new items only, overwriting existing ones, or handling conflicts, which could lead to misuse by an AI agent.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
query_containerC
Queries a Azure Cosmos DB container using SQL-like syntax
| Name | Required | Description | Default |
|---|---|---|---|
| containerName | Yes | Name of the container | |
| parameters | No | Query parameters | |
| query | Yes | SQL query string |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool queries a container but doesn't describe what happens on executionโsuch as whether it's read-only, if it affects data, potential rate limits, error conditions, or the format of results. For a query tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded with the core action and resource, making it easy to parse. Every part of the sentence contributes essential information, earning its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of querying a database, lack of annotations, and no output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., result sets, error formats), behavioral aspects like safety or performance, or how to interpret parameters effectively. For a tool with three parameters and no structured behavioral hints, more context is needed.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all three parameters (containerName, parameters, query) with basic descriptions. The description adds marginal value by implying the query uses SQL-like syntax, but it doesn't provide additional details like syntax examples, parameter usage, or constraints beyond what the schema offers. Baseline 3 is appropriate when the schema handles most documentation.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('queries') and target resource ('Azure Cosmos DB container'), and specifies the method ('using SQL-like syntax'). It distinguishes from siblings like get_item, put_item, and update_item by focusing on querying rather than direct item operations. However, it doesn't explicitly contrast with siblings beyond the general verb difference.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives. It doesn't mention scenarios where query_container is preferred over get_item (e.g., for complex filtering or multiple items), nor does it specify prerequisites like container existence or permissions. Usage is implied by the action but not explicitly defined.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
update_itemC
Updates specific attributes of an item in a Azure Cosmos DB container
| Name | Required | Description | Default |
|---|---|---|---|
| containerName | Yes | Name of the container | |
| id | Yes | ID of the item to update | |
| updates | Yes | The updated attributes of the item |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries full burden but only states it updates attributes without disclosing key behavioral traits. It doesn't mention whether this is a partial or full update, if it requires specific permissions, what happens on failure, or if there are rate limits. The description is minimal and lacks critical operational context for a mutation tool.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is a single, efficient sentence with zero waste. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word contributes directly to the tool's purpose without unnecessary elaboration.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the complexity of a database update operation with no annotations and no output schema, the description is insufficient. It doesn't explain what the tool returns, error conditions, or behavioral nuances (e.g., concurrency, atomicity). For a mutation tool in a database context, this leaves significant gaps in understanding.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents all three parameters (containerName, id, updates) adequately. The description adds no additional meaning beyond implying 'updates' modifies attributes, which is redundant with the schema. This meets the baseline for high schema coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action ('Updates') and resource ('specific attributes of an item in a Azure Cosmos DB container'), making the purpose understandable. It distinguishes from siblings like 'get_item' (read) and 'put_item' (create/replace), but doesn't explicitly differentiate from 'query_container' (which likely searches rather than updates).
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides no guidance on when to use this tool versus alternatives like 'put_item' or 'query_container'. It mentions updating attributes but doesn't specify prerequisites (e.g., item must exist) or exclusions (e.g., not for bulk updates), leaving the agent to infer usage from context alone.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
Each tool has a clearly distinct purpose: get_item retrieves, put_item inserts/replaces, query_container queries, and update_item modifies attributes. There is no overlap in functionality, making tool selection straightforward for an agent.
All tools follow a consistent verb_noun pattern (get_item, put_item, query_container, update_item) with clear actions and targets. The naming is uniform and predictable throughout the set.
Four tools is reasonable for a database server, covering core operations (CRUD and querying). However, it feels slightly thin as it lacks tools for container/collection management (e.g., create_container, list_containers), which are common in database APIs.
The tools provide good coverage for item-level operations (create, read, update, query), but there are minor gaps in container-level management (e.g., creating or listing containers) and deletion operations (no delete_item). Agents can work around this by using put_item with deletions or querying, but it's not ideal.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
- mcpOAuthcom.gibsonai
GibsonAI MCP server: manage your databases with natural language
MCP server unifying ERPs, CRMs, APIs and knowledge base for Claude, ChatGPT and Gemini.
The Ramp MCP server enables users to securely connect Ramp with AI assistants like ChatGPT and Claude to query financial data and take actions using natural language. It transforms Ramp's developer API into a SQL interface that LLMs can query, allowing admins to analyze spend trends, identify cost savings, and run complex SQL analyses on comprehensive datasets (transactions, purchase orders, vendors, users), while all users can manage cards, view transactions, request reimbursements, and get expense policy answers.
The Grafbase MCP server sits in front of a GraphQL API and exposes an MCP protocol-compliant interface that allows AI agents and LLMs to explore and query GraphQL APIs using natural language. It provides tools to search schemas, introspect types and fields, and execute GraphQL queries while minimizing context bloat by returning only relevant schema subsets, with built-in support for authentication, authorization, and configurable access control.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceA server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.1
- AlicenseNot gradedqualityDmaintenanceA server that enables natural language interactions with Couchbase databases through the Model Context Protocol, allowing users to perform SQL++ queries on Couchbase Capella clusters using conversational commands.1MIT
- AlicenseBqualityDmaintenanceA server that enables LLMs like Claude to query AWS DynamoDB databases through natural language requests, supporting table management, data querying, and schema analysis.7292MIT
- AlicenseNot gradedqualityDmaintenanceNode.js server that connects to Azure Cosmos DB NoSQL database, allowing users to query products and orders through an AI Assistant in a NextJS frontend application.1MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/robinong79/mcp-cosmos'
If you have feedback or need assistance with the MCP directory API, please join our Discord server