Skip to content

Commit efe596f

Browse files
authored
Merge pull request #9 from Hypercart-Dev-Tools/development
Development to Main
2 parents 0ecbadc + ba6063d commit efe596f

103 files changed

Lines changed: 27184 additions & 2189 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.DS_Store

2 KB
Binary file not shown.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: MCP Server CI
2+
3+
on:
4+
push:
5+
paths:
6+
- 'tools/mcp-server/**'
7+
pull_request:
8+
paths:
9+
- 'tools/mcp-server/**'
10+
11+
jobs:
12+
build-and-test:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [18, 20, 22]
18+
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: actions/setup-node@v4
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
26+
- name: Install dependencies
27+
working-directory: tools/mcp-server
28+
run: npm ci
29+
30+
- name: Build
31+
working-directory: tools/mcp-server
32+
run: npm run build
33+
34+
- name: Test
35+
working-directory: tools/mcp-server
36+
run: npm test

.gitignore

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55
!temp/README.md
66
!temp/*/.gitkeep
77
!temp/*/*/.gitkeep
8+
!temp/mcp/
9+
!temp/mcp/local-snippets/
10+
!temp/mcp/notes/
11+
!temp/mcp/local-snippets/.gitkeep
12+
!temp/mcp/notes/.gitkeep
813

914
# Credentials (never commit these)
1015
*.credentials
@@ -20,7 +25,9 @@ playwright-auth.json
2025

