Skip to content

Commit ebcd587

Browse files
lilyjmaCopilot
andauthored
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>
1 parent 22fbfd2 commit ebcd587

5 files changed

Lines changed: 323 additions & 423 deletions

File tree

README.md

Lines changed: 20 additions & 139 deletions
Original file line numberDiff line numberDiff line change
@@ -16,162 +16,43 @@ urlFragment: remote-mcp-functions-python
1616

1717
# Getting Started with Remote MCP Servers using Azure Functions (Python)
1818

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.
2020

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.
2222

2323
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.
2424

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.
2626

2727
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/Azure-Samples/remote-mcp-functions-python)
2828

29-
Below is the architecture diagram for the Remote MCP Server using Azure Functions:
30-
31-
![Architecture Diagram](/media/architecture-diagram-http.png)
32-
33-
## Sample Applications
34-
35-
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-
4229
## Prerequisites
4330

4431
+ [Python](https://www.python.org/downloads/) version 3.13 or higher
4532
+ [Azure Functions Core Tools](https://learn.microsoft.com/azure/azure-functions/functions-run-local?pivots=programming-language-python#install-the-azure-functions-core-tools) >= `4.8.0`
46-
+ [Azure Developer CLI](https://aka.ms/azd)
47-
+ To use Visual Studio Code to run and debug locally:
48-
+ [Visual Studio Code](https://code.visualstudio.com/)
49-
+ [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
50-
51-
## Local testing
52-
53-
Choose the sample app you want to run and follow its README:
54-
55-
- **[FunctionsMcpTool](src/FunctionsMcpTool/README.md)** - Sample tools (hello world, snippets, and more)
56-
- **[McpWeatherApp](src/McpWeatherApp/README.md)** - Interactive weather UI
57-
58-
Each app's README contains detailed instructions for:
59-
- Setting up the local environment
60-
- Installing dependencies
61-
- Running the function app locally
62-
- Connecting from MCP clients (VS Code, MCP Inspector)
63-
- Testing and verification
64-
65-
## Deploy to Azure for Remote MCP
66-
67-
### Step 1: Choose which app to deploy
68-
69-
This repository contains multiple sample apps. Open [azure.yaml](azure.yaml) and set `project:` to the app you want to deploy:
70-
71-
| App | `project:` value |
72-
|-----|-----------------|
73-
| FunctionsMcpTool (default) | `./src/FunctionsMcpTool` |
74-
| McpWeatherApp | `./src/McpWeatherApp` |
75-
76-
```yaml
77-
services:
78-
api:
79-
project: ./src/FunctionsMcpTool # ← change this to deploy a different app
80-
language: python
81-
host: function
82-
```
83-
84-
### Step 2: Create an environment and configure
85-
86-
In the root directory, create a new [azd](https://aka.ms/azd) environment:
87-
88-
```shell
89-
azd env new <environment-name>
90-
```
91-
92-
Configure VS Code as an allowed client application to request access tokens from Microsoft Entra:
93-
94-
```shell
95-
azd env set PRE_AUTHORIZED_CLIENT_IDS aebc6443-996d-45c2-90f0-388ff96faa56
96-
```
97-
98-
Optional: Enable VNet isolation:
33+
+ [Azure Developer CLI](https://aka.ms/azd) **1.23.x or above** (for deployment)
34+
+ [Docker](https://www.docker.com/) (for the Azurite storage emulator)
35+
+ [Visual Studio Code](https://code.visualstudio.com/) (recommended)
36+
+ [Azure Functions extension](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-azurefunctions)
9937

100-
```bash
101-
azd env set VNET_ENABLED true
102-
```
103-
104-
### Step 3: Deploy
105-
106-
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
148-
FUNCTION_APP_NAME=$(cat .azure/$(cat .azure/config.json | jq -r '.defaultEnvironment')/env.json | jq -r '.FUNCTION_APP_NAME')
149-
echo $FUNCTION_APP_NAME
150-
151-
# Get resource group
152-
RESOURCE_GROUP=$(cat .azure/$(cat .azure/config.json | jq -r '.defaultEnvironment')/env.json | jq -r '.AZURE_RESOURCE_GROUP')
153-
echo $RESOURCE_GROUP
154-
155-
# View function app logs
156-
az webapp log tail --name $FUNCTION_APP_NAME --resource-group $RESOURCE_GROUP
157-
```
38+
Below is the architecture diagram for the Remote MCP Server using Azure Functions:
15839

159-
## Architecture
40+
![Architecture Diagram](/media/architecture-diagram-http.png)
16041

161-
This sample demonstrates building MCP servers with Azure Functions using Python. It showcases two different patterns:
42+
## Samples in this repo
16243

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.
16545

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
46+
| Project | Description | Getting Started |
47+
|---------|-------------|-----------------|
48+
| **FunctionsMcpTool** | MCP Tools — snippet CRUD, QR code generation, structured metadata, batch operations | [README](src/FunctionsMcpTool/README.md) |
49+
| **FunctionsMcpResources** | MCP Resources — snippet resource template, server info resource | [README](src/FunctionsMcpResources/README.md) |
50+
| **FunctionsMcpPrompts** | MCP Prompts — code review checklist, summarize content, generate docs | [README](src/FunctionsMcpPrompts/README.md) |
51+
| **McpWeatherApp** | Weather App — MCP App demo with interactive UI | [README](src/McpWeatherApp/README.md) |
17052

17153
## Next Steps
17254

173-
- 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.
17758

src/FunctionsMcpPrompts/README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,12 +89,52 @@ For remote servers, replace the server name accordingly (e.g., `/mcp.remote-mcp-
8989

9090
## Deploy to Azure
9191

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+
92113
```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
96115
```
97116

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+
98138
## Examining the code
99139

100140
Prompts are defined in `function_app.py`. Each prompt is a Python function with the `@app.mcp_prompt_trigger` decorator:

0 commit comments

Comments
 (0)