mcp_cosmosdb_go
Build AI Tooling in Go with the MCP SDK – Connecting AI Apps to Azure Cosmos DB
claude mcp add --transport stdio abhirockzz-mcp_cosmosdb_go ./mcp_azure_cosmosdb_go \ --env PORT="9090" \ --env COSMOSDB_MCP_SERVER_MODE="http"
How to use
This MCP server provides a Go-based interface to Azure Cosmos DB by combining the Azure Go SDK with the MCP Go SDK. It exposes a set of capabilities including listing databases, creating databases, listing containers, reading container metadata, creating containers with a partition key, adding items to containers, reading items, executing queries, and batch-creating items via transactional batches. You can run the server locally in HTTP mode to expose a standard RESTful endpoint, or in stdio mode to connect via an MCP tool that communicates through standard input/output.
To use the HTTP server, start the binary with the appropriate environment to enable the HTTP transport (for example, http on port 9090). Then connect with your MCP client tool (such as VS Code MCP integration or Copilot CLI) using the provided HTTP URL (http://localhost:9090). The server authenticates with Azure using DefaultAzureCredential, so you can rely on environment-based credentials, Azure CLI login, or managed identities depending on your setup. If you are using the vNext emulator, ensure it is running and accessible at its default ports as documented in the README.
How to install
Prerequisites:
- Go 1.20+ (or latest stable)
- Git
- Access to Azure Cosmos DB or the vNext emulator
Step-by-step installation:
-
Install Go from the official website or your system package manager.
-
Clone the repository: git clone https://github.com/abhirockzz/mcp_cosmosdb_go cd mcp_cosmosdb_go
-
Build the MCP server binary: go build -o mcp_azure_cosmosdb_go main.go
-
Run the server in HTTP mode (default on port 9090): export COSMOSDB_MCP_SERVER_MODE=http export PORT=9090 ./mcp_azure_cosmosdb_go
-
Optional: run the vNext Cosmos DB emulator in a Docker container if you want to test offline: docker run -p 8081:8081 -p 1234:1234 mcr.microsoft.com/cosmosdb/linux/azure-cosmos-emulator:vnext-preview
-
Configure your MCP client (e.g., VS Code MCP extension) with an HTTP server entry pointing to http://localhost:9090 as shown in the README, or use the stdio mode by configuring the appropriate stdio server entry.
Additional notes
- The server uses DefaultAzureCredential for authentication, so ensure your environment has suitable credentials (Azure CLI login, Azure Developer CLI, or managed identity when running in Azure).
- If you intend to use the vNext emulator, start it prior to running the MCP server and ensure the emulator ports are accessible.
- Two run modes are supported: HTTP server for standard MCP clients and stdio mode for direct MCP tooling integration.
- When using the emulator, you may need to adjust Cosmos DB account endpoints and keys accordingly and ensure network access from the Go binary.
- Always validate results when running queries or batch operations, as with other MCP implementations, to avoid unintended data changes.
Related MCP Servers
weather
A lightweight Model Context Protocol (MCP) server that enables AI assistants like Claude to retrieve and interpret real-time weather data. Discuss on Hacker News:
sandbox
A Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.
github-brain
An experimental GitHub MCP server with local database.
mcp-tts
MCP Server for Text to Speech
tasker
An MCP server for Android's Tasker automation app.
kai
An MCP Server for Kubernetes