Skip to main content
Glama
robinong79

Azure Cosmos DB MCP Server

by robinong79

Azure Cosmos DB MCP 服务器

这是什么?🤔

这是一个服务器,可以让你的法学硕士(比如 Claude)直接与你的 Azure Cosmos DB 数据对话!你可以把它想象成一个友好的翻译器,位于你的 AI 助手和数据库之间,确保它们能够安全高效地进行对话。

快速示例

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

它是如何工作的?🛠️

该服务器利用了模型上下文协议 (MCP),这是一个多功能框架,可充当 AI 模型和数据库之间的通用转换器。虽然 MCP 旨在支持任何 AI 模型,但目前它仍可在 Claude Desktop 中作为开发者预览版使用。

您需要做的就是:

  1. 设置项目(见下文)

  2. 将您的项目详细信息添加到 Claude Desktop 的配置文件中

  3. 开始自然地与您的 Azure Cosmos DB 数据聊天!

它能做什么?📊

  • 只需用简单的英语提问即可运行 Azure Cosmos DB 查询

快速入门🚀

先决条件

  • Node.js 14 或更高版本

  • Azure Cosmos DB NOSQL 帐户或 Azure Cosmos DB 模拟器

  • 克劳德桌面

设置项目

  • 从密钥部分获取 Azure Cosmos DB NOSQL 帐户 URI 和密钥,并使用以下密钥创建一个“.env”文件并替换值

COSMOSDB_URI=
COSMOSDB_KEY= 

入门

  1. 安装依赖项
    在根文件夹中运行以下命令来安装所有必要的依赖项:

    npm install
  2. 构建项目
    通过运行以下命令编译项目:

    npm run build
  3. 启动服务器
    导航到dist文件夹并启动服务器:

    npm start
  4. 确认消息
    您应该会看到以下消息:

    Azure Cosmos DB Server running on stdio

将您的项目详细信息添加到 Claude Destkop 的配置文件中

打开 Claude Desktop 并导航至文件 -> 设置 -> 开发人员 -> 编辑配置,然后打开claude_desktop_config文件并将其替换为以下值,

{
  "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"
      }
    }
  }
}

现在,您应该已成功使用 Claude Desktop 为 Azure Cosmos DB 配置了 MCP 服务器。此设置允许您通过 MCP 服务器与 Azure Cosmos DB 无缝交互,如下所示。

https://github.com/user-attachments/assets/ae3a14f3-9ca1-415d-8645-1c8367fd6943

贡献

该项目欢迎您的贡献和建议。大多数贡献都要求您同意一份贡献者许可协议 (CLA),该协议声明您有权并确实授予我们使用您贡献的权利。详情请访问https://cla.opensource.microsoft.com 。

当您提交拉取请求时,CLA 机器人会自动判断您是否需要提供 CLA,并适当地修饰 PR(例如,状态检查、评论)。只需按照机器人提供的说明操作即可。您只需在所有使用我们 CLA 的仓库中执行一次此操作。

本项目已采用Microsoft 开源行为准则。更多信息请参阅行为准则常见问题解答,或联系opencode@microsoft.com提出其他问题或意见。

商标

本项目可能包含项目、产品或服务的商标或徽标。Microsoft 商标或徽标的授权使用须遵守Microsoft 的商标和品牌指南。在本项目的修改版本中使用 Microsoft 商标或徽标不得引起混淆或暗示 Microsoft 的赞助。任何第三方商标或徽标的使用均须遵守该第三方的政策。

Available Tools

4 tools
get_itemC

Retrieves an item from a Azure Cosmos DB container by its ID

ParametersJSON Schema
NameRequiredDescriptionDefault
containerNameYesName of the container
idYesID of the item to retrieve

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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

ParametersJSON Schema
NameRequiredDescriptionDefault
containerNameYesName of the container
itemYesItem to insert into the container

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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

ParametersJSON Schema
NameRequiredDescriptionDefault
containerNameYesName of the container
parametersNoQuery parameters
queryYesSQL query string

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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

ParametersJSON Schema
NameRequiredDescriptionDefault
containerNameYesName of the container
idYesID of the item to update
updatesYesThe updated attributes of the item

TDQS

C2.9/5.0
Behavior2/5

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.

Conciseness5/5

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.

Completeness2/5

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.

Parameters3/5

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.

Purpose4/5

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.

Usage Guidelines2/5

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.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 4 tool updatesv1.0.0
    • First observedget_item
    • First observedput_item
    • First observedquery_container
    • First observedupdate_item

TDQS

B3.4/5.0

Scored across 4 tools

Disambiguation5/5

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.

Naming Consistency5/5

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.

Tool Count4/5

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.

Completeness4/5

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

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

  • 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.

  • Text-to-SQL MCP server: read-only queries on PostgreSQL, MySQL and SQL Server with your real schema

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    A server that enables interaction with PostgreSQL, MySQL, MariaDB, or SQLite databases through Claude Desktop using natural language queries.
    1
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    A 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.
    1
    MIT