what is azure-mcp-server?
The azure-mcp-server is a Model Context Protocol (MCP) server built with the mcp-framework, designed to facilitate the development and integration of tools that interact with Azure services, particularly Azure Blob Storage.
how to use azure-mcp-server?
To use the azure-mcp-server, clone the repository, install the dependencies using npm install
, and build the project with npm run build
. You can then interact with the server and its tools through defined operations.
key features of azure-mcp-server?
- Integration with Azure Blob Storage for managing blobs and containers.
- Support for multiple authentication methods using DefaultAzureCredential.
- A structured approach to tool development with example templates.
use cases of azure-mcp-server?
- Managing Azure Blob Storage containers and blobs.
- Developing custom tools that leverage Azure services.
- Automating storage operations in cloud applications.
FAQ from azure-mcp-server?
- What is the MCP framework?
The MCP framework is a structure for building tools that can interact with various services, providing a standardized way to manage operations.
- What permissions are required to use the Azure Blob Storage tool?
You need the Storage Account Contributor and Storage Blob Data Contributor roles to perform operations on Azure Blob Storage.
- How can I authenticate with Azure?
The server supports multiple authentication methods, including environment variables, managed identity, and Azure CLI credentials.
azure-mcp-server
A Model Context Protocol (MCP) server built with mcp-framework.
Quick Start
# Install dependencies
npm install
# Build the project
npm run build
Project Structure
azure-mcp-server/
├── src/
│ ├── tools/ # MCP Tools
│ │ ├── Storage/ # Azure Storage tools
│ │ │ ├── BaseAzureStorageTool.ts # Base class for Azure tools
│ │ │ ├── ListContainersTool.ts # List containers
│ │ │ ├── CreateContainerTool.ts # Create container
│ │ │ ├── DeleteContainerTool.ts # Delete container
│ │ │ ├── ListBlobsTool.ts # List blobs
│ │ │ ├── UploadBlobTool.ts # Upload blob
│ │ │ ├── DownloadBlobTool.ts # Download blob
│ │ │ └── DeleteBlobTool.ts # Delete blob
│ │ └── ExampleTool.ts # Example tool template
│ └── index.ts # Server entry point
├── package.json
└── tsconfig.json
Tool Development
Example Tool Structure
import { MCPTool } from 'mcp-framework';
import { z } from 'zod';
interface MyToolInput {
message: string;
}
class MyTool extends MCPTool<MyToolInput> {
name = 'my_tool';
description = 'Describes what your tool does';
schema = {
message: {
type: z.string(),
description: 'Description of this input parameter'
}
};
async execute(input: MyToolInput) {
// Your tool logic here
return `Processed: ${input.message}`;
}
}
export default MyTool;
Azure Storage Tools
This MCP server includes several tools for interacting with Azure Blob Storage using DefaultAzureCredential for authentication.
Required Azure Permissions
To use the Azure Storage tools, you need the following Azure RBAC roles:
- Storage Account Contributor: Required for listing containers and managing storage account settings
- Storage Blob Data Contributor: Required for creating/reading/updating/deleting blobs and containers
Without these permissions, certain operations may fail with authorization errors.
Authentication
All tools use DefaultAzureCredential from @azure/identity, which tries multiple authentication methods in the following order:
- Environment variables (AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET)
- Managed Identity
- Azure CLI credentials
- Visual Studio Code credentials
- Interactive browser login (as a fallback)
Ensure at least one of these authentication methods is properly configured.
Available Tools
The following Azure Storage tools are available:
Container Operations
- azure_list_containers: Lists all containers in a storage account
- azure_create_container: Creates a new container
- azure_delete_container: Deletes a container
Blob Operations
- azure_list_blobs: Lists all blobs in a container
- azure_upload_blob: Uploads a blob to a container
- azure_download_blob: Downloads a blob and returns its content
- azure_delete_blob: Deletes a blob from a container
Example Usage
List Containers
{
"accountName": "yourstorageaccount"
}
Create Container
{
"accountName": "yourstorageaccount",
"containerName": "mycontainer"
}
List Blobs
{
"accountName": "yourstorageaccount",
"containerName": "mycontainer"
}
Upload Blob
{
"accountName": "yourstorageaccount",
"containerName": "mycontainer",
"blobName": "example.txt",
"content": "This is the content of the blob"
}
Download Blob
{
"accountName": "yourstorageaccount",
"containerName": "mycontainer",
"blobName": "example.txt"
}
Delete Blob
{
"accountName": "yourstorageaccount",
"containerName": "mycontainer",
"blobName": "example.txt"
}
Delete Container
{
"accountName": "yourstorageaccount",
"containerName": "mycontainer"
}
Debugging
If you encounter issues with the Azure Storage tools, check the console logs for detailed debugging information. Common issues include:
- Authentication failures
- Missing permissions
- Non-existent containers or blobs
- Network connectivity problems
Building and Testing
- Make changes to your tools
- Run
npm run build
to compile - The server will automatically load your tools on startup