@enfyra/mcp-server 0.0.11 → 0.0.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -8
- package/package.json +3 -2
- package/src/index.mjs +10 -511
- package/src/lib/config-local.mjs +286 -0
- package/src/lib/mcp-instructions.js +26 -13
- package/src/mcp-server-entry.mjs +514 -0
package/README.md
CHANGED
|
@@ -1,12 +1,131 @@
|
|
|
1
1
|
# Enfyra MCP Server
|
|
2
2
|
|
|
3
|
-
MCP server for managing Enfyra instances from **Claude Code**
|
|
3
|
+
MCP server for managing Enfyra instances from **Claude Code**, **Cursor**, and other MCP-compatible clients. All operations go through Enfyra's REST API.
|
|
4
|
+
|
|
4
5
|
|
|
5
6
|
**LLM rules (REST, GraphQL, auth, URL, mutation `create_{tableName}`, etc.):** not in this README — see **`src/lib/mcp-instructions.js`** (content sent via MCP `instructions`) and tool descriptions in **`src/index.mjs`**. This README only covers **MCP installation and configuration** for users/devs.
|
|
6
7
|
|
|
7
|
-
|
|
8
|
+
**Official docs:** [Claude Code MCP](https://docs.anthropic.com/en/docs/claude-code/mcp) · [Claude Code settings](https://docs.anthropic.com/en/docs/claude-code/settings) · [Cursor MCP (`mcp.json`)](https://cursor.com/docs/context/mcp)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## Quick local setup (`config` command)
|
|
13
|
+
|
|
14
|
+
From your **Enfyra project root** (where you want `.mcp.json` / `.cursor/mcp.json`):
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npx @enfyra/mcp-server config
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
- **Interactive (default in a terminal):** first asks **where** to write config — `[1]` Claude Code only, `[2]` Cursor only, `[3]` both (default) — unless you already passed `--claude-code` / `--cursor` / etc. Then prompts for `ENFYRA_API_URL`, `ENFYRA_EMAIL`, and `ENFYRA_PASSWORD` when missing. Press **Enter** to accept bracketed defaults (env + existing `enfyra` in either local file). Password **Enter** keeps the current saved password when updating.
|
|
21
|
+
- **Re-run anytime** to update the same files; other entries under `mcpServers` are preserved.
|
|
22
|
+
- **Non-interactive** (CI / scripts): `npx @enfyra/mcp-server config --yes` plus optional `-a` / `-e` / `-p` and/or env vars.
|
|
23
|
+
- **One IDE only:** `--claude-code` / `--claude` / `--claude-only` → `./.mcp.json` only. `--cursor` / `--cursor-only` → `./.cursor/mcp.json` only. Pass **both** target flags → write both files (same as default).
|
|
24
|
+
- **Help:** `npx @enfyra/mcp-server config --help`
|
|
25
|
+
|
|
26
|
+
Equivalent in this repo: `yarn mcp:config` (Yarn v1 reserves `yarn config` for registry settings). Same as `node src/index.mjs config` / `npm run mcp:config`.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## Which coding tool? (switch)
|
|
31
|
+
|
|
32
|
+
Use this table to see **where** each host stores config. The **`mcpServers.enfyra` JSON block** at the bottom of each section is identical; only the **file paths** and **CLI** differ.
|
|
33
|
+
|
|
34
|
+
| | **Claude Code** | **Cursor** |
|
|
35
|
+
|---|-----------------|------------|
|
|
36
|
+
| **Global (all projects)** | `~/.claude.json` — scopes **user** or **local** | `~/.cursor/mcp.json` |
|
|
37
|
+
| **Project (repo)** | **`.mcp.json`** at repository root (`--scope project`) | **`.cursor/mcp.json`** in the project |
|
|
38
|
+
| **Typical install** | `claude mcp add --transport stdio …` | Edit `mcp.json` or **Settings → MCP** |
|
|
39
|
+
| **Precedence / merge** | local → project `.mcp.json` → user | Project `.cursor/mcp.json` overrides global `~/.cursor/mcp.json` |
|
|
40
|
+
| **Gotcha** | Do not put MCP server definitions in `.claude/settings.json` | Root **`.mcp.json`** is for Claude Code project scope, not Cursor — use **`.cursor/mcp.json`** for Cursor |
|
|
41
|
+
|
|
42
|
+
Expand **one** block below for step-by-step setup.
|
|
43
|
+
|
|
44
|
+
<details open>
|
|
45
|
+
<summary><strong>Claude Code</strong> — setup</summary>
|
|
46
|
+
|
|
47
|
+
MCP server definitions are **not** placed in `.claude/settings.json`; that folder is for other Claude Code settings.
|
|
48
|
+
|
|
49
|
+
### Choose scope (Claude Code)
|
|
50
|
+
|
|
51
|
+
| Goal | Location | Claude Code scope | Typical use |
|
|
52
|
+
|------|----------|-------------------|-------------|
|
|
53
|
+
| Same Enfyra MCP in **every** project on your machine | **`~/.claude.json`** | **user** (`claude mcp add … --scope user`) | One admin stack you always use |
|
|
54
|
+
| MCP only when this **repo is cwd**, private to you, often with secrets | **`~/.claude.json`** | **local** (default: `claude mcp add …` without `--scope project`) | Per-machine URLs or tokens; nothing committed |
|
|
55
|
+
| **Team** / reproducible setup; commit config to git | **`.mcp.json`** at the **repository root** | **project** (`claude mcp add … --scope project`) | Shared onboarding; env expansion supported |
|
|
56
|
+
|
|
57
|
+
**Precedence when the same server name exists in more than one place:** **local** → **project** (`.mcp.json`) → **user**. See the [official MCP docs](https://docs.anthropic.com/en/docs/claude-code/mcp).
|
|
58
|
+
|
|
59
|
+
**Project `.mcp.json` approval:** Claude Code may prompt before trusting project-scoped servers; use `claude mcp reset-project-choices` to reset.
|
|
60
|
+
|
|
61
|
+
### `claude mcp add` — user, local, or project
|
|
62
|
+
|
|
63
|
+
Use the CLI (recommended). **User** and **local** configs are stored in **`~/.claude.json`**; **project** (`--scope project`) writes **`./.mcp.json`** at the repo root.
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# User scope — available in all projects (options before server name per Claude Code docs)
|
|
67
|
+
claude mcp add --transport stdio --scope user \
|
|
68
|
+
--env ENFYRA_API_URL=http://localhost:3000/api \
|
|
69
|
+
--env ENFYRA_EMAIL=your-email@example.com \
|
|
70
|
+
--env ENFYRA_PASSWORD=your-password \
|
|
71
|
+
enfyra -- npx -y @enfyra/mcp-server
|
|
72
|
+
|
|
73
|
+
# Local scope (default) — only when this repo is cwd; still stored in ~/.claude.json under project path
|
|
74
|
+
claude mcp add --transport stdio \
|
|
75
|
+
--env ENFYRA_API_URL=http://localhost:3000/api \
|
|
76
|
+
--env ENFYRA_EMAIL=your-email@example.com \
|
|
77
|
+
--env ENFYRA_PASSWORD=your-password \
|
|
78
|
+
enfyra -- npx -y @enfyra/mcp-server
|
|
79
|
+
|
|
80
|
+
# Project scope — writes/updates .mcp.json at repo root (good for teams)
|
|
81
|
+
claude mcp add --transport stdio --scope project \
|
|
82
|
+
--env ENFYRA_API_URL=http://localhost:3000/api \
|
|
83
|
+
--env ENFYRA_EMAIL=your-email@example.com \
|
|
84
|
+
--env ENFYRA_PASSWORD=your-password \
|
|
85
|
+
enfyra -- npx -y @enfyra/mcp-server
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
On **native Windows** (not WSL), stdio servers using `npx` often need the `cmd /c` wrapper — see [Claude Code MCP — Windows](https://docs.anthropic.com/en/docs/claude-code/mcp).
|
|
89
|
+
|
|
90
|
+
You can set env vars with **`--env`** (as above), edit **`~/.claude.json`** / **`.mcp.json`**, or use the `/mcp` UI.
|
|
91
|
+
|
|
92
|
+
### Manual JSON (Claude Code)
|
|
93
|
+
|
|
94
|
+
Use inside **`.mcp.json`** `mcpServers`, or merge into **`~/.claude.json`** per [Claude Code settings](https://docs.anthropic.com/en/docs/claude-code/settings) for your scope. Reuse the **shared JSON** in the [Shared](#shared-enfyra-mcp-json-and-environment) section below.
|
|
95
|
+
|
|
96
|
+
### `.mcp.json` only (Claude Code project, manual)
|
|
97
|
+
|
|
98
|
+
If you skip the CLI, add **`mcpServers.enfyra`** to **`.mcp.json`** at the repository root. Official docs support **environment variable expansion** in `.mcp.json`.
|
|
99
|
+
|
|
100
|
+
**Local dev (this monorepo):** point `command` / `args` / `cwd` at `node` and `src/index.mjs` inside your clone — see the sample **`.mcp.json`** in this repository (adjust `cwd` or use expansion).
|
|
101
|
+
|
|
102
|
+
</details>
|
|
103
|
+
|
|
104
|
+
<details>
|
|
105
|
+
<summary><strong>Cursor</strong> — setup</summary>
|
|
106
|
+
|
|
107
|
+
Cursor reads MCP from **`mcp.json`** in two places ([Cursor docs](https://cursor.com/docs/context/mcp)):
|
|
108
|
+
|
|
109
|
+
| Scope | Path |
|
|
110
|
+
|-------|------|
|
|
111
|
+
| **Global** | `~/.cursor/mcp.json` (macOS/Linux) or `%USERPROFILE%\.cursor\mcp.json` (Windows) |
|
|
112
|
+
| **Project** | **`.cursor/mcp.json`** inside the project (directory **`.cursor`** at repo root) |
|
|
8
113
|
|
|
9
|
-
|
|
114
|
+
Paste the **same** `mcpServers` structure as in the [Shared](#shared-enfyra-mcp-json-and-environment) section. Cursor supports **interpolation**, e.g. `${env:ENFYRA_PASSWORD}`, `${workspaceFolder}`, for secrets and paths.
|
|
115
|
+
|
|
116
|
+
Optional **STDIO** fields per Cursor: `type`, `command`, `args`, `env`, `envFile` — see [STDIO server configuration](https://cursor.com/docs/context/mcp).
|
|
117
|
+
|
|
118
|
+
**After edits:** restart Cursor (or toggle the server under **Settings → Features → Model Context Protocol**). Use **Output → MCP Logs** if the server fails to start.
|
|
119
|
+
|
|
120
|
+
**Using both Cursor and Claude Code in one repo:** keep **`.cursor/mcp.json`** for Cursor and **`.mcp.json`** (root) for Claude Code **project** scope if needed — they are different files.
|
|
121
|
+
|
|
122
|
+
</details>
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Shared: Enfyra MCP JSON and environment
|
|
127
|
+
|
|
128
|
+
Use this block in any host-specific `mcp.json` / `mcpServers` merge (adjust env or use `${env:…}` where your editor supports it).
|
|
10
129
|
|
|
11
130
|
```json
|
|
12
131
|
{
|
|
@@ -24,17 +143,26 @@ Edit `~/.claude.json` and add to `mcpServers`:
|
|
|
24
143
|
}
|
|
25
144
|
```
|
|
26
145
|
|
|
27
|
-
- `-y`: auto-confirm package install without prompting.
|
|
28
|
-
- **Restart
|
|
29
|
-
|
|
30
|
-
**Local dev (running this repo):** use `node` with path to `src/index.mjs`; see `.mcp.json` in the project.
|
|
146
|
+
- `-y`: auto-confirm `npx` package install without prompting.
|
|
147
|
+
- **Restart** the coding tool after manual file edits.
|
|
31
148
|
|
|
32
149
|
| Variable | Description | Default |
|
|
33
150
|
|----------|-------------|---------|
|
|
34
|
-
| `ENFYRA_API_URL` |
|
|
151
|
+
| `ENFYRA_API_URL` | Base for REST + GraphQL + auth (see table below) | `http://localhost:3000/api` |
|
|
35
152
|
| `ENFYRA_EMAIL` | Admin email | — |
|
|
36
153
|
| `ENFYRA_PASSWORD` | Admin password | — |
|
|
37
154
|
|
|
155
|
+
### `ENFYRA_API_URL` — two valid setups
|
|
156
|
+
|
|
157
|
+
| Mode | Example | When to use |
|
|
158
|
+
|------|---------|-------------|
|
|
159
|
+
| **Via Nuxt admin (typical local dev)** | `http://localhost:3000/api` | Browser app on 3000; Nitro proxies `/api/*` to Nest (`API_URL`, often `http://localhost:1105`). GraphQL at `{ENFYRA_API_URL}/graphql` is proxied to the backend `/graphql`. |
|
|
160
|
+
| **Direct to Nest backend** | `http://localhost:1105` | Call Enfyra **without** the Nuxt prefix. **Do not** append `/api` unless your reverse proxy serves routes under `/api`—`http://localhost:1105/api/...` will not match default Nest paths. |
|
|
161
|
+
|
|
162
|
+
Pick the base URL that matches how **your** HTTP client reaches the same server as the Enfyra REST API.
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
38
166
|
## Tools (summary)
|
|
39
167
|
|
|
40
168
|
Metadata, query/CRUD, route/handler/hook, tables/columns, reload cache, logs, user/roles, login, menu/extension, `get_enfyra_api_context`. For full tool list and behavior, see the app after enabling MCP or the source in `src/index.mjs`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enfyra/mcp-server",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "MCP server for Enfyra - manage your Enfyra instance via Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -11,7 +11,8 @@
|
|
|
11
11
|
],
|
|
12
12
|
"scripts": {
|
|
13
13
|
"start": "node src/index.mjs",
|
|
14
|
-
"dev": "node --watch src/index.mjs"
|
|
14
|
+
"dev": "node --watch src/index.mjs",
|
|
15
|
+
"mcp:config": "node src/index.mjs config"
|
|
15
16
|
},
|
|
16
17
|
"dependencies": {
|
|
17
18
|
"@modelcontextprotocol/sdk": "^1.0.0",
|