@modootoday/pmcp 0.11.0 → 0.13.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 CHANGED
@@ -1,546 +1,144 @@
1
1
  # pmcp
2
2
 
3
- Find and use package skills without loading every document into your agent's context.
4
- `pmcp` reads `SKILL.md` files from installed packages, from monorepo workspaces
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
- ## Install
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
- ```sh
14
- npm install --save-dev @modootoday/pmcp
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
- Register it with an MCP host:
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
+ | View a native main, worker dock and coordination panel | `pmcp tui` |
24
+ | Serve a catalog to your own application | The HTTP library |
18
25
 
19
- ```json
20
- {
21
- "mcpServers": {
22
- "pmcp": { "command": "npx", "args": ["-y", "@modootoday/pmcp"] }
23
- }
24
- }
25
- ```
26
+ ## Get started
27
+
28
+ Requires Node.js 22 or later, or Bun 1.3 or later.
26
29
 
27
- For Claude Code:
30
+ Install pmcp in your project:
28
31
 
29
32
  ```sh
30
- claude mcp add pmcp -- npx -y @modootoday/pmcp
33
+ npm install --save-dev @modootoday/pmcp
31
34
  ```
32
35
 
33
- ## Commands
36
+ For Claude Code, register the MCP server from the project directory:
34
37
 
35
38
  ```sh
36
- pmcp list
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
39
+ claude mcp add pmcp -- npx @modootoday/pmcp
44
40
  ```
45
41
 
46
- `available` matches the provided catalog against actual installed dependency
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.
42
+ Other MCP hosts can use a stdio entry:
52
43
 
53
- Run `pmcp --help` or `pmcp <command> --help` for options. With no command,
54
- `pmcp` serves MCP on stdio. Use `--root <node_modules>` to select a local tree
55
- and repeat `--scope <prefix>` to restrict local package discovery.
44
+ ```json
45
+ {
46
+ "mcpServers": {
47
+ "pmcp": {
48
+ "command": "npx",
49
+ "args": ["@modootoday/pmcp"]
50
+ }
51
+ }
52
+ }
53
+ ```
56
54
 
57
- ## Project config
55
+ Restart or reconnect your tool's MCP connection after changing its configuration.
56
+ Ask your tool to find a skill relevant to your task and open the result.
57
+ Local skill discovery and reading require no pmcp login.
58
58
 
59
- A `pmcp.toml` at or above the working directory sets the catalog once, so a
60
- host entry needs no flags and works from any package in the repository:
59
+ To include your workspace's own skills, create `pmcp.toml` at the project root:
61
60
 
62
61
  ```toml
63
62
  [catalog]
64
- workspaces = [".", "packages/*"]
65
- packages = ["docs"]
66
- marketplaces = ["vendor/marketplace"]
63
+ workspaces = ["."]
67
64
  ```
68
65
 
69
- Paths resolve against the file's directory. Keys are `roots`, `scopes`,
70
- `workspaces`, `packages` and `marketplaces`, each a list mirroring the flag of
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.
66
+ Run `npx @modootoday/pmcp list` to see the local catalog. Paths in the configuration resolve
67
+ relative to `pmcp.toml`; pmcp searches for this file above the working directory.
73
68
 
74
- ## Native files for each agent tool
69
+ ## Share configuration across your tools
75
70
 
76
- `pmcp project` writes what Claude Code, Codex, Gemini CLI, Grok Build and
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`:
71
+ Declare your tools and MCP servers in the same `pmcp.toml`:
80
72
 
