@luveo-tech/vark-mcp 0.1.1 → 0.2.0-beta.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/bridge.d.ts CHANGED
@@ -12,6 +12,12 @@
12
12
  * - a CTP signature so the descriptor can be sent to the model in far fewer
13
13
  * tokens than the original JSON Schema.
14
14
  *
15
+ * Every wrapped tool pins a SHA-256 hash of `{ name, description,
16
+ * inputSchema }`. The pin is enforced two ways: `check()`/`execute()`
17
+ * detect in-place mutation of the captured descriptor, and
18
+ * `reconcile()` detects a server that re-lists a *changed* descriptor
19
+ * (schema rug pull) — see {@link VarkMCPAdapter.reconcile}.
20
+ *
15
21
  * ```ts
16
22
  * const adapter = new VarkMCPAdapter({ executor: async (tool, args) => client.callTool(tool.name, args) });
17
23
  * const tools = adapter.wrapTools(mcpTools, { network: { allowedHosts: ['api.example.com'] } });
@@ -24,18 +30,25 @@ import type { CapabilityConfig, CompressionReport, ExecutionOptions, ExecutionCo
24
30
  export interface MCPToolLike {
25
31
  name: string;
26
32
  description?: string;
27
- inputSchema?: Record<string, any>;
33
+ inputSchema?: Record<string, unknown>;
28
34
  /** OpenAI-style alias for `inputSchema`. */
29
- schema?: Record<string, any>;
35
+ schema?: Record<string, unknown>;
30
36
  [key: string]: unknown;
31
37
  }
32
38
  /** Performs the real `tools/call` round trip against the MCP server. */
33
- export type MCPExecutor = (tool: MCPToolLike, args: any, context: ExecutionContext) => Promise<unknown>;
39
+ export type MCPExecutor = (tool: MCPToolLike, args: Record<string, unknown>, context: ExecutionContext) => Promise<unknown>;
34
40
  /** A raw MCP tool after vark has wrapped it. */
35
41
  export interface WrappedMCPTool {
36
42
  name: string;
37
43
  description: string;
38
- inputSchema: Record<string, any>;
44
+ inputSchema: Record<string, unknown>;
45
+ /**
46
+ * SHA-256 pin of `{ name, description, inputSchema }` taken at wrap time.
47
+ * Every `check()`/`execute()` recomputes it — a mismatch means the
48
+ * descriptor was mutated after wrapping (MCP rug pull) and the call is
49
+ * refused with `DESCRIPTOR_PIN_VIOLATION`.
50
+ */
51
+ descriptorHash: string;
39
52
  /** Effective grants (defaults merged with the per-wrap defaults). */
40
53
  capabilities: CapabilityConfig;
41
54
  /** CTP signature for this tool. */
@@ -47,6 +60,8 @@ export interface WrappedMCPTool {
47
60
  /** Guarded execution — runs the payload through vark, then the MCP server. */
48
61
  execute: (args?: unknown, options?: ExecutionOptions) => Promise<ToolExecutionResult>;
49
62
  }
63
+ /** Canonical descriptor fingerprint for rug-pull detection. */
64
+ export declare function hashDescriptor(tool: Pick<MCPToolLike, 'name' | 'description' | 'inputSchema' | 'schema'>): string;
50
65
  export interface VarkMCPAdapterOptions {
51
66
  config?: VarkConfig;
52
67
  executor?: MCPExecutor;
@@ -69,15 +84,34 @@ export declare class VarkMCPAdapter {
69
84
  * @param defaultCapabilities grants applied to every wrapped tool
70
85
  * @param executor per-call override for the MCP server round trip
71
86
  */
72
- wrapTools(mcpTools: any[], defaultCapabilities?: CapabilityConfig, executor?: MCPExecutor): WrappedMCPTool[];
87
+ wrapTools(mcpTools: unknown[], defaultCapabilities?: CapabilityConfig, executor?: MCPExecutor): WrappedMCPTool[];
73
88
  get(name: string): WrappedMCPTool | undefined;
74
89
  list(): WrappedMCPTool[];
90
+ /**
91
+ * Verify a freshly fetched `tools/list` against the wrap-time pins.
92
+ *
93
+ * The in-place pin check inside `check()`/`execute()` only sees mutations
94
+ * of the descriptor object captured at wrap time; a server that returns
95
+ * *new* objects on its next listing (the real schema rug pull) is only
96
+ * visible when the host feeds that listing back in. Call `reconcile()`
97
+ * whenever the server re-lists (`notifications/list_changed`, reconnects,
98
+ * polling): any wrapped tool whose `{ name, description, inputSchema }`
99
+ * no longer matches its pin is **permanently refused** with
100
+ * `DESCRIPTOR_PIN_VIOLATION` (audited once) until `clear()` and a fresh
101
+ * `wrapTools()` re-establish trust.
102
+ *
103
+ * @returns descriptors that failed verification — empty array = all pinned
104
+ */
105
+ reconcile(descriptors: unknown): Array<{
106
+ name: string;
107
+ reason: string;
108
+ }>;
75
109
  /** Payload-only inspection (circuit breaker) for a raw argument object. */
76
110
  inspect(args: unknown): InspectionResult;
77
- /** Unwrap every tool registered through this adapter. */
111
+ /** Unwrap every tool registered through this adapter (also clears recorded pin violations). */
78
112
  clear(): void;
79
113
  }
80
114
  /** Functional shorthand for `new VarkMCPAdapter(options).wrapTools(...)`. */
81
- export declare function wrapMCPTools(mcpTools: any[], defaultCapabilities?: CapabilityConfig, options?: VarkMCPAdapterOptions): WrappedMCPTool[];
115
+ export declare function wrapMCPTools(mcpTools: unknown[], defaultCapabilities?: CapabilityConfig, options?: VarkMCPAdapterOptions): WrappedMCPTool[];
82
116
  export type { CompressionReport, ExecutionOptions, ExecutionContext, GuardResult, InspectionResult };
83
117
  //# sourceMappingURL=bridge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.d.ts","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EACV,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACX,MAAM,kBAAkB,CAAC;AAG1B,qEAAqE;AACrE,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAClC,4CAA4C;IAC5C,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,wEAAwE;AACxE,MAAM,MAAM,WAAW,GAAG,CACxB,IAAI,EAAE,WAAW,EACjB,IAAI,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,CAAC;IAmBxE,2EAA2E;IAC3E,OAAO,CAAC,IAAI,EAAE,OAAO,GAAG,gBAAgB;IAIxC,+FAA+F;IAC/F,KAAK,IAAI,IAAI;CAKd;AAED,6EAA6E;AAC7E,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,OAAO,EAAE,EACnB,mBAAmB,CAAC,EAAE,gBAAgB,EACtC,OAAO,GAAE,qBAA0B,GAClC,cAAc,EAAE,CAElB;AAED,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,CAAC"}
package/dist/bridge.js CHANGED
@@ -12,6 +12,12 @@
12
12
  * - a CTP signature so the descriptor can be sent to the model in far fewer
13
13
  * tokens than the original JSON Schema.
14
14
  *
15
+ * Every wrapped tool pins a SHA-256 hash of `{ name, description,
16
+ * inputSchema }`. The pin is enforced two ways: `check()`/`execute()`
17
+ * detect in-place mutation of the captured descriptor, and
18
+ * `reconcile()` detects a server that re-lists a *changed* descriptor
19
+ * (schema rug pull) — see {@link VarkMCPAdapter.reconcile}.
20
+ *
15
21
  * ```ts
