@clearedby/mcp 0.0.1 → 0.0.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.js CHANGED
@@ -17,13 +17,19 @@ async function main() {
17
17
  }
18
18
  const cb = new ClearedBy({ apiKey, baseUrl: process.env.CLEAREDBY_BASE_URL });
19
19
  const server = new McpServer({ name: 'clearedby', version: '0.0.1' });
20
- server.tool('request_clearance', 'Gate a consequential action before doing it. Returns whether it is cleared (safe to proceed), rejected (do NOT proceed), or — if held for a human — waits up to 10 minutes for a decision.', {
20
+ server.tool('request_clearance', 'Gate a consequential action before doing it. Returns whether it is cleared (safe to proceed), rejected (do NOT proceed), or — if held for a human — waits up to 10 minutes for a decision. Pass model + confidence + reason so the reviewer sees a real proof case, not placeholders.', {
21
21
  action: z.string().describe('e.g. refund.create, ad.launch'),
22
22
  params: z.record(z.unknown()).optional().describe('the action parameters, e.g. { amount: 250 }'),
23
23
  policy: z.string().optional(),
24
24
  summary: z.string().optional().describe('one-line human summary for the reviewer'),
25
+ model: z.string().optional().describe('the model proposing this action, e.g. claude-opus-4-8'),
26
+ confidence: z.number().min(0).max(1).optional().describe('your confidence this should be cleared, 0..1'),
27
+ reason: z.string().optional().describe('why this should be cleared — your justification/evidence'),
25
28
  }, async (args) => {
26
- const r = await requestClearance(cb, args);
29
+ // agent_id from the connecting MCP client (e.g. "claude-code") so the
30
+ // provenance record shows the real agent rather than the 'agent' default.
31
+ const agentId = server.server.getClientVersion()?.name;
32
+ const r = await requestClearance(cb, { ...args, agentId });
27
33
  return { content: [{ type: 'text', text: r.text }], isError: r.isError, structuredContent: r.structured };
28
34
  });
29
35
  server.tool('check_policy', 'Dry-run: preview what the policy WOULD decide for an action, without recording anything.', {
package/dist/tools.d.ts CHANGED
@@ -10,6 +10,10 @@ export declare function requestClearance(cb: ClearedBy, args: {
10
10
  params?: Record<string, unknown>;
11
11
  policy?: string;
12
12
  summary?: string;
13
+ agentId?: string;
14
+ model?: string;
15
+ confidence?: number;
16
+ reason?: string;
13
17
  }): Promise<ToolResult>;
14
18
  /** check_policy: dry-run — what would the policy do, with nothing persisted. */
15
19
  export declare function checkPolicy(cb: ClearedBy, args: {
package/dist/tools.js CHANGED
@@ -6,11 +6,27 @@ const hash8 = (h) => (h ? ` · attestation ${h.slice(0, 8)}` : '');
6
6
  /** request_clearance: gate the action; if held, wait for a human (≤10 min). */
7
7
  export async function requestClearance(cb, args) {
8
8
  try {
9
+ // Real provenance + proof case so the review card shows who proposed this,
10
+ // on what model, with what confidence — not the 'agent'/'—'/'90%' defaults.
11
+ const proof = {};
12
+ if (typeof args.confidence === 'number')
13
+ proof.confidence = args.confidence;
14
+ if (args.reason)
15
+ proof.reason = args.reason;
16
+ const context = {};
17
+ if (args.summary)
18
+ context.summary = args.summary;
19
+ if (args.agentId)
20
+ context.agent_id = args.agentId;
21
+ if (args.model)
22
+ context.model = args.model;
23
+ if (Object.keys(proof).length > 0)
24
+ context.proof = proof;
9
25
  const r = await cb.gate({
10
26
  action: args.action,
11
27
  params: args.params ?? {},
12
28
  ...(args.policy ? { policy: args.policy } : {}),
13
- ...(args.summary ? { context: { summary: args.summary } } : {}),
29
+ ...(Object.keys(context).length > 0 ? { context } : {}),
14
30
  });
15
31
  if (r.shadow) {
16
32
  return { text: `Shadow mode — not blocking. Would have been: ${r.would?.verdict ?? 'n/a'}.`, structured: { cleared: true, shadow: true, result: r } };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clearedby/mcp",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "ClearedBy MCP server — request_clearance, check_policy, get_ledger from any MCP client.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://clearedby.com",