You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Reorganize READMEs to match .NET repo structure (#51)
- Simplify root README: intro, prerequisites, project table, next steps
- Move deployment instructions into each sub-project README
- Each project now has self-contained: prerequisites, local dev, deploy, troubleshooting
- Add deploy sections to FunctionsMcpPrompts and McpWeatherApp
- Remove redundant sections from root (architecture, helpful commands, etc.)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
# Getting Started with Remote MCP Servers using Azure Functions (Python)
18
18
19
-
This is a quickstart template to easily build and deploy custom remote MCP servers to the cloud using Azure Functions with Python. You can clone/restore/run on your local machine with debugging, and `azd up` to have it in the cloud in a couple minutes.
19
+
This repo has a collection of samples to help you easily build and deploy a custom remote MCP server to the cloud using Azure Functions. You can clone/restore/run on your local machine with debugging, and `azd up` to have a server in the cloud in a couple minutes.
20
20
21
-
The MCP servers are configured with [built-in authentication](https://learn.microsoft.com/en-us/azure/app-service/overview-authentication-authorization) using Microsoft Entra as the identity provider.
21
+
All sample MCP servers are configured with [built-in authentication](https://learn.microsoft.com/en-us/azure/app-service/overview-authentication-authorization) using Microsoft Entra as the identity provider.
22
22
23
23
You can also use [API Management](https://learn.microsoft.com/azure/api-management/secure-mcp-servers) to secure the server, as well as network isolation using VNET.
24
24
25
-
If you're looking for this sample in more languages check out the [.NET/C#](https://github.com/Azure-Samples/remote-mcp-functions-dotnet) and [Node.js/TypeScript](https://github.com/Azure-Samples/remote-mcp-functions-typescript) versions.
25
+
If you're looking for samples in more languages check out the [.NET/C#](https://github.com/Azure-Samples/remote-mcp-functions-dotnet) and [Node.js/TypeScript](https://github.com/Azure-Samples/remote-mcp-functions-typescript) versions.
26
26
27
27
[](https://codespaces.new/Azure-Samples/remote-mcp-functions-python)
28
28
29
-
Below is the architecture diagram for the Remote MCP Server using Azure Functions:
This repository includes two sample MCP applications:
36
-
37
-
-**[FunctionsMcpTool](src/FunctionsMcpTool/README.md)** - An MCP server with sample tools demonstrating various patterns (hello world, snippet management, and more)
38
-
-**[McpWeatherApp](src/McpWeatherApp/README.md)** - An interactive MCP App that displays weather information with a visual UI
39
-
40
-
See each app's README for detailed setup and usage instructions.
41
-
42
29
## Prerequisites
43
30
44
31
+[Python](https://www.python.org/downloads/) version 3.13 or higher
Run this azd command to provision the function app, with any required Azure resources, and deploy your code:
107
-
108
-
```shell
109
-
azd up
110
-
```
111
-
112
-
Additionally, [API Management](https://aka.ms/mcp-remote-apim-auth) can be used for improved security and policies over your MCP Server.
113
-
114
-
### Step 4: Connect to remote MCP server in VS Code
115
-
116
-
After deployment, connect to your remote MCP server using `https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp`.
117
-
118
-
The [.vscode/mcp.json](.vscode/mcp.json) file is already configured with both local and remote server options. Click **Start** on the `remote-mcp-function` server and provide your function app name when prompted. The server uses built-in MCP authentication, so you'll be asked to login.
119
-
120
-
## Redeploy your code
121
-
122
-
You can run the `azd deploy` command as many times as you need to both provision your Azure resources and deploy code updates to your function app.
123
-
124
-
>[!NOTE]
125
-
>Deployed code files are always overwritten by the latest deployment package.
126
-
127
-
## Clean up resources
128
-
129
-
When you're done working with your function app and related resources, you can use this command to delete the function app and its related resources from Azure and avoid incurring any further costs:
130
-
131
-
```shell
132
-
azd down
133
-
```
134
-
135
-
## Troubleshooting
136
-
137
-
| Error | Solution |
138
-
|---|---|
139
-
|`deployment was partially successful` / `KuduSpecializer` restart during `azd up`| This is a transient error. Run `azd deploy` to retry just the deployment step. |
140
-
|`AttributeError: 'FunctionApp' object has no attribute 'mcp_resource_trigger'`| Python 3.13 is required. Verify with `python3 --version`. Install via `brew install python@3.13` (macOS) or from [python.org](https://www.python.org/downloads/). Recreate your virtual environment with Python 3.13 after installing. |
141
-
142
-
## Helpful Azure Commands
143
-
144
-
Once your application is deployed, you can use these commands to manage and monitor your application:
145
-
146
-
```bash
147
-
# Get your function app name from the environment file
This sample demonstrates building MCP servers with Azure Functions using Python. It showcases two different patterns:
42
+
## Samples in this repo
162
43
163
-
1.**Simple MCP Tools** - Functions that expose tools using the `@app.mcp_tool()` decorator with Azure bindings (see [FunctionsMcpTool](src/FunctionsMcpTool/README.md))
164
-
2.**MCP Apps** - Tools that return interactive UIs using MCP resources and the `ui://` scheme (see [McpWeatherApp](src/McpWeatherApp/README.md))
44
+
Each project README has instructions for running locally, connecting to the MCP server, deploying to the cloud, and more.
165
45
166
-
Both patterns use the first-class MCP decorators available in `azure-functions>=2.0.0`, which:
167
-
- Infer tool properties from function signatures and type hints
168
-
- Eliminate manual JSON serialization
169
-
- Integrate seamlessly with Azure Functions bindings
- Learn more about the [Azure Functions MCP extension](https://learn.microsoft.com/azure/azure-functions/functions-bindings-mcp?pivots=programming-language-typescript)
174
-
- Add [API Management](https://aka.ms/mcp-remote-apim-auth) to your MCP server (auth, gateway, policies, more!)
175
-
- Enable VNET using VNET_ENABLED=true flag
176
-
55
+
+ Learn more about the [Azure Functions MCP extension](https://learn.microsoft.com/azure/azure-functions/functions-bindings-mcp?pivots=programming-language-typescript)
56
+
+ Learn more about [built-in MCP auth](https://learn.microsoft.com/azure/azure-functions/functions-mcp-tutorial?tabs=mcp-extension&pivots=programming-language-python#remote-mcp-server-authorization)
57
+
+ Follow our blog posts on [Azure SDK Blog](https://devblogs.microsoft.com/azure-sdk) and [Tech Community](https://techcommunity.microsoft.com/category/azure/blog/appsonazureblog) for updates.
Copy file name to clipboardExpand all lines: src/FunctionsMcpPrompts/README.md
+43-3Lines changed: 43 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -89,12 +89,52 @@ For remote servers, replace the server name accordingly (e.g., `/mcp.remote-mcp-
89
89
90
90
## Deploy to Azure
91
91
92
+
### Step 1: Sign in
93
+
94
+
```shell
95
+
az login
96
+
azd auth login
97
+
```
98
+
99
+
### Step 2: Create an environment
100
+
101
+
```shell
102
+
azd env new <environment-name>
103
+
```
104
+
105
+
This also becomes the resource group name.
106
+
107
+
### Step 3: Provision and deploy
108
+
109
+
By default, OAuth-based authentication is enabled using the [built-in MCP auth feature](https://learn.microsoft.com/azure/app-service/configure-authentication-mcp?toc=/azure/azure-functions/toc.json&bc=/azure/azure-functions/breadcrumb/toc.json) with Microsoft Entra as the identity provider.
110
+
111
+
Configure VS Code as an allowed client application for Microsoft Entra:
112
+
92
113
```shell
93
-
azd env set DEPLOY_SERVICE prompts
94
-
azd provision
95
-
azd deploy --service prompts
114
+
azd env set PRE_AUTHORIZED_CLIENT_IDS aebc6443-996d-45c2-90f0-388ff96faa56
96
115
```
97
116
117
+
Optionally enable VNet isolation:
118
+
119
+
```shell
120
+
azd env set VNET_ENABLED true
121
+
```
122
+
123
+
Deploy the project. When prompted, pick your subscription and an Azure region.
124
+
125
+
```shell
126
+
azd up
127
+
```
128
+
129
+
### Step 4: Connect to the remote MCP server
130
+
131
+
Open **`.vscode/mcp.json`** and click **Start** above **`remote-mcp-function`**. You'll be prompted for `functionapp-name` — find it in your `azd` command output or the `.azure/<env>/.env` file. Since authentication is enabled, you'll also be prompted to sign in with Microsoft.
132
+
133
+
### Redeploy and clean up
134
+
135
+
-**Redeploy:**`azd deploy`
136
+
-**Clean up all resources:**`azd down`
137
+
98
138
## Examining the code
99
139
100
140
Prompts are defined in `function_app.py`. Each prompt is a Python function with the `@app.mcp_prompt_trigger` decorator:
0 commit comments