Skip to content

Commit 0406e5a

Browse files
committed
feat: make MCP server auto-discoverable by all VS Code agents (Phase 1)
1 parent bd97e8f commit 0406e5a

7 files changed

Lines changed: 79 additions & 9 deletions

File tree

.mcp.README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
1-
# .mcp.json — MCP Server Configuration for Claude Code
1+
# .mcp.json — MCP Server Configuration
22

3-
`.mcp.json` is how Claude Code discovers MCP servers for this project.
3+
`.mcp.json` is how **Claude Code** discovers MCP servers for this project (auto-discovery at repo root).
4+
Other clients use different config paths — see the client table below.
45
JSON does not support comments, so this companion file documents the config.
56

7+
## Client Config Reference
8+
9+
| Client | Config location | Schema root key | How to set up |
10+
|--------|----------------|-----------------|---------------|
11+
| **Claude Code** | `.mcp.json` (repo root, auto-discovered) | `"mcpServers"` | Checked-in already ✅ |
12+
| **VS Code (Copilot / Cline / etc.)** | `.vscode/mcp.json` (workspace) | `"servers"` + `"type": "stdio"` | Copy `mcp-configs/vscode.json``.vscode/mcp.json`, or install the AI-DDTK VS Code extension (auto-registers) |
13+
| **Augment Code** | `~/.augment/settings.json` (global) | `"mcpServers"` | See `AGENTS.md § MCP Server Setup` |
14+
| **Cursor** | `~/.cursor/mcp.json` (global) | `"mcpServers"` | Copy `mcp-configs/cursor.json``~/.cursor/mcp.json` |
15+
| **Claude Desktop** | `~/Library/Application Support/Claude/claude_desktop_config.json` | `"mcpServers"` | Copy `mcp-configs/claude-desktop.json` |
16+
617
## Repo Safety Reminder
718

819
Do not commit site-specific LocalWP names, internal hostnames, user IDs, filesystem paths, bearer tokens, cookies, auth-state files, or other confidential environment details into `.mcp.json` or related MCP docs.

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,17 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
1313
- Do not edit a version block that has already been committed and pushed
1414
-->
1515

16+
## [1.5.0] - 2026-03-29
17+
18+
### Added
19+
- **VS Code extension — `contributes.mcpServerDefinitionProviders`** — the extension now registers the AI-DDTK MCP server directly with VS Code's agent runtime via `vscode.lm.registerMcpServerDefinitionProvider`. GitHub Copilot, Cline, Continue, and any future VS Code MCP client auto-discover the server the moment the extension is installed — no manual config files required.
20+
- **`tools/mcp-server/mcp-configs/vscode.json`** — template for users who prefer manual `.vscode/mcp.json` setup (VS Code Copilot workspace config format; uses `"servers"` root key and `"type": "stdio"`).
21+
22+
### Changed
23+
- **VS Code extension `engines.vscode`** — bumped from `^1.85.0` to `^1.100.0` (MCP provider API requires VS Code 1.100+, May 2025).
24+
- **VS Code extension `isMcpConfigured()`** — now also recognises `.vscode/mcp.json` alongside `.mcp.json` / `.mcp.local.json` when checking project wiring state.
25+
- **`.mcp.README.md`** — retitled from "for Claude Code" to client-agnostic; added a client config reference table covering Claude Code, VS Code Copilot, Augment Code, Cursor, and Claude Desktop.
26+
1627
## [1.4.2] - 2026-03-26
1728

1829
### Added

