Skip to content

Commit 4393aca

Browse files
committed
improving the devex for mcp clients
1 parent ba7886b commit 4393aca

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

README.md

+23-7
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ An Azure Storage Emulator is needed for this particular sample because we will s
6262

6363
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>`
6464

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

6767
### VS Code - Copilot Edits
6868

@@ -120,13 +120,18 @@ azd env set VNET_ENABLED true
120120
121121
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/en-us/azure/app-service/overview-authentication-authorization) can be used to set up your favorite OAuth provider including Entra.
122122
123-
### Connect to your function app from a client
123+
## Connect to your *remote() MCP server function app from a client
124124
125125
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/en-us/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`.
126126
127-
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>`.
127+
### Connect to remote MCP server in MCP Inspector
128+
For MCP Inspector, you can include the key in the URL:
129+
```plaintext
130+
https://<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse?code=<your-mcp-extension-system-key>
131+
```
128132
129-
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:
133+
### Connect to remote MCP server in VS Code - GitHub Copilot
134+
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]() 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.
130135
131136
```json
132137
{
@@ -136,20 +141,31 @@ For GitHub Copilot within VS Code, you should instead set the key as the `x-func
136141
"id": "functions-mcp-extension-system-key",
137142
"description": "Azure Functions MCP Extension System Key",
138143
"password": true
144+
},
145+
{
146+
"type": "promptString",
147+
"id": "functionapp-name",
148+
"description": "Azure Functions App Name"
139149
}
140150
],
141151
"servers": {
142-
"my-mcp-server": {
152+
"remote-mcp-function": {
143153
"type": "sse",
144-
"url": "<funcappname>.azurewebsites.net/runtime/webhooks/mcp/sse",
154+
"url": "https://${input:functionapp-name}.azurewebsites.net/runtime/webhooks/mcp/sse",
145155
"headers": {
146156
"x-functions-key": "${input:functions-mcp-extension-system-key}"
147157
}
158+
},
159+
"local-mcp-function": {
160+
"type": "sse",
161+
"url": "http://0.0.0.0:7071/runtime/webhooks/mcp/sse"
148162
}
149163
}
150164
}
151165
```
152166
167+
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.
168+
153169
## Redeploy your code
154170
155171
You can run the `azd up` command as many times as you need to both provision your Azure resources and deploy code updates to your function app.
@@ -168,7 +184,7 @@ azd down
168184

169185
## Source Code
170186

171-
The function code for the `GetSnippet` and `SaveSnippet` endpoints are defined in [`SnippetsTool.cs`](./dotnet/). The `McpToolsTrigger` attribute applied to the async `Run` method exposes the code function as an MCP Server.
187+
The function code for the `GetSnippet` and `SaveSnippet` endpoints are defined in [`SnippetsTool.cs`](./src/SnippetsTool.cs). The `McpToolsTrigger` attribute applied to the async `Run` method exposes the code function as an MCP Server.
172188

173189
This shows the code for a few MCP server examples (get string, get object, save object):
174190

0 commit comments

Comments
 (0)