81
73
  ```toml
82
74
  [targets]
83
75
  tools = ["claude", "codex", "gemini", "grok", "antigravity"]
84
76
 
85
- [skills.deploy]
86
- invocation = "user" # the person starts it; the model is not offered it
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"]
98
- ```
99
-
100
- ```sh
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
- ```
107
-
108
- Rules go to `.claude/rules/<dir>/`, never the top level, because Grok Build
109
- loads top-level `.claude/rules/*.md` in every session regardless of `paths:`.
110
- A server that names `${PROJECT_ROOT}` is launched through `sh`, which finds
111
- `pmcp.toml` at spawn time, so the generated files hold no machine's path.
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
- ## Unified project MCP configuration
118
-
119
- Antigravity receives a native project plugin at .agents/plugins/pmcp-mcp with
120
- plugin.json and mcp_config.json. Projection removes only lock-owned entries
121
- from the earlier .agents/mcp_config.json artifact and backs up both layouts.
122
- Antigravity's global mcp list does not enumerate project plugin servers;
123
- validate the generated plugin with agy plugin validate.
124
- Its HTTP entries use serverUrl, accepted by the installed plugin validator.
125
-
126
- Declare each MCP server once in pmcp.toml. The projector writes the native
127
- project files for all selected runtimes. A server can narrow its targets:
128
-
129
- ```toml
130
77
  [mcp.docs]
131
78
  url = "https://example.com/mcp"
132
-
133
- [mcp.private-api]
134
- url = "https://example.com/private-mcp"
135
- targets = ["claude", "codex", "gemini", "grok"]
136
- bearer_token_env_var = "PRIVATE_MCP_TOKEN"
137
- header_env = { "X-Workspace" = "PRIVATE_MCP_WORKSPACE" }
138
-
139
- [mcp.local-service]
140
- command = "my-mcp-server"
141
- env_vars = ["MY_SERVICE_KEY"]
142
- cwd = "${PROJECT_ROOT}"
143
-
144
- [mcp.local-service.native.codex]
145
- startup_timeout_sec = 30
146
-
147
- [mcp.local-service.native.gemini]
148
- timeout = 120000
149
79
  ```
150
80
 
151
- url means Streamable HTTP; Gemini receives httpUrl. Legacy SSE is not imported
152
- as HTTP. headers contains literal nonsecret headers, header_env maps header
153
- names to environment variable names, and bearer_token_env_var references a
154
- token without writing its value. Each runtime retains its own OAuth session.
155
- Antigravity HTTP header projection is not qualified and is rejected; explicitly
156
- limit those servers to supported targets. tools maps to Gemini includeTools and
157
- Codex enabled_tools; it is not a cross-runtime security boundary. Native timeout
158
- options retain each runtime's documented names and units. Unknown fields fail.
159
-
160
- Import explicitly selected native configurations. Preview is the default:
81
+ Replace the example URL with your server, then run:
161
82
 
