@keelcodes/mcp 0.1.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/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Keel contributors
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,104 @@
1
+ # @keelcodes/mcp
2
+
3
+ A **policy-aware MCP server**: it exposes an agent account's on-chain actions to a
4
+ model as [Model Context Protocol](https://modelcontextprotocol.io) tools, and every
5
+ action is checked against `@keelcodes/policy` **before it runs**.
6
+
7
+ The difference between *policy-aware* and *policy-documented* is where the gate
8
+ sits. A denied call never reaches the tool handler — the gate stands in front of
9
+ `run`, so a misbehaving model cannot talk the account past its policy, and no
10
+ amount of prompt injection changes the outcome.
11
+
12
+ ## What it speaks
13
+
14
+ - Protocol revision **`2025-06-18`** (also accepts `2025-03-26` / `2024-11-05` on
15
+ `initialize`, and answers in the client's version when known).
16
+ - Methods: `initialize`, `notifications/initialized`, `ping`, `tools/list`,
17
+ `tools/call`.
18
+ - Transport: newline-delimited JSON over stdio — one JSON-RPC 2.0 message per
19
+ line, no embedded newlines.
20
+ - Errors use the standard JSON-RPC codes (`-32700`, `-32600`, `-32601`, `-32602`,
21
+ `-32603`). A *policy denial* is **not** a protocol error: it is a tool result
22
+ with `isError: true`, so the reason is visible to the model.
23
+
24
+ ## Built-in tools
25
+
26
+ `createPolicyTools` ships the three moves an agent needs in front of a
27
+ policy-bounded account, in the order it needs them:
28
+
29
+ | Tool | Gated? | Does |
30
+ |---|---|---|
31
+ | `keel_policy` | no | Return the commitment hash and the normalised rules. |
32
+ | `keel_check_call` | no | Dry-run a call; returns `allowed` plus the refusing rule. |
33
+ | `keel_execute_call` | **yes** | Execute — a denied call never reaches the executor. |
34
+
35
+ Reading and dry-running are deliberately ungated: refusing them would only hide
36
+ the policy from the model and push it to guess.
37
+
38
+ ### PIM tools (ERC-8313)
39
+
40
+ `createPimTools` adds consumption of **Protocol Interaction Manifests** — a PIM
41
+ is untrusted JSON, so the model can check it before acting on it. Both tools are
42
+ read-only and ungated, and take the manifest inline as `{ pim: <object> }` (this
43
+ package never touches the filesystem):
44
+
45
+ | Tool | Does |
46
+ |---|---|
47
+ | `pim_validate` | Validate against the nine mandatory sections; returns `{ valid, errors, warnings }`. |
48
+ | `pim_inspect` | Summarise protocol/chains/intents/contracts and the assigned trust level (0–3). |
49
+
50
+ ## Usage
51
+
52
+ ```ts
53
+ import { createMcpServer, createPolicyGate, createPolicyTools, serveStdio } from '@keelcodes/mcp';
54
+ import type { Policy } from '@keelcodes/policy';
55
+
56
+ const policy: Policy = /* normalisePolicy({ … }) */;
57
+
58
+ const server = createMcpServer({
59
+ name: 'keel',
60
+ version: '0.1.0',
61
+ tools: createPolicyTools({
62
+ policy,
63
+ // Wire this to a bundler/paymaster; without it keel_execute_call reports unavailable.
64
+ executor: async (call) => ({ transactionHash: '0x…' }),
65
+ }),
66
+ gate: createPolicyGate({ policy }),
67
+ });
68
+
69
+ serveStdio({ server });
70
+ ```
71
+
72
+ This is a library: the process entry point is yours. Point an MCP client at that
73
+ entry (an `mcp-stdio.js` that imports `serveStdio` as above):
74
+
75
+ ```json
76
+ {
77
+ "mcpServers": {
78
+ "keel": { "command": "node", "args": ["./dist/mcp-stdio.js"] }
79
+ }
80
+ }
81
+ ```
82
+
83
+ When no policy is configured, use the safe default `DENY_ALL`: the server can still
84
+ describe itself and dry-run, but it cannot execute. That is "cannot act", never
85
+ "acts by default".
86
+
87
+ ## Design
88
+
89
+ - **One source of truth.** The gate calls `evaluateCall` from `@keelcodes/policy` —
90
+ the same function the on-chain hook mirrors — so an MCP verdict and the eventual
91
+ transaction cannot disagree.
92
+ - **Ports, not wiring.** `PolicyGate`, `CallExecutor` and `serveStdio`'s
93
+ `ReadableLike` / `WritableLike` are structural interfaces, so tests inject fakes
94
+ and the package needs no `@types/node`.
95
+
96
+ ## Develop
97
+
98
+ ```bash
99
+ pnpm --filter @keelcodes/mcp build
100
+ pnpm --filter @keelcodes/mcp test
101
+ ```
102
+
103
+ The integration point is described in
104
+ [`docs/KEEL_PLAN.md`](../../docs/KEEL_PLAN.md) §4.4 ⑥.
@@ -0,0 +1,32 @@
1
+ import { type Call, type Policy } from '@keelcodes/policy';
2
+ import { type McpTool } from './tools.js';
3
+ /**
4
+ * The built-in, policy-aware tools.
5
+ *
6
+ * These are the three moves an agent needs in front of a policy-bounded account,
7
+ * in the order it needs them:
8
+ *
9
+ * 1. `keel_policy` — read what it is allowed to do.
10
+ * 2. `keel_check_call` — dry-run a call and learn the verdict before spending.
11
+ * 3. `keel_execute_call` — execute, gated: a denied call never reaches the
12
+ * executor.
13
+ *
14
+ * Reading and dry-running are deliberately **not** gated — refusing them would
15
+ * only hide the policy from the model and push it to guess.
16
+ */
17
+ /** Runs a policy-approved call. Wire it to a bundler/paymaster via `@keelcodes/adapters`. */
18
+ export type CallExecutor = (call: Call) => Promise<Record<string, unknown>> | Record<string, unknown>;
19
+ export interface PolicyToolsOptions {
20
+ /** The normalised policy these tools describe and enforce. */
21
+ policy: Policy;
22
+ /** Required for `keel_execute_call`; without it that tool reports unavailable. */
23
+ executor?: CallExecutor;
24
+ /** Clock for the dry-run; defaults to the wall clock. */
25
+ now?: () => bigint;
26
+ }
27
+ export declare function createPolicyTools(options: PolicyToolsOptions): McpTool[];
28
+ /** A JSON-safe rendering of a normalised policy (bigints become decimal strings). */
29
+ export declare function describePolicy(policy: Policy): Record<string, unknown>;
30
+ /** A JSON-safe rendering of a call. */
31
+ export declare function describeCall(call: Call): Record<string, unknown>;
32
+ //# sourceMappingURL=builtin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin.d.ts","sourceRoot":"","sources":["../src/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,EAA0C,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAA4C,KAAK,OAAO,EAAiB,MAAM,YAAY,CAAC;AAEnG;;;;;;;;;;;;;GAaG;AAEH,6FAA6F;AAC7F,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEtG,MAAM,WAAW,kBAAkB;IACjC,8DAA8D;IAC9D,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,yDAAyD;IACzD,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAeD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,EAAE,CAgDxE;AAED,qFAAqF;AACrF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAkBtE;AAED,uCAAuC;AACvC,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOhE"}
@@ -0,0 +1,114 @@
1
+ import { evaluateCall, policyCommitment, toCall } from '@keelcodes/policy';
2
+ import { errorResult, jsonResult } from './tools.js';
3
+ const CALL_SCHEMA = {
4
+ type: 'object',
5
+ properties: {
6
+ target: { type: 'string', description: 'Contract or recipient address, 0x-prefixed.' },
7
+ value: { type: 'string', description: 'Native value in wei as a decimal string. Defaults to "0".' },
8
+ data: { type: 'string', description: 'Call data, 0x-prefixed. Defaults to "0x", a plain value transfer.' },
9
+ },
10
+ required: ['target'],
11
+ additionalProperties: false,
12
+ };
13
+ const EMPTY_SCHEMA = { type: 'object', properties: {}, additionalProperties: false };
14
+ export function createPolicyTools(options) {
15
+ const { policy } = options;
16
+ const now = options.now ?? (() => BigInt(Math.floor(Date.now() / 1000)));
17
+ const policyTool = {
18
+ name: 'keel_policy',
19
+ title: 'Keel policy',
20
+ description: 'Return the authorization policy this server enforces: its canonical commitment hash and normalised rules. Read-only.',
21
+ inputSchema: EMPTY_SCHEMA,
22
+ run: () => jsonResult({ commitment: policyCommitment(policy), policy: describePolicy(policy) }),
23
+ };
24
+ const checkTool = {
25
+ name: 'keel_check_call',
26
+ title: 'Dry-run a call against the policy',
27
+ description: 'Evaluate a proposed call against the policy without executing it. Returns whether it would be allowed and, if not, the exact rule that refused it. Read-only and never gated.',
28
+ inputSchema: CALL_SCHEMA,
29
+ run: (args) => {
30
+ const call = callFromArgs(args);
31
+ const decision = evaluateCall(policy, { now: now(), usage: [] }, call);
32
+ return jsonResult({
33
+ allowed: decision.allowed,
34
+ ...(decision.reason !== undefined ? { reason: decision.reason } : {}),
35
+ ...(decision.ruleIndex !== undefined ? { ruleIndex: decision.ruleIndex } : {}),
36
+ });
37
+ },
38
+ };
39
+ const executeTool = {
40
+ name: 'keel_execute_call',
41
+ title: 'Execute a policy-approved call',
42
+ description: 'Execute a call on the agent account. The call is checked against the policy first; a denied call is never executed.',
43
+ inputSchema: CALL_SCHEMA,
44
+ action: (args) => ({ kind: 'execute-call', call: callFromArgs(args) }),
45
+ run: async (args) => {
46
+ if (options.executor === undefined) {
47
+ return errorResult('this server has no call executor configured; keel_execute_call is unavailable');
48
+ }
49
+ const call = callFromArgs(args);
50
+ const outcome = await options.executor(call);
51
+ return jsonResult({ executed: true, call: describeCall(call), ...outcome });
52
+ },
53
+ };
54
+ return [policyTool, checkTool, executeTool];
55
+ }
56
+ /** A JSON-safe rendering of a normalised policy (bigints become decimal strings). */
57
+ export function describePolicy(policy) {
58
+ return {
59
+ version: policy.version,
60
+ validAfter: policy.validAfter.toString(),
61
+ validUntil: policy.validUntil.toString(),
62
+ rules: policy.rules.map((rule) => ({
63
+ target: rule.target,
64
+ selectors: [...rule.selectors],
65
+ maxPerTx: rule.maxPerTx.toString(),
66
+ maxDaily: rule.maxDaily.toString(),
67
+ maxCalls: rule.maxCalls,
68
+ tokenLimits: rule.tokenLimits.map((limit) => ({
69
+ token: limit.token,
70
+ maxPerTx: limit.maxPerTx.toString(),
71
+ maxDaily: limit.maxDaily.toString(),
72
+ })),
73
+ })),
74
+ };
75
+ }
76
+ /** A JSON-safe rendering of a call. */
77
+ export function describeCall(call) {
78
+ return {
79
+ target: call.target,
80
+ value: call.value.toString(),
81
+ data: call.data,
82
+ selector: call.selector,
83
+ };
84
+ }
85
+ function callFromArgs(args) {
86
+ const target = requireString(args, 'target');
87
+ const data = args.data === undefined ? undefined : requireString(args, 'data');
88
+ const value = args.value === undefined ? 0n : parseWei(args.value);
89
+ return toCall({
90
+ target: target,
91
+ value,
92
+ ...(data !== undefined ? { data: data } : {}),
93
+ });
94
+ }
95
+ function parseWei(value) {
96
+ if (typeof value === 'bigint')
97
+ return value;
98
+ if (typeof value !== 'string')
99
+ throw new Error('"value" must be a decimal string of wei');
100
+ try {
101
+ return BigInt(value);
102
+ }
103
+ catch {
104
+ throw new Error(`"value" is not a valid integer: "${value}"`);
105
+ }
106
+ }
107
+ function requireString(args, name) {
108
+ const value = args[name];
109
+ if (typeof value !== 'string' || value.length === 0) {
110
+ throw new Error(`"${name}" is required and must be a non-empty string`);
111
+ }
112
+ return value;
113
+ }
114
+ //# sourceMappingURL=builtin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"builtin.js","sourceRoot":"","sources":["../src/builtin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAA0B,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,UAAU,EAAgD,MAAM,YAAY,CAAC;AA6BnG,MAAM,WAAW,GAAe;IAC9B,IAAI,EAAE,QAAQ;IACd,UAAU,EAAE;QACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,6CAA6C,EAAE;QACtF,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,2DAA2D,EAAE;QACnG,IAAI,EAAE,E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AAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACnE,OAAO,MAAM,CAAC;QACZ,MAAM,EAAE,MAAuB;QAC/B,KAAK;QACL,GAAG,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAqB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC/D,CAAC,CAAC;AACL,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAC5C,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC,CAAC;IAC1F,IAAI,CAAC;QACH,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC;IACvB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,oCAAoC,KAAK,GAAG,CAAC,CAAC;IAChE,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,IAAc,EAAE,IAAY;IACjD,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,8CAA8C,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/dist/gate.d.ts ADDED
@@ -0,0 +1,46 @@
1
+ import { type Call, type Policy, type RuleUsage } from '@keelcodes/policy';
2
+ /**
3
+ * What a tool wants to do, in terms the policy engine understands.
4
+ *
5
+ * A tool that performs no call (a read, a dry-run) declares no `call` and is
6
+ * always allowed through — the gate only stands in front of actions.
7
+ */
8
+ export interface ToolAction {
9
+ /** Short label used in denial messages, e.g. `transfer`. */
10
+ kind: string;
11
+ /** The call to evaluate. When absent, the action is not gated. */
12
+ call?: Call;
13
+ }
14
+ export type GateVerdict = 'allow' | 'deny';
15
+ export interface GateDecision {
16
+ verdict: GateVerdict;
17
+ /** Set when `verdict` is `deny`. */
18
+ reason?: string;
19
+ /** The policy rule that decided it, when one matched. */
20
+ ruleIndex?: number;
21
+ }
22
+ /** Decides whether a tool action may proceed. */
23
+ export interface PolicyGate {
24
+ check(action: ToolAction): Promise<GateDecision> | GateDecision;
25
+ }
26
+ export interface PolicyGateOptions {
27
+ /** The normalised policy to enforce. */
28
+ policy: Policy;
29
+ /** Current unix time in seconds. Defaults to the wall clock. */
30
+ now?: () => bigint;
31
+ /**
32
+ * Usage aligned to `policy.rules` by index. Defaults to zero, which is right
33
+ * for a stateless server; a stateful one advances it as calls are allowed.
34
+ */
35
+ usage?: () => readonly RuleUsage[];
36
+ }
37
+ /**
38
+ * Wraps `@keelcodes/policy`'s off-chain pre-check as a {@link PolicyGate}.
39
+ *
40
+ * The gate never widens what the on-chain module allows: it runs the same
41
+ * `evaluateCall` the account's hook mirrors, so a denial here is a denial there.
42
+ */
43
+ export declare function createPolicyGate(options: PolicyGateOptions): PolicyGate;
44
+ /** A gate that denies every action — the safe default when no policy is wired. */
45
+ export declare const DENY_ALL: PolicyGate;
46
+ //# sourceMappingURL=gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,KAAK,IAAI,EAAmB,KAAK,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE1G;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,IAAI,CAAC,EAAE,IAAI,CAAC;CACb;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,MAAM,CAAC;AAE3C,MAAM,WAAW,YAAY;IAC3B,OAAO,EAAE,WAAW,CAAC;IACrB,oCAAoC;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,iDAAiD;AACjD,MAAM,WAAW,UAAU;IACzB,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,GAAG,YAAY,CAAC;CACjE;AAED,MAAM,WAAW,iBAAiB;IAChC,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,SAAS,SAAS,EAAE,CAAC;CACpC;AAID;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,GAAG,UAAU,CAqBvE;AAED,kFAAkF;AAClF,eAAO,MAAM,QAAQ,EAAE,UAEtB,CAAC"}
package/dist/gate.js ADDED
@@ -0,0 +1,38 @@
1
+ import { evaluateCall } from '@keelcodes/policy';
2
+ const noUsage = [];
3
+ /**
4
+ * Wraps `@keelcodes/policy`'s off-chain pre-check as a {@link PolicyGate}.
5
+ *
6
+ * The gate never widens what the on-chain module allows: it runs the same
7
+ * `evaluateCall` the account's hook mirrors, so a denial here is a denial there.
8
+ */
9
+ export function createPolicyGate(options) {
10
+ const now = options.now ?? (() => BigInt(Math.floor(Date.now() / 1000)));
11
+ const usage = options.usage ?? (() => noUsage);
12
+ return {
13
+ check(action) {
14
+ if (action.call === undefined)
15
+ return { verdict: 'allow' };
16
+ const decision = evaluateCall(options.policy, { now: now(), usage: usage() }, action.call);
17
+ if (decision.allowed) {
18
+ return decision.ruleIndex === undefined
19
+ ? { verdict: 'allow' }
20
+ : { verdict: 'allow', ruleIndex: decision.ruleIndex };
21
+ }
22
+ return {
23
+ verdict: 'deny',
24
+ reason: describeDenial(decision.reason, action.kind),
25
+ ...(decision.ruleIndex !== undefined ? { ruleIndex: decision.ruleIndex } : {}),
26
+ };
27
+ },
28
+ };
29
+ }
30
+ /** A gate that denies every action — the safe default when no policy is wired. */
31
+ export const DENY_ALL = {
32
+ check: () => ({ verdict: 'deny', reason: 'no policy configured; all actions are denied' }),
33
+ };
34
+ function describeDenial(reason, kind) {
35
+ const detail = reason ?? 'unknown';
36
+ return `policy denied ${kind}: ${detail}`;
37
+ }
38
+ //# sourceMappingURL=gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gate.js","sourceRoot":"","sources":["../src/gate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA2D,MAAM,mBAAmB,CAAC;AA0C1G,MAAM,OAAO,GAAyB,EAAE,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAA0B;IACzD,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;IACzE,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,CAAC;IAE/C,OAAO;QACL,KAAK,CAAC,MAAkB;YACtB,IAAI,MAAM,CAAC,IAAI,KAAK,SAAS;gBAAE,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;YAE3D,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,CAAC;YAC3F,IAAI,QAAQ,CAAC,OAAO,EAAE,CAAC;gBACrB,OAAO,QAAQ,CAAC,SAAS,KAAK,SAAS;oBACrC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE;oBACtB,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;YAC1D,CAAC;YACD,OAAO;gBACL,OAAO,EAAE,MAAM;gBACf,MAAM,EAAE,cAAc,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC;gBACpD,GAAG,CAAC,QAAQ,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC/E,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,MAAM,QAAQ,GAAe;IAClC,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,8CAA8C,EAAE,CAAC;CAC3F,CAAC;AAEF,SAAS,cAAc,CAAC,MAA8B,EAAE,IAAY;IAClE,MAAM,MAAM,GAAG,MAAM,IAAI,SAAS,CAAC;IACnC,OAAO,iBAAiB,IAAI,KAAK,MAAM,EAAE,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * @keelcodes/mcp
3
+ *
4
+ * A **policy-aware MCP server**: it exposes on-chain actions to a model as MCP
5
+ * tools, and every action passes through `@keelcodes/policy` before it runs.
6
+ *
7
+ * The server implements the server side of the Model Context Protocol revision
8
+ * `2025-06-18` — `initialize`, `tools/list`, `tools/call` — over the
9
+ * newline-delimited stdio transport, and ships three built-in tools
10
+ * ({@link createPolicyTools}): read the policy, dry-run a call, execute a call.
11
+ *
12
+ * What makes it *policy-aware* rather than merely *policy-documented*: a denied
13
+ * call never reaches the tool's handler. The gate stands in front of `run`, so
14
+ * the account cannot be instructed past the policy even by a misbehaving model.
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ export { JSONRPC_ERROR, MCP_METHODS, MCP_PROTOCOL_VERSION, MCP_SUPPORTED_VERSIONS, rpcError, } from './protocol.js';
19
+ export type { JsonRpcErrorBody, JsonRpcFailure, JsonRpcId, JsonRpcRequest, JsonRpcResponse, JsonRpcSuccess, McpInitializeResult, McpServerInfo, McpTextContent, McpToolResult, } from './protocol.js';
20
+ export { DENY_ALL, createPolicyGate } from './gate.js';
21
+ export type { GateDecision, GateVerdict, PolicyGate, PolicyGateOptions, ToolAction, } from './gate.js';
22
+ export { ToolRegistry, errorResult, jsonReplacer, jsonResult, textResult } from './tools.js';
23
+ export type { JsonSchema, McpTool, ToolArgs, ToolDescriptor } from './tools.js';
24
+ export { createMcpServer } from './server.js';
25
+ export type { McpServer, McpServerOptions } from './server.js';
26
+ export { serveStdio } from './stdio.js';
27
+ export type { ReadableLike, ServeStdioOptions, WritableLike } from './stdio.js';
28
+ export { createPolicyTools, describeCall, describePolicy } from './builtin.js';
29
+ export type { CallExecutor, PolicyToolsOptions } from './builtin.js';
30
+ export { createPimTools } from './pim.js';
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,sBAAsB,EACtB,QAAQ,GACT,MAAM,eAAe,CAAC;AACvB,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,cAAc,EACd,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,aAAa,GACd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACvD,YAAY,EACV,YAAY,EACZ,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,UAAU,GACX,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7F,YAAY,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,YAAY,EAAE,YAAY,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC/E,YAAY,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAErE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @keelcodes/mcp
3
+ *
4
+ * A **policy-aware MCP server**: it exposes on-chain actions to a model as MCP
5
+ * tools, and every action passes through `@keelcodes/policy` before it runs.
6
+ *
7
+ * The server implements the server side of the Model Context Protocol revision
8
+ * `2025-06-18` — `initialize`, `tools/list`, `tools/call` — over the
9
+ * newline-delimited stdio transport, and ships three built-in tools
10
+ * ({@link createPolicyTools}): read the policy, dry-run a call, execute a call.
11
+ *
12
+ * What makes it *policy-aware* rather than merely *policy-documented*: a denied
13
+ * call never reaches the tool's handler. The gate stands in front of `run`, so
14
+ * the account cannot be instructed past the policy even by a misbehaving model.
15
+ *
16
+ * @packageDocumentation
17
+ */
18
+ export { JSONRPC_ERROR, MCP_METHODS, MCP_PROTOCOL_VERSION, MCP_SUPPORTED_VERSIONS, rpcError, } from './protocol.js';
19
+ export { DENY_ALL, createPolicyGate } from './gate.js';
20
+ export { ToolRegistry, errorResult, jsonReplacer, jsonResult, textResult } from './tools.js';
21
+ export { createMcpServer } from './server.js';
22
+ export { serveStdio } from './stdio.js';
23
+ export { createPolicyTools, describeCall, describePolicy } from './builtin.js';
24
+ export { createPimTools } from './pim.js';
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,sBAAsB,EACtB,QAAQ,GACT,MAAM,eAAe,CAAC;AAcvB,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AASvD,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAG7F,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGxC,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG/E,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC"}
package/dist/pim.d.ts ADDED
@@ -0,0 +1,16 @@
1
+ import { type McpTool } from './tools.js';
2
+ /**
3
+ * ERC-8313 Protocol Interaction Manifest tools.
4
+ *
5
+ * A manifest is an *untrusted input*: it arrives as JSON from a dApp, a
6
+ * registry or a peer agent. These tools let a model validate and summarise one
7
+ * before it is ever acted on. Both are read-only and therefore ungated —
8
+ * refusing to validate a manifest would only push the model to guess at its
9
+ * shape, which is exactly the failure mode the PIM standard exists to remove.
10
+ *
11
+ * `pim` is passed inline as a parsed object (not a path): this package
12
+ * deliberately has no `@types/node` dependency, so it never touches the
13
+ * filesystem. A host that wants path input reads the file itself.
14
+ */
15
+ export declare function createPimTools(): McpTool[];
16
+ //# sourceMappingURL=pim.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pim.d.ts","sourceRoot":"","sources":["../src/pim.ts"],"names":[],"mappings":"AACA,OAAO,EAA+B,KAAK,OAAO,EAAiB,MAAM,YAAY,CAAC;AAEtF;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,IAAI,OAAO,EAAE,CA+C1C"}