@ai-ecoverse/slicc-agent 7.34.0 → 7.34.1

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
@@ -408,7 +408,7 @@ MCP servers reachable over Streamable HTTP become native agent tools. The client
408
408
 
409
409
  **Per agent.** Every cone gets every enabled server from the one file above: `/etc/slicc/agent/mcp.json` with users on, `/home/.pi/agent/mcp.json` with users off. A scoop doesn't read a file of its own: it inherits its cone's servers, and a role's `tools:` or `agent --tools` list narrows them. A list with no `mcp__` entry gets no MCP servers. A list with `mcp__docs__search` or `mcp__docs__*` keeps only those, and `codemode` is added so codemode tools stay reachable. The resource tools must be listed by name, and they reach only the servers the list names. A nested scoop without a list inherits its calling scoop's list. A `beforeTool` hook blocks the model's calls outside the list, and codemode scripts only get the tools on it.
410
410
 
411
- **Secrets.** `${NAME}` placeholders resolve to the vault's placeholders for that server (`records()`: an `mcp` record with `server` equal to the `mcp.json` key and that name, else the server's only record when the headers use one name, else an unbound record of that name, which covers mcpcat's `${MCP_<NAME>_TOKEN}` bridge tokens). The headers go out holding placeholders, and the vault fills them in its `mcp` op, only for that server's registered URL. The headers are passed to the vault and on to the kernel's transport as data, never through a browser `Request`, so a forbidden request header such as `Cookie` isn't dropped on the way; whether it then reaches the server is up to the transport's route (the page's own fetch drops it, see slicc-kernel#1796). A server whose record is missing comes up as needing one, with a lick, and reconnects when the record appears. The worker never holds a value; server log lines are scrubbed through the vault before they reach `~/.pi/agent/mcp.log`. **OAuth.** A server without an `Authorization` header that answers 401 needs a sign-in, as in pi. Its row in Settings › MCP servers offers Connect, which opens a held pop-up (`slicc-mcp-oauth`, see **Held sign-in windows**) on the authorization server, found through the server's protected-resource metadata (RFC 9728) or `oauth.authServerMetadataUrl`. SLICC registers itself dynamically as a public client named `SLICC` (`oauth.clientName` changes it), or uses `oauth.clientId`, with PKCE S256 and the redirect URI `https://<origin>/oauth/mcp-callback`. slicc-bios serves that path from `dist/oauth/mcp-callback.html` in this package. The callback page hands the code back over the `slicc-mcp-oauth` BroadcastChannel and clears it from its address. Before the pop-up opens, the worker registers the server's `tokenUrl` (the discovered `token_endpoint`, else `<authServer>/token`) with the vault. It exchanges the code, checking `state` and `iss`, as a prepared `mcp` request to that `tokenUrl`, and hands the token response straight to the vault's `grant`; the raw response is dropped, and pi-mcp keeps only the reply, which holds placeholders, with the client and discovery state in `/.slicc/accounts.json` under the server's name and URL. When the server answers 401, the worker asks the vault to `refresh` once and sends again; pi-mcp's own refresh is off, because the refresh token is a placeholder. When that fails, the row shows the sign-in as expired. Disconnect deletes the local state; spectrum removes the vault records. Without a vault, the exchange is refused ("MCP sign-in needs seven's vault: update seven") before any token is issued. `oauth.scope` sets the scopes, else the server's advertised ones are used. `clientSecret`, `callbackPort`, `callbackUrl` and `clientRegistration` are refused, because SLICC signs in as a public client through its own page.
411
+ **Secrets.** `${NAME}` placeholders resolve to the vault's placeholders for that server (`records()`: an `mcp` record with `server` equal to the `mcp.json` key and that name, else the server's only record when the headers use one name, else an unbound record of that name, which covers mcpcat's `${MCP_<NAME>_TOKEN}` bridge tokens). The headers go out holding placeholders, and the vault fills them in its `mcp` op, only for that server's registered URL. The headers are passed to the vault and on to the kernel's transport as data, never through a browser `Request`, so a forbidden request header such as `Cookie` isn't dropped on the way; whether it then reaches the server is up to the transport's route (the page's own fetch drops it, see slicc-kernel#1796). A server whose record is missing comes up as needing one, with a lick, and reconnects when the record appears. The worker never holds a value; server log lines are scrubbed through the vault before they reach `~/.pi/agent/mcp.log`. **OAuth.** A server without an `Authorization` header that answers 401 needs a sign-in, as in pi. Its row in Settings › MCP servers offers Connect, which opens a held pop-up (`slicc-mcp-oauth`, see **Held sign-in windows**) on the authorization server, found through the server's protected-resource metadata (RFC 9728) or `oauth.authServerMetadataUrl`. SLICC registers itself dynamically as a public client named `SLICC` (`oauth.clientName` changes it), or uses `oauth.clientId`, with PKCE S256 and the redirect URI `https://<origin>/oauth/mcp-callback`. slicc-bios serves that path from `dist/oauth/mcp-callback.html` in this package. The callback page hands the code back over the `slicc-mcp-oauth` BroadcastChannel and clears it from its address only when its `state` has a `slicc-mcp-oauth:<state>` key in `localStorage`, which SLICC writes when it starts the sign-in; for any other answer it says no sign-in from SLICC was waiting, broadcasts nothing, stays open and keeps its address, so a sign-in started elsewhere can still copy the code from it. It never shows the code. Before the pop-up opens, the worker registers the server's `tokenUrl` (the discovered `token_endpoint`, else `<authServer>/token`) with the vault. It exchanges the code, checking `state` and `iss`, as a prepared `mcp` request to that `tokenUrl`, and hands the token response straight to the vault's `grant`; the raw response is dropped, and pi-mcp keeps only the reply, which holds placeholders, with the client and discovery state in `/.slicc/accounts.json` under the server's name and URL. When the server answers 401, the worker asks the vault to `refresh` once and sends again; pi-mcp's own refresh is off, because the refresh token is a placeholder. When that fails, the row shows the sign-in as expired. Disconnect deletes the local state; spectrum removes the vault records. Without a vault, the exchange is refused ("MCP sign-in needs seven's vault: update seven") before any token is issued. `oauth.scope` sets the scopes, else the server's advertised ones are used. `clientSecret`, `callbackPort`, `callbackUrl` and `clientRegistration` are refused, because SLICC signs in as a public client through its own page.
412
412
 
