Skip to content

Commit a4d03e3

Browse files
committed
Enhance devcontainer and VSCode configurations; add MCP Inspector debugging setup
1 parent 66e48e8 commit a4d03e3

4 files changed

Lines changed: 146 additions & 9 deletions

File tree

.devcontainer/devcontainer.json

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,37 @@
55
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
66
"image": "mcr.microsoft.com/devcontainers/dotnet:1-9.0-bookworm",
77
"features": {
8-
"ghcr.io/devcontainers/features/azure-cli:1": {}
8+
"ghcr.io/devcontainers/features/azure-cli:1": {},
9+
"ghcr.io/devcontainers/features/node:1": {
10+
"version": "lts"
11+
}
912
},
1013

1114
// Features to add to the dev container. More info: https://containers.dev/features.
1215
// "features": {},
1316

1417
// Use 'forwardPorts' to make a list of ports inside the container available locally.
15-
// "forwardPorts": [5000, 5001],
16-
// "portsAttributes": {
17-
// "5001": {
18-
// "protocol": "https"
19-
// }
20-
// }
18+
"forwardPorts": [6274, 6277, 3001],
19+
"portsAttributes": {
20+
"6274": {
21+
"protocol": "http",
22+
"label": "MCP-Inspector",
23+
"onAutoForward": "notify"
24+
},
25+
"6277": {
26+
"protocol": "http",
27+
"label": "MCP-Inspector-Proxy",
28+
"onAutoForward": "notify"
29+
},
30+
"3001":{
31+
"label": "MCP-Server",
32+
"onAutoForward": "notify",
33+
"protocol": "http"
34+
}
35+
},
2136

2237
// Use 'postCreateCommand' to run commands after the container is created.
23-
//"postCreateCommand": "",
38+
"postCreateCommand": "npm install -g @modelcontextprotocol/inspector",
2439

2540
// Configure tool-specific properties.
2641
"customizations": {

.vscode/launch.json

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Debug MCP Server with Inspector (HTTP)",
6+
"type": "node",
7+
"request": "launch",
8+
"runtimeExecutable": "npx",
9+
"runtimeArgs": [
10+
"@modelcontextprotocol/inspector",
11+
"--transport",
12+
"http",
13+
"--server-url",
14+
"http://localhost:3001/mcp"
15+
],
16+
"env": {
17+
"HOST": "0.0.0.0"
18+
},
19+
"console": "integratedTerminal",
20+
"internalConsoleOptions": "neverOpen",
21+
"preLaunchTask": "build-and-run-server",
22+
"serverReadyAction": {
23+
"pattern": "MCP Inspector is up and running at:\\s+(http://[^\\s]+)",
24+
"uriFormat": "%s",
25+
"action": "openExternally"
26+
}
27+
}
28+
]
29+
}

.vscode/tasks.json

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"label": "restore-solution",
6+
"command": "dotnet",
7+
"type": "process",
8+
"args": [
9+
"restore",
10+
"${workspaceFolder}/AbeckDev.DbTimetable.sln"
11+
],
12+
"problemMatcher": "$msCompile",
13+
"presentation": {
14+
"reveal": "silent",
15+
"panel": "shared"
16+
}
17+
},
18+
{
19+
"label": "build-solution",
20+
"command": "dotnet",
21+
"type": "process",
22+
"args": [
23+
"build",
24+
"${workspaceFolder}/AbeckDev.DbTimetable.sln",
25+
"--no-restore"
26+
],
27+
"problemMatcher": "$msCompile",
28+
"group": {
29+
"kind": "build",
30+
"isDefault": true
31+
},
32+
"dependsOn": [
33+
"restore-solution"
34+
],
35+
"presentation": {
36+
"reveal": "always",
37+
"panel": "shared"
38+
}
39+
},
40+
{
41+
"label": "install-mcp-inspector",
42+
"type": "shell",
43+
"command": "npx",
44+
"args": [
45+
"-y",
46+
"@modelcontextprotocol/inspector"
47+
],
48+
"problemMatcher": [],
49+
"presentation": {
50+
"reveal": "silent",
51+
"panel": "shared"
52+
}
53+
},
54+
{
55+
"label": "run-mcp-server",
56+
"command": "dotnet",
57+
"type": "process",
58+
"args": [
59+
"run",
60+
"--project",
61+
"${workspaceFolder}/AbeckDev.DbTimetable.Mcp/AbeckDev.DbTimetable.Mcp.csproj"
62+
],
63+
"isBackground": true,
64+
"problemMatcher": {
65+
"pattern": {
66+
"regexp": "^$",
67+
"file": 1,
68+
"location": 2,
69+
"message": 3
70+
},
71+
"background": {
72+
"activeOnStart": true,
73+
"beginsPattern": "^.*Building.*$",
74+
"endsPattern": "^.*Now listening on.*$|^.*Application started.*$"
75+
}
76+
},
77+
"presentation": {
78+
"reveal": "always",
79+
"panel": "dedicated"
80+
}
81+
},
82+
{
83+
"label": "build-and-run-server",
84+
"dependsOn": [
85+
"build-solution",
86+
"run-mcp-server"
87+
],
88+
"dependsOrder": "sequence",
89+
"problemMatcher": []
90+
}
91+
]
92+
}

AbeckDev.DbTimetable.Mcp/Program.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616

1717
var app = builder.Build();
18+
1819
app.MapMcp("/mcp");
1920

20-
app.Run("http://localhost:3001");
21+
app.Run("http://0.0.0.0:3001");

0 commit comments

Comments
 (0)