@modootoday/pmcp 0.10.0 → 0.12.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/README.md +93 -356
- package/dist/cli.js +12075 -2046
- package/dist/harness-egress-bridge.d.ts +2 -0
- package/dist/harness-egress-bridge.js +74 -0
- package/dist/harness-launch-gate.d.ts +2 -0
- package/dist/harness-launch-gate.js +1187 -0
- package/dist/harness-pane-runner.d.ts +2 -0
- package/dist/harness-pane-runner.js +118 -0
- package/dist/harness-worker.d.ts +2 -0
- package/dist/harness-worker.js +2706 -0
- package/dist/hook-spec-PRSnYGLV.d.ts +10 -0
- package/dist/http.js +2102 -12
- package/dist/index.d.ts +20 -3
- package/dist/index.js +4541 -85
- package/dist/mailbox/index.js +1556 -47
- package/dist/project/hook-adapter.d.ts +11 -0
- package/dist/project/hook-adapter.js +191 -0
- package/dist/stdio.js +3050 -9
- package/docs/embeddings.md +125 -0
- package/docs/hosting.md +46 -0
- package/docs/mailbox.md +59 -0
- package/docs/project-configuration.md +203 -0
- package/docs/skills.md +74 -0
- package/docs/terminal-harness.md +393 -0
- package/package.json +3 -2
- package/dist/chunk-HNAVQG6R.js +0 -1198
- package/dist/chunk-JRSR4JBR.js +0 -88
- package/dist/chunk-MSTKY33C.js +0 -147
- package/dist/chunk-VRZFM2M5.js +0 -1774
- package/dist/chunk-XEH4ZGGJ.js +0 -336
- package/dist/chunk-XOH2CW6P.js +0 -297
- package/dist/chunk-ZUFFVIHQ.js +0 -1191
package/README.md
CHANGED
|
@@ -1,405 +1,142 @@
|
|
|
1
1
|
# pmcp
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
(`--workspace <dir>`: the root and every member its `workspaces` globs name, nested
|
|
6
|
-
workspace roots included), from single package directories (`--package <dir>`), and
|
|
7
|
-
from plugin marketplaces (`--marketplace <dir>`), and exposes six MCP tools: `skill_catalog`, `skill_find`,
|
|
8
|
-
`skill_describe`, `skill_call`, `skill_read` and `skill_bundle`, plus every skill file as a
|
|
9
|
-
`skill://` resource and, on request, one prompt per skill.
|
|
3
|
+
Use the skills your packages already ship, and keep your AI tools' project
|
|
4
|
+
configuration in one place.
|
|
10
5
|
|
|
11
|
-
|
|
6
|
+
pmcp discovers `SKILL.md` documents in installed packages, workspace packages
|
|
7
|
+
and plugin marketplaces. Your AI tool can search the catalog and open a skill
|
|
8
|
+
when it needs one, without loading the entire catalog into each conversation.
|
|
12
9
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
10
|
+
Claude Code, Codex, Gemini CLI, Grok Build and Antigravity keep their native
|
|
11
|
+
model calls, account login and permission controls. pmcp supplies skills,
|
|
12
|
+
projects shared configuration into their native formats, and optionally provides
|
|
13
|
+
a local mailbox for exchanging messages.
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
| What you want to do | Use |
|
|
16
|
+
| ------------------------------------------------------------- | ------------------------------ |
|
|
17
|
+
| Find and read package skills from your AI tool | The MCP skill catalog |
|
|
18
|
+
| Keep several tools' MCP servers and project assets consistent | `pmcp.toml` and `pmcp project` |
|
|
19
|
+
| Check what an installed tool loads | `pmcp doctor` |
|
|
20
|
+
| Search across languages using local embeddings | `pmcp models` and `pmcp index` |
|
|
21
|
+
| Exchange messages between authorized local actors | The optional mailbox |
|
|
22
|
+
| Supervise native main and worker terminals locally | `pmcp harness` |
|
|
23
|
+
| Serve a catalog to your own application | The HTTP library |
|
|
18
24
|
|
|
19
|
-
|
|
20
|
-
{
|
|
21
|
-
"mcpServers": {
|
|
22
|
-
"pmcp": { "command": "npx", "args": ["-y", "@modootoday/pmcp"] }
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
```
|
|
25
|
+
## Get started
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
Requires Node.js 22 or later, or Bun 1.3 or later.
|
|
28
|
+
|
|
29
|
+
Install pmcp in your project:
|
|
28
30
|
|
|
29
31
|
```sh
|
|
30
|
-
|
|
32
|
+
npm install --save-dev @modootoday/pmcp
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
For Claude Code, register the MCP server from the project directory:
|
|
34
36
|
|
|
35
37
|
```sh
|
|
36
|
-
pmcp
|
|
37
|
-
pmcp available
|
|
38
|
-
pmcp install --all --dry-run
|
|
39
|
-
pmcp install <skill-package> --yes
|
|
40
|
-
pmcp sync --dry-run
|
|
41
|
-
pmcp login
|
|
42
|
-
pmcp whoami
|
|
43
|
-
pmcp logout
|
|
38
|
+
claude mcp add pmcp -- npx @modootoday/pmcp
|
|
44
39
|
```
|
|
45
40
|
|
|
46
|
-
|
|
47
|
-
versions locally. `install` and `sync` use npm or Bun, pin exact versions, and
|
|
48
|
-
require confirmation before changing the project's manifest and lockfile.
|
|
49
|
-
`--dry-run` does not install packages. `--catalog <file>` uses a saved catalog
|
|
50
|
-
response instead of fetching one. Registry access is handled by your package
|
|
51
|
-
manager; an OAuth login is not an npm registry token.
|
|
41
|
+
Other MCP hosts can use a stdio entry:
|
|
52
42
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"pmcp": {
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": ["@modootoday/pmcp"]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
Restart or reconnect your tool's MCP connection after changing its configuration.
|
|
55
|
+
Ask your tool to find a skill relevant to your task and open the result.
|
|
56
|
+
Local skill discovery and reading require no pmcp login.
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
host entry needs no flags and works from any package in the repository:
|
|
58
|
+
To include your workspace's own skills, create `pmcp.toml` at the project root:
|
|
61
59
|
|
|
62
60
|
```toml
|
|
63
61
|
[catalog]
|
|
64
|
-
workspaces = ["."
|
|
65
|
-
packages = ["docs"]
|
|
66
|
-
marketplaces = ["vendor/marketplace"]
|
|
62
|
+
workspaces = ["."]
|
|
67
63
|
```
|
|
68
64
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
the same meaning; an unknown key is an error. A flag replaces the file's list
|
|
72
|
-
of its kind. `--config <file>` names another file and `--no-config` ignores it.
|
|
65
|
+
Run `npx @modootoday/pmcp list` to see the local catalog. Paths in the configuration resolve
|
|
66
|
+
relative to `pmcp.toml`; pmcp searches for this file above the working directory.
|
|
73
67
|
|
|
74
|
-
##
|
|
68
|
+
## Share configuration across your tools
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
Antigravity read natively, from cross-tool sources under `.agents/`
|
|
78
|
-
(`skills/<name>/SKILL.md`, `agents/<name>/agent.md`, `rules/*.md`) and the rest
|
|
79
|
-
of `pmcp.toml`:
|
|
70
|
+
Declare your tools and MCP servers in the same `pmcp.toml`:
|
|
80
71
|
|
|
81
72
|
```toml
|
|
82
73
|
[targets]
|
|
83
74
|
tools = ["claude", "codex", "gemini", "grok", "antigravity"]
|
|
84
75
|
|
|
85
|
-
[
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
[agents.reviewer.claude]
|
|
89
|
-
tools = "Read, Grep" # fields one tool reads stay out of agent.md
|
|
90
|
-
|
|
91
|
-
[rules.packages]
|
|
92
|
-
file = ".agent/rules/PACKAGE.RULE.md" # each package's path-scoped rule
|
|
93
|
-
strip = ["apps"] # dropped from derived link names
|
|
94
|
-
|
|
95
|
-
[mcp.skills]
|
|
96
|
-
command = "node"
|
|
97
|
-
args = ["${PROJECT_ROOT}/node_modules/@modootoday/pmcp/dist/cli.js", "serve"]
|
|
76
|
+
[mcp.docs]
|
|
77
|
+
url = "https://example.com/mcp"
|
|
98
78
|
```
|
|
99
79
|
|
|
100
|
-
|
|
101
|
-
pmcp project # write
|
|
102
|
-
pmcp project --check # exit 2 on drift, stale or undeclared outputs
|
|
103
|
-
pmcp project add <name> # copy a catalog skill or agent into .agents/
|
|
104
|
-
pmcp project remove <name>
|
|
105
|
-
pmcp doctor # ask each installed tool what it loads
|
|
106
|
-
```
|
|
80
|
+
Replace the example URL with your server, then run:
|
|
107
81
|
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
`pmcp.lock` records what was written; a file pmcp did not write is never
|
|
113
|
-
overwritten. `doctor` calls no model: it reads `claude mcp list`,
|
|
114
|
-
`codex mcp list`, `gemini skills list`, `gemini mcp list` and
|
|
115
|
-
`grok inspect --json`, and skips a tool that is not installed.
|
|
116
|
-
|
|
117
|
-
## Package skills
|
|
118
|
-
|
|
119
|
-
Skills are discovered by filename, including `skills/`, `.agents/skills/`,
|
|
120
|
-
`.agent/skills/`, `.claude/skills/`, `.gemini/skills/`, `.codex/skills/`, and
|
|
121
|
-
`lib/skill/` layouts
|
|
122
|
-
within the discovery depth. A skill needs a frontmatter `description` for search.
|
|
123
|
-
|
|
124
|
-
`skill_find` accepts a problem description and returns matching skills.
|
|
125
|
-
`skill_call` opens the selected document and lists the reference, script and asset
|
|
126
|
-
files it carries, as text and as resource links. Local MCP reading requires no login.
|
|
127
|
-
|
|
128
|
-
Files keep their type, as the Agent Skills layout (`references/`, `scripts/`, `assets/`)
|
|
129
|
-
expects: `skill_read` returns text as text, images and audio as image and audio content,
|
|
130
|
-
and other binary files as an embedded resource with its media type; a file whose extension
|
|
131
|
-
names text but whose bytes are not UTF-8 goes out as a blob, so its sha256 stays exact.
|
|
132
|
-
Scripts are returned, never run: running them is the host's job, from a local copy of the
|
|
133
|
-
skill. `skill_bundle` lists every file of a skill as resource links that `resources/read`
|
|
134
|
-
returns, so a host can write the skill into a local skills directory without the bytes
|
|
135
|
-
passing through the model.
|
|
136
|
-
|
|
137
|
-
`skill_catalog`, `skill_find`, `skill_describe` and `skill_bundle` declare an
|
|
138
|
-
`outputSchema` and return `structuredContent` alongside the same JSON as text.
|
|
139
|
-
Frontmatter is read as YAML (folded and block descriptions, a BOM and CRLF are fine), and
|
|
140
|
-
`metadata` is read for every skill. Loading is lenient, as the client guide asks; what
|
|
141
|
-
breaks the specification is reported, and `pmcp validate [<skill-dir>...]` checks given
|
|
142
|
-
directories or every skill the catalog reaches (name rules and length, description and
|
|
143
|
-
compatibility length, field types, name matching the directory, duplicate names).
|
|
144
|
-
|
|
145
|
-
`metadata` keeps strings, string lists and maps of those one level down; `skill_describe`
|
|
146
|
-
reports a map as dotted keys, so `requires: {mcp, gpu-gb}` arrives as `requires.mcp` and
|
|
147
|
-
`requires.gpu-gb`. Deeper nesting is dropped.
|
|
148
|
-
|
|
149
|
-
Output schemas accept additional properties, so a field added later does not break a
|
|
150
|
-
client that cached an earlier tool list. An answer to a call without the newer inputs keeps
|
|
151
|
-
the earlier shape.
|
|
152
|
-
|
|
153
|
-
Since 0.9.0 a skill can list `metadata.verified-runtimes`, a list drawn from `claude-code`,
|
|
154
|
-
`codex-cli`, `gemini-cli`, `grok-cli` and `antigravity`, meaning its effect was verified on
|
|
155
|
-
that runtime. `skill_find` and `skill_catalog` accept `runtime` and `verifiedOnly`; when either
|
|
156
|
-
is given, items carry `verifiedRuntimes` (omitted when empty). `runtime` never removes a skill: it marks
|
|
157
|
-
each item `verified` and lists verified ones first (within a package group in
|
|
158
|
-
`skill_catalog`). `verifiedOnly` drops the rest, keeping those verified on `runtime`, or on
|
|
159
|
-
any runtime when none is given. Without `runtime` the answer is ordered exactly as before.
|
|
160
|
-
A server can opt in with `rankByClientRuntime: true`: then, when `runtime` is not passed and
|
|
161
|
-
the MCP client's name is recognised (`claude-code`, `codex`, `gemini`, `grok`,
|
|
162
|
-
`antigravity`), that runtime is used for the ordering only, never for filtering.
|
|
163
|
-
`skill_find` then answers with `runtime`, the one the ordering used, or `null`.
|
|
164
|
-
|
|
165
|
-
`pmcp serve --prompts` also offers one prompt per skill, for hosts that turn prompts into
|
|
166
|
-
commands; the prompt's text is the skill body and its file list, with an optional `task`.
|
|
167
|
-
|
|
168
|
-
Marketplace plugins also carry commands, agents, hooks and MCP servers.
|
|
169
|
-
Commands are listed as skills. The others are listed under their own kind and
|
|
170
|
-
are left out of `skill_catalog` and `skill_find` unless `kind` asks for them
|
|
171
|
-
(`agent`, `hook`, `mcp`, or `any`); `skill_describe`, `skill_read` and
|
|
172
|
-
`skill_call` work on every kind.
|
|
173
|
-
|
|
174
|
-
## MCP Skills extension
|
|
175
|
-
|
|
176
|
-
The server also declares `io.modelcontextprotocol/skills` (SEP-2640): it
|
|
177
|
-
answers `skills/list` and `skills/get` (both with `ttlMs` and `cacheScope`), with
|
|
178
|
-
a sha256 digest and size per file. A skill qualifies when its frontmatter passes the
|
|
179
|
-
Agent Skills specification and its `name` matches its directory, and it stays within
|
|
180
|
-
512 files and 16 MiB; the rest remain reachable through the tools.
|
|
181
|
-
|
|
182
|
-
Every file of every skill the caller may see is a `skill://pmcp/<package>/<name>/<file>`
|
|
183
|
-
resource: `resources/list` lists each skill's `SKILL.md`, `resources/read` returns any file
|
|
184
|
-
(text, or a blob with its media type), and the template completes skill names and paths.
|
|
185
|
-
List-change notifications and subscriptions are not offered: they need a session, and the
|
|
186
|
-
HTTP handler is stateless.
|
|
187
|
-
|
|
188
|
-
## Hosting over HTTP
|
|
189
|
-
|
|
190
|
-
`@modootoday/pmcp/http` serves the same tools and resources over streamable HTTP for a hosted
|
|
191
|
-
catalog. Tools, resources, the Skills extension and prompts all read the same per-caller,
|
|
192
|
-
tier-filtered catalog, so a file of a skill a caller cannot list cannot be read either. The
|
|
193
|
-
extension's `cacheScope` is `private` there by default (`cacheScope` overrides it), and
|
|
194
|
-
`prompts: true` turns prompts on.
|
|
195
|
-
The host owns identity: `authorize(request)` returns the caller or `undefined` (answered 401),
|
|
196
|
-
and `tiersFor(caller)` decides which tiers that caller sees (default `open` and `free`; skills
|
|
197
|
-
without a tier count as `open`). The catalog is read once; call `reload()` after deploying new
|
|
198
|
-
skill releases.
|
|
199
|
-
|
|
200
|
-
```ts
|
|
201
|
-
import { createSkillHttpHandler } from "@modootoday/pmcp/http";
|
|
202
|
-
|
|
203
|
-
const skills = createSkillHttpHandler({
|
|
204
|
-
roots: [],
|
|
205
|
-
marketplaces: ["/srv/marketplace", "/srv/marketplace-free"],
|
|
206
|
-
authorize: async (request) =>
|
|
207
|
-
verifyBearer(request.headers.get("authorization")),
|
|
208
|
-
});
|
|
209
|
-
export default { fetch: (request: Request) => skills.fetch(request) };
|
|
82
|
+
```sh
|
|
83
|
+
npx @modootoday/pmcp project
|
|
84
|
+
npx @modootoday/pmcp project --check
|
|
85
|
+
npx @modootoday/pmcp doctor
|
|
210
86
|
```
|
|
211
87
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
| `allowedOrigins` | none | A request with an `Origin` other than the server's own gets 403. Listed origins are served with CORS headers, and their preflight is answered. `"*"` admits any origin. Requests without `Origin` are not from a browser page and pass. |
|
|
217
|
-
| `publicOrigins` | none | The server's own origins as browsers see them, when a proxy ends TLS and the request URL is `http://`. Without it, a same-site page behind such a proxy gets 403. |
|
|
218
|
-
| `allowedHosts` | any | When set, a `Host` outside the list gets 403 (DNS rebinding). |
|
|
219
|
-
| `maxRequestBytes` | 1 MiB | A larger body gets 413; a declared length is refused before reading. |
|
|
220
|
-
| `rateLimit` | off | `{ perMinute }` per caller id; past it, 429 with `retry-after`. |
|
|
88
|
+
`project` generates native files for the selected tools and records its ownership
|
|
89
|
+
in `pmcp.lock`. It preserves unrelated settings and refuses conflicting unmanaged
|
|
90
|
+
entries. `--check` reports drift without writing files. Each runtime retains its
|
|
91
|
+
own OAuth session.
|
|
221
92
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
93
|
+
The [configuration guide](docs/project-configuration.md) covers importing
|
|
94
|
+
existing servers, environment references, shared skills and rules, shell guards
|
|
95
|
+
and memory metadata.
|
|
225
96
|
|
|
226
|
-
|
|
227
|
-
the catalog at start with `@huggingface/transformers` and the multilingual model, so an
|
|
228
|
-
intent in one language finds a description in another. Requests rank lexically until
|
|
229
|
-
`ready()` settles, and stay lexical when the encoder cannot load (`onError` says why).
|
|
97
|
+
## Everyday commands
|
|
230
98
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Mailbox is disabled by default. The six catalog tools stay read-only. A launcher
|
|
234
|
-
that supplies a private actor credential adds five tools: mailbox_send,
|
|
235
|
-
mailbox_inbox, mailbox_read, mailbox_ack, and mailbox_sessions. Read and ack
|
|
236
|
-
record durable receipts; peer text is data and does not authorize execution.
|
|
99
|
+
Run these with `npx @modootoday/pmcp`, or with `pmcp` when it is on your PATH:
|
|
237
100
|
|
|
238
101
|
```sh
|
|
239
|
-
pmcp
|
|
240
|
-
pmcp
|
|
241
|
-
pmcp
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
State defaults to XDG_STATE_HOME/pmcp/projects/<project UUID>, outside the
|
|
246
|
-
repository. Credential and binding files contain secrets: keep them private,
|
|
247
|
-
outside source control and container images. Commands do not print credentials.
|
|
248
|
-
An optional mailbox-binding-file records the current attachment for a trusted
|
|
249
|
-
launcher. Replacement requires the exact mailbox-replace-session ID; stale
|
|
250
|
-
sessions are fenced. Canonical runtimes are codex-cli, claude-code, gemini-cli,
|
|
251
|
-
grok-cli, and antigravity; the Antigravity executable is agy.
|
|
252
|
-
|
|
253
|
-
The mailbox CLI also supports send, inbox, read, ack, sessions, rotate, export,
|
|
254
|
-
backup, and restore. Actor operations accept a private actor-file or existing
|
|
255
|
-
binding-file and JSON input file. Administration requires explicit operator
|
|
256
|
-
intent. Backups and exports are sensitive. Encrypted recovery bundles are
|
|
257
|
-
available through the mailbox API; key custody belongs to the operator.
|
|
258
|
-
|
|
259
|
-
```ts
|
|
260
|
-
import { MailboxService, MailboxStore } from "@modootoday/pmcp/mailbox";
|
|
261
|
-
|
|
262
|
-
const store = await MailboxStore.open({
|
|
263
|
-
enabled: true,
|
|
264
|
-
projectId,
|
|
265
|
-
databasePath,
|
|
266
|
-
});
|
|
267
|
-
const credential = await store.registerActor("reviewer");
|
|
268
|
-
const binding = await store.attach(credential, "codex-cli");
|
|
269
|
-
const mailbox = new MailboxService(store, binding);
|
|
102
|
+
pmcp list
|
|
103
|
+
pmcp available
|
|
104
|
+
pmcp install --all --dry-run
|
|
105
|
+
pmcp install <skill-package> --yes
|
|
106
|
+
pmcp sync --dry-run
|
|
107
|
+
pmcp validate
|
|
270
108
|
```
|
|
271
109
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
have bounded authority and may reply only to their parent. Generation changes,
|
|
277
|
-
parent expiry, and credential rotation revoke stale child authority.
|
|
110
|
+
`available` checks catalog packages against your installed dependencies.
|
|
111
|
+
`install` and `sync` pin exact versions with npm or Bun and require confirmation
|
|
112
|
+
before changing your manifest and lockfile. `--dry-run` previews the work.
|
|
113
|
+
Use `--catalog <file>` to read a saved catalog response.
|
|
278
114
|
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
harness. Existing arbitrary terminal sessions are not captured. Elastic License
|
|
283
|
-
2.0 and NOTICE continue to apply.
|
|
115
|
+
`pmcp login`, `whoami` and `logout` manage pmcp service login. Package registry
|
|
116
|
+
access uses your package manager's credentials. Your runtime's provider login
|
|
117
|
+
remains with that runtime.
|
|
284
118
|
|
|
285
|
-
|
|
119
|
+
Run `pmcp --help` or `pmcp <command> --help` for options.
|
|
120
|
+
With no command, pmcp serves MCP on stdio.
|
|
286
121
|
|
|
287
|
-
|
|
288
|
-
model once in your project's `pmcp.toml`; both indexing and the stdio server use
|
|
289
|
-
the same settings:
|
|
122
|
+
## Guides
|
|
290
123
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
124
|
+
| Guide | Contents |
|
|
125
|
+
| ------------------------------------------------------ | ------------------------------------------------------------- |
|
|
126
|
+
| [Project configuration](docs/project-configuration.md) | Catalog sources, native files, MCP import, guards and doctor |
|
|
127
|
+
| [Skills and MCP reference](docs/skills.md) | Skill documents, tools, resources, prompts and compatibility |
|
|
128
|
+
| [Embedding models](docs/embeddings.md) | E5, EmbeddingGemma and custom local model selection |
|
|
129
|
+
| [Local mailbox](docs/mailbox.md) | Actor credentials, messages, receipts and library integration |
|
|
130
|
+
| [HTTP hosting](docs/hosting.md) | Authentication, catalog access and request controls |
|
|
131
|
+
| [Native terminal control](docs/terminal-harness.md) | Owned sessions, explicit input, Docker profiles and recovery |
|
|
132
|
+
| [Security policy](SECURITY.md) | Reporting vulnerabilities |
|
|
297
133
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
```
|
|
134
|
+
Semantic search is optional and requires `@huggingface/transformers` installed
|
|
135
|
+
separately. Lexical search works without downloading a model. The mailbox is
|
|
136
|
+
disabled until explicitly configured.
|
|
302
137
|
|
|
303
|
-
|
|
304
|
-
artifacts and an existing, complete index. A missing model, stale catalog or
|
|
305
|
-
incompatible vectors keeps ranking lexical and reports the reason on stderr.
|
|
306
|
-
`pmcp index --dry-run` plans work without loading a model or writing files;
|
|
307
|
-
`pmcp index --local-only` refuses downloads. Use `[embedding] enabled = false`
|
|
308
|
-
or `pmcp serve --lexical` to disable semantic ranking.
|
|
309
|
-
|
|
310
|
-
| Preset | Default precision | Supported output dimensions |
|
|
311
|
-
| --------------------- | ----------------- | --------------------------- |
|
|
312
|
-
| `e5-small` | `q8` | 384 |
|
|
313
|
-
| `embeddinggemma-300m` | `q4` | 768, 512, 256, 128 |
|
|
314
|
-
| `embeddinggemma-2` | `q4` | 768, 512, 256, 128 |
|
|
315
|
-
|
|
316
|
-
E5 remains the default. Gemma presets use qualified, pinned revisions, listed by
|
|
317
|
-
`pmcp models --json`; E5 retains its existing `main` revision for compatibility.
|
|
318
|
-
Gemma dimension reduction truncates and re-normalizes the projected embedding;
|
|
319
|
-
it reduces vector storage, not loaded model memory.
|
|
320
|
-
|
|
321
|
-
CLI flags override individual config fields: `--model`, `--dtype`,
|
|
322
|
-
`--dimensions`, `--model-revision`, `--model-path`, `--model-cache`,
|
|
323
|
-
`--query-prefix`, `--passage-prefix` and `--pooling`. Omit precision and dimensions
|
|
324
|
-
in the file when you want each model's defaults. Use `--no-config` for an
|
|
325
|
-
independent CLI selection. Config paths resolve relative to the TOML file;
|
|
326
|
-
CLI model paths resolve relative to the working directory.
|
|
327
|
-
|
|
328
|
-
Query caches also include the encoder identity, so sharing a cache between
|
|
329
|
-
same-width profiles cannot reuse another encoder's query vector. Library hosts
|
|
330
|
-
using openIntentCache must open a cache with the selected output width when
|
|
331
|
-
changing dimensions; pass the encoder's indexKey as its modelId for explicit
|
|
332
|
-
profile-scoped cache metadata.
|
|
333
|
-
|
|
334
|
-
Each model, revision, precision, output width and encoder specification has its
|
|
335
|
-
own vector identity. Switching preserves other models' indexes; switching back
|
|
336
|
-
reuses unchanged vectors. `--force` re-encodes only the selected model. A local
|
|
337
|
-
`model_path` must contain the declared revision's artifacts; change `revision`
|
|
338
|
-
and reindex after replacing them. The directory's location is not its identity.
|
|
339
|
-
|
|
340
|
-
Custom Transformers.js feature-extraction models need no source edits:
|
|
341
|
-
|
|
342
|
-
```toml
|
|
343
|
-
[embedding]
|
|
344
|
-
model = "your-organization/your-onnx-model"
|
|
345
|
-
dtype = "q8"
|
|
346
|
-
revision = "your-pinned-revision"
|
|
347
|
-
|
|
348
|
-
[embedding.encoder]
|
|
349
|
-
query_prefix = "query: "
|
|
350
|
-
passage_prefix = "passage: "
|
|
351
|
-
pooling = "mean"
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
Use the model's documented prefixes and pooling (`mean` or `cls`); unknown models
|
|
355
|
-
default to unprefixed mean pooling. A native `sentence_embedding` export may use
|
|
356
|
-
`projected = true`. Explicit dimension reduction is supported for the listed
|
|
357
|
-
presets. Other architectures require compatible Transformers.js exports.
|
|
358
|
-
|
|
359
|
-
The library API shares the same presets and identity rules:
|
|
360
|
-
|
|
361
|
-
```js
|
|
362
|
-
import { loadEmbedder, prepareSearch } from "@modootoday/pmcp";
|
|
363
|
-
|
|
364
|
-
const encoder = await loadEmbedder("embeddinggemma-2", {
|
|
365
|
-
dimensions: 256,
|
|
366
|
-
modelPath: "/opt/models/embeddinggemma-2",
|
|
367
|
-
localOnly: true,
|
|
368
|
-
});
|
|
369
|
-
const search = await prepareSearch(
|
|
370
|
-
{ roots: ["node_modules"] },
|
|
371
|
-
{
|
|
372
|
-
indexPath: "node_modules/.cache/pmcp/vectors.sqlite",
|
|
373
|
-
modelId: "embeddinggemma-2",
|
|
374
|
-
dimensions: 256,
|
|
375
|
-
embedder: encoder ?? undefined,
|
|
376
|
-
},
|
|
377
|
-
);
|
|
378
|
-
```
|
|
138
|
+
## Licence
|
|
379
139
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
policy, so hosts can prepare different encoders in one process.
|
|
384
|
-
|
|
385
|
-
## Runtime and licence
|
|
386
|
-
|
|
387
|
-
Node.js 22 or later, or Bun 1.3 or later. Ranking is lexical until an index and
|
|
388
|
-
encoder are ready. Semantic
|
|
389
|
-
ranking (the `index` command, or the HTTP handler's `semantic` option) needs
|
|
390
|
-
`@huggingface/transformers` installed separately; it is not part of the default
|
|
391
|
-
installation. The default encoder is `Xenova/multilingual-e5-small` (MIT, about
|
|
392
|
-
130 MB), so vectors indexed with the earlier English-only default are re-encoded.
|
|
393
|
-
|
|
394
|
-
The optional encoder also supports the ONNX Community EmbeddingGemma 300M and
|
|
395
|
-
EmbeddingGemma 2 exports. It uses their projected sentence embeddings and task
|
|
396
|
-
prefixes. EmbeddingGemma 2 loads its text encoder without vision or audio models.
|
|
397
|
-
EmbeddingGemma was qualified with Transformers.js 4.3.1. Install a version
|
|
398
|
-
supporting the chosen export and keep model
|
|
399
|
-
weights outside the npm package. Regenerate document vectors when changing the
|
|
400
|
-
encoder. Quantization reduces weight storage; application RAM and latency need
|
|
401
|
-
workload measurements. EmbeddingGemma 300M uses the Gemma terms; EmbeddingGemma 2
|
|
402
|
-
is listed under Apache-2.0 in its model card.
|
|
403
|
-
|
|
404
|
-
Elastic License 2.0. See `LICENSE` and `NOTICE` for terms and dependency notices.
|
|
405
|
-
Documentation: <https://pmcp.build>.
|
|
140
|
+
pmcp is source available under [Elastic License 2.0](LICENSE).
|
|
141
|
+
See [NOTICE](NOTICE) for dependency notices and the embedding guide for model
|
|
142
|
+
licences. Website: [pmcp.build](https://pmcp.build).
|