Azure Cosmos DB MCP Server - Web Testing Guide
May 29, 2026 ยท View on GitHub
This guide shows you how to test your Azure Cosmos DB MCP Server using the secure web interface with enterprise-grade Microsoft Entra authentication.
๐ Web Interface Overview
The Azure Cosmos DB MCP Toolkit includes an enhanced web interface that provides:
- โ Secure Microsoft Entra Authentication - No token copy/paste required
- โ Interactive MCP Tool Testing - Forms for all Cosmos DB operations
- โ Real-time JSON-RPC Calls - Direct protocol testing
- โ Auto-generated cURL Examples - For automation and scripting
- โ
Role-based Security - Validates
Mcp.Tool.Executorpermissions - โ Enterprise Compliance - Uses Microsoft Authentication Library (MSAL)
๐ฅ Getting Started
Option 1: Use the Deployed Web Interface (Recommended)
The web interface is automatically deployed with your Container App:
- Find your Container App URL from deployment output or
scripts/deployment-info.json - Open in browser:
https://your-container-app-url.azurecontainerapps.io/ - Start testing - No additional setup required!
Example:
https://mcp-toolkit-app.icywave-532ba7dd.westus2.azurecontainerapps.io/
Option 2: Test Locally (Development)
If you want to test against your local development server:
# Clone the repository
git clone https://github.com/AzureCosmosDB/MCPToolKit.git
cd MCPToolKit
# Run the application locally
cd src/AzureCosmosDB.MCP.Toolkit
dotnet run
# Open browser to local URL
# http://localhost:8080/
Option 3: Standalone HTML File
To use the web interface without running the full application:
# Copy the HTML file from the repository
cp src/AzureCosmosDB.MCP.Toolkit/wwwroot/index.html cosmos-mcp-client.html
# Start a simple HTTP server
python -m http.server 3000
# Open browser
# http://localhost:3000/cosmos-mcp-client.html
๐ Authentication Setup
Get Your Client ID
Your Client ID is created automatically during deployment. Find it in:
- From deployment output: Check
scripts/deployment-info.json - From Azure Portal: Go to Azure Active Directory > App Registrations
- From Azure CLI:
az ad app list --display-name "*cosmos*" --query "[].{Name:displayName, ClientId:appId}"
Configure the Web Interface
- Enter Client ID: Paste your Entra ID app's Client ID
- Tenant ID: Leave empty to use your default tenant (or specify if needed)
- Server URL: Your deployed MCP server URL (from deployment-info.json)
Secure Login Process
- Click "๐ Sign In with Microsoft Entra"
- Microsoft login popup appears - standard OAuth flow
- Use your corporate/personal Microsoft account
- Grant permissions if prompted
- Success: Shows โ Authenticated with your user info
๐งช Testing MCP Tools
Available Cosmos DB Tools
list_databases- List all databases in your Cosmos DB accountlist_collections- List containers in a specific databaseget_recent_documents- Get recent documents from a containerfind_document_by_id- Find a specific document by IDtext_search- Full-text search within documentsvector_search- Semantic search using AI embeddingshybrid_search- Hybrid search combining vector similarity and full-text keyword search using RRF rankingget_approximate_schema- Analyze document structure
Interactive Testing
- List Tools: Click to see all available MCP tools
- Expand "Test Cosmos DB Tools" section
- Fill in parameters:
- Database ID: Your Cosmos DB database name
- Container ID: Your container name
- Tool-specific parameters (document ID, search terms, etc.)
- Select tool from dropdown
- Click "Invoke Selected Tool"
Example Test Scenarios
Basic Database Exploration
1. Click "List Tools" - See all available tools
2. Select "list_databases" - No parameters needed
3. Click "Invoke Selected Tool" - See your databases
4. Enter a database name
5. Select "list_collections" - See containers in that database
Document Querying
1. Enter Database ID: "your-db-name"
2. Enter Container ID: "your-container-name"
3. Select "get_recent_documents"
4. Set result count: 5
5. Click "Invoke Selected Tool" - See recent documents
Advanced Search
1. Configure database and container
2. Select "text_search"
3. Property: "name" (or any property in your documents)
4. Search Phrase: "Azure" (or relevant search term)
5. Result count: 10
6. Click "Invoke Selected Tool" - See matching documents
๐ง Troubleshooting
Common Issues
"Authentication Failed"
- Check: Client ID is correct
- Check: User has
Mcp.Tool.Executorrole assigned - Solution: Assign role with:
az ad app role assignment create \ --id "your-client-id" \ --principal "user@domain.com" \ --role "Mcp.Tool.Executor"
"CORS Error"
- Expected: Browser security prevents direct calls
- Solution: Use the generated cURL commands instead
- Alternative: Test from command line or deployed frontend
"404 Not Found"
- Check: Server URL is correct and accessible
- Check: MCP server is running and healthy
- Test: Visit
https://your-server-url/health
"No Databases/Containers Found"
- Check: MCP server has access to Cosmos DB
- Check: Cosmos DB account has data
- Verify: Connection strings and permissions
Security Validation
The interface automatically validates:
- โ Valid Microsoft Entra token
- โ
Correct audience (
api://your-client-id) - โ
Required role claims (
Mcp.Tool.Executor) - โ Token expiration and refresh
๐ Using Generated cURL Commands
The interface generates ready-to-use cURL commands:
# Copy from the "Equivalent cURL Commands" section
curl -X POST "https://your-app.azurecontainerapps.io/mcp" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer eyJ0eXAiOiJKV1Q..." \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'
Use these for:
- Automation scripts
- CI/CD pipelines
- Command line testing
- Integration with other tools
๐ Next Steps
After successful web testing:
- Integrate with Microsoft Foundry - Connect as MCP server
- Automate with scripts - Use generated cURL commands
- Deploy to production - Scale your MCP server
- Monitor usage - Check Microsoft Entra logs and Container App metrics
๐ Support
- Health Endpoint:
GET /health- Check server status - GitHub Issues: Report problems with detailed logs
- Azure Logs: Check Container App logs for server-side issues
- Authentication Logs: Review Microsoft Entra sign-in logs
The web interface provides the same professional testing experience as the PostgreSQL MCP demo, with enterprise-grade security that your IT team will approve! ๐ก๏ธ