413
413
  **Settings › MCP servers** lists every server in the file, under its own heading below Accounts, with the URL host. A row's `state` says what it's doing: `connecting`, `connected`, `needs-secret`, `needs-auth` or `failed`, or `disabled` (`enabled: false`) and `refused` (the entry's check failed; the warn lick says why, `refusals()` below gives the owner the same sentence, and the row's only action is Remove). A server that needs nothing has `auth: 'local'` and no Connect; it turns into an `oauth` row with Connect if it answers 401. **Adding and removing.** `addServer(name, entry)` and `removeServer('mcp:<server>')` on the settings service are for the owner's page only: a view-only or control seat gets `{ ok: false, code: 'not-owner', reason }`, a guest has no settings service, and the spectrum adapter offers them only on the owner's connection. No tool or kernel command reaches them, so an agent still needs `sudo` to change the file. Both answer `{ ok: true }` or `{ ok: false, code, reason }`, where `code` is a stable `McpRefusalCode` from `src/services.ts`, for a page to act on, and `reason` is the sentence to show. `refusals()`, also the owner's alone (other seats and guests get `EACCES`, and an agent without MCP answers `{}`), answers `{ [server]: { code, reason } }` for the entries refused in the file, with no URL, header value or secret. `entry` goes through the same checks as reading the file, so a stdio or `type: "sse"` entry, a literal secret, or a URL with a password or key returns the reason and writes nothing, and so does a name that's taken. `token: true` writes `Authorization: Bearer ${MCP_<NAME>_TOKEN}` (`<NAME>` in upper case with anything else as `_`, the name mcpcat and jerk use), so the row offers Connect like any token server; without it, the server signs in through the OAuth path above if it answers 401. The other servers and unknown fields stay. A file that doesn't parse or can't be read is refused, with the reason, and never overwritten. The write goes to a `0600` temporary file beside it and is renamed over it, and the file watch does the rest. `removeServer` also forgets the server's local OAuth state; the vault's records and the page's endpoint registration are the page's to clear, as on Disconnect. The page can ask for a server's URL, the `mcp.json` URL without user name, password, query or fragment, with `serverUrl('mcp:<server>')`, so it can register it with the vault (its `endpoints` op) before it connects a token it put there; from slicc-vault 1.13.0 a page-sealed token is filled only on a URL the page registered. The URL is never in the replicated settings state, since a path can carry a token and view-only principals read that state; `serverUrl` is a settings method, which view-only principals don't get, and it answers `null` for model accounts. The spectrum adapter fills each MCP account's `url` from it. Connect takes the token, which fills every placeholder of a server that uses one name; a server whose headers use several different names can't be filled from Settings yet. The server then reconnects. A server that answers 401 shows as **Rejected**, with Reconnect, and Disconnect deletes the token. Tool cards and remote summaries label MCP calls `server · tool`, unless the name is ambiguous (a server name that starts or ends with `_`, or a name with more than two `__` separators); then they show the raw name.
