@engramprotocol/mcp-server 0.9.0 → 0.10.0
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/LICENSE +21 -0
- package/README.md +98 -48
- package/dist/cli.js +53 -10
- package/dist/cli.js.map +1 -1
- package/dist/http-client.d.ts +7 -7
- package/dist/http-client.js +7 -7
- package/dist/server.d.ts +6 -6
- package/dist/setup/_helpers.d.ts +71 -0
- package/dist/setup/_helpers.d.ts.map +1 -0
- package/dist/setup/_helpers.js +275 -0
- package/dist/setup/_helpers.js.map +1 -0
- package/dist/setup/index.d.ts +2 -0
- package/dist/setup/index.d.ts.map +1 -0
- package/dist/setup/index.js +83 -0
- package/dist/setup/index.js.map +1 -0
- package/dist/setup/install.d.ts +2 -0
- package/dist/setup/install.d.ts.map +1 -0
- package/dist/setup/install.js +241 -0
- package/dist/setup/install.js.map +1 -0
- package/dist/setup/uninstall.d.ts +2 -0
- package/dist/setup/uninstall.d.ts.map +1 -0
- package/dist/setup/uninstall.js +120 -0
- package/dist/setup/uninstall.js.map +1 -0
- package/dist/setup/update.d.ts +2 -0
- package/dist/setup/update.d.ts.map +1 -0
- package/dist/setup/update.js +130 -0
- package/dist/setup/update.js.map +1 -0
- package/dist/tools/_helpers.d.ts +6 -6
- package/dist/tools/_helpers.js +6 -6
- package/dist/tools/boot.d.ts.map +1 -1
- package/dist/tools/boot.js +4 -9
- package/dist/tools/boot.js.map +1 -1
- package/dist/tools/decide.d.ts +13 -0
- package/dist/tools/decide.d.ts.map +1 -0
- package/dist/tools/decide.js +59 -0
- package/dist/tools/decide.js.map +1 -0
- package/dist/tools/entity.d.ts +6 -2
- package/dist/tools/entity.d.ts.map +1 -1
- package/dist/tools/entity.js +23 -25
- package/dist/tools/entity.js.map +1 -1
- package/dist/tools/get.d.ts.map +1 -1
- package/dist/tools/get.js +3 -9
- package/dist/tools/get.js.map +1 -1
- package/dist/tools/index.d.ts +19 -4
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +41 -17
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/list.d.ts.map +1 -1
- package/dist/tools/list.js +6 -10
- package/dist/tools/list.js.map +1 -1
- package/dist/tools/note.d.ts +15 -0
- package/dist/tools/note.d.ts.map +1 -0
- package/dist/tools/note.js +50 -0
- package/dist/tools/note.js.map +1 -0
- package/dist/tools/projects.d.ts +9 -0
- package/dist/tools/projects.d.ts.map +1 -0
- package/dist/tools/projects.js +65 -0
- package/dist/tools/projects.js.map +1 -0
- package/dist/tools/recall.d.ts.map +1 -1
- package/dist/tools/recall.js +4 -6
- package/dist/tools/recall.js.map +1 -1
- package/dist/tools/set-status.d.ts +13 -0
- package/dist/tools/set-status.d.ts.map +1 -0
- package/dist/tools/set-status.js +48 -0
- package/dist/tools/set-status.js.map +1 -0
- package/dist/tools/show.d.ts +11 -0
- package/dist/tools/show.d.ts.map +1 -0
- package/dist/tools/show.js +25 -0
- package/dist/tools/show.js.map +1 -0
- package/dist/tools/stats.d.ts +11 -0
- package/dist/tools/stats.d.ts.map +1 -0
- package/dist/tools/stats.js +21 -0
- package/dist/tools/stats.js.map +1 -0
- package/dist/tools/track-task.d.ts +10 -0
- package/dist/tools/track-task.d.ts.map +1 -0
- package/dist/tools/track-task.js +56 -0
- package/dist/tools/track-task.js.map +1 -0
- package/dist/tools/update.d.ts.map +1 -1
- package/dist/tools/update.js +4 -5
- package/dist/tools/update.js.map +1 -1
- package/package.json +15 -12
- package/templates/hooks/session_start_boot.sh +63 -0
- package/templates/hooks/user_prompt_submit_reminder.sh +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dominik Tilman / Epistemic Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,72 +1,122 @@
|
|
|
1
1
|
# @engramprotocol/mcp-server
|
|
2
2
|
|
|
3
|
-
MCP
|
|
3
|
+
MCP wrapper around the EML HTTP API. Exposes the Engram Protocol as MCP tools for Claude Code (and other MCP clients) — stdio transport, Bearer token auth against `api.engramprotocol.io`.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Request an API token: **parsley_22bonds@icloud.com**
|
|
6
|
+
|
|
7
|
+
## Install
|
|
6
8
|
|
|
7
9
|
```bash
|
|
8
|
-
|
|
10
|
+
EML_API_TOKEN=eml_<prefix><secret> \
|
|
11
|
+
npx @engramprotocol/mcp-server setup install
|
|
9
12
|
```
|
|
10
13
|
|
|
11
|
-
|
|
14
|
+
The installer:
|
|
15
|
+
- Verifies the token against `/stats` before storing
|
|
16
|
+
- Writes `~/.eml/config` (chmod 600) with URL + token + client-version
|
|
17
|
+
- Registers the `engramprotocol` MCP server via `claude mcp add` (user scope, stdio transport, semver-range-pinned to `@~0.10`)
|
|
18
|
+
- Adds two hooks to `~/.claude/settings.json` (see [Hooks](#hooks) below):
|
|
19
|
+
- **SessionStart** → loads your brain at session start (identity, rules, decisions, status, tasks, protocol conventions)
|
|
20
|
+
- **UserPromptSubmit** → light mid-session reminder on turn 1, every 5 turns, or after >1h pause
|
|
21
|
+
- Adds two permissions: `mcp__engramprotocol__*` (skip per-call prompt for EML tools) and `Bash(npx @engramprotocol/mcp-server setup *)` (let the agent auto-execute `setup update` when prompted)
|
|
22
|
+
- Performs a final `/stats` round-trip as smoke test
|
|
23
|
+
|
|
24
|
+
A backup of `~/.claude/settings.json` is created first (pattern `.pre-eml-install-YYYY-MM-DD-HH-MM-SS.bak`).
|
|
25
|
+
|
|
26
|
+
### Update
|
|
12
27
|
|
|
13
28
|
```bash
|
|
14
|
-
|
|
15
|
-
EML_API_TOKEN=eml_<prefix><secret> \
|
|
16
|
-
npx @engramprotocol/mcp-server
|
|
29
|
+
npx @engramprotocol/mcp-server@latest setup update
|
|
17
30
|
```
|
|
18
31
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
"mcpServers": {
|
|
26
|
-
"eml": {
|
|
27
|
-
"command": "npx",
|
|
28
|
-
"args": [
|
|
29
|
-
"@engramprotocol/mcp-server",
|
|
30
|
-
"--url", "https://api.engramprotocol.io",
|
|
31
|
-
"--token", "eml_<prefix><secret>"
|
|
32
|
-
]
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
32
|
+
Refreshes hook templates (marker-aware — preserves files you customised), bumps `EML_CLIENT_VERSION` in `~/.eml/config`. Idempotent. The `@latest` suffix busts the npx cache so you actually get the new version.
|
|
33
|
+
|
|
34
|
+
### Uninstall
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npx @engramprotocol/mcp-server setup uninstall
|
|
36
38
|
```
|
|
37
39
|
|
|
38
|
-
|
|
40
|
+
Removes the MCP registration, the two managed hook entries, the two managed permission entries, and `~/.eml/hooks/`. Your own hooks and permissions are untouched. `~/.eml/config` is kept by default (asks for confirmation before delete — it contains your token).
|
|
41
|
+
|
|
42
|
+
## Hooks
|
|
43
|
+
|
|
44
|
+
Two bash hooks land in `~/.eml/hooks/`:
|
|
45
|
+
|
|
46
|
+
### `session_start_boot.sh` (SessionStart event)
|
|
47
|
+
- Sources `~/.eml/config`, POSTs to `/boot`, prints the returned markdown to stdout
|
|
48
|
+
- Claude Code injects that stdout into model context — **invisible in chat** but reaches the model (verified empirically; behavior decided 2026-05-15)
|
|
49
|
+
- Performs an update-banner check: if `EML_CLIENT_VERSION` from config differs from `/boot.version`, emits a banner pointing to `setup update`
|
|
50
|
+
- Fail-soft: missing config, missing vars, or unreachable server emits a warning and exits 0 — session continues without brain
|
|
51
|
+
|
|
52
|
+
### `user_prompt_submit_reminder.sh` (UserPromptSubmit event)
|
|
53
|
+
- Local only, no HTTP
|
|
54
|
+
- Triggers a 5-bullet reminder on turn 1, every 5 turns, or after >1h pause
|
|
55
|
+
- Per-session turn counter at `/tmp/eml-turns/<session_id>`
|
|
56
|
+
- Reminder content is a heredoc inside the script — refreshed via `setup update`
|
|
57
|
+
|
|
58
|
+
Both hooks log to `~/.eml/logs/<event>-YYYY-MM-DD.log` (self-rotating per day) and carry a `# managed-by: engramprotocol-setup` marker line that lets `setup update` / `setup uninstall` identify which files they own.
|
|
39
59
|
|
|
40
|
-
## Tools
|
|
60
|
+
## Tools (v0.10.0)
|
|
61
|
+
|
|
62
|
+
All tools have an `eml_` prefix. Total: **17 tools**.
|
|
63
|
+
|
|
64
|
+
### Boot / Recall
|
|
65
|
+
|
|
66
|
+
| Tool | HTTP endpoint | Use case |
|
|
67
|
+
|---|---|---|
|
|
68
|
+
| `eml_boot` | `POST /boot` | Manual brain-reload (SessionStart-Hook does this automatically at session start) |
|
|
69
|
+
| `eml_recall` | `POST /recall` | Topic search (FTS5 + recency) |
|
|
70
|
+
|
|
71
|
+
### Write (typed)
|
|
72
|
+
|
|
73
|
+
| Tool | HTTP endpoint | Use case |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| `eml_decide` | `POST /context` (type=decision) | Record a deliberate, documented decision |
|
|
76
|
+
| `eml_set_status` | `POST /context` (type=status) | Set current status for a scope (auto-supersedes old active status) |
|
|
77
|
+
| `eml_track_task` | `POST /context` (type=task) | Plan/track a task with priority + due date |
|
|
78
|
+
| `eml_note` | `POST /context` (kind-discriminated) | Catch-all for rule/profile/event/reference/log |
|
|
79
|
+
|
|
80
|
+
### Read / Find
|
|
81
|
+
|
|
82
|
+
| Tool | HTTP endpoint | Use case |
|
|
83
|
+
|---|---|---|
|
|
84
|
+
| `eml_show` | `GET /brain-state?scope=` | Curated snapshot for any scope |
|
|
85
|
+
| `eml_list` | `GET /list` | Filter-based engram list |
|
|
86
|
+
| `eml_get` | `GET /engram/:id` | Single engram + relations |
|
|
87
|
+
| `eml_projects` | `GET /projects` | List projects (filter: status) |
|
|
88
|
+
| `eml_entities` | `GET /entities` | List entities (filter: kind) |
|
|
89
|
+
|
|
90
|
+
### Self-awareness / Edit
|
|
91
|
+
|
|
92
|
+
| Tool | HTTP endpoint | Use case |
|
|
93
|
+
|---|---|---|
|
|
94
|
+
| `eml_stats` | `GET /stats` | Brain stats (counts per type/scope, container counts) |
|
|
95
|
+
| `eml_update` | `POST /update` | Patch engram (status/properties/etc.) |
|
|
41
96
|
|
|
42
|
-
|
|
97
|
+
### Container CRUD
|
|
43
98
|
|
|
44
|
-
| Tool | HTTP
|
|
99
|
+
| Tool | HTTP endpoint | Use case |
|
|
45
100
|
|---|---|---|
|
|
46
|
-
| `
|
|
47
|
-
| `
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `eml_list` | `GET /list[/mode]` | Filter-basierte Liste |
|
|
51
|
-
| `eml_get` | `GET /engram/:id` | Einzelnes Engram + Relations |
|
|
52
|
-
| `eml_relate` | `POST /relate` | Typed Relation zwischen 2 Engrams |
|
|
53
|
-
| `eml_update` | `POST /update` | Patch (status/properties/etc.) |
|
|
54
|
-
| `eml_confirm_review` | `POST /engram/:id/confirm-review` | review_due_at-Reset (Brain-Hygiene) |
|
|
55
|
-
| `eml_entity_create` | `POST /entity` | Entity-Registrierung (Pflicht vor `entity.<id>`-scope) |
|
|
56
|
-
| `eml_entity_list` | `GET /entities` | |
|
|
57
|
-
| `eml_entity_get` | `GET /entity/:id` | |
|
|
58
|
-
| `eml_entity_update` | `PUT /entity/:id` | |
|
|
101
|
+
| `eml_project_create` | `POST /project` | Register a project (required before `scope=project.<id>`) |
|
|
102
|
+
| `eml_project_update` | `PUT /project/:id` | Patch project fields |
|
|
103
|
+
| `eml_entity_create` | `POST /entity` | Register an entity (required before `scope=entity.<id>`) |
|
|
104
|
+
| `eml_entity_update` | `PUT /entity/:id` | Patch entity fields |
|
|
59
105
|
|
|
60
|
-
|
|
106
|
+
### Intentionally not exposed (v0.10.0)
|
|
61
107
|
|
|
62
|
-
|
|
108
|
+
- `eml_relate` — available via HTTP API directly
|
|
109
|
+
- `eml_confirm_review` — deferred to brain-hygiene cluster
|
|
110
|
+
- Epistemic-mode write tools (observation/hypothesis/assessment/prediction/pattern) — Alpha-state, available via HTTP API
|
|
111
|
+
- Session-Awareness tools — deferred to its own future version
|
|
112
|
+
- `eml_*_delete` — by design not in the agent action space; cleanup is operator-only
|
|
63
113
|
|
|
64
|
-
|
|
114
|
+
## Error handling
|
|
65
115
|
|
|
66
|
-
|
|
116
|
+
Backend errors (e.g. 401 invalid token, 400 invalid scope) are returned as `isError: true` with a clear message — not as MCP protocol errors. The LLM can self-correct.
|
|
67
117
|
|
|
68
|
-
|
|
118
|
+
Protocol errors (malformed JSON-RPC, unknown tool name) are handled by the SDK.
|
|
69
119
|
|
|
70
|
-
##
|
|
120
|
+
## License
|
|
71
121
|
|
|
72
|
-
|
|
122
|
+
MIT — see [LICENSE](./LICENSE).
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
3
36
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
37
|
const server_1 = require("./server");
|
|
5
38
|
function parseArgs(argv) {
|
|
@@ -26,25 +59,27 @@ function parseArgs(argv) {
|
|
|
26
59
|
return out;
|
|
27
60
|
}
|
|
28
61
|
function printHelpAndExit(code) {
|
|
29
|
-
const msg = `eml-mcp-server — MCP
|
|
62
|
+
const msg = `eml-mcp-server — MCP wrapper for the EML HTTP API
|
|
30
63
|
|
|
31
64
|
Usage:
|
|
32
65
|
eml-mcp-server --url <api-url> --token <bearer> [--name <client-name>]
|
|
33
66
|
|
|
34
67
|
Args:
|
|
35
|
-
--url EML_API_URL EML
|
|
36
|
-
--token EML_API_TOKEN Bearer
|
|
37
|
-
--name EML_CLIENT_NAME Client
|
|
68
|
+
--url EML_API_URL EML API URL (e.g. http://localhost:3117)
|
|
69
|
+
--token EML_API_TOKEN Bearer token (eml_<prefix><secret>)
|
|
70
|
+
--name EML_CLIENT_NAME Client name in server logs (default: eml-mcp-server)
|
|
38
71
|
--help
|
|
39
72
|
|
|
40
|
-
|
|
73
|
+
Example — Claude Code MCP config:
|
|
41
74
|
{
|
|
42
75
|
"mcpServers": {
|
|
43
|
-
"
|
|
76
|
+
"engramprotocol": {
|
|
44
77
|
"command": "npx",
|
|
45
|
-
"args": ["@engramprotocol/mcp-server",
|
|
46
|
-
|
|
47
|
-
|
|
78
|
+
"args": ["-y", "@engramprotocol/mcp-server"],
|
|
79
|
+
"env": {
|
|
80
|
+
"EML_API_URL": "https://api.engramprotocol.io",
|
|
81
|
+
"EML_API_TOKEN": "eml_..."
|
|
82
|
+
}
|
|
48
83
|
}
|
|
49
84
|
}
|
|
50
85
|
}
|
|
@@ -53,7 +88,15 @@ Beispiel — Claude Code MCP-Config:
|
|
|
53
88
|
process.exit(code);
|
|
54
89
|
}
|
|
55
90
|
async function main() {
|
|
56
|
-
const
|
|
91
|
+
const argv = process.argv.slice(2);
|
|
92
|
+
// Dispatch: setup-mode vs server-mode
|
|
93
|
+
if (argv[0] === 'setup') {
|
|
94
|
+
const { runSetup } = await Promise.resolve().then(() => __importStar(require('./setup/index.js')));
|
|
95
|
+
await runSetup(argv.slice(1));
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
// Server-mode (default)
|
|
99
|
+
const args = parseArgs(argv);
|
|
57
100
|
if (args.help)
|
|
58
101
|
printHelpAndExit(0);
|
|
59
102
|
const url = args.url ?? process.env.EML_API_URL;
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,qCAAyC;AAgCzC,SAAS,SAAS,CAAC,IAAc;IAC/B,MAAM,GAAG,GAAY,EAAE,CAAA;IACvB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;QACjB,IAAI,CAAC,KAAK,QAAQ,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAAC,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC;YAAC,SAAQ;QAAC,CAAC;QAC/D,IAAI,CAAC,KAAK,OAAO,EAAI,CAAC;YAAC,GAAG,CAAC,GAAG,GAAK,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAAC,SAAQ;QAAC,CAAC;QACxD,IAAI,CAAC,KAAK,SAAS,EAAE,CAAC;YAAC,GAAG,CAAC,KAAK,GAAG,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAAC,SAAQ;QAAC,CAAC;QACxD,IAAI,CAAC,KAAK,QAAQ,EAAG,CAAC;YAAC,GAAG,CAAC,IAAI,GAAI,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;YAAC,SAAQ;QAAC,CAAC;IAC1D,C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KAAK,EAAE,UAAU,EAAE,CAAC,CAAA;QAChD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,sDAAsD,UAAU,MAAM,GAAG,KAAK,CAAC,CAAA;IACtG,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,CAAC,GAAG,GAAY,CAAA;QACtB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oCAAoC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAA;QACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAA"}
|
package/dist/http-client.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Thin fetch
|
|
2
|
+
* Thin fetch wrapper for the EML HTTP API (v0.9-PROPOSAL §6.2).
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* SDK + zod +
|
|
4
|
+
* Deliberately lives without an `@engramprotocol/core` dependency — the MCP
|
|
5
|
+
* server ships as a small npm package (`@engramprotocol/mcp-server`) that
|
|
6
|
+
* only needs the SDK + zod + this file.
|
|
7
7
|
*
|
|
8
|
-
* Error
|
|
9
|
-
*
|
|
10
|
-
* "Error
|
|
8
|
+
* Error handling: all failures throw `EmlApiError`. Tools catch it in the
|
|
9
|
+
* handler and map to an `isError: true` result (see v0.9-PROPOSAL §6.4
|
|
10
|
+
* "Error handling — two channels").
|
|
11
11
|
*/
|
|
12
12
|
export interface HttpClientOptions {
|
|
13
13
|
url: string;
|
package/dist/http-client.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Thin fetch
|
|
3
|
+
* Thin fetch wrapper for the EML HTTP API (v0.9-PROPOSAL §6.2).
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* SDK + zod +
|
|
5
|
+
* Deliberately lives without an `@engramprotocol/core` dependency — the MCP
|
|
6
|
+
* server ships as a small npm package (`@engramprotocol/mcp-server`) that
|
|
7
|
+
* only needs the SDK + zod + this file.
|
|
8
8
|
*
|
|
9
|
-
* Error
|
|
10
|
-
*
|
|
11
|
-
* "Error
|
|
9
|
+
* Error handling: all failures throw `EmlApiError`. Tools catch it in the
|
|
10
|
+
* handler and map to an `isError: true` result (see v0.9-PROPOSAL §6.4
|
|
11
|
+
* "Error handling — two channels").
|
|
12
12
|
*/
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
exports.HttpClient = exports.EmlApiError = void 0;
|
package/dist/server.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* MCP
|
|
2
|
+
* MCP server setup (v0.9-PROPOSAL §6).
|
|
3
3
|
*
|
|
4
|
-
* Single-
|
|
5
|
-
*
|
|
4
|
+
* Single-mode HTTP client (no embedded SQLite). Self-host uses the same
|
|
5
|
+
* invocation, just with `--url http://localhost:3117`.
|
|
6
6
|
*
|
|
7
|
-
* Stdio
|
|
8
|
-
* Capabilities:
|
|
9
|
-
*
|
|
7
|
+
* Stdio transport: local process spawned by Claude Code's MCP config.
|
|
8
|
+
* Capabilities: tools only (static, listChanged=false). Resources/prompts
|
|
9
|
+
* are v0.9.x polish.
|
|
10
10
|
*/
|
|
11
11
|
export interface McpServerOptions {
|
|
12
12
|
url: string;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
export declare const HOME_DIR: string;
|
|
2
|
+
export declare const EML_DIR: string;
|
|
3
|
+
export declare const EML_CONFIG: string;
|
|
4
|
+
export declare const EML_HOOKS_DIR: string;
|
|
5
|
+
export declare const CLAUDE_DIR: string;
|
|
6
|
+
export declare const CLAUDE_JSON: string;
|
|
7
|
+
export declare const CLAUDE_SETTINGS: string;
|
|
8
|
+
export declare const MANAGED_BY_MARKER = "engramprotocol-setup";
|
|
9
|
+
export declare const MCP_SERVER_NAME = "engramprotocol";
|
|
10
|
+
/** Resolve the package's own root (where templates/ lives). Works from dist/. */
|
|
11
|
+
export declare function pkgRoot(): string;
|
|
12
|
+
export declare function pkgVersion(): string;
|
|
13
|
+
export declare function templatesDir(): string;
|
|
14
|
+
export declare function promptText(question: string): Promise<string>;
|
|
15
|
+
export declare function promptConfirm(question: string, defaultYes?: boolean): Promise<boolean>;
|
|
16
|
+
export interface EmlConfig {
|
|
17
|
+
EML_URL?: string;
|
|
18
|
+
EML_API_TOKEN?: string;
|
|
19
|
+
EML_CLIENT_VERSION?: string;
|
|
20
|
+
}
|
|
21
|
+
export declare function readConfig(): EmlConfig | null;
|
|
22
|
+
export declare function writeConfig(cfg: EmlConfig): void;
|
|
23
|
+
export type SettingsJson = Record<string, any>;
|
|
24
|
+
export declare function readSettings(): SettingsJson;
|
|
25
|
+
export declare function backupSettings(): string;
|
|
26
|
+
export declare function writeSettings(settings: SettingsJson): void;
|
|
27
|
+
/** Add a permission entry to settings.permissions.allow if not already present. */
|
|
28
|
+
export declare function mergePermission(settings: SettingsJson, entry: string): boolean;
|
|
29
|
+
/** Remove permission entries matching the predicate. Returns count removed. */
|
|
30
|
+
export declare function removePermissions(settings: SettingsJson, predicate: (entry: string) => boolean): number;
|
|
31
|
+
export interface HookEntry {
|
|
32
|
+
hooks: Array<{
|
|
33
|
+
type: string;
|
|
34
|
+
command: string;
|
|
35
|
+
}>;
|
|
36
|
+
matcher?: string;
|
|
37
|
+
}
|
|
38
|
+
/** Add a command-hook to settings.hooks.<event>[] if no existing entry references the same command. */
|
|
39
|
+
export declare function mergeHookCommand(settings: SettingsJson, event: string, command: string): boolean;
|
|
40
|
+
/** Remove hook entries whose command starts with the given prefix (e.g. `$HOME/.eml/hooks/`). Returns count removed. */
|
|
41
|
+
export declare function removeHooksByCommandPrefix(settings: SettingsJson, prefix: string): number;
|
|
42
|
+
export declare function claudeCli(args: string[]): {
|
|
43
|
+
stdout: string;
|
|
44
|
+
stderr: string;
|
|
45
|
+
status: number;
|
|
46
|
+
};
|
|
47
|
+
export declare function claudeCliExists(): boolean;
|
|
48
|
+
/** Unauthenticated reachability check — "is the server alive?". */
|
|
49
|
+
export declare function verifyHealth(url: string): Promise<{
|
|
50
|
+
ok: boolean;
|
|
51
|
+
status?: number;
|
|
52
|
+
error?: string;
|
|
53
|
+
}>;
|
|
54
|
+
/** Authenticated round-trip — "does this token work?". Uses GET /stats (lightweight, auth-required). */
|
|
55
|
+
export declare function verifyToken(url: string, token: string): Promise<{
|
|
56
|
+
ok: boolean;
|
|
57
|
+
status?: number;
|
|
58
|
+
error?: string;
|
|
59
|
+
}>;
|
|
60
|
+
export interface HookTemplate {
|
|
61
|
+
filename: string;
|
|
62
|
+
event: string;
|
|
63
|
+
}
|
|
64
|
+
export declare const HOOK_TEMPLATES: HookTemplate[];
|
|
65
|
+
export declare function readTemplate(filename: string): string;
|
|
66
|
+
export declare function hasMarker(content: string): boolean;
|
|
67
|
+
export declare function installTemplate(filename: string): {
|
|
68
|
+
installedPath: string;
|
|
69
|
+
alreadyExisted: boolean;
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=_helpers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_helpers.d.ts","sourceRoot":"","sources":["../../src/setup/_helpers.ts"],"names":[],"mappings":"AAUA,eAAO,MAAM,QAAQ,QAAoD,CAAA;AACzE,eAAO,MAAM,OAAO,QAA8B,CAAA;AAClD,eAAO,MAAM,UAAU,QAA+B,CAAA;AACtD,eAAO,MAAM,aAAa,QAA8B,CAAA;AACxD,eAAO,MAAM,UAAU,QAAiC,CAAA;AACxD,eAAO,MAAM,WAAW,QAAsC,CAAA;AAC9D,eAAO,MAAM,eAAe,QAAyC,CAAA;AAErE,eAAO,MAAM,iBAAiB,yBAAyB,CAAA;AAGvD,eAAO,MAAM,eAAe,mBAAmB,CAAA;AAI/C,iFAAiF;AACjF,wBAAgB,OAAO,IAAI,MAAM,CAIhC;AAED,wBAAgB,UAAU,IAAI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