2126
# IDE files
2227
.DS_Store
23-
.vscode/
28+
.vscode/*
29+
!.vscode/tasks.json
30+
!.vscode/launch.json
2431
.idea/
2532
*.sublime-*
2633
*.swp
@@ -57,4 +64,13 @@ coverage/
5764
*.bak
5865
*.cache
5966

60-
.DS_Store
67+
# Root-level shell transcript artifacts from script(1)
68+
/typescript
69+
/typescript.[0-9]*
70+
71+
/.claude
72+
/.mcp.local.json
73+
74+
# Machine-specific symlinks (never commit these)
75+
/npx
76+
/playwright

.mcp.README.md

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
# .mcp.json — MCP Server Configuration for Claude Code
2+
3+
`.mcp.json` is how Claude Code discovers MCP servers for this project.
4+
JSON does not support comments, so this companion file documents the config.
5+
6+
## Repo Safety Reminder
7+
8+
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.
9+
10+
Keep the checked-in `.mcp.json` generic and public-safe. If you need a second WordPress MCP Adapter entry for a real site, keep that variant local-only and store working snippets or notes under `temp/` instead of committing them.
11+
12+
Tracked helpers for local use:
13+
- `.mcp.local.example.json` shows a generic dual-server shape with placeholders.
14+
- `./bin/mcp-local-config` merges `.mcp.json` with any local-only snippets under `temp/mcp/local-snippets/`.
15+
- `examples/mcp/local-snippet.example.json` shows the exact snippet shape expected under `temp/mcp/local-snippets/`.
16+
17+
Scaffolded local snippet directories are kept in git with:
18+
- `temp/mcp/local-snippets/.gitkeep`
19+
- `temp/mcp/notes/.gitkeep`
20+
21+
## Current: Single-Server (AI-DDTK)
22+
23+
The checked-in `.mcp.json` now defaults to the public-safe AI-DDTK server only. Add a second WordPress MCP Adapter entry locally when you want site-specific abilities without committing a real Local site name into the repo.
24+
25+
## Dual-Server Config: AI-DDTK + WordPress MCP Adapter
26+
27+
To run the WP MCP Adapter alongside AI-DDTK, replace `.mcp.json` with:
28+
29+
```json
30+
{
31+
"mcpServers": {
32+
"ai-ddtk": {
33+
"command": "bash",
34+
"args": ["tools/mcp-server/start.sh"]
35+
},
36+
"wordpress": {
37+
"command": "./bin/local-wp",
38+
"args": [
39+
"<site-name>",
40+
"mcp-adapter", "serve",
41+
"--server=mcp-adapter-default-server",
42+
"--user=1"
43+
]
44+
}
45+
}
46+
}
47+
```
48+
49+
You can also keep the checked-in `.mcp.json` generic, place one or more real local adapter snippets in `temp/mcp/local-snippets/*.json`, and generate a merged local config with:
50+
51+
```bash
52+
./bin/mcp-local-config --write .mcp.local.json
53+
```
54+
55+
`/.mcp.local.json` is gitignored on purpose.
56+
57+
Preview a write target without modifying files:
58+
59+
```bash
60+
./bin/mcp-local-config --dry-run --write .mcp.local.json
61+
```
62+
63+
If you intentionally want to overwrite the repo-root `.mcp.json` for local-only work, the helper supports that too but requires an explicit warning acknowledgment:
64+
65+
```bash
66+
printf 'OVERWRITE\n' | ./bin/mcp-local-config --write-root
67+
```
68+
69+
### Notes
70+
71+
- Replace `<site-name>` with your Local site (e.g. `love2hugcom-clone`).
72+
- Use `--user=1` (user ID), not `--user=admin` — admin usernames vary per site.
73+
- Do not commit the resolved site name, internal domain, or user identifier from your local environment back into the checked-in `.mcp.json`.
74+
- For Valet sites, use system WP-CLI instead of `./bin/local-wp`:
75+
```json
76+
"wordpress": {
77+
"command": "wp",
78+
"args": [
79+
"--path=/Users/<you>/Valet-Sites/<site>",
80+
"mcp-adapter", "serve",
81+
"--server=mcp-adapter-default-server",
82+
"--user=admin"
83+
]
84+
}
85+
```
86+
87+
### Tool namespaces (no collisions)
88+
89+
| Server | Tools | Prefix |
90+
|---|---|---|
91+
| ai-ddtk | 18 | `local_wp_*`, `pw_auth_*`, `tmux_*`, `wpcc_*`, `wp_ajax_test` |
92+
| wordpress | 3 | `mcp-adapter-*` (discover, get-info, execute) |
93+
94+
### Custom ability requirements
95+
96+
Abilities must set three things to be visible via MCP Adapter:
97+
1. Hook: `add_action('wp_abilities_api_init', ...)`
98+
2. Category: `'category' => 'site'` (or `user`, `mcp-adapter`)
99+
3. MCP flag: `'meta' => ['mcp' => ['public' => true]]`
100+
101+
See `P1-WP-MCP-ADAPTER.md` Phase 0.2 for the full mu-plugin pattern.
102+
103+
### No-parameter abilities — omit `input_schema`
104+
105+
Abilities that take no parameters must **not** include an `input_schema`. Using `'properties' => new stdClass()` triggers two bugs in `ExecuteAbilityAbility` v0.4.1. See [docs/MCP-ADAPTER-SETUP.md](docs/MCP-ADAPTER-SETUP.md#abilities-with-no-parameters-must-omit-input_schema) for details.
106+
107+
---
108+
Validated 2026-03-22 on Local and Valet test sites.
109+
Validated 2026-03-21 on a Local WordPress 6.9.4 site — all 12 Phase 1+2 abilities confirmed.

.mcp.json

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

.mcp.local.example.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"mcpServers": {
3+
"ai-ddtk": {
4+
"command": "bash",
5+
"args": ["tools/mcp-server/start.sh"]
6+
},
7+
"wordpress-local": {
8+
"command": "./bin/local-wp",
9+
"args": [
10+
"<site-name>",
11+
"mcp-adapter",
12+
"serve",
13+
"--server=mcp-adapter-default-server",
14+
"--user=1"
15+
]
16+
}
17+
}
18+
}

.vscode/launch.json

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "MCP Server (stdio)",
6+
"type": "node",
7+
"request": "launch",
8+
"program": "${workspaceFolder}/tools/mcp-server/dist/src/index.js",
9+
"outFiles": ["${workspaceFolder}/tools/mcp-server/dist/**/*.js"],
10+
"sourceMaps": true,
11+
"console": "integratedTerminal",
12+
"cwd": "${workspaceFolder}/tools/mcp-server",
13+
"preLaunchTask": "MCP: Build"
14+
},
15+
{
16+
"name": "MCP Server (HTTP :3100)",
17+
"type": "node",
18+
"request": "launch",
19+
"program": "${workspaceFolder}/tools/mcp-server/dist/src/index.js",
20+
"args": ["--http"],
21+
"outFiles": ["${workspaceFolder}/tools/mcp-server/dist/**/*.js"],
22+
"sourceMaps": true,
23+
"console": "integratedTerminal",
24+
"cwd": "${workspaceFolder}/tools/mcp-server",
25+
"preLaunchTask": "MCP: Build"
26+
},
27+
{
28+
"name": "MCP Server Tests",
29+
"type": "node",
30+
"request": "launch",
31+
"program": "${workspaceFolder}/tools/mcp-server/dist/test/${input:testFile}",
32+
"args": ["--test"],
33+
"outFiles": ["${workspaceFolder}/tools/mcp-server/dist/**/*.js"],
34+
"sourceMaps": true,
35+
"console": "integratedTerminal",
36+
"cwd": "${workspaceFolder}/tools/mcp-server",
37+
"preLaunchTask": "MCP: Build"
38+
}
39+
],
40+
"inputs": [
41+
{
42+
"id": "testFile",
43+
"description": "Test file to debug (e.g. local-wp.test.js)",
44+
"type": "promptString",
45+
"default": "local-wp.test.js"
46+
}
47+
]
48+
}

