Skip to main content
Glama
robinong79

Azure Cosmos DB MCP Server

by robinong79

Azure Cosmos DB MCP サーバー

これは何ですか?🤔

これは、Claude のような LLM が 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

どのように機能するのですか?🛠️

このサーバーは、AIモデルとデータベース間の汎用的な翻訳機能を持つ汎用フレームワークであるModel Context Protocol(MCP)を活用しています。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)への同意が必要です。CLAは、貢献者がその貢献を利用する権利を有し、実際にその権利をMicrosoftに付与することを宣言するものです。詳細については、 https://cla.opensource.microsoft.comをご覧ください。

プルリクエストを送信すると、CLAボットがCLAが必要かどうかを自動的に判断し、適切な装飾(ステータス確認、コメントなど)をPRに施します。ボットの指示に従うだけで、CLAを使用しているすべてのリポジトリでこの操作を一度だけ実行すれば完了です。

このプロジェクトは、Microsoft オープンソース行動規範を採用しています。詳細については、行動規範に関する FAQ をご覧ください。ご質問やご意見がございましたら、 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