
azure rust mcp server apim
A production-ready random song API built with Rust and Azure Container Apps, featuring Model Context Protocol (MCP) integration for AI tools.
Repository Info
About This Server
A production-ready random song API built with Rust and Azure Container Apps, featuring Model Context Protocol (MCP) integration for AI tools.
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Rust Song API with MCP Integration
This workspace implements a RESTful Song API service with Model Context Protocol (MCP) integration. The project demonstrates how to build and deploy a web service that provides random song information while also supporting AI tool integration through MCP.
- Youtube
- Azure documentation
The dev container includes all required tools: Azure CLI, Azure Developer CLI (azd), Rust toolchain, and Docker.
Open in browser
Open in local dev container
-
Local development prerequisites:
- VS Code
- Dev Containers extension
-
Clone and open in dev container:
git clone https://github.com/yourusername/rust-mcp.git cd rust-mcp code .When prompted, click "Reopen in Container"
Deploy with Azure Developer CLI
-
Deploy to Azure:
azd auth login azd init azd up -
Test the deployment:
curl https://<your-app-url>/song
Your custom API is now deployed to Azure Container Apps.
Create an Azure API Management resource
-
Use the Azure portal to create an Azure API Managment resource.
-
Create the Song API on the resource using the openapi.json.
-
Configure resource for MCP servers. Estimated time is up to 2.5 hours for Azure to set up the MCP connection for the API Management resource.
Configure Visual Studio Code to use MCP server
-
In the Azure portal, get the APIM endpoint and subscription key.
-
In Visual Studio Code, use the Command Pallete to add an MCP server with the remote URI.
-
Edit the MCP server to add the required header for
Ocp-Apim-Subscription-Key:{ "files.autoSave": "afterDelay", "rust-analyzer.initializeStopped": true, "@azure.argTenant": "", "mcp": { "servers": { "my-mcp-server-<UNIQUE_ID>": { "url": "<AZURE_API_MANAGEMENT_ENDPOINT_FOR_MCP>/mcp/sse", "headers": { "Ocp-Apim-Subscription-Key": "<AZURE_API_MANAGEMENT_SUBSCRIPTION_KEY>" } } } } } -
Use the Chat to ask for a song:
What is a good hello song.
Project Structure
rust-mcp/
├── server/ # Main API server implementation
│ ├── src/ # Server source code
│ ├── openapi.json # API specification
│ └── Cargo.toml # Server dependencies
├── song-lib/ # Song generation library
│ ├── src/ # Library source code
│ └── Cargo.toml # Library dependencies
├── infra/ # Infrastructure as Code
│ ├── main.bicep # Azure deployment template
│ └── main.bicepparam # Azure deployment parameters
├── http/ # API test files
│ ├── song.http # REST API tests
│ └── song-mcp.http # MCP integration tests
└── Dockerfile # Container definition
Features
- RESTful API endpoint for random song generation
- Modular architecture with separate song library
- Azure Container Apps deployment support
- Model Context Protocol (MCP) integration for AI tools
- OpenAPI specification
- Docker containerization
- Infrastructure as Code using Bicep
Getting Started
Manual Setup Prerequisites
- Rust toolchain (install via rustup)
- Docker (for container builds)
- Azure CLI (for deployment)
- Azure Developer CLI (azd)
Local Development (Without Dev Container)
- Build the workspace:
cargo build --workspace
- Run the tests:
cargo test --workspace
- Start the server:
cd server
cargo run
- Try the API:
curl http://localhost:3000/song
Docker Build
Build and run the container locally:
docker build -t song-api .
docker run -p 3000:3000 song-api
Azure Deployment
Deploy to Azure Container Apps using the provided Bicep templates:
cd infra
az deployment sub create --location eastus2 --template-file main.bicep --parameters main.bicepparam
Components
Song Library (song-lib)
A Rust library crate that provides the core functionality for random song generation. See song-lib/README.md for details.
API Server (server)
The main web service that exposes the song generation functionality via REST API and MCP. See server/README.md for API documentation.
Infrastructure (infra)
Contains Bicep templates for deploying the service to Azure Container Apps with proper configuration and scaling rules.
API Documentation
The API is documented using OpenAPI 3.0 specification. You can find the full API documentation in server/openapi.json.
Model Context Protocol Integration
The server implements MCP tools for AI integration:
get_random_song- Returns a random song with title, artist, and lyrics- Support for both REST and MCP interfaces
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This project is licensed under the MIT License - see the LICENSE file for details.
Quick Start
Clone the repository
git clone https://github.com/dfberry/azure-rust-mcp-server-apimInstall dependencies
cd azure-rust-mcp-server-apim
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.