.vscode/tasks.json

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
{
2+
"version": "2.0.0",
3+
"inputs": [
4+
{
5+
"id": "siteUrl",
6+
"description": "WordPress site URL (e.g. http://my-site.local)",
7+
"type": "promptString"
8+
},
9+
{
10+
"id": "siteName",
11+
"description": "Local by Flywheel site name",
12+
"type": "promptString"
13+
},
14+
{
15+
"id": "ajaxUrl",
16+
"description": "WordPress site URL for AJAX testing",
17+
"type": "promptString"
18+
},
19+
{
20+
"id": "ajaxAction",
21+
"description": "WordPress AJAX action name",
22+
"type": "promptString"
23+
},
24+
{
25+
"id": "scanPaths",
26+
"description": "Path(s) to scan with WPCC (relative to workspace)",
27+
"type": "promptString",
28+
"default": "."
29+
}
30+
],
31+
"tasks": [
32+
{
33+
"label": "MCP: Start Server (stdio)",
34+
"type": "shell",
35+
"command": "npm run mcp",
36+
"options": { "cwd": "${workspaceFolder}/tools/mcp-server" },
37+
"group": "none",
38+
"problemMatcher": []
39+
},
40+
{
41+
"label": "MCP: Start Server (HTTP)",
42+
"type": "shell",
43+
"command": "npm run mcp:http",
44+
"options": { "cwd": "${workspaceFolder}/tools/mcp-server" },
45+
"group": "none",
46+
"problemMatcher": [],
47+
"isBackground": true
48+
},
49+
{
50+
"label": "MCP: Build",
51+
"type": "shell",
52+
"command": "npm run build",
53+
"options": { "cwd": "${workspaceFolder}/tools/mcp-server" },
54+
"group": "build",
55+
"problemMatcher": ["$tsc"]
56+
},
57+
{
58+
"label": "MCP: Test",
59+
"type": "shell",
60+
"command": "npm test",
61+
"options": { "cwd": "${workspaceFolder}/tools/mcp-server" },
62+
"group": "test",
63+
"problemMatcher": []
64+
},
65+
{
66+
"label": "WPCC: Run Scan",
67+
"type": "shell",
68+
"command": "wpcc --paths ${input:scanPaths} --format json",
69+
"group": "none",
70+
"problemMatcher": []
71+
},
72+
{
73+
"label": "pw-auth: Login",
74+
"type": "shell",
75+
"command": "pw-auth login --site-url ${input:siteUrl} --wp-cli 'local-wp ${input:siteName}'",
76+
"group": "none",
77+
"problemMatcher": []
78+
},
79+
{
80+
"label": "AJAX Test",
81+
"type": "shell",
82+
"command": "wp-ajax-test --url ${input:ajaxUrl} --action ${input:ajaxAction} --format json",
83+
"group": "none",
84+
"problemMatcher": []
85+
}
86+
]
87+
}

0 commit comments

Comments
 (0)