16
22
  * const adapter = new VarkMCPAdapter({ executor: async (tool, args) => client.callTool(tool.name, args) });
17
23
  * const tools = adapter.wrapTools(mcpTools, { network: { allowedHosts: ['api.example.com'] } });
@@ -19,7 +25,32 @@
19
25
  * ```
20
26
  */
21
27
  import { VarkRuntime } from '@luveo-tech/vark';
22
- import { VarkError } from '@luveo-tech/vark';
28
+ import { createHash } from 'node:crypto';
29
+ import { VarkError, stableStringify, DEFAULT_SESSION } from '@luveo-tech/vark';
30
+ /** Canonical descriptor fingerprint for rug-pull detection. */
31
+ export function hashDescriptor(tool) {
32
+ const canonical = stableStringify({
33
+ name: tool.name,
34
+ description: tool.description ?? '',
35
+ inputSchema: tool.inputSchema ?? tool.schema ?? {},
36
+ });
37
+ return createHash('sha256').update(canonical).digest('hex');
38
+ }
39
+ /**
40
+ * Recompute the live descriptor hash and compare it to the wrap-time pin.
41
+ * Returns a refusal when the server (or anyone holding the original object)
42
+ * mutated the descriptor after wrapping.
43
+ */
44
+ function checkDescriptorPin(entry, live) {
45
+ if (hashDescriptor(live) === entry.descriptorHash)
46
+ return undefined;
47
+ return {
48
+ safe: false,
49
+ blockedBy: 'DESCRIPTOR_PIN_VIOLATION',
50
+ reason: `MCP descriptor for "${entry.name}" changed since wrap ` +
51
+ `(pinned ${entry.descriptorHash.slice(0, 12)}…) — possible rug pull, refusing`,
52
+ };
53
+ }
23
54
  function normalizeTool(raw) {
24
55
  if (!raw || typeof raw !== 'object')
25
56
  throw new TypeError('MCP tool descriptor must be an object');
@@ -34,10 +65,33 @@ export class VarkMCPAdapter {
34
65
  runtime;
35
66
  #executor;
36
67
  #tools = new Map();
68
+ /** Recorded pin violations from `reconcile()` — permanent until re-wrap. */
69
+ #violations = new Map();
37
70
  constructor(options = {}) {
38
71
  this.runtime = options.runtime ?? new VarkRuntime(options.config ?? {});
39
72
  this.#executor = options.executor;
40
73
  }
74
+ /** Audit a pin refusal and build the failed execution result. */
75
+ #refuse(entry, reason, args, options) {
76
+ const sessionId = options?.sessionId ?? this.runtime.session ?? DEFAULT_SESSION;
77
+ // Audited here because the guard pipeline is never reached.
78
+ this.runtime.audit.append({
79
+ sessionId,
80
+ tool: entry.name,
81
+ decision: 'DESCRIPTOR_PIN_VIOLATION',
82
+ blockedBy: 'DESCRIPTOR_PIN_VIOLATION',
83
+ reason,
84
+ sanitizedInputs: args,
85
+ executionTimeMs: 0,
86
+ });
87
+ return {
88
+ success: false,
89
+ blockedBy: 'DESCRIPTOR_PIN_VIOLATION',
90
+ error: reason,
91
+ executionTimeMs: 0,
92
+ sessionId,
93
+ };
94
+ }
41
95
  /**
42
96
  * Wrap raw Anthropic MCP tools with vark protection.
43
97
  *
@@ -71,11 +125,29 @@ export class VarkMCPAdapter {
71
125
  name: tool.name,
72
126
  description: tool.description ?? '',
73
127
  inputSchema,
128
+ descriptorHash: hashDescriptor(tool),
74
129
  capabilities: guard.capabilities,
75
130
  compact: guard.compact,
76
131
  compression: guard.compression,
77
- check: (args, options) => this.runtime.check(tool.name, args, options),
78
- execute: (args, options) => guard.execute(args, options),
132
+ check: (args, options) => {
133
+ const recorded = this.#violations.get(entry.name);
134
+ if (recorded) {
135
+ return { safe: false, blockedBy: 'DESCRIPTOR_PIN_VIOLATION', reason: recorded };
136
+ }
137
+ const pin = checkDescriptorPin(entry, tool);
138
+ if (pin)
139
+ return pin;
140
+ return this.runtime.check(tool.name, args, options);
141
+ },
142
+ execute: async (args, options) => {
143
+ const recorded = this.#violations.get(entry.name);
144
+ if (recorded)
145
+ return this.#refuse(entry, recorded, args, options);
146
+ const pin = checkDescriptorPin(entry, tool);
147
+ if (pin)
148
+ return this.#refuse(entry, pin.reason ?? 'MCP descriptor changed since wrap', args, options);
149
+ return guard.execute(args, options);
150
+ },
79
151
  };
80
152
  this.#tools.set(entry.name, entry);
81
153
  wrapped.push(entry);
@@ -88,15 +160,53 @@ export class VarkMCPAdapter {
88
160
  list() {
89
161
  return [...this.#tools.values()];
90
162
  }
163
+ /**
164
+ * Verify a freshly fetched `tools/list` against the wrap-time pins.
165
+ *
166
+ * The in-place pin check inside `check()`/`execute()` only sees mutations
167
+ * of the descriptor object captured at wrap time; a server that returns
168
+ * *new* objects on its next listing (the real schema rug pull) is only
169
+ * visible when the host feeds that listing back in. Call `reconcile()`
170
+ * whenever the server re-lists (`notifications/list_changed`, reconnects,
171
+ * polling): any wrapped tool whose `{ name, description, inputSchema }`
172
+ * no longer matches its pin is **permanently refused** with
173
+ * `DESCRIPTOR_PIN_VIOLATION` (audited once) until `clear()` and a fresh
174
+ * `wrapTools()` re-establish trust.
175
+ *
176
+ * @returns descriptors that failed verification — empty array = all pinned
177
+ */
178
+ reconcile(descriptors) {
179
+ const failures = [];
180
+ for (const raw of Array.isArray(descriptors) ? descriptors : []) {
181
+ if (!raw || typeof raw !== 'object')
182
+ continue;
183
+ const live = raw;
184
+ if (typeof live.name !== 'string')
185
+ continue;
186
+ const entry = this.#tools.get(live.name);
187
+ if (!entry)
188
+ continue; // not wrapped through this adapter
189
+ if (this.#violations.has(entry.name))
190
+ continue; // already refused — audited once
191
+ const verdict = checkDescriptorPin(entry, live);
192
+ if (verdict?.reason) {
193
+ this.#violations.set(entry.name, verdict.reason);
194
+ failures.push({ name: entry.name, reason: verdict.reason });
195
+ this.#refuse(entry, verdict.reason, raw);
196
+ }
197
+ }
198
+ return failures;
199
+ }
91
200
  /** Payload-only inspection (circuit breaker) for a raw argument object. */
92
201
  inspect(args) {
93
202
  return this.runtime.inspect(args);
94
203
  }
95
- /** Unwrap every tool registered through this adapter. */
204
+ /** Unwrap every tool registered through this adapter (also clears recorded pin violations). */
96
205
  clear() {
97
206
  for (const name of this.#tools.keys())
98
207
  this.runtime.unregister(name);
99
208
  this.#tools.clear();
209
+ this.#violations.clear();
100
210
  }
101
211
  }
102
212
  /** Functional shorthand for `new VarkMCPAdapter(options).wrapTools(...)`. */
@@ -1 +1 @@
1
- {"version":3,"file":"bridge.js","sourceRoot":"","sources":["../src/bridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAW/C,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AA+C7C,SAAS,aAAa,CAAC,GAAY;IACjC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;IAClG,MAAM,IAAI,GAAG,GAAkB,CAAC;IAChC,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACnE,IAAI,CAAC,IAAI;QAAE,MAAM,IAAI,SAAS,CAAC,uCAAuC,CAAC,CAAC;IACxE,OAAO,IAAI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AI,cAAc,CAAC,OAAO,CAAC,CAAC,SAAS,CAAC,QAAQ,EAAE,mBAAmB,CAAC,CAAC;AAC9E,CAAC"}
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  * `@luveo-tech/vark-mcp` — zero-rewrite bridge between Anthropic Model Context
3
3
  * Protocol tool descriptors and the vark guard pipeline.
4
4
  */
5
- export { VarkMCPAdapter, wrapMCPTools } from './bridge.js';
5
+ export { VarkMCPAdapter, wrapMCPTools, hashDescriptor } from './bridge.js';
6
6
  export type { MCPExecutor, MCPToolLike, VarkMCPAdapterOptions, WrappedMCPTool, } from './bridge.js';
7
7
  export type { ExecutionOptions } from './bridge.js';
8
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3D,YAAY,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC3E,YAAY,EACV,WAAW,EACX,WAAW,EACX,qBAAqB,EACrB,cAAc,GACf,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC"}
package/dist/index.js CHANGED
@@ -2,5 +2,5 @@
2
2
  * `@luveo-tech/vark-mcp` — zero-rewrite bridge between Anthropic Model Context
3
3
  * Protocol tool descriptors and the vark guard pipeline.
4
4
  */
5
- export { VarkMCPAdapter, wrapMCPTools } from './bridge.js';
5
+ export { VarkMCPAdapter, wrapMCPTools, hashDescriptor } from './bridge.js';
6
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,19 @@
1
1
  {
2
2
  "name": "@luveo-tech/vark-mcp",
3
- "version": "0.1.1",
4
- "description": "Zero-rewrite bridge that wraps Anthropic Model Context Protocol (MCP) tools with vark protection.",
3
+ "version": "0.2.0-beta.2",
4
+ "description": "MCP adapter for @luveo-tech/vark — wrap Anthropic Model Context Protocol tools with vark's zero-trust security gates (no rewrites).",
5
+ "keywords": [
6
+ "vark",
7
+ "mcp",
8
+ "model-context-protocol",
9
+ "anthropic",
10
+ "ai-agents",
11
+ "llm-security",
12
+ "agent-security",
13
+ "tool-calls",
14
+ "security",
15
+ "zero-trust"
16
+ ],
5
17
  "type": "module",
6
18
  "license": "MIT",
7
19
  "main": "./dist/index.js",
@@ -17,7 +29,7 @@
17
29
  ],
18
30
  "sideEffects": false,
19
31
  "dependencies": {
20
- "@luveo-tech/vark": "0.1.1"
32
+ "@luveo-tech/vark": "0.2.0-beta.2"
21
33
  },
22
34
  "engines": {
23
35
  "node": ">=20"