Skip to content

Commit 4e76f86

Browse files
committed
improving devex for the mcp clients
1 parent beef953 commit 4e76f86

File tree

2 files changed

+71
-3
lines changed

2 files changed

+71
-3
lines changed

.vscode/mcp.json

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"inputs": [
3+
{
4+
"type": "promptString",
5+
"id": "functions-mcp-extension-system-key",
6+
"description": "Azure Functions MCP Extension System Key",
7+
"password": true
8+
},
9+
{
10+
"type": "promptString",
11+
"id": "functionapp-name",
12+
"description": "Azure Functions App Name"
13+
}
14+
],
15+
"servers": {
16+
"remote-mcp-function": {
17+
"type": "sse",
18+
"url": "https://${input:functionapp-name}.azurewebsites.net/runtime/webhooks/mcp/sse",
19+
"headers": {
20+
"x-functions-key": "${input:functions-mcp-extension-system-key}"
21+
}
22+
},
23+
"local-mcp-function": {
24+
"type": "sse",
25+
"url": "http://0.0.0.0:7071/runtime/webhooks/mcp/sse"
26+
}
27+
}
28+
}

README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ An Azure Storage Emulator is needed for this particular sample because we will s
7070

7171
> **Note** by default this will use the webhooks route: `/runtime/webhooks/mcp/sse`. Later we will use this in Azure to set the key on client/host calls: `/runtime/webhooks/mcp/sse?code=<system_key>`
7272

73-
## Use the MCP server from within a client/host
73+
## Connect to the *local* MCP server from a client/host
7474

75-
### VS Code - Copilot Edits
75+
### VS Code - Copilot agent mode
7676

7777
1. **Add MCP Server** from command palette and add URL to your running Function app's SSE endpoint:
7878
@@ -133,10 +133,50 @@ azd env set VNET_ENABLED true
133133
134134
Additionally, [API Management]() can be used for improved security and policies over your MCP Server, and [App Service built-in authentication](https://learn.microsoft.com/azure/app-service/overview-authentication-authorization) can be used to set up your favorite OAuth provider including Entra.
135135
136-
### Connect to your function app from a client
136+
## Connect to your *remote* MCP server function app from a client
137137
138138
Your client will need a key in order to invoke the new hosted SSE endpoint, which will be of the form `https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse`. The hosted function requires a system key by default which can be obtained from the [portal](https://learn.microsoft.com/azure/azure-functions/function-keys-how-to?tabs=azure-portal) or the CLI (`az functionapp keys list --resource-group <resource_group> --name <function_app_name>`). Obtain the system key named `mcp_extension`.
139139
140+
### Connect to remote MCP server in MCP Inspector
141+
For MCP Inspector, you can include the key in the URL:
142+
```plaintext
143+
https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse?code=<your-mcp-extension-system-key>
144+
```
145+
146+
### Connect to remote MCP server in VS Code - GitHub Copilot
147+
For GitHub Copilot within VS Code, you should instead set the key as the `x-functions-key` header in `mcp.json`, and you would just use `https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse` for the URL. The following example uses an input and will prompt you to provide the key when you start the server from VS Code. Note [mcp.json](.vscode/mcp.json) has already been included in this repo and will be picked up by VS Code. Click Start on the server to be prompted for values including `functionapp-name` (in your /.azure/*/.env file) and `functions-mcp-extension-system-key` which can be obtained from CLI command above or API Keys in the portal for the Function App.
148+
149+
```json
150+
{
151+
"inputs": [
152+
{
153+
"type": "promptString",
154+
"id": "functions-mcp-extension-system-key",
155+
"description": "Azure Functions MCP Extension System Key",
156+
"password": true
157+
},
158+
{
159+
"type": "promptString",
160+
"id": "functionapp-name",
161+
"description": "Azure Functions App Name"
162+
}
163+
],
164+
"servers": {
165+
"remote-mcp-function": {
166+
"type": "sse",
167+
"url": "https://${input:functionapp-name}.azurewebsites.net/runtime/webhooks/mcp/sse",
168+
"headers": {
169+
"x-functions-key": "${input:functions-mcp-extension-system-key}"
170+
}
171+
},
172+
"local-mcp-function": {
173+
"type": "sse",
174+
"url": "http://0.0.0.0:7071/runtime/webhooks/mcp/sse"
175+
}
176+
}
177+
}
178+
```
179+
140180
For MCP Inspector, you can include the key in the URL: `https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse?code=<your-mcp-extension-system-key>`.
141181
142182
For GitHub Copilot within VS Code, you should instead set the key as the `x-functions-key` header in `mcp.json`, and you would just use `https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse` for the URL. The following example uses an input and will prompt you to provide the key when you start the server from VS Code:

0 commit comments

Comments
 (0)