@mcpolyglot/cli 0.2.0 → 0.4.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 +27 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/__tests__/agents.test.d.ts +2 -0
- package/dist/__tests__/agents.test.d.ts.map +1 -0
- package/dist/__tests__/agents.test.js +172 -0
- package/dist/__tests__/agents.test.js.map +1 -0
- package/dist/__tests__/examples.test.d.ts +2 -0
- package/dist/__tests__/examples.test.d.ts.map +1 -0
- package/dist/__tests__/examples.test.js +140 -0
- package/dist/__tests__/examples.test.js.map +1 -0
- package/dist/__tests__/init-doctor.test.d.ts +2 -0
- package/dist/__tests__/init-doctor.test.d.ts.map +1 -0
- package/dist/__tests__/init-doctor.test.js +79 -0
- package/dist/__tests__/init-doctor.test.js.map +1 -0
- package/dist/bin.js +16 -3
- package/dist/bin.js.map +1 -1
- package/dist/commands/doctor-agents.d.ts +5 -0
- package/dist/commands/doctor-agents.d.ts.map +1 -0
- package/dist/commands/doctor-agents.js +33 -0
- package/dist/commands/doctor-agents.js.map +1 -0
- package/dist/commands/doctor.d.ts +10 -0
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +79 -1
- package/dist/commands/doctor.js.map +1 -1
- package/dist/commands/init.d.ts +16 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +85 -5
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/serve.d.ts.map +1 -1
- package/dist/commands/serve.js +34 -12
- package/dist/commands/serve.js.map +1 -1
- package/dist/commands/token.d.ts +5 -0
- package/dist/commands/token.d.ts.map +1 -0
- package/dist/commands/token.js +23 -0
- package/dist/commands/token.js.map +1 -0
- package/dist/factory.d.ts +6 -2
- package/dist/factory.d.ts.map +1 -1
- package/dist/factory.js +99 -14
- package/dist/factory.js.map +1 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +0 -2
- package/dist/ui.js.map +1 -1
- package/package.json +9 -6
package/README.md
CHANGED
|
@@ -18,9 +18,36 @@ npx @mcpolyglot/cli serve --http --port 7337 # start over Streamable HTTP
|
|
|
18
18
|
| `doctor` | Load + validate config, resolve secrets, ping each source, list tools. |
|
|
19
19
|
| `tools` | Print every tool mcpolyglot would expose for the current config. |
|
|
20
20
|
| `serve` | Start the server. `--http` flips to Streamable HTTP with bearer auth. |
|
|
21
|
+
| `token` | `token create <agentId>` mints a per-agent token; `token hash` hashes one. |
|
|
21
22
|
|
|
22
23
|
`serve --http` prints the bearer token, MCP URL, and `/healthz` URL on stderr. Pin the token in your config (`transport.auth.token`) for stable deployments; omit it to mint a fresh token on each start.
|
|
23
24
|
|
|
25
|
+
## Multiple agents over HTTP
|
|
26
|
+
|
|
27
|
+
Give each agent its own token, sources and scopes. Tokens are stored only as sha256 hashes:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
mcpolyglot token create analyst # prints the token once, its hash, and a config snippet
|
|
31
|
+
echo -n "$TOKEN" | mcpolyglot token hash
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```ts
|
|
35
|
+
agents: [
|
|
36
|
+
{
|
|
37
|
+
id: 'analyst',
|
|
38
|
+
tokens: [{ hash: '<sha256 hex>', label: '2026-09' }],
|
|
39
|
+
scopes: ['schema:read', 'tables:read', 'query:raw'],
|
|
40
|
+
sources: { 'pg.main': { policy: { tables: { users: 'none' } } } },
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
- An agent sees only tools of the sources listed under it, and only tools its scopes fully cover. `scopes` defaults to, and is capped at, the union of those sources' scopes.
|
|
46
|
+
- A per-agent `policy` can only **narrow** the source's `policy`: per table the most restrictive access wins, deny lists are combined, and caps take the smaller value. An agent can't re-open a table the source hides or gain writes the source doesn't grant. The reverse also holds: a table the agent's policy doesn't list falls to its `defaultAccess` (at most `read`), so an agent that should keep a source's write access must list that table as `write` again. It gets its own connector, so its own DB connection; sources listed without a policy share the main one.
|
|
47
|
+
- The token decides the audit `agentId`; the `x-mcpolyglot-agent` header is ignored when `agents` is set. Unknown or revoked tokens get `401`.
|
|
48
|
+
- Rotate: add the new hash, move the client over, set `revoked: true` on the old one (or delete it), restart `serve`. There is no hot reload.
|
|
49
|
+
- `agents` needs bearer auth (not OAuth) and is ignored under stdio (single local user). `doctor` lists what each agent can and can't use.
|
|
50
|
+
|
|
24
51
|
Stdio servers must keep stdout clean, so all CLI output goes to stderr.
|
|
25
52
|
|
|
26
53
|
## Docs
|