Skip to main content
Glama

MCP Server on Cloudflare Workers & Azure Functions

by TedTschopp
AZURE_ADDITION.md5.83 kB
# Azure Deployment Addition Summary ## Overview Azure Functions deployment capability has been added to the MCP server, providing an alternative to Cloudflare Workers deployment. This allows you to run the same MCP server on Microsoft Azure's serverless platform. ## New Files Added ### 1. `src/azure-handler.ts` - **Purpose**: Azure Functions v4 HTTP trigger handler - **Features**: - Full compatibility with Azure Functions programming model v4 - Same endpoints as Cloudflare Workers (/health, /mcp, CORS) - Uses modern Azure Functions API (`app.http()`) - Proper TypeScript types with `@azure/functions` ### 2. `host.json` - **Purpose**: Azure Functions host configuration - **Settings**: - Application Insights sampling configuration - Extension bundle configuration - 5-minute function timeout ### 3. `azure-function.json` - **Purpose**: Function binding configuration - **Settings**: - HTTP trigger with catch-all route - Anonymous authentication level - Supports GET, POST, OPTIONS methods ### 4. `local.settings.json` - **Purpose**: Local development environment configuration - **Settings**: - Azure Web Jobs storage configuration - Node.js runtime specification - Worker indexing enabled ### 5. `.funcignore` - **Purpose**: Excludes unnecessary files from Azure deployment - **Excludes**: Source files, tests, config files not needed in production ### 6. `tsconfig.azure.json` - **Purpose**: TypeScript configuration for Azure Functions build - **Settings**: - CommonJS module format (required by Azure Functions) - Separate output directory (dist/) - Azure Functions types included ### 7. `AZURE_DEPLOYMENT.md` - **Purpose**: Comprehensive Azure deployment documentation - **Content**: - Prerequisites and setup instructions - Step-by-step deployment guide - Local testing instructions - Configuration options - Monitoring and troubleshooting - Security best practices - Cost optimization tips - Comparison with Cloudflare Workers ## Package Updates ### New Dependencies **Production**: - `@azure/functions@^4.5.0` - Azure Functions programming model v4 **Development**: - `azure-functions-core-tools@^4.0.5611` - Local testing and deployment CLI ### New Scripts ```json { "build:azure": "tsc -p tsconfig.azure.json", "start:azure": "npm run build:azure && func start", "deploy:azure": "npm run build:azure && func azure functionapp publish mcp-server" } ``` ## Updated Files ### `package.json` - Added Azure Functions dependency - Added Azure Core Tools dev dependency - Added three new npm scripts for Azure operations ### `README.md` - Updated title to mention both platforms - Changed "Cloudflare Workers" feature to "Multi-Platform" - Added "Option 2: Azure Functions" deployment section - Link to AZURE_DEPLOYMENT.md for detailed instructions ### `.gitignore` - Added Azure Functions specific directories - Added Azure storage emulator files ## Deployment Options ### Cloudflare Workers - **Best for**: Edge computing, global distribution, minimal cold starts - **Deploy**: `npm run deploy` - **Docs**: README.md ### Azure Functions - **Best for**: Azure ecosystem integration, enterprise requirements - **Deploy**: `npm run deploy:azure` - **Docs**: AZURE_DEPLOYMENT.md ## Platform Comparison | Feature | Cloudflare Workers | Azure Functions | |---------|-------------------|----------------| | **Cold Start** | < 100ms | 1-3 seconds | | **Global Edge** | Automatic (200+ locations) | Available but requires configuration | | **Free Tier** | 100K requests/day | 1M requests/month | | **Max Execution** | 30s (free), 15min (paid) | 5 min (Consumption), 30 min (Premium) | | **Pricing Model** | $5/month for 10M+ requests | Pay per execution | | **Integration** | Cloudflare ecosystem | Azure ecosystem (App Insights, Key Vault, etc.) | | **Custom Domains** | Included | Extra configuration required | ## Testing ### Local Testing **Cloudflare (Wrangler)**: ```bash npm run dev # http://localhost:8787 ``` **Azure (Functions Core Tools)**: ```bash npm run start:azure # http://localhost:7071 ``` ### TypeScript Compilation All code compiles successfully: ```bash npm run types # ✅ No errors ``` ## Architecture Both handlers provide identical functionality: 1. **Health Check** (`GET /health`): Returns server status 2. **MCP Protocol** (`POST /mcp`): Handles MCP requests 3. **CORS Support** (`OPTIONS /*`): Cross-origin request handling 4. **Default Response** (`GET /`): Server information The core MCP logic is the same; only the HTTP handler wrapper differs: - **Cloudflare**: Uses Workers `fetch()` API - **Azure**: Uses Functions v4 `app.http()` API ## Next Steps ### For Cloudflare Deployment 1. `npx wrangler login` 2. `npm run deploy` ### For Azure Deployment 1. `az login` 2. Create Azure resources (Function App, Storage Account) 3. `npm run deploy:azure` ### For Both Platforms - Set up monitoring - Configure custom domains - Enable authentication if needed - Set up CI/CD pipelines ## Benefits of Multi-Platform Support 1. **Flexibility**: Choose the platform that best fits your needs 2. **Redundancy**: Deploy to both platforms for high availability 3. **Cost Optimization**: Compare costs and choose the most economical option 4. **Regional Requirements**: Use Azure for Azure-centric enterprises 5. **Performance**: Use Cloudflare for edge computing benefits ## Documentation - **Quick Start**: README.md - **Azure Detailed Guide**: AZURE_DEPLOYMENT.md - **API Reference**: CAPABILITIES.md - **Code Documentation**: DOCUMENTATION.md ## Verification ✅ TypeScript compiles without errors ✅ All dependencies installed ✅ Azure Functions v4 compatibility ✅ Same endpoints as Cloudflare version ✅ Comprehensive documentation provided Your MCP server is now truly multi-platform! 🎉

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/TedTschopp/MCP-Server-on-CloudFlare'

If you have feedback or need assistance with the MCP directory API, please join our Discord server