experimental/preflight.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,12 @@ Tracked here for visibility. Reference: VS Code full MCP spec blog post (June 20
9191
9292
### Phase 1 — Config portability
9393

94-
- [ ] Add `tools/mcp-server/mcp-configs/vscode.json` template using VS Code Copilot schema (`"servers"` root key, `"type": "stdio"`)
94+
- [x] Add `tools/mcp-server/mcp-configs/vscode.json` template using VS Code Copilot schema (`"servers"` root key, `"type": "stdio"`)
9595
- [ ] Add `tools/mcp-server/mcp-configs/cursor.json` template (uses same `"mcpServers"` schema as Claude Code)
96-
- [ ] Retitle `.mcp.README.md` from "for Claude Code" to client-agnostic (e.g. "MCP Server Configuration")
96+
- [x] Retitle `.mcp.README.md` from "for Claude Code" to client-agnostic — now includes client config reference table
97+
- [x] VS Code extension now auto-registers via `contributes.mcpServerDefinitionProviders` — Copilot/Cline see it with no config files needed
9798
- [ ] Add VS Code Copilot setup instructions to `AGENTS.md` (alongside existing Claude Code / Augment Code sections)
98-
- [ ] Document the two config schemas side-by-side somewhere (`.mcp.json` vs `.vscode/mcp.json`)
99+
- [x] Document the two config schemas side-by-side in `.mcp.README.md` client table
99100

100101
### Phase 2 — `wire-project` multi-client
101102

experimental/vscode-extension/package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"publisher": "hypercart",
77
"license": "MIT",
88
"engines": {
9-
"vscode": "^1.85.0"
9+
"vscode": "^1.100.0"
1010
},
1111
"categories": [
1212
"Other",
@@ -37,6 +37,12 @@
3737
],
3838
"main": "./dist/extension.js",
3939
"contributes": {
40+
"mcpServerDefinitionProviders": [
41+
{
42+
"id": "ai-ddtk",
43+
"label": "AI-DDTK WordPress Development Toolkit"
44+
}
45+
],
4046
"commands": [
4147
{
4248
"command": "ai-ddtk.wireProject",
@@ -136,7 +142,7 @@
136142
},
137143
"devDependencies": {
138144
"@types/node": "^18.0.0",
139-
"@types/vscode": "^1.85.0",
145+
"@types/vscode": "^1.100.0",
140146
"@typescript-eslint/eslint-plugin": "^6.0.0",
141147
"@typescript-eslint/parser": "^6.0.0",
142148
"esbuild": "^0.19.0",

experimental/vscode-extension/src/extension.ts

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
import * as vscode from 'vscode';
2+
import * as path from 'path';
3+
import * as fs from 'fs';
24
import { AiDdtkManager } from './manager';
35
import { StatusBarManager } from './statusBar';
46
import { CommandHandler } from './commands';
@@ -15,6 +17,33 @@ export async function activate(context: vscode.ExtensionContext) {
1517
statusBar = new StatusBarManager();
1618
commandHandler = new CommandHandler(manager);
1719

20+
// --- MCP server registration ---
21+
// Exposes the AI-DDTK MCP server to ALL VS Code MCP clients:
22+
// GitHub Copilot, Cline, Continue, and any future VS Code agent.
23+
// Claude Code discovers the server via .mcp.json (separate mechanism).
24+
const mcpChangeEmitter = new vscode.EventEmitter<void>();
25+
context.subscriptions.push(mcpChangeEmitter);
26+
27+
context.subscriptions.push(
28+
vscode.lm.registerMcpServerDefinitionProvider('ai-ddtk', {
29+
onDidChangeMcpServerDefinitions: mcpChangeEmitter.event,
30+
provideMcpServerDefinitions: async () => {
31+
const aiDdtkPath = manager.getAiDdtkPath();
32+
const startScript = path.join(aiDdtkPath, 'tools', 'mcp-server', 'start.sh');
33+
if (!fs.existsSync(aiDdtkPath) || !fs.existsSync(startScript)) {
34+
return [];
35+
}
36+
// McpStdioServerDefinition(label, command, args?, env?, version?)
37+
return [
38+
new vscode.McpStdioServerDefinition('AI-DDTK', 'bash', [startScript], undefined, '1.0.0'),
39+
];
40+
},
41+
resolveMcpServerDefinition: async (server) => server,
42+
})
43+
);
44+
// Fire when the user changes the aiDdtkPath setting so VS Code re-queries
45+
// (wired into the config-change handler below)
46+
1847
// Register commands
1948
const commands = [
2049
vscode.commands.registerCommand('ai-ddtk.wireProject', () =>
@@ -44,11 +73,12 @@ export async function activate(context: vscode.ExtensionContext) {
4473
const status = await manager.checkStatus();
4574
statusBar.update(status);
4675

47-
// Watch for configuration changes
76+
// Watch for configuration changes; re-notify MCP clients if the path changes
4877
context.subscriptions.push(
4978
vscode.workspace.onDidChangeConfiguration((e) => {
5079
if (e.affectsConfiguration('ai-ddtk')) {
5180
manager.reloadConfig();
81+
mcpChangeEmitter.fire(); // tell VS Code to re-query MCP server definitions
5282
}
5383
})
5484
);

experimental/vscode-extension/src/manager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export class AiDdtkManager {
7676
const workspaceRoot = vscode.workspace.workspaceFolders[0].uri.fsPath;
7777
return (
7878
fs.existsSync(path.join(workspaceRoot, '.mcp.local.json')) ||
79-
fs.existsSync(path.join(workspaceRoot, '.mcp.json'))
79+
fs.existsSync(path.join(workspaceRoot, '.mcp.json')) ||
80+
fs.existsSync(path.join(workspaceRoot, '.vscode', 'mcp.json'))
8081
);
8182
}
8283

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"servers": {
3+
"ai-ddtk": {
4+
"type": "stdio",
5+
"command": "bash",
6+
"args": ["${env:HOME}/bin/ai-ddtk/tools/mcp-server/start.sh"]
7+
}
8+
}
9+
}
10+

0 commit comments

Comments
 (0)