Skip to content

Commit 5c9f872

Browse files
committed
Add Dev Proxy MCP Server. Closes #244
Closes #244
1 parent 80f034e commit 5c9f872

File tree

6 files changed

+50
-12
lines changed

6 files changed

+50
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
1010
## [0.25.0] - Unreleased
1111

12+
### Added:
13+
14+
- MCP Server: Dev Proxy
15+
1216
### Changed:
1317

1418
- Snippets: Updated all snippets to use `v0.29.0` schema
@@ -44,6 +48,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
4448
- Command: `dev-proxy-toolkit.restart` - Restart Dev Proxy
4549
- Snippets: `devproxy-plugin-typespec-generator` - TypeSpecGeneratorPlugin instance
4650
- Snippets: `devproxy-plugin-typespec-generator-config` - TypeSpecGeneratorPlugin config section
51+
- MCP Server: Dev Proxy
4752

4853
### Changed:
4954

README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ Shown when the active document is a Dev Proxy configuration file
5555
- Start recording
5656
- Stop recording
5757

58+
### MCP Server
59+
60+
- Tool: Find Dev Proxy documentation
61+
- Tool: Get the installed Dev Proxy version
62+
5863
### Notifications
5964

6065
- Not installed
@@ -70,8 +75,6 @@ Shown when the active document is a Dev Proxy configuration file
7075

7176
### Snippets
7277

73-
| Prefix | Description |
74-
| ------ | ----------- |
7578
| Prefix | Description |
7679
| ------ | ----------- |
7780
| `devproxy-config-file` | Dev Proxy config file |

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"version": "0.25.0",
66
"publisher": "garrytrinder",
77
"engines": {
8-
"vscode": "^1.89.0"
8+
"vscode": "^1.101.0"
99
},
1010
"categories": [
1111
"Snippets",
@@ -85,6 +85,12 @@
8585
"enablement": "!isDevProxyRunning"
8686
}
8787
],
88+
"mcpServerDefinitionProviders": [
89+
{
90+
"id": "devproxymcp",
91+
"label": "Dev Proxy"
92+
}
93+
],
8894
"menus": {
8995
"editor/title": [
9096
{
@@ -186,7 +192,7 @@
186192
"@types/mocha": "^10.0.9",
187193
"@types/node": "^20.11.17",
188194
"@types/sinon": "^17.0.3",
189-
"@types/vscode": "^1.89.0",
195+
"@types/vscode": "^1.101.0",
190196
"@typescript-eslint/eslint-plugin": "^6.21.0",
191197
"@typescript-eslint/parser": "^6.21.0",
192198
"@vscode/test-cli": "^0.0.10",

src/extension.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,23 @@ import { createStatusBar, statusBarLoop, updateStatusBar } from './statusbar';
77
import { registerCodeActions } from './codeactions';
88
import { updateGlobalState } from './state';
99
import { VersionPreference } from './enums';
10+
import { registerMcpServer } from './mcp';
1011

1112
export const activate = async (context: vscode.ExtensionContext): Promise<vscode.ExtensionContext> => {
13+
1214
const configuration = vscode.workspace.getConfiguration('dev-proxy-toolkit');
1315
const versionPreference = configuration.get('version') as VersionPreference;
14-
16+
1517
const statusBar = createStatusBar(context);
1618
await updateGlobalState(context, versionPreference);
17-
19+
1820
const collection = vscode.languages.createDiagnosticCollection('dev-proxy-toolkit');
19-
21+
2022
registerDocumentListeners(context, collection);
2123
registerCodeActions(context);
2224
registerCodeLens(context);
2325
registerCommands(context, configuration);
26+
registerMcpServer(context);
2427

2528
const notification = handleStartNotification(context);
2629
processNotification(notification);

src/mcp.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as vscode from 'vscode';
2+
3+
export const registerMcpServer = (context: vscode.ExtensionContext) => {
4+
const didChangeEmitter = new vscode.EventEmitter<void>();
5+
6+
context.subscriptions.push(
7+
vscode.lm.registerMcpServerDefinitionProvider('devproxymcp', {
8+
onDidChangeMcpServerDefinitions: didChangeEmitter.event,
9+
provideMcpServerDefinitions: async () => {
10+
const server: vscode.McpStdioServerDefinition = {
11+
label: 'Dev Proxy',
12+
command: 'npx',
13+
args: ['-y', '@devproxy/mcp'],
14+
env: {},
15+
};
16+
17+
return [server];
18+
},
19+
}),
20+
);
21+
};

0 commit comments

Comments
 (0)