162
83
  ```sh
163
- pmcp project import-mcp --source claude:/path/to/native.json
164
- pmcp project import-mcp --source codex:/path/to/config.toml --name docs --write
165
- pmcp project
166
- pmcp project --check
167
- ```
168
-
169
- Repeat source and name to select multiple inputs. Conflicting aliases, missing
170
- requested names, unsupported authentication fields and credential-bearing URLs
171
- block import. Source contents and credential values are not printed. Sources
172
- are never rewritten. Review plugin-provided servers separately to avoid
173
- duplicating a server the runtime already loads.
174
-
175
- Literal stdio environment values remain in their source file. The importer
176
- stores an env_from reference containing file and an RFC 6901 JSON pointer:
177
-
178
- ```toml
179
- [mcp.local-service.env_from.MY_SERVICE_KEY]
180
- file = "~/.config/my-client/settings.json"
181
- pointer = "/mcpServers/local-service/env/MY_SERVICE_KEY"
182
- ```
183
-
184
- The generated entry invokes pmcp project exec-mcp for that declared server.
185
- It reads only the referenced values and passes them to the child process, using
186
- inherited stdio. JSON and TOML sources are supported. The source must remain
187
- available; rotating its value takes effect on the next server launch. A project
188
- installed CLI is referenced relative to the project; otherwise pmcp must be on
189
- PATH. Configurations using env_from require this release on every runtime host.
190
-
191
- Writes retain private backups in ~/.cache/pmcp/project-backups, outside the
192
- project. Receipts record file hashes and absent paths. A conflicting unmanaged
193
- native alias is refused before projection writes. The managed TOML block and
194
- JSON keys preserve unrelated settings. Inspect the reported backup before
195
- restoring any file that another process may have edited.
196
-
197
- Configuration references: [Codex](https://developers.openai.com/codex/config-reference/),
198
- [Claude Code](https://code.claude.com/docs/en/mcp),
199
- [Gemini CLI](https://geminicli.com/docs/tools/mcp-server/),
200
- and [Grok Build](https://docs.x.ai/build/features/mcp-servers).
201
-
202
- ## Operator shell guards
203
-
204
- Declare a project-owned guard explicitly to project it into Codex, Gemini or
205
- Antigravity's native hooks. Without a declaration, pmcp generates no hooks.
206
-
207
- ```toml
208
- [[hooks.shell]]
209
- name = "shell-command-policy"
210
- command = ["node", ".agents/guards/shell-command-policy.mjs"]
211
- targets = ["codex", "gemini", "antigravity"]
212
- timeout_ms = 15000
213
- ```
214
-
215
- The guard script must exist under .agents/guards/ and cannot resolve outside
216
- that directory. It receives one JSON object on stdin containing runtime,
217
- event=before_shell, command and cwd. It returns a JSON object with
218
- decision=allow or decision=deny and an optional reason. Malformed responses,
219
- nonzero exits and timeouts deny the shell call. The guard receives PATH and
220
- LANG rather than the native CLI's credential environment. Non-shell tools are
221
- outside this contract.
222
-
223
- Run pmcp project to write lock-owned adapter and policy artifacts under
224
- .agents/pmcp-hooks/, plus the native entries in .codex/hooks.json,
225
- .gemini/settings.json and .agents/hooks.json. Peer entries are retained.
226
- Edited owned hook entries refuse projection for review. Removing a declaration
227
- removes its generated entries and artifacts while preserving peer settings.
228
- Writes retain private backups; pmcp project --check only reports drift.
229
-
230
- Guard, policy and adapter fingerprints bind the generated command. Changing
231
- guard code requires reprojection and native Codex hook review. Generated files
232
- contain no trust bypass. Grok can load Claude project hooks, so this first scope
233
- does not generate a second Grok guard. Hooks do not force pmcp catalog use,
234
- inject reminders or replace the runtime's execution sandbox.
235
-
236
- ## Native memory metadata
237
-
238
- ```sh
239
- pmcp doctor --memory --json
240
- pmcp doctor --memory --tool codex
241
- ```
242
-
243
- This explicit operation reports selected runtimes' native memory configuration
244
- and path existence. It reads no memory body, index or transcript, writes no
245
- configuration, connects to no MCP server and makes no provider request.
246
- Ordinary doctor output is unchanged.
247
-
248
- The report distinguishes enabled, disabled, unknown and unsupported. Path
249
- existence does not establish activation. Where native metadata cannot identify
250
- a project-specific location, pathScope=base reports only the storage parent;
251
- the project identifier is not guessed. Supported native home overrides are
252
- respected. Codex uses its native features listing. Claude and Grok report
253
- explicit user settings, with active session overrides and unverified project
254
- trust left unknown. Gemini context filenames and the global GEMINI.md file
255
- are separate from unexposed memory-tool activation. Antigravity trajectories
256
- are not reported as a memory store. pmcp does not synchronize or inject memory.
257
-
258
- ## Package skills
259
-
260
- Skills are discovered by filename, including `skills/`, `.agents/skills/`,
261
- `.agent/skills/`, `.claude/skills/`, `.gemini/skills/`, `.codex/skills/`, and
262
- `lib/skill/` layouts
263
- within the discovery depth. A skill needs a frontmatter `description` for search.
264
-
265
- `skill_find` accepts a problem description and returns matching skills.
266
- `skill_call` opens the selected document and lists the reference, script and asset
267
- files it carries, as text and as resource links. Local MCP reading requires no login.
268
-
269
- Files keep their type, as the Agent Skills layout (`references/`, `scripts/`, `assets/`)
270
- expects: `skill_read` returns text as text, images and audio as image and audio content,
271
- and other binary files as an embedded resource with its media type; a file whose extension
272
- names text but whose bytes are not UTF-8 goes out as a blob, so its sha256 stays exact.
273
- Scripts are returned, never run: running them is the host's job, from a local copy of the
274
- skill. `skill_bundle` lists every file of a skill as resource links that `resources/read`
275
- returns, so a host can write the skill into a local skills directory without the bytes
276
- passing through the model.
277
-
278
- `skill_catalog`, `skill_find`, `skill_describe` and `skill_bundle` declare an
279
- `outputSchema` and return `structuredContent` alongside the same JSON as text.
280
- Frontmatter is read as YAML (folded and block descriptions, a BOM and CRLF are fine), and
281
- `metadata` is read for every skill. Loading is lenient, as the client guide asks; what
282
- breaks the specification is reported, and `pmcp validate [<skill-dir>...]` checks given
283
- directories or every skill the catalog reaches (name rules and length, description and
284
- compatibility length, field types, name matching the directory, duplicate names).
285
-
286
- `metadata` keeps strings, string lists and maps of those one level down; `skill_describe`
287
- reports a map as dotted keys, so `requires: {mcp, gpu-gb}` arrives as `requires.mcp` and
288
- `requires.gpu-gb`. Deeper nesting is dropped.
289
-
290
- Output schemas accept additional properties, so a field added later does not break a
291
- client that cached an earlier tool list. An answer to a call without the newer inputs keeps
292
- the earlier shape.
293
-
294
- Since 0.9.0 a skill can list `metadata.verified-runtimes`, a list drawn from `claude-code`,
295
- `codex-cli`, `gemini-cli`, `grok-cli` and `antigravity`, meaning its effect was verified on
296
- that runtime. `skill_find` and `skill_catalog` accept `runtime` and `verifiedOnly`; when either
297
- is given, items carry `verifiedRuntimes` (omitted when empty). `runtime` never removes a skill: it marks
298
- each item `verified` and lists verified ones first (within a package group in
299
- `skill_catalog`). `verifiedOnly` drops the rest, keeping those verified on `runtime`, or on
300
- any runtime when none is given. Without `runtime` the answer is ordered exactly as before.
301
- A server can opt in with `rankByClientRuntime: true`: then, when `runtime` is not passed and
302
- the MCP client's name is recognised (`claude-code`, `codex`, `gemini`, `grok`,
303
- `antigravity`), that runtime is used for the ordering only, never for filtering.
304
- `skill_find` then answers with `runtime`, the one the ordering used, or `null`.
305
-
306
- `pmcp serve --prompts` also offers one prompt per skill, for hosts that turn prompts into
307
- commands; the prompt's text is the skill body and its file list, with an optional `task`.
308
-
309
- Marketplace plugins also carry commands, agents, hooks and MCP servers.
310
- Commands are listed as skills. The others are listed under their own kind and
311
- are left out of `skill_catalog` and `skill_find` unless `kind` asks for them
312
- (`agent`, `hook`, `mcp`, or `any`); `skill_describe`, `skill_read` and
313
- `skill_call` work on every kind.
314
-
315
- ## MCP Skills extension
316
-
317
- The server also declares `io.modelcontextprotocol/skills` (SEP-2640): it
318
- answers `skills/list` and `skills/get` (both with `ttlMs` and `cacheScope`), with
319
- a sha256 digest and size per file. A skill qualifies when its frontmatter passes the
320
- Agent Skills specification and its `name` matches its directory, and it stays within
321
- 512 files and 16 MiB; the rest remain reachable through the tools.
322
-
323
- Every file of every skill the caller may see is a `skill://pmcp/<package>/<name>/<file>`
324
- resource: `resources/list` lists each skill's `SKILL.md`, `resources/read` returns any file
325
- (text, or a blob with its media type), and the template completes skill names and paths.
326
- List-change notifications and subscriptions are not offered: they need a session, and the
327
- HTTP handler is stateless.
328
-
329
- ## Hosting over HTTP
330
-
331
- `@modootoday/pmcp/http` serves the same tools and resources over streamable HTTP for a hosted
332
- catalog. Tools, resources, the Skills extension and prompts all read the same per-caller,
333
- tier-filtered catalog, so a file of a skill a caller cannot list cannot be read either. The
334
- extension's `cacheScope` is `private` there by default (`cacheScope` overrides it), and
335
- `prompts: true` turns prompts on.
336
- The host owns identity: `authorize(request)` returns the caller or `undefined` (answered 401),
337
- and `tiersFor(caller)` decides which tiers that caller sees (default `open` and `free`; skills
338
- without a tier count as `open`). The catalog is read once; call `reload()` after deploying new
339
- skill releases.
340
-
341
- ```ts
342
- import { createSkillHttpHandler } from "@modootoday/pmcp/http";
343
-
344
- const skills = createSkillHttpHandler({
345
- roots: [],
346
- marketplaces: ["/srv/marketplace", "/srv/marketplace-free"],
347
- authorize: async (request) =>
348
- verifyBearer(request.headers.get("authorization")),
349
- });
350
- export default { fetch: (request: Request) => skills.fetch(request) };
84
+ npx @modootoday/pmcp project
85
+ npx @modootoday/pmcp project --check
86
+ npx @modootoday/pmcp doctor
351
87
  ```
352
88
 
353
- The handler checks requests before they reach MCP:
354
-
355
- | Option | Default | Effect |
356
- | ----------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
357
- | `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. |
358
- | `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. |
359
- | `allowedHosts` | any | When set, a `Host` outside the list gets 403 (DNS rebinding). |
360
- | `maxRequestBytes` | 1 MiB | A larger body gets 413; a declared length is refused before reading. |
361
- | `rateLimit` | off | `{ perMinute }` per caller id; past it, 429 with `retry-after`. |
362
-
363
- An MCP config (`.mcp.json`) is never served as written: every `env` and `headers` value is
364
- replaced with `<redacted>`, whichever entry reaches the file, and listed digests describe
365
- the redacted bytes.
89
+ `project` generates native files for the selected tools and records its ownership
90
+ in `pmcp.lock`. It preserves unrelated settings and refuses conflicting unmanaged
91
+ entries. `--check` reports drift without writing files. Each runtime retains its
92
+ own OAuth session.
366
93
 
367
- Pass `semantic: { modelId: "embeddinggemma-2", cacheDir, localOnly: true }` to rank by meaning: the handler encodes
368
- the catalog at start with `@huggingface/transformers` and the multilingual model, so an
369
- intent in one language finds a description in another. Requests rank lexically until
370
- `ready()` settles, and stay lexical when the encoder cannot load (`onError` says why).
94
+ The [configuration guide](docs/project-configuration.md) covers importing
95
+ existing servers, environment references, shared skills and rules, shell guards
96
+ and memory metadata.
371
97
 
372
- ## Optional local mailbox
98
+ ## Everyday commands
373
99
 
374
- Mailbox is disabled by default. The six catalog tools stay read-only. A launcher
375
- that supplies a private actor credential adds five tools: mailbox_send,
376
- mailbox_inbox, mailbox_read, mailbox_ack, and mailbox_sessions. Read and ack
377
- record durable receipts; peer text is data and does not authorize execution.
100
+ Run these with `npx @modootoday/pmcp`, or with `pmcp` when it is on your PATH:
378
101
 
379
102
  ```sh
380
- pmcp mailbox init --config ./pmcp.toml
381
- pmcp mailbox actor --config ./pmcp.toml --actor reviewer --actor-file /private/reviewer.actor.json
382
- pmcp serve --config ./pmcp.toml --mailbox-actor-file /private/reviewer.actor.json --mailbox-runtime codex-cli
103
+ pmcp list
104
+ pmcp available
105
+ pmcp install --all --dry-run
106
+ pmcp install <skill-package> --yes
107
+ pmcp sync --dry-run
108
+ pmcp validate
383
109
  ```
384
110
 
385
- Initialization preserves existing configuration and creates a project UUID.
386
- State defaults to XDG_STATE_HOME/pmcp/projects/<project UUID>, outside the
387
- repository. Credential and binding files contain secrets: keep them private,
388
- outside source control and container images. Commands do not print credentials.
389
- An optional mailbox-binding-file records the current attachment for a trusted
390
- launcher. Replacement requires the exact mailbox-replace-session ID; stale
391
- sessions are fenced. Canonical runtimes are codex-cli, claude-code, gemini-cli,
392
- grok-cli, and antigravity; the Antigravity executable is agy.
393
-
394
- The mailbox CLI also supports send, inbox, read, ack, sessions, rotate, export,
395
- backup, and restore. Actor operations accept a private actor-file or existing
396
- binding-file and JSON input file. Administration requires explicit operator
397
- intent. Backups and exports are sensitive. Encrypted recovery bundles are
398
- available through the mailbox API; key custody belongs to the operator.
399
-
400
- ```ts
401
- import { MailboxService, MailboxStore } from "@modootoday/pmcp/mailbox";
402
-
403
- const store = await MailboxStore.open({
404
- enabled: true,
405
- projectId,
406
- databasePath,
407
- });
408
- const credential = await store.registerActor("reviewer");
409
- const binding = await store.attach(credential, "codex-cli");
410
- const mailbox = new MailboxService(store, binding);
411
- ```
111
+ `available` checks catalog packages against your installed dependencies.
112
+ `install` and `sync` pin exact versions with npm or Bun and require confirmation
113
+ before changing your manifest and lockfile. `--dry-run` previews the work.
114
+ Use `--catalog <file>` to read a saved catalog response.
412
115
 
413
- Pass mailbox to createSkillServer or registerMailboxTools on an existing server.
414
- For HTTP, provide mailboxFor(caller) to createSkillHttpHandler; the host resolves
415
- authenticated callers to authorized bindings. Tool arguments cannot choose a
416
- sender identity. The host owns attachment heartbeat and cleanup. Child actors
417
- have bounded authority and may reply only to their parent. Generation changes,
418
- parent expiry, and credential rotation revoke stale child authority.
116
+ `pmcp login`, `whoami` and `logout` manage pmcp service login. Package registry
117
+ access uses your package manager's credentials. Your runtime's provider login
118
+ remains with that runtime.
419
119
 
420
- The public package contains one reusable local domain. Organization identity,
421
- fleet policy, enterprise audit retention, native process supervision, provider
422
- credentials, and automatic runtime input delivery belong to a host or dedicated
423
- harness. Existing arbitrary terminal sessions are not captured. Elastic License
424
- 2.0 and NOTICE continue to apply.
120
+ Run `pmcp --help` or `pmcp <command> --help` for options.
121
+ With no command, pmcp serves MCP on stdio.
425
122
 
426
- ## Switching embedding models
123
+ ## Guides
427
124
 
428
- List the built-in presets with `pmcp models` (or `pmcp models --json`). Select a
429
- model once in your project's `pmcp.toml`; both indexing and the stdio server use
430
- the same settings:
125
+ | Guide | Contents |
126
+ | ------------------------------------------------------ | ------------------------------------------------------------- |
127
+ | [Project configuration](docs/project-configuration.md) | Catalog sources, native files, MCP import, guards and doctor |
128
+ | [Skills and MCP reference](docs/skills.md) | Skill documents, tools, resources, prompts and compatibility |
129
+ | [Embedding models](docs/embeddings.md) | E5, EmbeddingGemma and custom local model selection |
130
+ | [Local mailbox](docs/mailbox.md) | Actor credentials, messages, receipts and library integration |
131
+ | [HTTP hosting](docs/hosting.md) | Authentication, catalog access and request controls |
132
+ | [Native terminal control](docs/terminal-harness.md) | Owned sessions, explicit input, Docker profiles and recovery |
133
+ | [Terminal workspace](docs/terminal-workspace.md) | A layout, read-only observation, control and visible failures |
134
+ | [Security policy](SECURITY.md) | Reporting vulnerabilities |
431
135
 
432
- ```toml
433
- [embedding]
434
- model = "embeddinggemma-2"
435
- dimensions = 256
436
- cache_dir = ".cache/pmcp/models"
437
- ```
438
-
439
- ```sh
440
- pmcp index
441
- pmcp serve
442
- ```
443
-
444
- Indexing explicitly downloads missing model artifacts. Serving reads only local
445
- artifacts and an existing, complete index. A missing model, stale catalog or
446
- incompatible vectors keeps ranking lexical and reports the reason on stderr.
447
- `pmcp index --dry-run` plans work without loading a model or writing files;
448
- `pmcp index --local-only` refuses downloads. Use `[embedding] enabled = false`
449
- or `pmcp serve --lexical` to disable semantic ranking.
450
-
451
- | Preset | Default precision | Supported output dimensions |
452
- | --------------------- | ----------------- | --------------------------- |
453
- | `e5-small` | `q8` | 384 |
454
- | `embeddinggemma-300m` | `q4` | 768, 512, 256, 128 |
455
- | `embeddinggemma-2` | `q4` | 768, 512, 256, 128 |
456
-
457
- E5 remains the default. Gemma presets use qualified, pinned revisions, listed by
458
- `pmcp models --json`; E5 retains its existing `main` revision for compatibility.
459
- Gemma dimension reduction truncates and re-normalizes the projected embedding;
460
- it reduces vector storage, not loaded model memory.
461
-
462
- CLI flags override individual config fields: `--model`, `--dtype`,
463
- `--dimensions`, `--model-revision`, `--model-path`, `--model-cache`,
464
- `--query-prefix`, `--passage-prefix` and `--pooling`. Omit precision and dimensions
465
- in the file when you want each model's defaults. Use `--no-config` for an
466
- independent CLI selection. Config paths resolve relative to the TOML file;
467
- CLI model paths resolve relative to the working directory.
468
-
469
- Query caches also include the encoder identity, so sharing a cache between
470
- same-width profiles cannot reuse another encoder's query vector. Library hosts
471
- using openIntentCache must open a cache with the selected output width when
472
- changing dimensions; pass the encoder's indexKey as its modelId for explicit
473
- profile-scoped cache metadata.
474
-
475
- Each model, revision, precision, output width and encoder specification has its
476
- own vector identity. Switching preserves other models' indexes; switching back
477
- reuses unchanged vectors. `--force` re-encodes only the selected model. A local
478
- `model_path` must contain the declared revision's artifacts; change `revision`
479
- and reindex after replacing them. The directory's location is not its identity.
480
-
481
- Custom Transformers.js feature-extraction models need no source edits:
136
+ Semantic search is optional and requires `@huggingface/transformers` installed
137
+ separately. Lexical search works without downloading a model. The mailbox is
138
+ disabled until explicitly configured.
482
139
 
483
- ```toml
484
- [embedding]
485
- model = "your-organization/your-onnx-model"
486
- dtype = "q8"
487
- revision = "your-pinned-revision"
488
-
489
- [embedding.encoder]
490
- query_prefix = "query: "
491
- passage_prefix = "passage: "
492
- pooling = "mean"
493
- ```
494
-
495
- Use the model's documented prefixes and pooling (`mean` or `cls`); unknown models
496
- default to unprefixed mean pooling. A native `sentence_embedding` export may use
497
- `projected = true`. Explicit dimension reduction is supported for the listed
498
- presets. Other architectures require compatible Transformers.js exports.
499
-
500
- The library API shares the same presets and identity rules:
501
-
502
- ```js
503
- import { loadEmbedder, prepareSearch } from "@modootoday/pmcp";
504
-
505
- const encoder = await loadEmbedder("embeddinggemma-2", {
506
- dimensions: 256,
507
- modelPath: "/opt/models/embeddinggemma-2",
508
- localOnly: true,
509
- });
510
- const search = await prepareSearch(
511
- { roots: ["node_modules"] },
512
- {
513
- indexPath: "node_modules/.cache/pmcp/vectors.sqlite",
514
- modelId: "embeddinggemma-2",
515
- dimensions: 256,
516
- embedder: encoder ?? undefined,
517
- },
518
- );
519
- ```
140
+ ## Licence
520
141
 
521
- HTTP hosts use these options under `semantic`; HTTP catalogs are encoded in
522
- memory at startup rather than reading the CLI's persisted index. Model runtime
523
- settings are passed to each loader without changing global download or cache
524
- policy, so hosts can prepare different encoders in one process.
525
-
526
- ## Runtime and licence
527
-
528
- Node.js 22 or later, or Bun 1.3 or later. Ranking is lexical until an index and
529
- encoder are ready. Semantic
530
- ranking (the `index` command, or the HTTP handler's `semantic` option) needs
531
- `@huggingface/transformers` installed separately; it is not part of the default
532
- installation. The default encoder is `Xenova/multilingual-e5-small` (MIT, about
533
- 130 MB), so vectors indexed with the earlier English-only default are re-encoded.
534
-
535
- The optional encoder also supports the ONNX Community EmbeddingGemma 300M and
536
- EmbeddingGemma 2 exports. It uses their projected sentence embeddings and task
537
- prefixes. EmbeddingGemma 2 loads its text encoder without vision or audio models.
538
- EmbeddingGemma was qualified with Transformers.js 4.3.1. Install a version
539
- supporting the chosen export and keep model
540
- weights outside the npm package. Regenerate document vectors when changing the
541
- encoder. Quantization reduces weight storage; application RAM and latency need
542
- workload measurements. EmbeddingGemma 300M uses the Gemma terms; EmbeddingGemma 2
543
- is listed under Apache-2.0 in its model card.
544
-
545
- Elastic License 2.0. See `LICENSE` and `NOTICE` for terms and dependency notices.
546
- Documentation: <https://pmcp.build>.
142
+ pmcp is source available under [Elastic License 2.0](LICENSE).
143
+ See [NOTICE](NOTICE) for dependency notices and the embedding guide for model
144
+ licences. Website: [pmcp.build](https://pmcp.build).