@cat-factory/mcp-server 0.5.0 → 0.7.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 +57 -4
- package/dist/bin.js +9 -3
- package/dist/bin.js.map +1 -1
- package/dist/config.d.ts +38 -8
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +3 -5
- package/dist/config.js.map +1 -1
- package/dist/http.d.ts +44 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +64 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/instructions.d.ts.map +1 -1
- package/dist/instructions.js +22 -4
- package/dist/instructions.js.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/dist/stdio.d.ts.map +1 -1
- package/dist/stdio.js +1 -1
- package/dist/stdio.js.map +1 -1
- package/dist/tools.generated.d.ts.map +1 -1
- package/dist/tools.generated.js +289 -13
- package/dist/tools.generated.js.map +1 -1
- package/package.json +9 -2
package/README.md
CHANGED
|
@@ -8,6 +8,19 @@ It is a **facade**, not a client. Every tool is one call on
|
|
|
8
8
|
[`@cat-factory/sdk`](../typescript), and the tool table is generated from the same
|
|
9
9
|
[`docs/openapi.json`](../../docs/openapi.json) the four SDK clients are generated from.
|
|
10
10
|
|
|
11
|
+
## Do you need this package?
|
|
12
|
+
|
|
13
|
+
There are two ways to reach a cat-factory deployment over MCP, and they serve the same server.
|
|
14
|
+
|
|
15
|
+
- **Hosted**, `POST /api/v1/mcp` on the deployment itself. Nothing to install: give the host a URL
|
|
16
|
+
and a key. This is the one to reach for if the host speaks HTTP MCP. See
|
|
17
|
+
[`backend/docs/public-api.md`](../../backend/docs/public-api.md#from-an-mcp-host).
|
|
18
|
+
- **This package**, over stdio. It needs no backend deployment of your own, it is the only path for
|
|
19
|
+
a host that cannot speak HTTP MCP, and it is the only one with per-host tool filters.
|
|
20
|
+
|
|
21
|
+
A deployment mounts the hosted endpoint from this package too (`handleMcpHttpRequest`, below), so
|
|
22
|
+
the tool table, the instructions and the result rendering are the same bytes on both paths.
|
|
23
|
+
|
|
11
24
|
## Run it
|
|
12
25
|
|
|
13
26
|
With Claude Code, in one line:
|
|
@@ -121,6 +134,41 @@ const { server, tools } = createCatFactoryMcpServer({ baseUrl, apiKey })
|
|
|
121
134
|
await server.connect(myTransport)
|
|
122
135
|
```
|
|
123
136
|
|
|
137
|
+
## Mounting it yourself
|
|
138
|
+
|
|
139
|
+
Two exports for a deployment that wants to serve MCP from its own routes rather than have every caller
|
|
140
|
+
spawn a process:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
import { handleMcpHttpRequest, refuseMcpMethod } from '@cat-factory/mcp-server'
|
|
144
|
+
|
|
145
|
+
app.all('/api/v1/mcp', async (c) => {
|
|
146
|
+
const refused = refuseMcpMethod(c.req.method) // 405 + Allow: POST for GET/DELETE
|
|
147
|
+
if (refused) return refused
|
|
148
|
+
const key = authenticate(c) // your gate: this package never decides who may call
|
|
149
|
+
return handleMcpHttpRequest(c.req.raw, {
|
|
150
|
+
baseUrl: new URL(c.req.url).origin,
|
|
151
|
+
apiKey: key.secret, // the CALLER's key, so every scope rule applies unchanged
|
|
152
|
+
readOnly: key.scope === 'read',
|
|
153
|
+
readOnlyReason: 'key-scope',
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
It is **stateless**: one server per request, no session id minted, and a JSON response rather than an
|
|
159
|
+
event stream. That is not a simplification but the only shape that survives the runtimes this has to
|
|
160
|
+
serve — a Worker request lands on whichever isolate the edge picks, and a Node deployment scaled past
|
|
161
|
+
one instance has the same problem without sticky routing, so a session-keyed server works on one
|
|
162
|
+
process and fails intermittently in production.
|
|
163
|
+
|
|
164
|
+
Everything `handleMcpHttpRequest` reaches is therefore written against Web standards and imports no
|
|
165
|
+
Node built-in (`test/runtime-neutral.test.ts` enforces it, since the typecheck cannot): this package's
|
|
166
|
+
own `bin` is a Node process, but the hosted half is bundled into deployments' Workers, where `node:fs`
|
|
167
|
+
does not resolve at build time. That is also why `optionsFromEnv` takes its file reader as a
|
|
168
|
+
dependency rather than importing `readFileSync`.
|
|
169
|
+
|
|
170
|
+
For a transport neither of these covers, `createCatFactoryMcpServer` returns the bare `Server`.
|
|
171
|
+
|
|
124
172
|
## What "thin" means here
|
|
125
173
|
|
|
126
174
|
The facade decides three things: which tools to list, how to render one result, and how to render
|
|
@@ -193,7 +241,9 @@ quietly stale.
|
|
|
193
241
|
destructive.
|
|
194
242
|
- **Read-only mode is a convenience, not a boundary.** It removes tools from this server; the key
|
|
195
243
|
still carries whatever scope it was minted with. Mint a `read`-scoped key for the boundary. The
|
|
196
|
-
same goes for the two per-tool filters.
|
|
244
|
+
same goes for the two per-tool filters. (The hosted endpoint runs this the other way round: it
|
|
245
|
+
DERIVES read-only from the key's scope, and the instructions name that as the cause so a model asks
|
|
246
|
+
for a wider key rather than for a config edit.)
|
|
197
247
|
- **A result that does not fit is REFUSED, not truncated.** The message names how many characters
|
|
198
248
|
there were, the limit, and the way out from either side: `limit` / `cursor` on the list endpoints,
|
|
199
249
|
`offset` on the debug text reads, or a bigger `CAT_FACTORY_MCP_MAX_RESULT_CHARS`. Half an object
|
|
@@ -222,8 +272,11 @@ Three layers of coverage, and the split is about what each CAN see:
|
|
|
222
272
|
client whose `fetch` is stubbed, so a tool that lists but cannot be called fails a test rather than
|
|
223
273
|
shipping. `test/stdio.test.ts` covers the executable's rules (connect before announcing, every
|
|
224
274
|
human-readable byte off stdout, refuse rather than start) without spawning anything.
|
|
225
|
-
- **The MCP
|
|
226
|
-
|
|
227
|
-
|
|
275
|
+
- **The two MCP phases of `backend/internal/sdk-smoketest`** drive both access paths against one real
|
|
276
|
+
backend: `--only=mcp` spawns the built `dist/bin.js` as a real process, `--only=mcp-hosted` connects
|
|
277
|
+
a real Streamable HTTP client to that deployment's `POST /api/v1/mcp`. Either one is the only thing
|
|
278
|
+
that can see the published output schemas DISAGREE with what the deployment actually answers,
|
|
279
|
+
because the client validates them; running both against one board is what would catch the two paths
|
|
280
|
+
answering differently.
|
|
228
281
|
- **`pnpm check:publish`** covers the shape this package is most exposed to: one `bin` entry pointing
|
|
229
282
|
at a gitignored `dist`, which is exactly how two other packages once reached npm as empty shells.
|
package/dist/bin.js
CHANGED
|
@@ -1,13 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
2
3
|
import { bootStdioServer, startupFailureMessage } from './stdio.js';
|
|
3
4
|
// The `cat-factory-mcp` executable: the stdio server an MCP host spawns.
|
|
4
5
|
//
|
|
5
|
-
// Deliberately nothing but the process wiring: the environment, the stream every
|
|
6
|
-
// byte goes to (stderr, NEVER stdout, which carries the protocol), and the exit
|
|
7
|
-
// decides lives in `stdio.ts`, where a test can drive it.
|
|
6
|
+
// Deliberately nothing but the process wiring: the environment, the filesystem, the stream every
|
|
7
|
+
// human-readable byte goes to (stderr, NEVER stdout, which carries the protocol), and the exit
|
|
8
|
+
// code. Everything it decides lives in `stdio.ts`, where a test can drive it.
|
|
9
|
+
//
|
|
10
|
+
// The `node:fs` import belongs to THIS file, the one module here that is a Node process by
|
|
11
|
+
// definition. The rest of the package is bundled into deployments' hosted endpoints (`http.ts`),
|
|
12
|
+
// including onto workerd, where the built-in does not resolve at build time.
|
|
8
13
|
bootStdioServer({
|
|
9
14
|
env: process.env,
|
|
10
15
|
log: (line) => process.stderr.write(line),
|
|
16
|
+
readSecretFile: (path) => readFileSync(path, 'utf8'),
|
|
11
17
|
}).catch((error) => {
|
|
12
18
|
process.stderr.write(startupFailureMessage(error));
|
|
13
19
|
// Refusing to start is the point: a server that comes up without credentials would be listed by
|
package/dist/bin.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEnE,yEAAyE;AACzE,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAA;AAEnE,yEAAyE;AACzE,EAAE;AACF,iGAAiG;AACjG,+FAA+F;AAC/F,8EAA8E;AAC9E,EAAE;AACF,2FAA2F;AAC3F,iGAAiG;AACjG,6EAA6E;AAE7E,eAAe,CAAC;IACd,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;IACzC,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC;CACrD,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC1B,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,CAAA;IAClD,gGAAgG;IAChG,kGAAkG;IAClG,wDAAwD;IACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC,CAAC,CAAA"}
|
package/dist/config.d.ts
CHANGED
|
@@ -32,11 +32,23 @@ export interface CatFactoryMcpOptions {
|
|
|
32
32
|
* Expose only the tools that change nothing (the GETs). For an agent that should be able to
|
|
33
33
|
* READ a deployment and never act on it.
|
|
34
34
|
*
|
|
35
|
-
*
|
|
36
|
-
* key still carries whatever scope it was minted with, and anything else
|
|
37
|
-
* write. Mint a `read`-scoped key for the boundary
|
|
35
|
+
* On the STDIO server this is a convenience, NOT a security boundary: the tools are gone from
|
|
36
|
+
* this server, but the key still carries whatever scope it was minted with, and anything else
|
|
37
|
+
* holding it can still write. Mint a `read`-scoped key for the boundary — which is what the
|
|
38
|
+
* hosted endpoint does the other way round, deriving this FROM the key (see
|
|
39
|
+
* {@link readOnlyReason}).
|
|
38
40
|
*/
|
|
39
41
|
readOnly?: boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Why {@link readOnly} is set. Defaults to `configured`.
|
|
44
|
+
*
|
|
45
|
+
* Carried because the two causes need DIFFERENT fixes and a model told only "writes are hidden"
|
|
46
|
+
* cannot tell them apart: `configured` is an operator's switch on this server (edit the host
|
|
47
|
+
* config), `key-scope` is the key itself being `read`-scoped (mint a wider key). Stated in the
|
|
48
|
+
* instructions, so a model asks the person who can act rather than reporting the platform as
|
|
49
|
+
* unable to write.
|
|
50
|
+
*/
|
|
51
|
+
readOnlyReason?: ReadOnlyReason;
|
|
40
52
|
/** Ceiling on one tool result, in characters. See `DEFAULT_MAX_RESULT_CHARS`. */
|
|
41
53
|
maxResultChars?: number;
|
|
42
54
|
/** Per-request deadline in ms, passed to the SDK; `0` disables it. */
|
|
@@ -52,6 +64,16 @@ export interface CatFactoryMcpOptions {
|
|
|
52
64
|
*/
|
|
53
65
|
fetch?: typeof globalThis.fetch;
|
|
54
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Why the write tools are withheld.
|
|
69
|
+
*
|
|
70
|
+
* - `configured` — an operator started this server read-only.
|
|
71
|
+
* - `key-scope` — the key presented to it is `read`-scoped, so a write tool could only 403.
|
|
72
|
+
*
|
|
73
|
+
* A closed vocabulary rather than a free-form note: the instructions switch on it exhaustively,
|
|
74
|
+
* so a third cause fails to compile until it has been written down for a model to read.
|
|
75
|
+
*/
|
|
76
|
+
export type ReadOnlyReason = 'configured' | 'key-scope';
|
|
55
77
|
/** The environment variables `optionsFromEnv` reads. */
|
|
56
78
|
export declare const ENV_VARS: {
|
|
57
79
|
readonly baseUrl: 'CAT_FACTORY_BASE_URL';
|
|
@@ -65,9 +87,17 @@ export declare const ENV_VARS: {
|
|
|
65
87
|
readonly timeoutMs: 'CAT_FACTORY_MCP_TIMEOUT_MS';
|
|
66
88
|
readonly maxRetries: 'CAT_FACTORY_MCP_MAX_RETRIES';
|
|
67
89
|
};
|
|
68
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* How `optionsFromEnv` reaches the filesystem.
|
|
92
|
+
*
|
|
93
|
+
* REQUIRED rather than defaulted to `readFileSync`, so this module imports no Node built-in: the
|
|
94
|
+
* same modules are bundled into a deployment's hosted endpoint (see `http.ts`), and on workerd
|
|
95
|
+
* `node:fs` does not resolve at build time — a default here would be a Worker that fails to BUILD
|
|
96
|
+
* for the sake of a code path it can never take. Reading a file is the executable's business; the
|
|
97
|
+
* `cat-factory-mcp` binary passes `readFileSync` and a test passes its own reader.
|
|
98
|
+
*/
|
|
69
99
|
export interface EnvReadDeps {
|
|
70
|
-
readSecretFile
|
|
100
|
+
readSecretFile: (path: string) => string;
|
|
71
101
|
}
|
|
72
102
|
/**
|
|
73
103
|
* Read the options an MCP host can supply: environment variables, because that is what every host
|
|
@@ -77,7 +107,7 @@ export interface EnvReadDeps {
|
|
|
77
107
|
* lists 36 tools and then fails every one of them is the worst of both worlds: the host reports it
|
|
78
108
|
* as connected, and the model spends turns discovering that nothing works.
|
|
79
109
|
*/
|
|
80
|
-
export declare function optionsFromEnv(env: Record<string, string | undefined>, deps
|
|
110
|
+
export declare function optionsFromEnv(env: Record<string, string | undefined>, deps: EnvReadDeps): CatFactoryMcpOptions;
|
|
81
111
|
/**
|
|
82
112
|
* What a server exposes, and what it withheld.
|
|
83
113
|
*
|
|
@@ -92,8 +122,8 @@ export interface ToolSelection {
|
|
|
92
122
|
exposed: CatFactoryTool[];
|
|
93
123
|
/** Groups the operator switched off. Empty when no group filter was applied. */
|
|
94
124
|
filteredGroups: string[];
|
|
95
|
-
/**
|
|
96
|
-
writeToolsHidden:
|
|
125
|
+
/** Why the write tools were withheld by `readOnly`, or null when they were not. */
|
|
126
|
+
writeToolsHidden: ReadOnlyReason | null;
|
|
97
127
|
/** Tools the operator withheld BY NAME. Empty when no deny-list was applied. */
|
|
98
128
|
deniedTools: string[];
|
|
99
129
|
/** Whether an allow-list narrowed the server to an explicitly chosen set of tools. */
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAcnF,iDAAiD;AACjD,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,OAAO,EAAE,MAAM,CAAA;IACf,6FAA6F;IAC7F,MAAM,EAAE,MAAM,CAAA;IACd;;;;OAIG;IACH,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAC1B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IACzB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;IAChC;;;;;;;;;OASG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,cAAc,CAAA;IAC/B,iFAAiF;IACjF,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,sEAAsE;IACtE,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,gGAAgG;IAChG,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAA;CAChC;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,GAAG,WAAW,CAAA;AAEvD,wDAAwD;AACxD,eAAO,MAAM,QAAQ;aACnB,OAAO,EAAE,sBAAsB;aAC/B,MAAM,EAAE,qBAAqB;aAC7B,UAAU,EAAE,0BAA0B;aACtC,MAAM,EAAE,wBAAwB;aAChC,KAAK,EAAE,uBAAuB;aAC9B,YAAY,EAAE,+BAA+B;aAC7C,QAAQ,EAAE,2BAA2B;aACrC,cAAc,EAAE,kCAAkC;aAClD,SAAS,EAAE,4BAA4B;aACvC,UAAU,EAAE,6BAA6B;CACjC,CAAA;AAEV;;;;;;;;GAQG;AACH,MAAM,WAAW,WAAW;IAC1B,cAAc,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAA;CACzC;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,EACvC,IAAI,EAAE,WAAW,GAChB,oBAAoB,CAwBtB;AA6ED;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,cAAc,EAAE,CAAA;IACzB,gFAAgF;IAChF,cAAc,EAAE,MAAM,EAAE,CAAA;IACxB,mFAAmF;IACnF,gBAAgB,EAAE,cAAc,GAAG,IAAI,CAAA;IACvC,gFAAgF;IAChF,WAAW,EAAE,MAAM,EAAE,CAAA;IACrB,sFAAsF;IACtF,gBAAgB,EAAE,OAAO,CAAA;CAC1B;AAED,qEAAqE;AACrE,wBAAgB,WAAW,CACzB,KAAK,EAAE,SAAS,cAAc,EAAE,EAChC,OAAO,EAAE,oBAAoB,GAC5B,aAAa,CA2Cf"}
|
package/dist/config.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { readFileSync } from 'node:fs';
|
|
2
1
|
import { CAT_FACTORY_TOOL_GROUPS } from './tools.generated.js';
|
|
3
2
|
/** The environment variables `optionsFromEnv` reads. */
|
|
4
3
|
export const ENV_VARS = {
|
|
@@ -21,7 +20,7 @@ export const ENV_VARS = {
|
|
|
21
20
|
* lists 36 tools and then fails every one of them is the worst of both worlds: the host reports it
|
|
22
21
|
* as connected, and the model spends turns discovering that nothing works.
|
|
23
22
|
*/
|
|
24
|
-
export function optionsFromEnv(env, deps
|
|
23
|
+
export function optionsFromEnv(env, deps) {
|
|
25
24
|
const baseUrl = env[ENV_VARS.baseUrl]?.trim();
|
|
26
25
|
if (!baseUrl)
|
|
27
26
|
throw new Error(`${ENV_VARS.baseUrl} is required (the deployment's origin).`);
|
|
@@ -74,10 +73,9 @@ function readApiKey(env, deps) {
|
|
|
74
73
|
throw new Error(`${ENV_VARS.apiKey} is required (a public-API key), or ${ENV_VARS.apiKeyFile} naming a file ` +
|
|
75
74
|
'that holds one.');
|
|
76
75
|
}
|
|
77
|
-
const read = deps.readSecretFile ?? ((target) => readFileSync(target, 'utf8'));
|
|
78
76
|
let contents;
|
|
79
77
|
try {
|
|
80
|
-
contents =
|
|
78
|
+
contents = deps.readSecretFile(path);
|
|
81
79
|
}
|
|
82
80
|
catch (error) {
|
|
83
81
|
// The PATH is named and the cause is passed through; the contents never are, on any branch of
|
|
@@ -150,7 +148,7 @@ export function selectTools(tools, options) {
|
|
|
150
148
|
return {
|
|
151
149
|
exposed,
|
|
152
150
|
filteredGroups,
|
|
153
|
-
writeToolsHidden: options.readOnly === true,
|
|
151
|
+
writeToolsHidden: options.readOnly === true ? (options.readOnlyReason ?? 'configured') : null,
|
|
154
152
|
deniedTools: denied ? [...denied].sort() : [],
|
|
155
153
|
toolsAllowListed: allowed !== null,
|
|
156
154
|
};
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAuB,MAAM,sBAAsB,CAAA;AA2FnF,wDAAwD;AACxD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,sBAAsB;IAC/B,MAAM,EAAE,qBAAqB;IAC7B,UAAU,EAAE,0BAA0B;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,OAAO,CAAC,cAAc,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI;QAC7F,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE;QAC7C,gBAAgB,EAAE,OAAO,KAAK,IAAI;KACnC,CAAA;AACH,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CACjB,KAAgC,EAChC,KAAoC,EACpC,QAAgB;IAEhB,IAAI,CAAC,KAAK,EAAE,MAAM;QAAE,OAAO,IAAI,CAAA;IAC/B,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAA;IACrD,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAA;IACxD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,KAAK,CACb,GAAG,QAAQ,6CAA6C,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI;YAC5E,yDAAyD,CAAC,GAAG,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAC3F,CAAA;IACH,CAAC;IACD,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAA;AACvB,CAAC"}
|
package/dist/http.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import type { CatFactoryMcpOptions } from './config.ts';
|
|
2
|
+
/** How a deployment mounts the hosted endpoint. */
|
|
3
|
+
export interface HostedMcpOptions extends CatFactoryMcpOptions {
|
|
4
|
+
/**
|
|
5
|
+
* Report a transport-level fault (a malformed frame, a write to a stream that went away).
|
|
6
|
+
*
|
|
7
|
+
* These never reach the caller — the transport has already answered by the time it fires — so
|
|
8
|
+
* without this they are lost, and a client reporting "the MCP endpoint is broken" leaves nothing
|
|
9
|
+
* behind to read. A mount points this at its own logger.
|
|
10
|
+
*/
|
|
11
|
+
onTransportError?: (error: Error) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Serve ONE Streamable-HTTP request against a freshly built server.
|
|
15
|
+
*
|
|
16
|
+
* STATELESS, per request, on purpose. A session-keyed server holds its state in the memory of the
|
|
17
|
+
* process that minted the session id, and neither runtime this has to serve can promise the next
|
|
18
|
+
* request lands there: a Worker request gets whichever isolate the edge picks, and a Node
|
|
19
|
+
* deployment scaled past one instance has the same problem without sticky routing. So a stateful
|
|
20
|
+
* endpoint works on a developer's single process and fails intermittently in production, which is
|
|
21
|
+
* the worst shape a bug can take. Nothing here needs the state anyway: every tool call is one
|
|
22
|
+
* key-authenticated HTTP call, and the server pushes nothing between them.
|
|
23
|
+
*
|
|
24
|
+
* `enableJsonResponse` follows from the same choice. With no server-initiated messages there is
|
|
25
|
+
* nothing for an SSE stream to carry, and holding one open on a request-scoped runtime costs a
|
|
26
|
+
* connection to deliver nothing.
|
|
27
|
+
*/
|
|
28
|
+
export declare function handleMcpHttpRequest(request: Request, options: HostedMcpOptions): Promise<Response>;
|
|
29
|
+
/**
|
|
30
|
+
* The refusal for a method this endpoint does not answer, or null for the one it does (`POST`).
|
|
31
|
+
*
|
|
32
|
+
* `GET` is a client asking to open a server-to-client SSE stream and `DELETE` is it ending a session;
|
|
33
|
+
* a stateless, JSON-answering endpoint has neither. Both are refused HERE rather than passed to the
|
|
34
|
+
* transport, which would field a `GET` by opening a stream that nothing will ever write to and then
|
|
35
|
+
* keeping it alive with heartbeats.
|
|
36
|
+
*
|
|
37
|
+
* `405` with `Allow`, in the transport's OWN error shape (`handleUnsupportedRequest` answers a `PUT`
|
|
38
|
+
* with byte-identical bytes), because the caller here is a protocol client rather than an API client:
|
|
39
|
+
* it reads a JSON-RPC error frame and it reads the `Allow` header, and the spec names 405 as the way
|
|
40
|
+
* an endpoint says it offers no stream. A mount rendering this in its own error envelope would give
|
|
41
|
+
* the endpoint two answer shapes and lose the header.
|
|
42
|
+
*/
|
|
43
|
+
export declare function refuseMcpMethod(method: string): Response | null;
|
|
44
|
+
//# sourceMappingURL=http.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAA;AA2BvD,mDAAmD;AACnD,MAAM,WAAW,gBAAiB,SAAQ,oBAAoB;IAC5D;;;;;;OAMG;IACH,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAA;CAC1C;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,oBAAoB,CACxC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,QAAQ,CAAC,CAenB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAgB/D"}
|
package/dist/http.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { WebStandardStreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js';
|
|
2
|
+
import { createCatFactoryMcpServer } from './server.js';
|
|
3
|
+
/**
|
|
4
|
+
* Serve ONE Streamable-HTTP request against a freshly built server.
|
|
5
|
+
*
|
|
6
|
+
* STATELESS, per request, on purpose. A session-keyed server holds its state in the memory of the
|
|
7
|
+
* process that minted the session id, and neither runtime this has to serve can promise the next
|
|
8
|
+
* request lands there: a Worker request gets whichever isolate the edge picks, and a Node
|
|
9
|
+
* deployment scaled past one instance has the same problem without sticky routing. So a stateful
|
|
10
|
+
* endpoint works on a developer's single process and fails intermittently in production, which is
|
|
11
|
+
* the worst shape a bug can take. Nothing here needs the state anyway: every tool call is one
|
|
12
|
+
* key-authenticated HTTP call, and the server pushes nothing between them.
|
|
13
|
+
*
|
|
14
|
+
* `enableJsonResponse` follows from the same choice. With no server-initiated messages there is
|
|
15
|
+
* nothing for an SSE stream to carry, and holding one open on a request-scoped runtime costs a
|
|
16
|
+
* connection to deliver nothing.
|
|
17
|
+
*/
|
|
18
|
+
export async function handleMcpHttpRequest(request, options) {
|
|
19
|
+
const { server } = createCatFactoryMcpServer(options);
|
|
20
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
21
|
+
sessionIdGenerator: undefined,
|
|
22
|
+
enableJsonResponse: true,
|
|
23
|
+
});
|
|
24
|
+
if (options.onTransportError)
|
|
25
|
+
transport.onerror = options.onTransportError;
|
|
26
|
+
try {
|
|
27
|
+
await server.connect(transport);
|
|
28
|
+
return await transport.handleRequest(request);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
// Closes the transport with it. In JSON-response mode `handleRequest` has already resolved the
|
|
32
|
+
// complete `Response`, so there is no stream left for this to cut short.
|
|
33
|
+
await server.close();
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The refusal for a method this endpoint does not answer, or null for the one it does (`POST`).
|
|
38
|
+
*
|
|
39
|
+
* `GET` is a client asking to open a server-to-client SSE stream and `DELETE` is it ending a session;
|
|
40
|
+
* a stateless, JSON-answering endpoint has neither. Both are refused HERE rather than passed to the
|
|
41
|
+
* transport, which would field a `GET` by opening a stream that nothing will ever write to and then
|
|
42
|
+
* keeping it alive with heartbeats.
|
|
43
|
+
*
|
|
44
|
+
* `405` with `Allow`, in the transport's OWN error shape (`handleUnsupportedRequest` answers a `PUT`
|
|
45
|
+
* with byte-identical bytes), because the caller here is a protocol client rather than an API client:
|
|
46
|
+
* it reads a JSON-RPC error frame and it reads the `Allow` header, and the spec names 405 as the way
|
|
47
|
+
* an endpoint says it offers no stream. A mount rendering this in its own error envelope would give
|
|
48
|
+
* the endpoint two answer shapes and lose the header.
|
|
49
|
+
*/
|
|
50
|
+
export function refuseMcpMethod(method) {
|
|
51
|
+
if (method === 'POST')
|
|
52
|
+
return null;
|
|
53
|
+
return new Response(JSON.stringify({
|
|
54
|
+
jsonrpc: '2.0',
|
|
55
|
+
error: {
|
|
56
|
+
code: -32000,
|
|
57
|
+
message: 'Method not allowed. This MCP endpoint answers JSON-RPC over POST only: it is stateless ' +
|
|
58
|
+
'and returns a JSON response per request, so there is no event stream to GET and no ' +
|
|
59
|
+
'session to DELETE.',
|
|
60
|
+
},
|
|
61
|
+
id: null,
|
|
62
|
+
}), { status: 405, headers: { Allow: 'POST', 'Content-Type': 'application/json' } });
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=http.js.map
|
package/dist/http.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wCAAwC,EAAE,MAAM,+DAA+D,CAAA;AAExH,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAsCvD;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,OAAgB,EAChB,OAAyB;IAEzB,MAAM,EAAE,MAAM,EAAE,GAAG,yBAAyB,CAAC,OAAO,CAAC,CAAA;IACrD,MAAM,SAAS,GAAG,IAAI,wCAAwC,CAAC;QAC7D,kBAAkB,EAAE,SAAS;QAC7B,kBAAkB,EAAE,IAAI;KACzB,CAAC,CAAA;IACF,IAAI,OAAO,CAAC,gBAAgB;QAAE,SAAS,CAAC,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAA;IAC1E,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAA;QAC/B,OAAO,MAAM,SAAS,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;IAC/C,CAAC;YAAS,CAAC;QACT,+FAA+F;QAC/F,yEAAyE;QACzE,MAAM,MAAM,CAAC,KAAK,EAAE,CAAA;IACtB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,IAAI,MAAM,KAAK,MAAM;QAAE,OAAO,IAAI,CAAA;IAClC,OAAO,IAAI,QAAQ,CACjB,IAAI,CAAC,SAAS,CAAC;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACL,IAAI,EAAE,CAAC,KAAK;YACZ,OAAO,EACL,yFAAyF;gBACzF,qFAAqF;gBACrF,oBAAoB;SACvB;QACD,EAAE,EAAE,IAAI;KACT,CAAC,EACF,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,CAChF,CAAA;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { createCatFactoryMcpServer, type CatFactoryMcpServer, MCP_SERVER_NAME, MCP_SERVER_VERSION, } from './server.ts';
|
|
2
|
-
export { type CatFactoryMcpOptions, ENV_VARS, type EnvReadDeps, optionsFromEnv, selectTools, type ToolSelection, } from './config.ts';
|
|
2
|
+
export { type CatFactoryMcpOptions, ENV_VARS, type EnvReadDeps, optionsFromEnv, type ReadOnlyReason, selectTools, type ToolSelection, } from './config.ts';
|
|
3
|
+
export { handleMcpHttpRequest, type HostedMcpOptions, refuseMcpMethod } from './http.ts';
|
|
3
4
|
export { buildInstructions } from './instructions.ts';
|
|
4
5
|
export { DEFAULT_MAX_RESULT_CHARS, renderError, renderResult, type ToolResult } from './result.ts';
|
|
5
6
|
export { bootStdioServer, type StdioBootDeps, type StdioBootResult, startupFailureMessage, } from './stdio.ts';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,yBAAyB,EACzB,KAAK,mBAAmB,EACxB,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EACL,KAAK,oBAAoB,EACzB,QAAQ,EACR,KAAK,WAAW,EAChB,cAAc,EACd,KAAK,cAAc,EACnB,WAAW,EACX,KAAK,aAAa,GACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,oBAAoB,EAAE,KAAK,gBAAgB,EAAE,eAAe,EAAE,MAAM,WAAW,CAAA;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAE,KAAK,UAAU,EAAE,MAAM,aAAa,CAAA;AAClG,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,qBAAqB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,iBAAiB,EACjB,KAAK,0BAA0B,EAC/B,KAAK,cAAc,GACpB,MAAM,sBAAsB,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,12 @@
|
|
|
5
5
|
// the facade cannot drift from the surface it exposes, and it re-implements none of the SDK's
|
|
6
6
|
// behaviour — retries, auth, error classes, pagination and encoding are all the SDK's.
|
|
7
7
|
//
|
|
8
|
-
//
|
|
9
|
-
// with `
|
|
8
|
+
// Three ways to run it. As a stdio server with the `cat-factory-mcp` binary; as a HOSTED HTTP
|
|
9
|
+
// endpoint on a deployment's own routes with `handleMcpHttpRequest` (no install for the caller);
|
|
10
|
+
// or on a transport of your own with `createCatFactoryMcpServer`.
|
|
10
11
|
export { createCatFactoryMcpServer, MCP_SERVER_NAME, MCP_SERVER_VERSION, } from './server.js';
|
|
11
12
|
export { ENV_VARS, optionsFromEnv, selectTools, } from './config.js';
|
|
13
|
+
export { handleMcpHttpRequest, refuseMcpMethod } from './http.js';
|
|
12
14
|
export { buildInstructions } from './instructions.js';
|
|
13
15
|
export { DEFAULT_MAX_RESULT_CHARS, renderError, renderResult } from './result.js';
|
|
14
16
|
export { bootStdioServer, startupFailureMessage, } from './stdio.js';
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,EAAE;AACF,+FAA+F;AAC/F,mGAAmG;AACnG,8FAA8F;AAC9F,uFAAuF;AACvF,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,+FAA+F;AAC/F,EAAE;AACF,+FAA+F;AAC/F,mGAAmG;AACnG,8FAA8F;AAC9F,uFAAuF;AACvF,EAAE;AACF,8FAA8F;AAC9F,iGAAiG;AACjG,kEAAkE;AAElE,OAAO,EACL,yBAAyB,EAEzB,eAAe,EACf,kBAAkB,GACnB,MAAM,aAAa,CAAA;AACpB,OAAO,EAEL,QAAQ,EAER,cAAc,EAEd,WAAW,GAEZ,MAAM,aAAa,CAAA;AACpB,OAAO,EAAE,oBAAoB,EAAyB,eAAe,EAAE,MAAM,WAAW,CAAA;AACxF,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AACrD,OAAO,EAAE,wBAAwB,EAAE,WAAW,EAAE,YAAY,EAAmB,MAAM,aAAa,CAAA;AAClG,OAAO,EACL,eAAe,EAGf,qBAAqB,GACtB,MAAM,YAAY,CAAA;AACnB,OAAO,EACL,8BAA8B,EAC9B,uBAAuB,EACvB,iBAAiB,GAGlB,MAAM,sBAAsB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"instructions.d.ts","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAkB,aAAa,EAAE,MAAM,aAAa,CAAA;AAWhE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,aAAa,GAAG,MAAM,CA6DlE"}
|
package/dist/instructions.js
CHANGED
|
@@ -41,10 +41,8 @@ export function buildInstructions(selection) {
|
|
|
41
41
|
'Results are JSON. Lists are keyset-paginated: pass the `cursor` a page returns to get the ' +
|
|
42
42
|
'next one, and stop when it comes back null (an empty page with a cursor is normal).',
|
|
43
43
|
];
|
|
44
|
-
if (writeToolsHidden)
|
|
45
|
-
sections.push(
|
|
46
|
-
'deployment supports creating and running tasks; you cannot do it from here.');
|
|
47
|
-
}
|
|
44
|
+
if (writeToolsHidden)
|
|
45
|
+
sections.push(readOnlySection(writeToolsHidden));
|
|
48
46
|
if (filteredGroups.length > 0) {
|
|
49
47
|
sections.push(`The operator switched off these tool groups on THIS server: ${filteredGroups.join(', ')}. ` +
|
|
50
48
|
'The deployment still supports them; they are not reachable from here.');
|
|
@@ -68,6 +66,26 @@ export function buildInstructions(selection) {
|
|
|
68
66
|
sections.push(`Not available as tools:\n${CAT_FACTORY_OMITTED_OPERATIONS.map((omitted) => `- ${omitted.route}: ${omitted.reason}`).join('\n')}`);
|
|
69
67
|
return sections.filter(Boolean).join('\n\n');
|
|
70
68
|
}
|
|
69
|
+
/**
|
|
70
|
+
* Why only the reading tools are here, in the words the cause deserves.
|
|
71
|
+
*
|
|
72
|
+
* Both cases hide the same tools and each needs a DIFFERENT person to act: an operator's switch is
|
|
73
|
+
* fixed in the host's config, a `read`-scoped key is fixed by minting a wider one. Collapsing them
|
|
74
|
+
* into one sentence would send a model to argue with whoever is nearest.
|
|
75
|
+
*/
|
|
76
|
+
function readOnlySection(reason) {
|
|
77
|
+
const supported = 'The deployment supports creating and running tasks; you cannot do it from here. Say which ' +
|
|
78
|
+
'tool you would have used rather than looking for another route to the same effect.';
|
|
79
|
+
switch (reason) {
|
|
80
|
+
case 'configured':
|
|
81
|
+
return `This server was started READ-ONLY: only the tools that change nothing are exposed. ${supported}`;
|
|
82
|
+
case 'key-scope':
|
|
83
|
+
return ('The API key this session is authenticated with is READ-scoped, so only the tools that ' +
|
|
84
|
+
`change nothing are exposed; a write would be refused even if it were listed. ${supported} ` +
|
|
85
|
+
'A `write`-scoped key (or `decide` to answer parked decisions, `admin` to delete) exposes ' +
|
|
86
|
+
'the rest, and whoever gave you this key can mint one.');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
71
89
|
/**
|
|
72
90
|
* The "check with a human first" section, or null when nothing exposed here needs one.
|
|
73
91
|
*
|
package/dist/instructions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,8BAA8B,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAA;AAE9F,8FAA8F;AAC9F,EAAE;AACF,iGAAiG;AACjG,4FAA4F;AAC5F,+FAA+F;AAC/F,gGAAgG;AAChG,2EAA2E;AAE3E;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,SAAwB;IACxD,MAAM,EAAE,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,GAAG,SAAS,CAAA;IAC9F,MAAM,MAAM,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC9D,iGAAiG;IACjG,iFAAiF;IACjF,MAAM,QAAQ,GAAsB;QAClC,6FAA6F;YAC3F,8FAA8F;YAC9F,yFAAyF;QAC3F,2BAA2B,MAAM;aAC9B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,KAAK,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I,CAAC,oCAAoC,CAAC,CAAA;IAClD,CAAC;IACD,+FAA+F;IAC/F,kGAAkG;IAClG,IAAI,CAAC,aAAa,EAAE,gBAAgB,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpD,KAAK,CAAC,IAAI,CACR,sFAAsF;YACpF,yFAAyF;YACzF,yCAAyC,CAC5C,CAAA;IACH,CAAC;IACD,iGAAiG;IACjG,+FAA+F;IAC/F,8FAA8F;IAC9F,0DAA0D;IAC1D,IAAI,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM;QAAE,KAAK,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAA;IAChF,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACxB,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
|
2
2
|
import { type CatFactoryMcpOptions } from './config.ts';
|
|
3
3
|
import { type CatFactoryTool } from './tools.generated.ts';
|
|
4
4
|
/** The npm version, stamped into the SDK's `User-Agent` so a deployment can attribute calls. */
|
|
5
|
-
export declare const MCP_SERVER_VERSION = "0.
|
|
5
|
+
export declare const MCP_SERVER_VERSION = "0.7.0";
|
|
6
6
|
/** The name this server reports to a host. */
|
|
7
7
|
export declare const MCP_SERVER_NAME = "cat-factory";
|
|
8
8
|
export interface CatFactoryMcpServer {
|
package/dist/server.js
CHANGED
|
@@ -19,7 +19,7 @@ import { CAT_FACTORY_TOOLS } from './tools.generated.js';
|
|
|
19
19
|
// has been round-tripped through a second type system, and every gap in that conversion becomes a
|
|
20
20
|
// tool that misdescribes its own input.
|
|
21
21
|
/** The npm version, stamped into the SDK's `User-Agent` so a deployment can attribute calls. */
|
|
22
|
-
export const MCP_SERVER_VERSION = '0.
|
|
22
|
+
export const MCP_SERVER_VERSION = '0.7.0';
|
|
23
23
|
/** The name this server reports to a host. */
|
|
24
24
|
export const MCP_SERVER_NAME = 'cat-factory';
|
|
25
25
|
/**
|
package/dist/stdio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAEvE,OAAO,EAAY,KAAK,WAAW,EAAkB,MAAM,aAAa,CAAA;AAaxE,sDAAsD;AACtD,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,0DAA0D;IAC1D,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5C;AAED,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,
|
|
1
|
+
{"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAA;AAEvE,OAAO,EAAY,KAAK,WAAW,EAAkB,MAAM,aAAa,CAAA;AAaxE,sDAAsD;AACtD,MAAM,WAAW,aAAc,SAAQ,WAAW;IAChD,iDAAiD;IACjD,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IACvC,0DAA0D;IAC1D,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5C;AAED,2EAA2E;AAC3E,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,eAAe,CAAC,CAOnF;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAM5D"}
|
package/dist/stdio.js
CHANGED
|
@@ -9,7 +9,7 @@ import { createCatFactoryMcpServer } from './server.js';
|
|
|
9
9
|
* is the one ordering that produces a log claiming success next to a server that never served.
|
|
10
10
|
*/
|
|
11
11
|
export async function bootStdioServer(deps) {
|
|
12
|
-
const options = optionsFromEnv(deps.env,
|
|
12
|
+
const options = optionsFromEnv(deps.env, { readSecretFile: deps.readSecretFile });
|
|
13
13
|
const { server, tools } = createCatFactoryMcpServer(options);
|
|
14
14
|
const connect = deps.connect ?? ((built) => built.connect(new StdioServerTransport()));
|
|
15
15
|
await connect(server);
|
package/dist/stdio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AAChF,OAAO,EAAE,QAAQ,EAAoB,cAAc,EAAE,MAAM,aAAa,CAAA;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAA;AAiCvD;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAmB;IACvD,MAAM,OAAO,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAA;AACh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