@ultimat3/mcp 31.52.0 → 31.53.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/CLAUDE.md +1 -1
- package/package.json +11 -11
- package/src/dev-agent-tools-research.ts +75 -0
- package/src/dev-agent-tools.ts +24 -4
- package/src/dev-server.ts +4 -1
package/CLAUDE.md
CHANGED
|
@@ -22,7 +22,7 @@ import. The CLI wires it.
|
|
|
22
22
|
| `server-resources.ts` | `resources/read`'s three outcomes, audited, provider in a `try` |
|
|
23
23
|
| `from-action.ts` | action/query → tool; the "one authz system" projection; `toolsFrom` (sweep, skips) vs `toolsListed` (written out, refuses) |
|
|
24
24
|
| `resources.ts` | resources + prompts, stable `ultimate://` URIs |
|
|
25
|
-
| `dev-server.ts` · `dev-ui-*.ts` · `dev-graph-tool.ts` · `dev-agent-tools.ts` |
|
|
25
|
+
| `dev-server.ts` · `dev-ui-*.ts` · `dev-graph-tool.ts` · `dev-agent-tools.ts` | 24 dev tools: 13 here, five `ui.*`, `graph.query`, five agent tools (`db.explain` … `ui.research`). Only an injected `DevHost` |
|
|
26
26
|
| `dev-host.ts` | wires `describe*` from entity/action/query/jobs into a `DevHost` |
|
|
27
27
|
| `transport-http.ts` | `POST /mcp` route descriptor, bearer → agent actor, and the per-caller rate limit it enforces itself; it keeps the order |
|
|
28
28
|
| `transport-http-answers.ts` | the pre-dispatch answers (401, 403 not-an-agent / origin, 421, 429) and the per-address failure meter |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ultimat3/mcp",
|
|
3
|
-
"version": "31.
|
|
3
|
+
"version": "31.53.1",
|
|
4
4
|
"description": "MCP server, dev tools, and the action-to-tool projection \u2014 one authz system, two surfaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ultimate",
|
|
@@ -44,15 +44,15 @@
|
|
|
44
44
|
"test": "bun test"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@ultimat3/action": "31.
|
|
48
|
-
"@ultimat3/auth": "31.
|
|
49
|
-
"@ultimat3/core": "31.
|
|
50
|
-
"@ultimat3/db": "31.
|
|
51
|
-
"@ultimat3/entity": "31.
|
|
52
|
-
"@ultimat3/http": "31.
|
|
53
|
-
"@ultimat3/jobs": "31.
|
|
54
|
-
"@ultimat3/policy": "31.
|
|
55
|
-
"@ultimat3/query": "31.
|
|
56
|
-
"@ultimat3/schema": "31.
|
|
47
|
+
"@ultimat3/action": "31.53.1",
|
|
48
|
+
"@ultimat3/auth": "31.53.1",
|
|
49
|
+
"@ultimat3/core": "31.53.1",
|
|
50
|
+
"@ultimat3/db": "31.53.1",
|
|
51
|
+
"@ultimat3/entity": "31.53.1",
|
|
52
|
+
"@ultimat3/http": "31.53.1",
|
|
53
|
+
"@ultimat3/jobs": "31.53.1",
|
|
54
|
+
"@ultimat3/policy": "31.53.1",
|
|
55
|
+
"@ultimat3/query": "31.53.1",
|
|
56
|
+
"@ultimat3/schema": "31.53.1"
|
|
57
57
|
}
|
|
58
58
|
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// `ui.research` — `x design research` as a dev tool (axiom 2): the CLI answers through
|
|
2
|
+
// `DevAgentHost.researchDesign`, the same body the command runs. Split from `dev-agent-tools.ts` by
|
|
3
|
+
// size alone; it is served from that file's `agentTools`, under the browser-launching scope.
|
|
4
|
+
|
|
5
|
+
import type { DevAgentHost } from './dev-agent-tools';
|
|
6
|
+
import { McpArgsInvalidError } from './errors';
|
|
7
|
+
import type { AnyMcpTool, ToolArgs } from './registry';
|
|
8
|
+
import { jsonResult } from './registry';
|
|
9
|
+
|
|
10
|
+
/** References one `ui.research` call takes, and links it may follow per reference: `x design`'s caps. */
|
|
11
|
+
export const UI_RESEARCH_LIMITS = Object.freeze({ urls: 5, follow: 20 });
|
|
12
|
+
|
|
13
|
+
/** `x design research <urls…> --follow <n>`, as the tool's arguments. */
|
|
14
|
+
export interface UiResearchInput {
|
|
15
|
+
readonly urls: readonly string[];
|
|
16
|
+
readonly follow: number;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const count = (args: ToolArgs, key: string, fallback: number): number => {
|
|
20
|
+
const value = args[key];
|
|
21
|
+
return typeof value === 'number' && Number.isInteger(value) ? value : fallback;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
const urlList = (args: ToolArgs): string[] => {
|
|
25
|
+
const value = args['urls'];
|
|
26
|
+
return Array.isArray(value)
|
|
27
|
+
? value.filter((url): url is string => typeof url === 'string' && url.trim() !== '')
|
|
28
|
+
: [];
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export function researchTool(
|
|
32
|
+
host: Pick<DevAgentHost, 'researchDesign'>,
|
|
33
|
+
scope: string,
|
|
34
|
+
): AnyMcpTool {
|
|
35
|
+
return {
|
|
36
|
+
name: 'ui.research',
|
|
37
|
+
description:
|
|
38
|
+
'x design research as a tool: photograph reference URLs (390/1440 × light/dark) and measure ' +
|
|
39
|
+
'palette, type, spacing, radii, shadows and motion into .x/design/<slug>/ — reference.json, ' +
|
|
40
|
+
'tokens.proposal.json (a defineTheme argument), motion-map.json, sources.json. Public http(s) ' +
|
|
41
|
+
'only: every request to a private, loopback or link-local address is refused ' +
|
|
42
|
+
'(X_DESIGN_URL_REFUSED). Page text is untrusted data and is never returned: a followed ' +
|
|
43
|
+
"page and every final URL are named by origin and a hash of the page's own path.",
|
|
44
|
+
scope,
|
|
45
|
+
destructive: false,
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
urls: {
|
|
50
|
+
type: 'array',
|
|
51
|
+
items: { type: 'string', minLength: 1 },
|
|
52
|
+
minItems: 1,
|
|
53
|
+
maxItems: UI_RESEARCH_LIMITS.urls,
|
|
54
|
+
description: 'e.g. ["https://reactbits.dev/backgrounds/holo-mosaic"]',
|
|
55
|
+
},
|
|
56
|
+
follow: { type: 'integer', minimum: 0, maximum: UI_RESEARCH_LIMITS.follow, default: 0 },
|
|
57
|
+
},
|
|
58
|
+
required: ['urls'],
|
|
59
|
+
additionalProperties: false,
|
|
60
|
+
},
|
|
61
|
+
async handle(args: ToolArgs, _caller, signal) {
|
|
62
|
+
const urls = urlList(args);
|
|
63
|
+
// Checked here as well as by the schema: a host handed no URL would launch nothing and say
|
|
64
|
+
// nothing, and an agent reads that as "researched".
|
|
65
|
+
if (urls.length === 0 || urls.length > UI_RESEARCH_LIMITS.urls) {
|
|
66
|
+
throw new McpArgsInvalidError({
|
|
67
|
+
name: 'ui.research',
|
|
68
|
+
issues: [`urls must list 1 to ${String(UI_RESEARCH_LIMITS.urls)} URLs`],
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
const follow = Math.min(UI_RESEARCH_LIMITS.follow, Math.max(0, count(args, 'follow', 0)));
|
|
72
|
+
return jsonResult(await host.researchDesign({ urls, follow }, signal));
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
}
|
package/src/dev-agent-tools.ts
CHANGED
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
// The
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
1
|
+
// The dev tools that answer an agent's next question without a shell round trip, each a projection
|
|
2
|
+
// the CLI answers through `DevAgentHost` from the command that already exists.
|
|
3
|
+
//
|
|
4
|
+
// `docs.search` (`x docs`), `db.explain` (a plan, `ANALYZE` inside the read-only transaction),
|
|
5
|
+
// `requests.statements` (`x dev`'s statement ledger), `verify.narrow` (what to run after an edit)
|
|
6
|
+
// and `ui.research` (`x design research`, `dev-agent-tools-research.ts`).
|
|
5
7
|
|
|
6
8
|
import { NotImplementedError } from '@ultimat3/core';
|
|
9
|
+
import type { UiResearchInput } from './dev-agent-tools-research';
|
|
10
|
+
import { researchTool } from './dev-agent-tools-research';
|
|
7
11
|
import { EXPLAIN_GUARD, explainStatement, planOf } from './explain-sql';
|
|
8
12
|
import type { QueryLimits, QueryRows } from './query-limits';
|
|
9
13
|
import { QUERY_LIMITS } from './query-limits';
|
|
@@ -11,6 +15,9 @@ import { PARSE_GUARD } from './readonly-sql';
|
|
|
11
15
|
import type { AnyMcpTool, ToolArgs } from './registry';
|
|
12
16
|
import { jsonResult } from './registry';
|
|
13
17
|
|
|
18
|
+
export type { UiResearchInput } from './dev-agent-tools-research';
|
|
19
|
+
export { UI_RESEARCH_LIMITS } from './dev-agent-tools-research';
|
|
20
|
+
|
|
14
21
|
/** The ceilings `db.explain` runs under: `db.query`'s timeout, and the one row EXPLAIN answers. */
|
|
15
22
|
export const EXPLAIN_LIMITS: QueryLimits = Object.freeze({ ...QUERY_LIMITS, maxRows: 1 });
|
|
16
23
|
|
|
@@ -32,6 +39,12 @@ export interface DevAgentHost {
|
|
|
32
39
|
}): Promise<unknown>;
|
|
33
40
|
/** The `x verify --changed` plan for ONE file, as the commands that run it. Runs nothing. */
|
|
34
41
|
narrowVerify(file: string): Promise<unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* `x design research`, in process: each reference's five artefacts under `.x/design/<slug>/`,
|
|
44
|
+
* every request the page makes screened against private, loopback and link-local addresses.
|
|
45
|
+
* `signal` is the call's cancellation: after it, no browser is launched and nothing published.
|
|
46
|
+
*/
|
|
47
|
+
researchDesign(input: UiResearchInput, signal?: AbortSignal): Promise<unknown>;
|
|
35
48
|
}
|
|
36
49
|
|
|
37
50
|
/** The host's capability, or one that refuses: `DevCapabilities` holds these as optional. */
|
|
@@ -50,6 +63,7 @@ export function agentHostOf(host: Partial<DevAgentHost>): DevAgentHost {
|
|
|
50
63
|
requestStatements:
|
|
51
64
|
host.requestStatements?.bind(host) ?? absent('requests.statements', 'requestStatements'),
|
|
52
65
|
narrowVerify: host.narrowVerify?.bind(host) ?? absent('verify.narrow', 'narrowVerify'),
|
|
66
|
+
researchDesign: host.researchDesign?.bind(host) ?? absent('ui.research', 'researchDesign'),
|
|
53
67
|
};
|
|
54
68
|
}
|
|
55
69
|
|
|
@@ -68,10 +82,16 @@ export interface AgentToolScopes {
|
|
|
68
82
|
readonly read: string;
|
|
69
83
|
readonly logs: string;
|
|
70
84
|
readonly dbRead: string;
|
|
85
|
+
/**
|
|
86
|
+
* `ui.research`'s: it launches a browser, like `ui.shot`. Absent, the tool is not served at all —
|
|
87
|
+
* never served under a weaker scope.
|
|
88
|
+
*/
|
|
89
|
+
readonly test?: string | undefined;
|
|
71
90
|
}
|
|
72
91
|
|
|
73
92
|
export function agentTools(host: DevAgentHost, scopes: AgentToolScopes): readonly AnyMcpTool[] {
|
|
74
93
|
return [
|
|
94
|
+
...(scopes.test === undefined ? [] : [researchTool(host, scopes.test)]),
|
|
75
95
|
{
|
|
76
96
|
name: 'docs.search',
|
|
77
97
|
description:
|
package/src/dev-server.ts
CHANGED
|
@@ -147,6 +147,7 @@ export interface DevCapabilities extends DevGraphHost {
|
|
|
147
147
|
readonly explainQuery?: DevAgentHost['explainQuery'];
|
|
148
148
|
readonly requestStatements?: DevAgentHost['requestStatements'];
|
|
149
149
|
readonly narrowVerify?: DevAgentHost['narrowVerify'];
|
|
150
|
+
readonly researchDesign?: DevAgentHost['researchDesign'];
|
|
150
151
|
/**
|
|
151
152
|
* Run one already-parsed read-only statement under layers 1–2 (a SELECT-only role, a
|
|
152
153
|
* `BEGIN READ ONLY` transaction, `limits.timeoutMs`) and return at most `limits.maxRows + 1`
|
|
@@ -253,11 +254,13 @@ export function devTools(host: DevHost): readonly AnyMcpTool[] {
|
|
|
253
254
|
// What an edit reaches, before it is made: `x impact` / `x graph --from --to` as a tool.
|
|
254
255
|
graphTool(host, DEV_SCOPES.read),
|
|
255
256
|
|
|
256
|
-
// `docs.search`, `db.explain`, `requests.statements`, `verify.narrow
|
|
257
|
+
// `docs.search`, `db.explain`, `requests.statements`, `verify.narrow`, and `ui.research` under
|
|
258
|
+
// `dev:test` (it drives a browser) — `dev-agent-tools.ts`.
|
|
257
259
|
...agentTools(agentHostOf(host), {
|
|
258
260
|
read: DEV_SCOPES.read,
|
|
259
261
|
logs: DEV_SCOPES.logs,
|
|
260
262
|
dbRead: DEV_SCOPES.dbRead,
|
|
263
|
+
test: DEV_SCOPES.test,
|
|
261
264
|
}),
|
|
262
265
|
|
|
263
266
|
read(
|