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
-[Debugging with VS Code and debugpy](#debugging-with-vs-code-and-debugpy)
16
+
-[Testing with MCP Inspector](#testing-with-mcp-inspector)
17
+
-[Contributing](#contributing)
18
+
19
+
20
+
## Environment Setup
10
21
11
22
#### 1. GitHub Codespaces
12
23
@@ -31,57 +42,56 @@ If you prefer a plain local environment, use **uv** for dependency management:
31
42
uv sync
32
43
```
33
44
34
-
### Run the MCP Server in VS Code
35
-
36
-
1. Open `.vscode/mcp.json` in the editor
37
-
2. Click the **Start** button (▶) above the server name `expenses-mcp`
38
-
3. Confirm in the output panel that the server is running
39
-
40
-
### GitHub Copilot Chat Integration
45
+
## Using the Expenses MCP Server
41
46
42
-
Make sure the MCP server is running, then:
47
+
### Run the MCP Server in VS Code with GitHub Copilot (Codespace/Local Dev Container/Local)
43
48
49
+
1. Open `.vscode/mcp.json` in the editor
50
+
1. Click the **Start** button (▶) above the server name `expenses-mcp`
51
+
1. Confirm in the output panel that the server is running
44
52
1. Open the GitHub Copilot Chat panel (bottom right, or via Command Palette: `GitHub Copilot: Focus Chat`)
45
-
2. Click the **Tools** icon (wrench) at the bottom of the chat panel
46
-
3. Ensure `expenses-mcp` is selected in the list of available tools
47
-
4. Ask Copilot to invoke the tool:
53
+
1. Click the **Tools** icon (wrench) at the bottom of the chat panel
54
+
1. Ensure `expenses-mcp` is selected in the list of available tools
55
+
1. Ask Copilot to invoke the tool:
48
56
- "Use add_expense to record a $12 lunch today paid with visa"
49
-
- "Read the expenses resource"
50
57
51
58
### MCP Inspector
52
59
53
-
The MCP Inspector is a browser-based visual testing and debugging tool for MCP servers.
60
+
The MCP Inspector is a browser-based visual testing and debugging tool for MCP servers. At the moment it does not work great with non STDIO MCP Servers when working inside of a Codespace.
54
61
55
-
**Launch the inspector in GitHub Codespaces:**
62
+
#### Launch the MCP Inspector and connect to STDIO MCP Server in GitHub Codespace
56
63
57
64
1. Run the following command in the terminal:
58
65
```bash
59
-
.devcontainer/launch-inspector.sh
66
+
.devcontainer/launch-inspector-codespace.sh
60
67
```
61
-
62
68
2. Note the **Inspector Proxy Address** and **Session Token** from the terminal output
63
69
64
70
3. In the **Ports** view, set port **6277** to **PUBLIC** visibility
3. The Inspector should now connect to your MCP server
86
+
1. Open `http://localhost:6274` in your browser
87
+
1. Access the Inspector UI and configure:
88
+
-**Transport Type**: `STDIO`
89
+
-**Command**: `uv`
90
+
-**Arguments**: `run main.py`
81
91
82
92
> **Note:**`HOST=0.0.0.0` is required in devcontainer environments to bind the Inspector to all network interfaces, allowing proper communication between the UI and proxy server. `DANGEROUSLY_OMIT_AUTH=true` disables authentication - only use in trusted development environments.
83
93
84
-
**Launch the inspector locally without Dev Container:**
94
+
#### Launch the inspector locally:**
85
95
86
96
1. Run the following command in the terminal:
87
97
```bash
@@ -90,6 +100,42 @@ The MCP Inspector is a browser-based visual testing and debugging tool for MCP s
90
100
2. The Inspector will automatically open in your browser at `http://localhost:6274`
91
101
92
102
103
+
---
104
+
105
+
## Debugging
106
+
107
+
You can attach the VS Code debugger to the running MCP server to set breakpoints and inspect code execution.
108
+
109
+
### Debugging STDIO MCP server with GitHub Copilot in Codespace/Dev Container/locally
110
+
111
+
112
+
1. Open `.vscode/mcp.json` in the editor
113
+
114
+
2. Start the **expenses-mcp-debug** server (instead of expenses-mcp)
115
+
116
+
3. In VS Code, open the Run and Debug panel (Ctrl+Shift+D / Cmd+Shift+D)
117
+
118
+
4. Select **"Attach to MCP Server"** from the dropdown and click the play button (or press F5)
119
+
120
+
5. In GitHub Copilot Chat, make sure **expenses-mcp-debug** is selected in the tools menu
121
+
122
+
6. Set breakpoints in `main.py` and use the server from GitHub Copilot Chat. Breakpoints will be hit when tools are invoked.
123
+
124
+
### Debugging HTTP MCP server with GitHub Copilot in Codespace/Dev Container/locally
125
+
126
+
1. Run the HTTP MCP Server in the terminal with `uv run -- python -m debugpy --listen 0.0.0.0:5678 main_http.py`
127
+
128
+
1. Open `.vscode/mcp.json` in the editor
129
+
130
+
1. Start the **expenses-mcp-debug** server (instead of expenses-mcp)
131
+
132
+
1. In VS Code, open the Run and Debug panel (Ctrl+Shift+D / Cmd+Shift+D)
133
+
134
+
1. Select **"Attach to MCP Server"** from the dropdown and click the play button (or press F5)
135
+
136
+
1. In GitHub Copilot Chat, make sure **expenses-mcp-debug** is selected in the tools menu
137
+
138
+
1. Set breakpoints in `main_http.py` and use the server from GitHub Copilot Chat. Breakpoints will be hit when tools are invoked.
0 commit comments