Skip to content

Commit 2a2e46a

Browse files
TMHSDigitalclaude
andcommitted
feat: register the MCP server for plugin installs and other clients (#32)
The server only worked from this repo's .cursor/mcp.json: the plugin manifest declared no MCP server, and the data path defaulted to the CWD-relative ./data, so other launches got "native database not found". - Default the data directory to mcp-server/data next to server.py; add CFX_DATA_PATH and keep CFX_NATIVES_PATH as an alias. - Add mcp.json (${CURSOR_PLUGIN_ROOT}/mcp-server/server.py) and point plugin.json "mcpServers" at it, as the sibling Developer Tools plugins do. - Add a root .mcp.json for Claude Code and document Claude Code and generic stdio setup in the README. Verified the tools return natives, events and docs results when the server module is loaded from an unrelated working directory. Fixes #32 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 49b8e5b commit 2a2e46a

5 files changed

Lines changed: 48 additions & 4 deletions

File tree

‎.cursor-plugin/plugin.json‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@
3939
"rules/fxmanifest-standards.mdc",
4040
"rules/security-best-practices.mdc",
4141
"rules/performance-rules.mdc"
42-
]
42+
],
43+
"mcpServers": "mcp.json"
4344
}

‎.mcp.json‎

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

‎README.md‎

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ Then ask the AI agent to scaffold a resource, look up a native, or generate a ma
227227

228228
## MCP Server
229229

230-
The companion MCP server provides programmatic tools that Cursor's AI agent can call directly. Configuration lives in `.cursor/mcp.json`.
230+
The companion MCP server provides programmatic tools that your AI agent can call directly. It finds its data files next to `server.py`, so it can be launched from any working directory (set `CFX_DATA_PATH` to use a different data folder; `CFX_NATIVES_PATH` is still accepted).
231231

232232
**Prerequisites:** Python 3.10+
233233

@@ -236,7 +236,26 @@ cd mcp-server
236236
pip install -r requirements.txt
237237
```
238238

239-
The server starts automatically when Cursor invokes an MCP tool.
239+
**Cursor (plugin install):** the plugin manifest registers the server from `mcp.json` (`${CURSOR_PLUGIN_ROOT}/mcp-server/server.py`), so it starts automatically when Cursor invokes an MCP tool. When working inside this repository, `.cursor/mcp.json` is used instead.
240+
241+
**Claude Code:** inside this repository, the root `.mcp.json` registers the server. From any other project, register it once with an absolute path:
242+
243+
```bash
244+
claude mcp add cfx-dev-tools -- python /absolute/path/to/CFX-Developer-Tools/mcp-server/server.py
245+
```
246+
247+
**Other MCP clients (stdio):**
248+
249+
```json
250+
{
251+
"mcpServers": {
252+
"cfx-dev-tools": {
253+
"command": "python",
254+
"args": ["/absolute/path/to/CFX-Developer-Tools/mcp-server/server.py"]
255+
}
256+
}
257+
}
258+
```
240259

241260
<details>
242261
<summary><strong>Available Tools (10)</strong></summary>

‎mcp-server/server.py‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,15 @@
2525

2626
mcp = FastMCP("cfx-dev-tools")
2727

28-
NATIVES_PATH = os.environ.get("CFX_NATIVES_PATH", "./data")
28+
# Data directory for natives, events and the docs index. Defaults to the
29+
# data/ folder next to this file so the server works from any working
30+
# directory. CFX_DATA_PATH overrides it; CFX_NATIVES_PATH is kept as an alias
31+
# for existing configs.
32+
NATIVES_PATH = (
33+
os.environ.get("CFX_DATA_PATH")
34+
or os.environ.get("CFX_NATIVES_PATH")
35+
or os.path.join(os.path.dirname(os.path.abspath(__file__)), "data")
36+
)
2937

3038

3139
@mcp.tool()

‎mcp.json‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"mcpServers": {
3+
"cfx-dev-tools": {
4+
"command": "python",
5+
"args": ["${CURSOR_PLUGIN_ROOT}/mcp-server/server.py"]
6+
}
7+
}
8+
}

0 commit comments

Comments
 (0)