azure-cosmos -samples
This repository contains a collection of sample implementations of the MCP across multiple programming languages, all backed by Azure Cosmos DB. These examples demonstrate how to create, query, update, and delete documents using the Azure Cosmos DB SDKs
claude mcp add --transport stdio azurecosmosdb-azure-cosmos-mcp-server-samples npx -y azure-cosmos-mcp-server-samples
How to use
This MCP server collection demonstrates how to build and run Model Context Protocol (MCP) servers that interface with Azure Cosmos DB. The samples provide ready-to-run implementations in JavaScript/TypeScript, Go, Java, and Python, all designed to enable AI agents to interact with Cosmos DB through natural language prompts. The toolkit exposes capabilities such as executing document operations (create, read, update, delete), performing vector search on stored data, and discovering or inferring schema information to help agents understand the data model. To use the server, start the chosen language-specific sample and point your MCP-enabled agent at it; the server will translate natural language queries into Cosmos DB operations and return structured results suitable for downstream reasoning.
How to install
Prerequisites:
- Node.js (for the JavaScript/TypeScript samples) or the corresponding runtime for the language you choose (Go, Java, Python)
- Access to an Azure Cosmos DB account with appropriate permissions
- Git for cloning the repository (optional if you download the samples)
Installation steps:
- Install prerequisites for your language/runtime (see below).
- Clone the repository or download the relevant language sample folders (javascript, golang, java, python).
- Navigate to the sample folder you want to run (e.g., javascript) and install dependencies.
Language-specific examples:
-
JavaScript/TypeScript (Node.js):
- cd javascript
- npm install
- Configure environment variables (see notes)
- npm run start
-
Go:
- cd golang
- go mod download
- go build ./...
- ./your-built-binary
-
Java:
- cd java
- mvn -q -DskipTests package
- java -jar target/your-mcp-server.jar
-
Python:
- cd python
- python -m venv venv
- source venv/bin/activate (Linux/macOS) or venv\Scripts\activate (Windows)
- pip install -r requirements.txt
- python -m your_server_module
Configuring the server typically requires environment variables (see notes). After starting, you should have a running MCP server listening on a localhost port or as configured by the sample.
Additional notes
Environment variables and configuration options:
- COSMOS_ENDPOINT or COSMOS_ACCOUNT_ENDPOINT: The REST endpoint for your Cosmos DB account.
- COSMOS_KEY or COSMOS_PRIMARY_KEY: Access key for the Cosmos DB account.
- COSMOS_DATABASE: Target database name within Cosmos DB.
- COSMOS_CONTAINER: Target container/collection name.
- AZURE_TENANT_ID and AZURE_CLIENT_ID / AZURE_CLIENT_SECRET (if using Entra ID authentication in samples that support it).
- Vector search settings (if applicable): VECTOR_INDEX_NAME, VECTOR_FIELD, and any custom schema metadata.
- For local testing, ensure network access to the Cosmos DB account and that firewall settings allow connections from your running server.
Common issues:
- Invalid Cosmos DB credentials or incorrect endpoint leading to authentication failures.
- Missing required environment variables for the selected runtime.
- Port conflicts or firewall rules preventing access from your agent.
Tips:
- Start with the JavaScript/TypeScript sample if you are new to MCP, as it often has straightforward configuration files and scripts.
- Review sample README in the language folder you choose for exact commands and configuration details.
Related MCP Servers
trpc-agent-go
trpc-agent-go is a powerful Go framework for building intelligent agent systems using large language models (LLMs) and tools.
station
Station is our open-source runtime that lets teams deploy agents on their own infrastructure with full control.
tiger-cli
Tiger CLI is the command-line interface for Tiger Cloud. It includes an MCP server for helping coding agents write production-level Postgres code.
gopls
MCP server for golang projects development: Expand AI Code Agent ability boundary to have a semantic understanding and determinisic information for golang projects.
kubernetes
A Model Context Protocol (MCP) server for the Kubernetes API.
gcp-cost
💰 An MCP server that enables AI assistants to estimate Google Cloud costs, powered by Cloud Billing Catalog API and built with Genkit for Go