⚠️ Private Preview - This is a pre-release version for testing and feedback purposes only.
Azure Cosmos DB Shell is a powerful command-line interface for Azure Cosmos DB that enables you to interact with your databases using intuitive bash-like commands. It features optional MCP (Model Context Protocol) server support for AI-powered automation.
- Bash-like Navigation - Use familiar
lsandcdcommands to explore databases and containers - Full CRUD Operations - Create, read, query, update, and delete resources with simple commands
- Scripting Support - Write scripts with variables, control flow, and custom functions
- Pipeline Composition - Chain commands using pipes (
|) with JSON data flow - MCP Server Integration - Enable AI assistants to interact with your Cosmos DB resources
- VS Code Integration - Launch directly from the Azure extension sidebar
- Quick Start
- Installation
- MCP Server Setup
- Usage Guide
- Documentation
- Security
- Troubleshooting
- Feedback & Support
- Download the VS Code extension and Cosmos Shell binaries
- Install the extension and configure the shell path
- Connect to your Azure account in VS Code
- Right-click a Cosmos DB resource and select "Launch Cosmos Shell"
- Start exploring with
ls,cd, andquerycommands!
Download from the GitHub Releases page:
| Component | Windows | macOS | Linux |
|---|---|---|---|
| VS Code Extension | vscode-cosmosdb-0.31.1.vsix | ⬅️ Same file | ⬅️ Same file |
| Cosmos Shell | cosmos_shell_win-x64.zip | cosmos_shell_osx-x64.zip | cosmos_shell_linux-x64.zip |
| Cosmos Shell (ARM) | — | — | cosmos_shell_linux-arm64.zip |
- Download
vscode-cosmosdb-0.31.1.vsixfor your OS from the Downloads section - Open VS Code
- Open the Extensions sidebar (
Ctrl+Shift+X/Cmd+Shift+X) - Click the
...menu (top-right) → Install from VSIX... - Select the downloaded
.vsixfile (or drag & drop it into the Extensions sidebar) - Restart VS Code
- Download
CosmosShell.zipfor your platform from Downloads - Extract the archive
- Navigate to the subfolder for your platform:
win-x64for Windowsosx-x64for macOSlinux-x64for Linux
Linux:
chmod +x "/path/to/CosmosShell"macOS:
chmod +x "/path/to/CosmosShell"
xattr -d com.apple.quarantine "/path/to/CosmosShell"
⚠️ Thexattrcommand removes the quarantine flag that macOS applies to downloaded files.
- Open VS Code Settings (
Ctrl+,/Cmd+,) - Search for
cosmosDB.shell.path - Click "Edit in settings.json"
- Add the full path to your CosmosShell executable:
Windows:
{
"cosmosDB.shell.path": "C:\\path\\to\\CosmosShell.exe"
}macOS/Linux:
{
"cosmosDB.shell.path": "/path/to/CosmosShell"
}The MCP (Model Context Protocol) server allows AI assistants and compatible clients to interact with Cosmos DB through the shell.
- Open VS Code Settings
- Set
cosmosDB.shell.MCP.enabledtotrue - (Optional) Configure
cosmosDB.shell.MCP.port(default:6128)
- Open Settings and search for
chat.mcp.autostart - Select
newAndOutdatedto auto-start MCP servers
Add .vscode/mcp.json to your workspace:
{
"servers": {
"localCosmosShellServer": {
"url": "http://localhost:6128"
}
}
}Or use Command Palette → MCP: Add Server... → HTTP → http://localhost:6128
- Launch Cosmos Shell using the "Launch Cosmos Shell" command
- If auto-start is disabled:
- Open Command Palette (
Ctrl+Shift+P/Cmd+Shift+P) - Run MCP: List Servers
- Select
localCosmosShellServer→ Start Server
- Open Command Palette (
Check the Output tab in VS Code for server startup messages.
⚠️ See Security Considerations before enabling MCP.
- Open VS Code and the Azure sidebar
- Sign in to your Azure account
- Expand your subscription → Azure Cosmos DB
- Right-click a database or container → "Launch Cosmos Shell"
Or use Command Palette → NoSQL: Launch Cosmos Shell
# Connect to an endpoint
connect "https://your-account.documents.azure.com:443/"
# List databases
ls
# Enter a database
cd myDatabase
# List containers
ls
# Enter a container
cd myContainer
# List items (documents)
ls
# Go up one level
cd ..
# Return to connected state
cd# Query items
query "SELECT * FROM c WHERE c.status = 'active'"
# Create a database
mkdb newDatabase
# Create a container
mkcon newContainer /partitionKey
# Create items
echo '[{"id":"1","pk":"a"},{"id":"2","pk":"b"}]' | mkitem
# Delete an item
rm itemId
# View item details
print itemId partitionKey# Enter the first database
ls | cd $.[0]
# Get the first item's ID
ls -m 1 | echo $.items[0].id
# Chain operations
query "SELECT * FROM c" | echo $.Documents[0]# List all commands
help
# Get help for a specific command
help query| Document | Description |
|---|---|
| Installation Guide | Detailed installation instructions |
| MCP Server Guide | Complete MCP setup and configuration |
| Command Reference | Full list of available commands |
| Scripting Guide | Variables, control flow, and custom functions |
| Security Guide | Security considerations and best practices |
⚠️ Read the full security guide before enabling MCP.
Key points:
- MCP server runs locally and executes commands with your user permissions
- Connected MCP clients can create, read, update, and delete resources
- Your MCP client may transmit data to remote LLM services
- Keep MCP bound to localhost and restrict firewall access
- Prefer Azure AD/managed identity over account keys
- Review and approve tool requests in the MCP client UI
- Verify
cosmosDB.shell.pathpoints to the correct executable - On macOS: ensure you ran the
xattrcommand to remove quarantine - On Linux/macOS: ensure the file has execute permissions (
chmod +x)
- Sign out and sign back in to Azure in VS Code
- Check that your account has access to the Cosmos DB resource
- Try using a connection string instead of Azure AD
- Ensure Cosmos Shell is running (use "Launch Cosmos Shell" command)
- Verify the port matches your
cosmosDB.shell.MCP.portsetting - Check the Output panel for error messages
- Ensure no firewall is blocking localhost:6128
- Type
helpto see available commands - Check you're in the correct scope (connected/database/container)
This is a private preview. Your feedback helps us improve!
- Report Issues: Create an issue
- Feature Requests: Submit feedback
- Questions: Reach out to the Cosmos DB team
This software is provided under a preview license for testing purposes only. See LICENSE for details.
Azure Cosmos DB Shell • Private Preview