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
Copy file name to clipboardExpand all lines: articles/container-apps/mcp-troubleshooting.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -47,7 +47,7 @@ The correct endpoint path depends on your MCP SDK and routing configuration.
47
47
| Java (Spring Boot SSE) |`/mcp`| SSE transport; path set in `WebMvcSseServerTransportProvider` constructor |
48
48
| Platform-managed sessions | Value from `mcpServerEndpoint`| Full URL provided by the Azure Resource Manager (ARM) API; retrieve it from the session pool properties |
49
49
50
-
A common cause of 404 errors in Python is mounting the FastMCP app at `/mcp` instead of `/` on the FastAPI router. Because the SDK adds its own `/mcp` subpath, mounting at `/mcp` results in a `/mcp/mcp` endpoint. Mount at `/` so the final path is `/mcp`.
50
+
A common cause of 404 errors in Python is mounting the FastMCP app at `/mcp` instead of `/` on the FastAPI router. Since the SDK adds its own `/mcp` subpath, mounting at `/mcp` results in a `/mcp/mcp` endpoint. Mount at `/` so the final path is `/mcp`.
51
51
52
52
Verify the endpoint responds by testing with curl:
53
53
@@ -274,7 +274,7 @@ If `isMCPServerEnabled` is `false` or the field is absent, redeploy the session
274
274
275
275
**Cause**: Dynamic sessions with MCP are available in a subset of Azure regions during preview.
276
276
277
-
**Solution**: Check the [Azure Container Apps sessions documentation](/azure/container-apps/sessions) for the current list of supported regions.
277
+
**Solution**: Check the [sessions documentation](/azure/container-apps/sessions) for the current list of supported regions.
Copy file name to clipboardExpand all lines: articles/container-apps/tutorial-mcp-server-dotnet.md
+10-2Lines changed: 10 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -138,6 +138,8 @@ Next, define the task-management data store and the MCP tools that expose it to
138
138
}
139
139
```
140
140
141
+
The `TaskItem` record defines the data model with five properties. The `TaskStore` class manages an in-memory list prepopulated with sample data and provides methods to list, find, create, toggle, and delete tasks.
142
+
141
143
1. Create a file named `TasksMcpTools.cs` with the MCP tool definitions:
142
144
143
145
```csharp
@@ -255,6 +257,8 @@ Package the application as a Docker container so you can test it locally before
255
257
ENTRYPOINT ["dotnet", "TasksMcpServer.dll"]
256
258
```
257
259
260
+
The multi-stage build uses the SDK image to restore, build, and publish the app, then copies only the published output to a smaller ASP.NET runtime image. The `ASPNETCORE_URLS` environment variable configures the app to listen on port 8080.
261
+
258
262
1. Verify the container builds and runs locally:
259
263
260
264
```bash
@@ -311,7 +315,7 @@ After you containerize the application, deploy it to Azure Container Apps by usi
311
315
--name $APP_NAME\
312
316
--resource-group $RESOURCE_GROUP\
313
317
--allowed-origins "*"\
314
-
--allowed-methods "GET,POST,OPTIONS"\
318
+
--allowed-methods "GET,POST,DELETE,OPTIONS"\
315
319
--allowed-headers "*"
316
320
```
317
321
@@ -384,13 +388,17 @@ If you don't plan to continue using this application, delete the resource group
384
388
az group delete --resource-group $RESOURCE_GROUP --yes --no-wait
385
389
```
386
390
391
+
## Next step
392
+
393
+
> [!div class="nextstepaction"]
394
+
> [Secure MCP servers on Container Apps](mcp-authentication.md)
395
+
387
396
## Related content
388
397
389
398
- [MCP servers on Azure Container Apps overview](mcp-overview.md)
390
399
- [Deploy an MCP server to Container Apps (Python)](tutorial-mcp-server-python.md)
391
400
- [Deploy an MCP server to Container Apps (Node.js)](tutorial-mcp-server-nodejs.md)
392
401
- [Deploy an MCP server to Container Apps (Java)](tutorial-mcp-server-java.md)
393
-
- [Secure MCP servers on Container Apps](mcp-authentication.md)
394
402
- [Troubleshoot MCP servers on Container Apps](mcp-troubleshooting.md)
Copy file name to clipboardExpand all lines: articles/container-apps/tutorial-mcp-server-java.md
+16-3Lines changed: 16 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,6 +90,8 @@ In this section, you create a new Spring Boot project with the MCP Java SDK.
90
90
</project>
91
91
```
92
92
93
+
The `pom.xml` defines a Spring Boot application with two key dependencies: `spring-boot-starter-web`for the web framework and `mcp-spring-webmvc`for the MCP SDK. The Spring Boot Maven plugin packages the app as an executable JAR.
94
+
93
95
> [!NOTE]
94
96
> The MCP Java SDK is under active development. Check the [MCP Java SDK releases](https://github.com/modelcontextprotocol/java-sdk/releases) for the latest version and update the `<version>` accordingly.
95
97
@@ -142,6 +144,8 @@ In this section, you define the task data model and an in-memory store.
142
144
}
143
145
```
144
146
147
+
The `TaskItem` class defines the data model with standard getters and a setter for the completion status. The constructor initializes the `createdAt` timestamp automatically.
@@ -192,6 +196,8 @@ In this section, you define the task data model and an in-memory store.
192
196
}
193
197
```
194
198
199
+
The `TaskStore` Spring component manages an in-memory list prepopulated with sample data. It uses `AtomicInteger`for thread-safe ID generation and provides methods for standard CRUD operations.
200
+
195
201
## Define the MCP tools
196
202
197
203
In this section, you define the MCP tools that the AI model can invoke and configure the MCP server in your Spring Boot application.
@@ -416,7 +422,6 @@ In this section, you define the MCP tools that the AI model can invoke and confi
416
422
- `WebMvcSseServerTransportProvider` registers the SSE transport at the `/mcp` path.
417
423
- `McpServer.sync(transport)` configures tool capabilities and registers each tool specification.
418
424
- CORS is enabled because GitHub Copilot in VS Code makes cross-origin requests to MCP servers.
419
-
- A `/health` endpoint is added separately for Azure Container Apps health probes. MCP endpoints return JSON-RPC responses that aren't suitable as health checks.
420
425
421
426
> [!NOTE]
422
427
> This tutorial uses `WebMvcSseServerTransportProvider` (SSE transport) because the MCP Java SDK doesn't yet offer a stable streamable HTTP transport. The other language tutorials (.NET, Python, Node.js) use streamable HTTP. When the Java SDK adds streamable HTTP support, update the transport provider accordingly. The SSE transport is fully compatible with VS Code Copilot and other MCP clients.
@@ -446,6 +451,8 @@ In this section, you define the MCP tools that the AI model can invoke and confi
446
451
}
447
452
```
448
453
454
+
The main class bootstraps the Spring Boot application and exposes a `/health` endpoint for Container Apps health probes. MCP endpoints return JSON-RPC responses, so a separate health endpoint is needed for health checks.
455
+
449
456
## Test the MCP server locally
450
457
451
458
Before deploying to Azure, verify the MCP server works by running it locally and connecting from GitHub Copilot.
@@ -514,7 +521,7 @@ Package the application as a Docker container so you can test it locally before
514
521
515
522
## Deploy to Azure Container Apps
516
523
517
-
Now you deploy the containerized MCP server to Azure Container Apps using the Azure CLI.
524
+
After you containerize the application, deploy it to Azure Container Apps by using the Azure CLI. The `az containerapp up` command builds the container image in the cloud, so you don't need Docker on your machine for this step.
518
525
519
526
1. Set environment variables:
520
527
@@ -575,6 +582,8 @@ Now you deploy the containerized MCP server to Azure Container Apps using the Az
575
582
576
583
## Connect GitHub Copilot to the deployed server
577
584
585
+
Now that the MCP server is running in Azure, configure VS Code to connect GitHub Copilot to the deployed endpoint.
586
+
578
587
1. Create or update `.vscode/mcp.json`:
579
588
580
589
```json
@@ -632,12 +641,16 @@ If you're not going to continue to use this application, delete the resource gro
632
641
az group delete --resource-group $RESOURCE_GROUP --yes --no-wait
633
642
```
634
643
644
+
## Next step
645
+
646
+
> [!div class="nextstepaction"]
647
+
> [Secure MCP servers on Container Apps](mcp-authentication.md)
648
+
635
649
## Related content
636
650
637
651
- [MCP servers on Azure Container Apps overview](mcp-overview.md)
638
652
- [Deploy an MCP server to Container Apps (.NET)](tutorial-mcp-server-dotnet.md)
639
653
- [Deploy an MCP server to Container Apps (Python)](tutorial-mcp-server-python.md)
640
654
- [Deploy an MCP server to Container Apps (Node.js)](tutorial-mcp-server-nodejs.md)
641
-
- [Secure MCP servers on Container Apps](mcp-authentication.md)
642
655
- [Troubleshoot MCP servers on Container Apps](mcp-troubleshooting.md)
Copy file name to clipboardExpand all lines: articles/container-apps/tutorial-mcp-server-nodejs.md
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -67,6 +67,8 @@ In this section, you create a new Node.js project with Express and the MCP TypeS
67
67
}
68
68
```
69
69
70
+
This configuration targets ES2022 with Node.js module resolution, outputs compiled files to `dist/`, and enables strict type checking.
71
+
70
72
1. Update `package.json` to enable ES modules and add build and start scripts. Add or replace the `type` and `scripts` fields:
71
73
72
74
```json
@@ -151,6 +153,8 @@ In this section, you create a new Node.js project with Express and the MCP TypeS
151
153
export const store = new TaskStore();
152
154
```
153
155
156
+
The `TaskItem` interface defines the task data shape. The `TaskStore` class manages an in-memory array prepopulated with sample data and provides methods to list, find, create, toggle, and delete tasks. A module-level singleton is exported for use by the MCP tools.
157
+
154
158
## Define the MCP tools
155
159
156
160
Next, you define the MCP server with tool registrations that expose the task store to AI clients.
@@ -331,6 +335,8 @@ Package the application as a Docker container so you can test it locally before
331
335
CMD ["node", "dist/index.js"]
332
336
```
333
337
338
+
The multi-stage build compiles TypeScript in the first stage, then creates a production image with only runtime dependencies and the compiled JavaScript output. The `PORT` environment variable is set to 8080 to match the Container Apps target port.
339
+
334
340
1. Verify locally:
335
341
336
342
```bash
@@ -432,7 +438,7 @@ Now that the MCP server is running in Azure, configure VS Code to connect GitHub
432
438
433
439
## Configure scaling for interactive use
434
440
435
-
By default, Azure Container Apps scale to zero replicas. For MCP servers that serve interactive clients like Copilot, cold starts cause noticeable delays. Set a minimum replica count to keep at least one instance running:
441
+
By default, Azure Container Apps can scale to zero replicas. For MCP servers that serve interactive clients like Copilot, cold starts cause noticeable delays. Set a minimum replica count to keep at least one instance running:
436
442
437
443
```azurecli
438
444
az containerapp update \
@@ -460,12 +466,16 @@ If you don't plan to continue using this application, delete the resource group
460
466
az group delete --resource-group $RESOURCE_GROUP --yes --no-wait
461
467
```
462
468
469
+
## Next step
470
+
471
+
> [!div class="nextstepaction"]
472
+
> [Secure MCP servers on Container Apps](mcp-authentication.md)
473
+
463
474
## Related content
464
475
465
476
- [MCP servers on Azure Container Apps overview](mcp-overview.md)
466
477
- [Deploy an MCP server to Container Apps (.NET)](tutorial-mcp-server-dotnet.md)
467
478
- [Deploy an MCP server to Container Apps (Python)](tutorial-mcp-server-python.md)
468
479
- [Deploy an MCP server to Container Apps (Java)](tutorial-mcp-server-java.md)
469
-
- [Secure MCP servers on Container Apps](mcp-authentication.md)
470
480
- [Troubleshoot MCP servers on Container Apps](mcp-troubleshooting.md)
Copy file name to clipboardExpand all lines: articles/container-apps/tutorial-mcp-server-python.md
+13-3Lines changed: 13 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,8 @@ In this section, you create a new Python project with FastAPI and the MCP Python
122
122
store = TaskStore()
123
123
```
124
124
125
+
The `TaskItem` dataclass defines the data model with a `to_dict()` method for serialization. The `TaskStore` class manages an in-memory list prepopulated with sample data and provides CRUD methods. The module-level `store` singleton is shared across the application for simplicity.
126
+
125
127
## Define the MCP tools
126
128
127
129
In this section, you define the MCP tools that the AI model can invoke and mount the MCP server in your FastAPI application.
@@ -274,6 +276,8 @@ Package the application as a Docker container so you can test it locally before
The Dockerfile uses a Python 3.12 slim base image, installs dependencies from `requirements.txt`, then copies the application code. Uvicorn serves the FastAPI app on port 8080.
280
+
277
281
1. Verify the container builds and runs locally:
278
282
279
283
```bash
@@ -285,7 +289,7 @@ Package the application as a Docker container so you can test it locally before
285
289
286
290
## Deploy to Azure Container Apps
287
291
288
-
Now you deploy the containerized MCP server to Azure Container Apps by using the Azure CLI.
292
+
After you containerize the application, deploy it to Azure Container Apps by using the Azure CLI. The `az containerapp up`command builds the container image in the cloud, so you don't need Docker on your machine for this step.
289
293
290
294
1. Set environment variables:
291
295
@@ -326,7 +330,7 @@ Now you deploy the containerized MCP server to Azure Container Apps by using the
326
330
--name $APP_NAME \
327
331
--resource-group $RESOURCE_GROUP \
328
332
--allowed-origins "*" \
329
-
--allowed-methods "GET,POST,OPTIONS" \
333
+
--allowed-methods "GET,POST,DELETE,OPTIONS" \
330
334
--allowed-headers "*"
331
335
```
332
336
@@ -346,6 +350,8 @@ Now you deploy the containerized MCP server to Azure Container Apps by using the
346
350
347
351
## Connect GitHub Copilot to the deployed server
348
352
353
+
Now that the MCP server is running in Azure, configure VS Code to connect GitHub Copilot to the deployed endpoint.
354
+
349
355
1. Create or update `.vscode/mcp.json`:
350
356
351
357
```json
@@ -397,12 +403,16 @@ If you don't plan to continue using this application, delete the resource group
397
403
az group delete --resource-group $RESOURCE_GROUP --yes --no-wait
398
404
```
399
405
406
+
## Next step
407
+
408
+
> [!div class="nextstepaction"]
409
+
> [Secure MCP servers on Container Apps](mcp-authentication.md)
410
+
400
411
## Related content
401
412
402
413
- [MCP servers on Azure Container Apps overview](mcp-overview.md)
403
414
- [Deploy an MCP server to Container Apps (.NET)](tutorial-mcp-server-dotnet.md)
404
415
- [Deploy an MCP server to Container Apps (Node.js)](tutorial-mcp-server-nodejs.md)
405
416
- [Deploy an MCP server to Container Apps (Java)](tutorial-mcp-server-java.md)
406
-
- [Secure MCP servers on Container Apps](mcp-authentication.md)
407
417
- [Troubleshoot MCP servers on Container Apps](mcp-troubleshooting.md)
0 commit comments