@scp-dev/mcp 0.1.1 → 0.1.2
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/dist/index.d.ts +3 -1
- package/dist/index.js +3 -3
- package/package.json +2 -2
- package/src/server.ts +8 -5
package/dist/index.d.ts
CHANGED
|
@@ -15,8 +15,10 @@ interface RelayMcpOptions {
|
|
|
15
15
|
output: (line: string) => void;
|
|
16
16
|
/** HOME shortens cwds in relay_list */
|
|
17
17
|
env?: Record<string, string | undefined>;
|
|
18
|
-
/** push deliveries as `notifications/claude/channel` */
|
|
18
|
+
/** push deliveries as `notifications/claude/channel` to a client that declares `claude/channel` or was launched with channels */
|
|
19
19
|
channels?: boolean;
|
|
20
|
+
/** the client was started with channels loaded (Claude Code does not declare the capability itself) */
|
|
21
|
+
launchedWithChannels?: boolean;
|
|
20
22
|
version?: string;
|
|
21
23
|
/** starts a worker for relay_spawn, resolving with its name and its runner's pid once its harness started; without it there is no relay_spawn */
|
|
22
24
|
spawn?: (request: SpawnRequest) => Promise<{
|
package/dist/index.js
CHANGED
|
@@ -336,6 +336,7 @@ function isDirectory(path) {
|
|
|
336
336
|
return false;
|
|
337
337
|
}
|
|
338
338
|
}
|
|
339
|
+
var capped = (wait) => typeof wait === "number" && wait > LIMITS.waitMaxS;
|
|
339
340
|
function seconds(args, fallback) {
|
|
340
341
|
const value = args.wait_s;
|
|
341
342
|
if (value === void 0) return fallback;
|
|
@@ -581,7 +582,7 @@ async function runRelayMcp(options) {
|
|
|
581
582
|
case "relay_inbox": {
|
|
582
583
|
const ack = bool(args, "ack") ?? true;
|
|
583
584
|
const { messages } = await call("inbox", { wait_s: seconds(args, 0) });
|
|
584
|
-
if (!messages.length) return text(
|
|
585
|
+
if (!messages.length) return text(`no unread messages${capped(args.wait_s) ? `; waited ${LIMITS.waitMaxS} s (cap)` : ""}`);
|
|
585
586
|
for (const message of messages) remember(message);
|
|
586
587
|
if (ack) await call("ack", { seqs: messages.map((m) => m.seq) });
|
|
587
588
|
return text(delivered(messages));
|
|
@@ -766,9 +767,8 @@ ${wrapMessage(message)}`,
|
|
|
766
767
|
const protocolVersion = typeof asked === "string" && MCP_PROTOCOLS.includes(asked) ? asked : MCP_PROTOCOLS[0];
|
|
767
768
|
initialized = true;
|
|
768
769
|
const capabilities = params.capabilities;
|
|
769
|
-
const client2 = params.clientInfo;
|
|
770
770
|
const channel = capabilities?.experimental?.["claude/channel"];
|
|
771
|
-
channelClient = typeof channel === "object" && channel !== null ||
|
|
771
|
+
channelClient = typeof channel === "object" && channel !== null || options.launchedWithChannels === true;
|
|
772
772
|
return respond({
|
|
773
773
|
protocolVersion,
|
|
774
774
|
capabilities: { tools: {}, ...options.channels ? { experimental: { "claude/channel": {} } } : {} },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scp-dev/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "The SCP stdio MCP server: gives an agent session the relay's tools.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"homepage": "https://scp.dev",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"typecheck": "tsc -p ."
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@scp-dev/broker": "0.1.
|
|
32
|
+
"@scp-dev/broker": "0.1.2",
|
|
33
33
|
"@scp-dev/core": "0.1.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
package/src/server.ts
CHANGED
|
@@ -59,8 +59,10 @@ export interface RelayMcpOptions {
|
|
|
59
59
|
output: (line: string) => void
|
|
60
60
|
/** HOME shortens cwds in relay_list */
|
|
61
61
|
env?: Record<string, string | undefined>
|
|
62
|
-
/** push deliveries as `notifications/claude/channel` */
|
|
62
|
+
/** push deliveries as `notifications/claude/channel` to a client that declares `claude/channel` or was launched with channels */
|
|
63
63
|
channels?: boolean
|
|
64
|
+
/** the client was started with channels loaded (Claude Code does not declare the capability itself) */
|
|
65
|
+
launchedWithChannels?: boolean
|
|
64
66
|
version?: string
|
|
65
67
|
/** starts a worker for relay_spawn, resolving with its name and its runner's pid once its harness started; without it there is no relay_spawn */
|
|
66
68
|
spawn?: (request: SpawnRequest) => Promise<{ name: string; pid: number }>
|
|
@@ -443,6 +445,8 @@ function isDirectory(path: string): boolean {
|
|
|
443
445
|
}
|
|
444
446
|
}
|
|
445
447
|
|
|
448
|
+
const capped = (wait: unknown): boolean => typeof wait === "number" && wait > LIMITS.waitMaxS
|
|
449
|
+
|
|
446
450
|
function seconds(args: Json, fallback: number): number {
|
|
447
451
|
const value = args.wait_s
|
|
448
452
|
if (value === undefined) return fallback
|
|
@@ -502,7 +506,7 @@ export async function runRelayMcp(options: RelayMcpOptions): Promise<void> {
|
|
|
502
506
|
let me: EndpointView | null = null
|
|
503
507
|
let announced = false
|
|
504
508
|
let initialized = false
|
|
505
|
-
/** whether the client takes channel notifications: it says so, or it
|
|
509
|
+
/** whether the client takes channel notifications: it says so, or it was launched with channels (Claude Code does not say so itself) */
|
|
506
510
|
let channelClient = false
|
|
507
511
|
let stopped = false
|
|
508
512
|
/** seqs this shim pushed, so a push whose confirm was lost is not pushed again */
|
|
@@ -717,7 +721,7 @@ export async function runRelayMcp(options: RelayMcpOptions): Promise<void> {
|
|
|
717
721
|
case "relay_inbox": {
|
|
718
722
|
const ack = bool(args, "ack") ?? true
|
|
719
723
|
const { messages } = await call<{ messages: Envelope[] }>("inbox", { wait_s: seconds(args, 0) })
|
|
720
|
-
if (!messages.length) return text(
|
|
724
|
+
if (!messages.length) return text(`no unread messages${capped(args.wait_s) ? `; waited ${LIMITS.waitMaxS} s (cap)` : ""}`)
|
|
721
725
|
for (const message of messages) remember(message)
|
|
722
726
|
if (ack) await call("ack", { seqs: messages.map((m) => m.seq) })
|
|
723
727
|
return text(delivered(messages))
|
|
@@ -903,9 +907,8 @@ export async function runRelayMcp(options: RelayMcpOptions): Promise<void> {
|
|
|
903
907
|
const protocolVersion = typeof asked === "string" && (MCP_PROTOCOLS as readonly string[]).includes(asked) ? asked : MCP_PROTOCOLS[0]
|
|
904
908
|
initialized = true
|
|
905
909
|
const capabilities = params.capabilities as { experimental?: Record<string, unknown> } | undefined
|
|
906
|
-
const client = params.clientInfo as { name?: unknown } | undefined
|
|
907
910
|
const channel = capabilities?.experimental?.["claude/channel"]
|
|
908
|
-
channelClient = (typeof channel === "object" && channel !== null) ||
|
|
911
|
+
channelClient = (typeof channel === "object" && channel !== null) || options.launchedWithChannels === true
|
|
909
912
|
return respond({
|
|
910
913
|
protocolVersion,
|
|
911
914
|
capabilities: { tools: {}, ...(options.channels ? { experimental: { "claude/channel": {} } } : {}) },
|