@tokenfactory/acc-mcp-server 0.1.0-internal
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 +66 -0
- package/dist/cli.d.ts +10 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +79 -0
- package/dist/cli.js.map +1 -0
- package/dist/server.d.ts +21 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +60 -0
- package/dist/server.js.map +1 -0
- package/dist/supabase.d.ts +22 -0
- package/dist/supabase.d.ts.map +1 -0
- package/dist/supabase.js +36 -0
- package/dist/supabase.js.map +1 -0
- package/dist/telemetry.d.ts +28 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +51 -0
- package/dist/telemetry.js.map +1 -0
- package/dist/tools.d.ts +21 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +154 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +34 -0
package/README.md
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# @tokenfactory/acc-mcp-server
|
|
2
|
+
|
|
3
|
+
Agent Control Center MCP server. Stdio-transport subprocess spawned by
|
|
4
|
+
`@tokenfactory/acc-runner` alongside each Claude Code session. Exposes
|
|
5
|
+
six read-only ACC tools (`query_tasks`, `query_prs`, `query_cost`,
|
|
6
|
+
`query_decisions`, `query_runners`, `query_approvals`) over the Model
|
|
7
|
+
Context Protocol and telemeters every tool call to `acc.mcp_tool_calls`.
|
|
8
|
+
|
|
9
|
+
## How agents reach it
|
|
10
|
+
|
|
11
|
+
The runner writes a `.mcp.json` into the task working directory before
|
|
12
|
+
spawning Claude Code:
|
|
13
|
+
|
|
14
|
+
```json
|
|
15
|
+
{
|
|
16
|
+
"mcpServers": {
|
|
17
|
+
"acc": {
|
|
18
|
+
"command": "npx",
|
|
19
|
+
"args": [
|
|
20
|
+
"-y", "@tokenfactory/acc-mcp-server",
|
|
21
|
+
"--task-id", "T-12345",
|
|
22
|
+
"--runner-id", "local-priyas-mbp",
|
|
23
|
+
"--access-token", "<runner JWT>"
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Claude Code auto-discovers the server, lists the tools at session
|
|
31
|
+
start, and the agent can call any of the six during a task. Each call
|
|
32
|
+
writes one row to `acc.mcp_tool_calls` (latency, request args, response
|
|
33
|
+
summary) via `POST /api/mcp/record-tool-call` — service-role only, so
|
|
34
|
+
the agent surface cannot fabricate telemetry.
|
|
35
|
+
|
|
36
|
+
## Tool catalog
|
|
37
|
+
|
|
38
|
+
The catalog is a duplicate of `api/chat/_tools.ts` (the Ask-ACC chat
|
|
39
|
+
contract). A parity test in `tests/tools.test.ts` cross-checks the two
|
|
40
|
+
arrays so additions in one place fail CI in the other.
|
|
41
|
+
|
|
42
|
+
## Environment
|
|
43
|
+
|
|
44
|
+
| Var | Notes |
|
|
45
|
+
| --- | --- |
|
|
46
|
+
| `SUPABASE_URL` / `ACC_SUPABASE_URL` | Project URL |
|
|
47
|
+
| `SUPABASE_ANON_KEY` / `ACC_SUPABASE_ANON_KEY` | Anon key for the user-scoped client |
|
|
48
|
+
| `ACC_PUBLIC_URL` | ACC API host. Defaults to `https://acc.techarch.dev`. Overridable via `--public-url`. |
|
|
49
|
+
| `ACC_MCP_ACCESS_TOKEN` | Runner JWT. Overridable via `--access-token` (visible in `ps`). |
|
|
50
|
+
|
|
51
|
+
## Security notes
|
|
52
|
+
|
|
53
|
+
- The runner's JWT is passed as a CLI arg. Visible in `ps` output for
|
|
54
|
+
the subprocess lifetime — acceptable for v0.5-C1 because the runner
|
|
55
|
+
itself owns the process tree, but tracked for v0.6 hardening (env-only
|
|
56
|
+
handoff or token-broker pattern).
|
|
57
|
+
- Telemetry writes go through `POST /api/mcp/record-tool-call`, which
|
|
58
|
+
validates the JWT and uses the service-role to call
|
|
59
|
+
`acc.record_mcp_tool_call`. Direct RPC access is denied.
|
|
60
|
+
|
|
61
|
+
## Versioning
|
|
62
|
+
|
|
63
|
+
Pin `@modelcontextprotocol/sdk` exactly — MCP SDK churns on minor
|
|
64
|
+
releases. Update via the standard checklist in
|
|
65
|
+
`docs/acc/MCP_SERVER.md` (peer-dep cycle, schema-shape diff, parity
|
|
66
|
+
test against the latest Claude Code release).
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAwBA,UAAU,UAAU;IAClB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA0BpD"}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* acc-mcp-server entrypoint.
|
|
4
|
+
*
|
|
5
|
+
* Invoked by Claude Code (which reads .mcp.json from the runner CWD)
|
|
6
|
+
* as a child stdio subprocess. We parse argv + env, build a Supabase
|
|
7
|
+
* user-scoped client, and wire up the MCP Server on a
|
|
8
|
+
* StdioServerTransport.
|
|
9
|
+
*
|
|
10
|
+
* argv contract:
|
|
11
|
+
* --task-id <id> Optional. The ACC task this server is bound to.
|
|
12
|
+
* --runner-id <id> Optional. The runner that spawned us.
|
|
13
|
+
* --access-token <jwt> Optional. Falls back to ACC_MCP_ACCESS_TOKEN.
|
|
14
|
+
* --public-url <url> Optional. Falls back to ACC_PUBLIC_URL.
|
|
15
|
+
*
|
|
16
|
+
* The access token is the runner's user JWT; visible in `ps` output for
|
|
17
|
+
* the subprocess lifetime — see MCP_SERVER.md "Security notes" for the
|
|
18
|
+
* v0.6 hardening plan.
|
|
19
|
+
*/
|
|
20
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
21
|
+
import { buildServer } from "./server.js";
|
|
22
|
+
import { createMcpClient, resolveSupabaseConfig } from "./supabase.js";
|
|
23
|
+
export function parseArgs(argv) {
|
|
24
|
+
const out = {};
|
|
25
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
26
|
+
const k = argv[i];
|
|
27
|
+
if (!k.startsWith("--"))
|
|
28
|
+
continue;
|
|
29
|
+
const key = k.slice(2);
|
|
30
|
+
const v = argv[i + 1];
|
|
31
|
+
if (v === undefined || v.startsWith("--")) {
|
|
32
|
+
out[key] = "";
|
|
33
|
+
}
|
|
34
|
+
else {
|
|
35
|
+
out[key] = v;
|
|
36
|
+
i += 1;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
const accessToken = out["access-token"] || process.env.ACC_MCP_ACCESS_TOKEN || "";
|
|
40
|
+
const publicUrl = out["public-url"] ||
|
|
41
|
+
process.env.ACC_PUBLIC_URL ||
|
|
42
|
+
"https://acc.techarch.dev";
|
|
43
|
+
return {
|
|
44
|
+
taskId: out["task-id"] || null,
|
|
45
|
+
runnerId: out["runner-id"] || null,
|
|
46
|
+
accessToken,
|
|
47
|
+
publicUrl,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
async function main() {
|
|
51
|
+
const args = parseArgs(process.argv.slice(2));
|
|
52
|
+
if (!args.accessToken) {
|
|
53
|
+
process.stderr.write("acc-mcp-server: --access-token (or ACC_MCP_ACCESS_TOKEN) is required\n");
|
|
54
|
+
process.exit(2);
|
|
55
|
+
}
|
|
56
|
+
const ctx = {
|
|
57
|
+
taskId: args.taskId,
|
|
58
|
+
runnerId: args.runnerId,
|
|
59
|
+
publicUrl: args.publicUrl,
|
|
60
|
+
accessToken: args.accessToken,
|
|
61
|
+
};
|
|
62
|
+
const sbCfg = resolveSupabaseConfig(args.accessToken);
|
|
63
|
+
const sb = createMcpClient(sbCfg);
|
|
64
|
+
const server = buildServer(ctx, sb);
|
|
65
|
+
const transport = new StdioServerTransport();
|
|
66
|
+
await server.connect(transport);
|
|
67
|
+
process.stderr.write(`[acc-mcp-server] online (task=${ctx.taskId ?? "-"} runner=${ctx.runnerId ?? "-"})\n`);
|
|
68
|
+
}
|
|
69
|
+
// Only run when executed directly. Importers (tests) get the parse helper
|
|
70
|
+
// and `main` without side effects.
|
|
71
|
+
const isDirectRun = import.meta.url === `file://${process.argv[1]}` ||
|
|
72
|
+
import.meta.url.endsWith(process.argv[1] ?? "");
|
|
73
|
+
if (isDirectRun) {
|
|
74
|
+
main().catch((err) => {
|
|
75
|
+
process.stderr.write(`[acc-mcp-server] fatal: ${err.message ?? String(err)}\n`);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAUvE,MAAM,UAAU,SAAS,CAAC,IAAc;IACtC,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QACxC,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,SAAS;QAClC,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ACF,MAAM,KAAK,GAAG,qBAAqB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,eAAe,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IACpC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,iCAAiC,GAAG,CAAC,MAAM,IAAI,GAAG,WAAW,GAAG,CAAC,QAAQ,IAAI,GAAG,KAAK,CACtF,CAAC;AACJ,CAAC;AAED,0EAA0E;AAC1E,mCAAmC;AACnC,MAAM,WAAW,GACf,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE;IAC/C,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAClD,IAAI,WAAW,EAAE,CAAC;IAChB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE;QAC5B,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,2BAA4B,GAAa,CAAC,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,IAAI,CACrE,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server wiring. Builds an @modelcontextprotocol/sdk Server with
|
|
3
|
+
* two request handlers — tools/list returns our 6-tool catalog;
|
|
4
|
+
* tools/call dispatches to runTool() and telemeters the outcome.
|
|
5
|
+
*
|
|
6
|
+
* Exposed as a factory so tests can drive the protocol surface
|
|
7
|
+
* in-process (StdioServerTransport ↔ Client) without spawning a real
|
|
8
|
+
* subprocess.
|
|
9
|
+
*/
|
|
10
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
11
|
+
import type { SupabaseClient } from "@supabase/supabase-js";
|
|
12
|
+
import { type RecordPayload } from "./telemetry.js";
|
|
13
|
+
import type { ServerContext } from "./types.js";
|
|
14
|
+
export declare const SERVER_NAME = "acc-mcp-server";
|
|
15
|
+
export declare const SERVER_VERSION = "0.1.0";
|
|
16
|
+
export interface BuildServerOptions {
|
|
17
|
+
/** Override the telemetry sink — tests pass an in-memory collector. */
|
|
18
|
+
recordCall?: (ctx: ServerContext, payload: RecordPayload) => Promise<void>;
|
|
19
|
+
}
|
|
20
|
+
export declare function buildServer(ctx: ServerContext, sb: SupabaseClient, opts?: BuildServerOptions): Server;
|
|
21
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAKnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAC5C,eAAO,MAAM,cAAc,UAAU,CAAC;AAEtC,MAAM,WAAW,kBAAkB;IACjC,uEAAuE;IACvE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC5E;AAED,wBAAgB,WAAW,CACzB,GAAG,EAAE,aAAa,EAClB,EAAE,EAAE,cAAc,EAClB,IAAI,GAAE,kBAAuB,GAC5B,MAAM,CAgDR"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP server wiring. Builds an @modelcontextprotocol/sdk Server with
|
|
3
|
+
* two request handlers — tools/list returns our 6-tool catalog;
|
|
4
|
+
* tools/call dispatches to runTool() and telemeters the outcome.
|
|
5
|
+
*
|
|
6
|
+
* Exposed as a factory so tests can drive the protocol surface
|
|
7
|
+
* in-process (StdioServerTransport ↔ Client) without spawning a real
|
|
8
|
+
* subprocess.
|
|
9
|
+
*/
|
|
10
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
11
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
12
|
+
import { TOOLS, runTool } from "./tools.js";
|
|
13
|
+
import { buildResponseSummary, recordToolCall, safeArgsJson, } from "./telemetry.js";
|
|
14
|
+
export const SERVER_NAME = "acc-mcp-server";
|
|
15
|
+
export const SERVER_VERSION = "0.1.0";
|
|
16
|
+
export function buildServer(ctx, sb, opts = {}) {
|
|
17
|
+
const record = opts.recordCall ?? recordToolCall;
|
|
18
|
+
const server = new Server({ name: SERVER_NAME, version: SERVER_VERSION }, { capabilities: { tools: {} } });
|
|
19
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
20
|
+
tools: TOOLS.map((t) => ({
|
|
21
|
+
name: t.name,
|
|
22
|
+
description: t.description,
|
|
23
|
+
inputSchema: t.inputSchema,
|
|
24
|
+
})),
|
|
25
|
+
}));
|
|
26
|
+
server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
27
|
+
const toolName = req.params.name;
|
|
28
|
+
const rawArgs = req.params.arguments ?? {};
|
|
29
|
+
const startMs = Date.now();
|
|
30
|
+
let output;
|
|
31
|
+
let errorMsg = null;
|
|
32
|
+
try {
|
|
33
|
+
output = await runTool(toolName, rawArgs, sb);
|
|
34
|
+
if (output && typeof output === "object" && "error" in output) {
|
|
35
|
+
errorMsg = String(output.error);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
catch (err) {
|
|
39
|
+
errorMsg = err.message ?? "tool_failed";
|
|
40
|
+
output = { error: errorMsg };
|
|
41
|
+
}
|
|
42
|
+
const text = JSON.stringify(output);
|
|
43
|
+
const summary = buildResponseSummary(startMs, output, Buffer.byteLength(text, "utf8"));
|
|
44
|
+
// Fire-and-forget: never block the agent on telemetry.
|
|
45
|
+
void record(ctx, {
|
|
46
|
+
task_id: ctx.taskId,
|
|
47
|
+
runner_id: ctx.runnerId,
|
|
48
|
+
tool_name: toolName,
|
|
49
|
+
request_args: safeArgsJson(rawArgs),
|
|
50
|
+
response_summary: summary,
|
|
51
|
+
error: errorMsg,
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
content: [{ type: "text", text }],
|
|
55
|
+
isError: errorMsg !== null,
|
|
56
|
+
};
|
|
57
|
+
});
|
|
58
|
+
return server;
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,oBAAoB,EACpB,cAAc,EACd,YAAY,GAEb,MAAM,gBAAgB,CAAC;AAGxB,MAAM,CAAC,MAAM,WAAW,GAAG,gBAAgB,CAAC;AAC5C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AAOtC,MAAM,UAAU,WAAW,CACzB,GAAkB,EAClB,EAAkB,EAClB,OAA2B,EAAE;IAE7B,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,IAAI,cAAc,CAAC;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AAC;QACD,MAAM,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACpC,MAAM,OAAO,GAAG,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC;QACvF,uDAAuD;QACvD,KAAK,MAAM,CAAC,GAAG,EAAE;YACf,OAAO,EAAE,GAAG,CAAC,MAAM;YACnB,SAAS,EAAE,GAAG,CAAC,QAAQ;YACvB,SAAS,EAAE,QAAQ;YACnB,YAAY,EAAE,YAAY,CAAC,OAAO,CAAC;YACnC,gBAAgB,EAAE,OAAO;YACzB,KAAK,EAAE,QAAQ;SAChB,CAAC,CAAC;QACH,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;YACjC,OAAO,EAAE,QAAQ,KAAK,IAAI;SAC3B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supabase client factory for the MCP server. The runner forwards its
|
|
3
|
+
* OAuth access token (the same JWT it uses to talk to acc.* RPCs) on
|
|
4
|
+
* the CLI; we feed it to a user-scoped client so RLS sees the right
|
|
5
|
+
* `auth.uid()` and tools only return data the operator is allowed to
|
|
6
|
+
* see.
|
|
7
|
+
*
|
|
8
|
+
* The ACC public URL doubles as the Supabase URL host for the
|
|
9
|
+
* @supabase/supabase-js client *only* when invoked via the API
|
|
10
|
+
* — here we hit Supabase directly so we accept SUPABASE_URL via env
|
|
11
|
+
* as the canonical, with a public-URL fallback that the runner sets
|
|
12
|
+
* when spawning us.
|
|
13
|
+
*/
|
|
14
|
+
import { type SupabaseClient } from "@supabase/supabase-js";
|
|
15
|
+
export interface SupabaseConfig {
|
|
16
|
+
supabaseUrl: string;
|
|
17
|
+
anonKey: string;
|
|
18
|
+
accessToken: string;
|
|
19
|
+
}
|
|
20
|
+
export declare function createMcpClient(cfg: SupabaseConfig): SupabaseClient;
|
|
21
|
+
export declare function resolveSupabaseConfig(accessToken: string): SupabaseConfig;
|
|
22
|
+
//# sourceMappingURL=supabase.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase.d.ts","sourceRoot":"","sources":["../src/supabase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAgB,KAAK,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE1E,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD,wBAAgB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,cAAc,CAMnE;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,GAAG,cAAc,CAYzE"}
|
package/dist/supabase.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supabase client factory for the MCP server. The runner forwards its
|
|
3
|
+
* OAuth access token (the same JWT it uses to talk to acc.* RPCs) on
|
|
4
|
+
* the CLI; we feed it to a user-scoped client so RLS sees the right
|
|
5
|
+
* `auth.uid()` and tools only return data the operator is allowed to
|
|
6
|
+
* see.
|
|
7
|
+
*
|
|
8
|
+
* The ACC public URL doubles as the Supabase URL host for the
|
|
9
|
+
* @supabase/supabase-js client *only* when invoked via the API
|
|
10
|
+
* — here we hit Supabase directly so we accept SUPABASE_URL via env
|
|
11
|
+
* as the canonical, with a public-URL fallback that the runner sets
|
|
12
|
+
* when spawning us.
|
|
13
|
+
*/
|
|
14
|
+
import { createClient } from "@supabase/supabase-js";
|
|
15
|
+
// The MCP server speaks the acc schema. Supabase's generic types model
|
|
16
|
+
// the default schema name in their type parameters, so we cast through
|
|
17
|
+
// `unknown` to land on the canonical SupabaseClient<...> type that the
|
|
18
|
+
// tool impls consume.
|
|
19
|
+
export function createMcpClient(cfg) {
|
|
20
|
+
return createClient(cfg.supabaseUrl, cfg.anonKey, {
|
|
21
|
+
db: { schema: "acc" },
|
|
22
|
+
auth: { persistSession: false, autoRefreshToken: false },
|
|
23
|
+
global: { headers: { Authorization: `Bearer ${cfg.accessToken}` } },
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function resolveSupabaseConfig(accessToken) {
|
|
27
|
+
const supabaseUrl = process.env.SUPABASE_URL ?? process.env.ACC_SUPABASE_URL ?? "";
|
|
28
|
+
const anonKey = process.env.SUPABASE_ANON_KEY ??
|
|
29
|
+
process.env.ACC_SUPABASE_ANON_KEY ??
|
|
30
|
+
"";
|
|
31
|
+
if (!supabaseUrl || !anonKey) {
|
|
32
|
+
throw new Error("acc-mcp-server: SUPABASE_URL and SUPABASE_ANON_KEY (or ACC_SUPABASE_*) must be set");
|
|
33
|
+
}
|
|
34
|
+
return { supabaseUrl, anonKey, accessToken };
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=supabase.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"supabase.js","sourceRoot":"","sources":["../src/supabase.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAuB,MAAM,uBAAuB,CAAC;AAQ1E,uEAAuE;AACvE,uEAAuE;AACvE,uEAAuE;AACvE,sBAAsB;AACtB,MAAM,UAAU,eAAe,CAAC,GAAmB;IACjD,OAAO,YAAY,CAAC,GAAG,CAAC,WAAW,EAAE,GAAG,CAAC,OAAO,EAAE;QAChD,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;QACrB,IAAI,EAAE,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE;QACxD,MAAM,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,UAAU,GAAG,CAAC,WAAW,EAAE,EAAE,EAAE;KACpE,CAA8B,CAAC;AAClC,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,WAAmB;IACvD,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC;IACnF,MAAM,OAAO,GACX,OAAO,CAAC,GAAG,CAAC,iBAAiB;QAC7B,OAAO,CAAC,GAAG,CAAC,qBAAqB;QACjC,EAAE,CAAC;IACL,IAAI,CAAC,WAAW,IAAI,CAAC,OAAO,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CACb,oFAAoF,CACrF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telemetry sink. Every tool call writes one row to acc.mcp_tool_calls.
|
|
3
|
+
*
|
|
4
|
+
* The MCP server runs under the runner's user JWT; the
|
|
5
|
+
* acc.record_mcp_tool_call RPC is service-role only (telemetry must be
|
|
6
|
+
* un-forgeable from the agent surface). So we post through the ACC
|
|
7
|
+
* server: POST {publicUrl}/api/mcp/record-tool-call which forwards the
|
|
8
|
+
* Bearer JWT, validates the user, and inserts via the service-role.
|
|
9
|
+
*
|
|
10
|
+
* The sink is fire-and-forget *for the agent*: a failed telemetry write
|
|
11
|
+
* is logged to stderr but never bubbled to the model, so a transient
|
|
12
|
+
* network blip doesn't poison the agent loop.
|
|
13
|
+
*/
|
|
14
|
+
import type { ResponseSummary, ServerContext } from "./types.js";
|
|
15
|
+
export declare function buildResponseSummary(startMs: number, response: unknown, bytes: number): ResponseSummary;
|
|
16
|
+
export declare function safeArgsJson(args: unknown): unknown;
|
|
17
|
+
export interface RecordPayload {
|
|
18
|
+
task_id: string | null;
|
|
19
|
+
runner_id: string | null;
|
|
20
|
+
tool_name: string;
|
|
21
|
+
request_args: unknown;
|
|
22
|
+
response_summary: ResponseSummary;
|
|
23
|
+
error: string | null;
|
|
24
|
+
}
|
|
25
|
+
type Fetcher = typeof fetch;
|
|
26
|
+
export declare function recordToolCall(ctx: ServerContext, payload: RecordPayload, fetcher?: Fetcher): Promise<void>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=telemetry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetry.d.ts","sourceRoot":"","sources":["../src/telemetry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAIjE,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,OAAO,EACjB,KAAK,EAAE,MAAM,GACZ,eAAe,CAkBjB;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAQnD;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,gBAAgB,EAAE,eAAe,CAAC;IAClC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAED,KAAK,OAAO,GAAG,OAAO,KAAK,CAAC;AAE5B,wBAAsB,cAAc,CAClC,GAAG,EAAE,aAAa,EAClB,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE,OAAe,GACvB,OAAO,CAAC,IAAI,CAAC,CAsBf"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const REQUEST_ARGS_CAP = 4 * 1024;
|
|
2
|
+
export function buildResponseSummary(startMs, response, bytes) {
|
|
3
|
+
const latency_ms = Math.max(0, Math.round(Date.now() - startMs));
|
|
4
|
+
const rowCount = Array.isArray(response)
|
|
5
|
+
? response.length
|
|
6
|
+
: typeof response === "object" && response !== null && Array.isArray(response.rows)
|
|
7
|
+
? (response.rows.length)
|
|
8
|
+
: 0;
|
|
9
|
+
const hasResults = rowCount > 0 ||
|
|
10
|
+
(typeof response === "object" &&
|
|
11
|
+
response !== null &&
|
|
12
|
+
!("error" in response));
|
|
13
|
+
return {
|
|
14
|
+
row_count: rowCount,
|
|
15
|
+
has_results: hasResults,
|
|
16
|
+
response_size_bytes: bytes,
|
|
17
|
+
latency_ms,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export function safeArgsJson(args) {
|
|
21
|
+
try {
|
|
22
|
+
const s = JSON.stringify(args ?? {});
|
|
23
|
+
if (s.length <= REQUEST_ARGS_CAP)
|
|
24
|
+
return args;
|
|
25
|
+
return { _truncated: true, preview: s.slice(0, REQUEST_ARGS_CAP) };
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return { _unserializable: true };
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export async function recordToolCall(ctx, payload, fetcher = fetch) {
|
|
32
|
+
const url = `${ctx.publicUrl.replace(/\/+$/, "")}/api/mcp/record-tool-call`;
|
|
33
|
+
try {
|
|
34
|
+
const res = await fetcher(url, {
|
|
35
|
+
method: "POST",
|
|
36
|
+
headers: {
|
|
37
|
+
"Content-Type": "application/json",
|
|
38
|
+
Authorization: `Bearer ${ctx.accessToken}`,
|
|
39
|
+
},
|
|
40
|
+
body: JSON.stringify(payload),
|
|
41
|
+
});
|
|
42
|
+
if (!res.ok) {
|
|
43
|
+
const body = await res.text().catch(() => "");
|
|
44
|
+
process.stderr.write(`[acc-mcp-server] telemetry POST failed ${res.status}: ${body.slice(0, 200)}\n`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
process.stderr.write(`[acc-mcp-server] telemetry POST threw: ${err.message}\n`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=telemetry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+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;IACrE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC;IACnC,CAAC;AACH,CAAC;AAaD,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,GAAkB,EAClB,OAAsB,EACtB,UAAmB,KAAK;IAExB,MAAM,GAAG,GAAG,GAAG,GAAG,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,2BAA2B,CAAC;IAC5E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,OAAO,CAAC,GAAG,EAAE;YAC7B,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,aAAa,EAAE,UAAU,GAAG,CAAC,WAAW,EAAE;aAC3C;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SAC9B,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;YACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YAC9C,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0CAA0C,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,IAAI,CAChF,CAAC;QACJ,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,0CAA2C,GAAa,CAAC,OAAO,IAAI,CACrE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tool catalog + implementations.
|
|
3
|
+
*
|
|
4
|
+
* MIRROR of api/chat/_tools.ts — that file is the canonical contract
|
|
5
|
+
* (input schema, response shape) for ACC's read-only tools across
|
|
6
|
+
* BOTH the Ask-ACC chat path and the MCP-server-for-agents path.
|
|
7
|
+
*
|
|
8
|
+
* When you add or change a tool here, change api/chat/_tools.ts in the
|
|
9
|
+
* same PR. tests/tools.test.ts cross-checks that the two catalogs are
|
|
10
|
+
* structurally identical and fails CI if they drift.
|
|
11
|
+
*
|
|
12
|
+
* Why duplicate? The MCP server is published as a standalone npm
|
|
13
|
+
* package (workspaces don't survive `npm publish`). The api/_lib path
|
|
14
|
+
* isn't reachable at runtime from `npx -y @tokenfactory/acc-mcp-server`,
|
|
15
|
+
* so we keep two source-of-truth copies and enforce parity via test.
|
|
16
|
+
*/
|
|
17
|
+
import type { SupabaseClient } from "@supabase/supabase-js";
|
|
18
|
+
import type { ToolDef } from "./types.js";
|
|
19
|
+
export declare const TOOLS: ToolDef[];
|
|
20
|
+
export declare function runTool(name: string, rawArgs: unknown, sb: SupabaseClient): Promise<unknown>;
|
|
21
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAQ1C,eAAO,MAAM,KAAK,EAAE,OAAO,EAwD1B,CAAC;AAQF,wBAAsB,OAAO,CAC3B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,OAAO,EAChB,EAAE,EAAE,cAAc,GACjB,OAAO,CAAC,OAAO,CAAC,CAqFlB"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
const obj = (properties, required = []) => ({
|
|
2
|
+
type: "object",
|
|
3
|
+
properties,
|
|
4
|
+
...(required.length ? { required } : {}),
|
|
5
|
+
});
|
|
6
|
+
export const TOOLS = [
|
|
7
|
+
{
|
|
8
|
+
name: "query_tasks",
|
|
9
|
+
description: "List tasks. Filter by status ('queued', 'running', 'blocked', 'needs-review', ...), runner id, ISO since timestamp, and limit.",
|
|
10
|
+
inputSchema: obj({
|
|
11
|
+
status: { type: "string" },
|
|
12
|
+
runner_id: { type: "string" },
|
|
13
|
+
since: { type: "string", description: "ISO-8601 timestamp" },
|
|
14
|
+
limit: { type: "integer", minimum: 1, maximum: 100 },
|
|
15
|
+
}),
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
name: "query_prs",
|
|
19
|
+
description: "List pull requests. Filter by state ('open', 'merged', 'closed', 'draft'), repo (owner/name), or ISO since timestamp.",
|
|
20
|
+
inputSchema: obj({
|
|
21
|
+
state: { type: "string" },
|
|
22
|
+
repo: { type: "string" },
|
|
23
|
+
since: { type: "string" },
|
|
24
|
+
}),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: "query_cost",
|
|
28
|
+
description: "Sum cost in USD cents over a scope. scope='task' requires scope_id; 'user' and 'org' aggregate across cost_events visible to the caller.",
|
|
29
|
+
inputSchema: obj({
|
|
30
|
+
scope: { type: "string", enum: ["task", "user", "org"] },
|
|
31
|
+
scope_id: { type: "string" },
|
|
32
|
+
since: { type: "string" },
|
|
33
|
+
until: { type: "string" },
|
|
34
|
+
}, ["scope"]),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: "query_decisions",
|
|
38
|
+
description: "List decisions. Filter by kind (e.g. 'task-status', 'merge-approval'), actor user id, or ISO since timestamp.",
|
|
39
|
+
inputSchema: obj({
|
|
40
|
+
kind: { type: "string" },
|
|
41
|
+
actor_id: { type: "string" },
|
|
42
|
+
since: { type: "string" },
|
|
43
|
+
}),
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "query_runners",
|
|
47
|
+
description: "List all known runners with current status and last heartbeat.",
|
|
48
|
+
inputSchema: obj({}),
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: "query_approvals",
|
|
52
|
+
description: "List approval requests. Filter by state ('pending', 'approved', 'denied').",
|
|
53
|
+
inputSchema: obj({ state: { type: "string" } }),
|
|
54
|
+
},
|
|
55
|
+
];
|
|
56
|
+
function clampInt(raw, min, max, fallback) {
|
|
57
|
+
const n = typeof raw === "number" ? raw : Number(raw);
|
|
58
|
+
if (!Number.isFinite(n))
|
|
59
|
+
return fallback;
|
|
60
|
+
return Math.max(min, Math.min(max, Math.floor(n)));
|
|
61
|
+
}
|
|
62
|
+
export async function runTool(name, rawArgs, sb) {
|
|
63
|
+
const args = (rawArgs && typeof rawArgs === "object"
|
|
64
|
+
? rawArgs
|
|
65
|
+
: {});
|
|
66
|
+
switch (name) {
|
|
67
|
+
case "query_tasks": {
|
|
68
|
+
let q = sb
|
|
69
|
+
.from("tasks")
|
|
70
|
+
.select("id, title, status, agent_id, runner_id, branch, priority, risk, pr_number, repo, created_at, updated_at")
|
|
71
|
+
.order("updated_at", { ascending: false })
|
|
72
|
+
.limit(clampInt(args.limit, 1, 100, 25));
|
|
73
|
+
if (typeof args.status === "string")
|
|
74
|
+
q = q.eq("status", args.status);
|
|
75
|
+
if (typeof args.runner_id === "string")
|
|
76
|
+
q = q.eq("runner_id", args.runner_id);
|
|
77
|
+
if (typeof args.since === "string")
|
|
78
|
+
q = q.gte("updated_at", args.since);
|
|
79
|
+
const { data, error } = await q;
|
|
80
|
+
return error ? { error: error.message } : (data ?? []);
|
|
81
|
+
}
|
|
82
|
+
case "query_prs": {
|
|
83
|
+
let q = sb
|
|
84
|
+
.from("prs")
|
|
85
|
+
.select("number, title, state, branch, base_branch, ci, typecheck, github_url, task_id, agent_id, created_at, merged_at")
|
|
86
|
+
.order("created_at", { ascending: false })
|
|
87
|
+
.limit(50);
|
|
88
|
+
if (typeof args.state === "string")
|
|
89
|
+
q = q.eq("state", args.state);
|
|
90
|
+
if (typeof args.repo === "string")
|
|
91
|
+
q = q.eq("repo", args.repo);
|
|
92
|
+
if (typeof args.since === "string")
|
|
93
|
+
q = q.gte("created_at", args.since);
|
|
94
|
+
const { data, error } = await q;
|
|
95
|
+
return error ? { error: error.message } : (data ?? []);
|
|
96
|
+
}
|
|
97
|
+
case "query_cost": {
|
|
98
|
+
const scope = String(args.scope ?? "");
|
|
99
|
+
let q = sb.from("cost_events").select("usd_cents, recorded_at, task_id, model");
|
|
100
|
+
if (scope === "task") {
|
|
101
|
+
if (typeof args.scope_id !== "string")
|
|
102
|
+
return { error: "scope_id required for task scope" };
|
|
103
|
+
q = q.eq("task_id", args.scope_id);
|
|
104
|
+
}
|
|
105
|
+
if (typeof args.since === "string")
|
|
106
|
+
q = q.gte("recorded_at", args.since);
|
|
107
|
+
if (typeof args.until === "string")
|
|
108
|
+
q = q.lte("recorded_at", args.until);
|
|
109
|
+
const { data, error } = await q;
|
|
110
|
+
if (error)
|
|
111
|
+
return { error: error.message };
|
|
112
|
+
const rows = (data ?? []);
|
|
113
|
+
const total = rows.reduce((acc, r) => acc + (r.usd_cents ?? 0), 0);
|
|
114
|
+
return { total_usd_cents: total, event_count: rows.length };
|
|
115
|
+
}
|
|
116
|
+
case "query_decisions": {
|
|
117
|
+
let q = sb
|
|
118
|
+
.from("decisions")
|
|
119
|
+
.select("id, kind, text, target, by_user_id, by_agent_id, system_actor, created_at")
|
|
120
|
+
.order("created_at", { ascending: false })
|
|
121
|
+
.limit(50);
|
|
122
|
+
if (typeof args.kind === "string")
|
|
123
|
+
q = q.eq("kind", args.kind);
|
|
124
|
+
if (typeof args.actor_id === "string")
|
|
125
|
+
q = q.eq("by_user_id", args.actor_id);
|
|
126
|
+
if (typeof args.since === "string")
|
|
127
|
+
q = q.gte("created_at", args.since);
|
|
128
|
+
const { data, error } = await q;
|
|
129
|
+
return error ? { error: error.message } : (data ?? []);
|
|
130
|
+
}
|
|
131
|
+
case "query_runners": {
|
|
132
|
+
// MCP server runs with the user's JWT; the "members read runners"
|
|
133
|
+
// RLS policy (0012) grants the full listing without admin escalation.
|
|
134
|
+
const { data, error } = await sb
|
|
135
|
+
.from("runners")
|
|
136
|
+
.select("id, name, owner, status, type, heartbeat_at, last_seen_version, current_task_id")
|
|
137
|
+
.order("status");
|
|
138
|
+
return error ? { error: error.message } : (data ?? []);
|
|
139
|
+
}
|
|
140
|
+
case "query_approvals": {
|
|
141
|
+
let q = sb
|
|
142
|
+
.from("approvals")
|
|
143
|
+
.select("id, kind, severity, title, subtitle, target, state, created_at")
|
|
144
|
+
.order("created_at", { ascending: false })
|
|
145
|
+
.limit(50);
|
|
146
|
+
if (typeof args.state === "string")
|
|
147
|
+
q = q.eq("state", args.state);
|
|
148
|
+
const { data, error } = await q;
|
|
149
|
+
return error ? { error: error.message } : (data ?? []);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
return { error: `unknown_tool: ${name}` };
|
|
153
|
+
}
|
|
154
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAmBA,MAAM,GAAG,GAAG,CAAC,UAAmC,EAAE,WAAqB,EAAE,EAAE,EAAE,CAAC,CAAC;IAC7E,IAAI,EAAE,QAAQ;IACd,UAAU;IACV,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;CACzC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,KAAK,GAAc;IAC9B;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EACT,gIAAgI;QAClI,WAAW,EAAE,GAAG,CAAC;YACf,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC1B,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC7B,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,oBAAoB,EAAE;YAC5D,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,GAAG,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AC,YAAY,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;iBACzC,KAAK,CAAC,EAAE,CAAC,CAAC;YACb,IAAI,OAAO,IAAI,CAAC,KAAK,KAAK,QAAQ;gBAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YAClE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC,CAAC;YAChC,OAAO,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACzD,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,iBAAiB,IAAI,EAAE,EAAE,CAAC;AAC5C,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for the acc-mcp-server package.
|
|
3
|
+
*
|
|
4
|
+
* The CLI populates a `ServerContext` from argv + env and threads it
|
|
5
|
+
* through to every tool handler so each call can telemeter the right
|
|
6
|
+
* (task_id, runner_id, user_id) tuple.
|
|
7
|
+
*/
|
|
8
|
+
export interface ServerContext {
|
|
9
|
+
taskId: string | null;
|
|
10
|
+
runnerId: string | null;
|
|
11
|
+
publicUrl: string;
|
|
12
|
+
accessToken: string;
|
|
13
|
+
}
|
|
14
|
+
export type ToolName = "query_tasks" | "query_prs" | "query_cost" | "query_decisions" | "query_runners" | "query_approvals";
|
|
15
|
+
export interface ToolDef {
|
|
16
|
+
name: ToolName;
|
|
17
|
+
description: string;
|
|
18
|
+
inputSchema: Record<string, unknown>;
|
|
19
|
+
}
|
|
20
|
+
export interface ResponseSummary {
|
|
21
|
+
row_count: number;
|
|
22
|
+
has_results: boolean;
|
|
23
|
+
response_size_bytes: number;
|
|
24
|
+
latency_ms: number;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,MAAM,QAAQ,GAChB,aAAa,GACb,WAAW,GACX,YAAY,GACZ,iBAAiB,GACjB,eAAe,GACf,iBAAiB,CAAC;AAEtB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,OAAO,CAAC;IACrB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@tokenfactory/acc-mcp-server",
|
|
3
|
+
"version": "0.1.0-internal",
|
|
4
|
+
"description": "Agent Control Center MCP server. Stdio-transport subprocess spawned by acc-runner alongside Claude Code; exposes read-only ACC tools and telemeters every call to acc.mcp_tool_calls.",
|
|
5
|
+
"license": "UNLICENSED",
|
|
6
|
+
"private": false,
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"acc-mcp-server": "./dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md"
|
|
14
|
+
],
|
|
15
|
+
"engines": {
|
|
16
|
+
"node": ">=20.6.0"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc -p tsconfig.build.json",
|
|
20
|
+
"typecheck": "tsc --noEmit",
|
|
21
|
+
"lint": "eslint .",
|
|
22
|
+
"test": "vitest run"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@modelcontextprotocol/sdk": "1.29.0",
|
|
26
|
+
"@supabase/supabase-js": "^2.105.3",
|
|
27
|
+
"zod": "^3.25.28"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^25.6.0",
|
|
31
|
+
"typescript": "^5.6.3",
|
|
32
|
+
"vitest": "^1.6.1"
|
|
33
|
+
}
|
|
34
|
+
}
|