414
414
 
@@ -49,6 +49,9 @@
49
49
  [data-state="failed"] .mark {
50
50
  background: var(--bad);
51
51
  }
52
+ [data-state="unknown"] .mark {
53
+ background: var(--muted);
54
+ }
52
55
  h1 {
53
56
  font-size: 1.25rem;
54
57
  margin: 0 0 0.5rem;
@@ -80,7 +83,6 @@
80
83
  const answer = {};
81
84
  for (const key of ['code', 'state', 'iss', 'error', 'error_description'])
82
85
  if (params.has(key)) answer[key] = params.get(key);
83
- history.replaceState(null, '', location.pathname);
84
86
  const main = document.querySelector('main');
85
87
  const show = (state, title, text, mark) => {
86
88
  main.dataset.state = state;
@@ -88,8 +90,14 @@
88
90
  main.querySelector('p').textContent = text;
89
91
  main.querySelector('.mark').textContent = mark;
90
92
  };
91
- const named = answer.state ? localStorage.getItem(`slicc-mcp-oauth:${answer.state}`) : null;
92
- const where = named ? ` to ${named}` : '';
93
+ const named = (() => {
94
+ if (!answer.state) return null;
95
+ try {
96
+ return localStorage.getItem(`slicc-mcp-oauth:${answer.state}`);
97
+ } catch {
98
+ return null;
99
+ }
100
+ })();
93
101
  if (!answer.state)
94
102
  show(
95
103
  'failed',
@@ -97,7 +105,19 @@
97
105
  'This page only works as the end of a sign-in from SLICC.',
98
106
  '!'
99
107
  );
100
- else {
108
+ else if (named === null) {
109
+ const said = answer.error
110
+ ? `The authorization server answered: ${answer.error_description ?? answer.error}. `
111
+ : '';
112
+ show(
113
+ 'unknown',
114
+ 'No sign-in from SLICC was waiting for this',
115
+ `${said}SLICC didn't start this sign-in, so nothing was handed over. The full address is still in the address bar if you need to copy it.`,
116
+ '?'
117
+ );
118
+ } else {
119
+ const where = named ? ` to ${named}` : '';
120
+ history.replaceState(null, '', location.pathname);
101
121
  new BroadcastChannel('slicc-mcp-oauth').postMessage(answer);
102
122
  if (answer.error)
103
123
  show('failed', `Couldn't sign in${where}`, answer.error_description ?? answer.error, '!');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-agent",
3
- "version": "7.34.0",
3
+ "version": "7.34.1",
4
4
  "description": "SLICC's agent core on pi durable: an agent worker, session storage, remoting and pi extensions",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -73,11 +73,11 @@
73
73
  },
74
74
  "devDependencies": {
75
75
  "@ai-ecoverse/slicc-jsh": "0.64.4",
76
- "@ai-ecoverse/slicc-kernel": "1.186.0",
76
+ "@ai-ecoverse/slicc-kernel": "1.189.2",
77
77
  "@ai-ecoverse/slicc-scrub": "1.1.1",
78
78
  "@ai-ecoverse/slicc-shared-web": "2.14.4",
79
79
  "@ai-ecoverse/slicc-spectrum": "2.16.1",
80
- "@ai-ecoverse/slicc-vault": "1.26.0",
80
+ "@ai-ecoverse/slicc-vault": "1.26.2",
81
81
  "@ai-ecoverse/wasi-fnox": "1.47.0-1",
82
82
  "@ai-ecoverse/wasm-bash": "5.3.0-23",
83
83
  "@ai-ecoverse/wasm-coreutils": "9.12.0-15",
@@ -85,9 +85,9 @@
85
85
  "@biomejs/biome": "2.6.6",
86
86
  "@types/node": "26.6.6",
87
87
  "esbuild": "0.28.2",
88
- "fake-indexeddb": "6.2.7",
88
+ "fake-indexeddb": "6.2.8",
89
89
  "lefthook": "2.2.2",
90
- "monocart-coverage-reports": "3.2.0",
90
+ "monocart-coverage-reports": "3.2.1",
91
91
  "playwright-core": "1.65.0",
92
92
  "semantic-release": "25.0.9",
93
93
  "slicc-agent-5": "npm:@ai-ecoverse/slicc-agent@5.10.1",