@frontmcp/plugin-approval 1.9.5 → 1.9.7
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 +179 -119
- package/esm/package.json +10 -8
- package/index.d.ts +9 -17
- package/index.d.ts.map +1 -1
- package/package.json +10 -8
package/README.md
CHANGED
|
@@ -1,158 +1,218 @@
|
|
|
1
1
|
# @frontmcp/plugin-approval
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A FrontMCP plugin that refuses to run a tool until an approval is recorded for the caller. Use it for tools that
|
|
4
|
+
shouldn't run without someone's say-so, like deleting a ticket or refunding a payment. Mark a tool with `approval`,
|
|
5
|
+
and every call to it is refused until your code grants an approval, through `this.approval` or the plugin's store.
|
|
6
|
+
Each approval records who granted it, and can be revoked or set to expire. The plugin doesn't ask anyone itself:
|
|
7
|
+
there's no prompt, webhook or callback, so you decide how a person says yes, for example with a form from
|
|
8
|
+
`this.elicit()`.
|
|
4
9
|
|
|
5
|
-
|
|
10
|
+
[](https://www.npmjs.com/package/@frontmcp/plugin-approval) [](https://github.com/agentfront/frontmcp/blob/main/LICENSE)
|
|
6
11
|
|
|
7
|
-
|
|
8
|
-
- **Multiple Approval Scopes**: SESSION, USER, TIME_LIMITED, TOOL_SPECIFIC, CONTEXT_SPECIFIC
|
|
9
|
-
- **PKCE Webhook Security**: RFC 7636 compliant PKCE for secure external approval systems
|
|
10
|
-
- **Recheck Mode**: Poll external API for approval status
|
|
11
|
-
- **Full Audit Trail**: Track who approved/revoked and when
|
|
12
|
-
- **Context Extension**: Use `this.approval` in tools
|
|
13
|
-
|
|
14
|
-
## Installation
|
|
12
|
+
## Install
|
|
15
13
|
|
|
16
14
|
```bash
|
|
17
|
-
npm install @frontmcp/plugin-approval
|
|
15
|
+
npm install @frontmcp/plugin-approval @frontmcp/sdk
|
|
18
16
|
```
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
Requires Node.js 24 or later. Keep `@frontmcp/sdk` on the same version as this package. Approvals
|
|
19
|
+
are kept in memory unless you configure `storage`. Redis support (`ioredis`) is included; for other stores, install
|
|
20
|
+
their client yourself:
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
- `@vercel/kv`, an optional peer dependency, for `storage: { type: 'vercel-kv' }`.
|
|
23
|
+
- `@upstash/redis` for `storage: { type: 'upstash' }`.
|
|
26
24
|
|
|
27
|
-
|
|
28
|
-
const plugin = ApprovalPlugin.init();
|
|
29
|
-
|
|
30
|
-
// Install into scope
|
|
31
|
-
await plugin.install(scope);
|
|
32
|
-
```
|
|
25
|
+
This plugin isn't part of the [`@frontmcp/plugins`](https://www.npmjs.com/package/@frontmcp/plugins) meta-package.
|
|
33
26
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
```typescript
|
|
37
|
-
const plugin = ApprovalPlugin.init({
|
|
38
|
-
mode: 'webhook',
|
|
39
|
-
webhook: {
|
|
40
|
-
url: 'https://approval.example.com/webhook',
|
|
41
|
-
challengeTtl: 300, // 5 minutes
|
|
42
|
-
callbackPath: '/approval/callback',
|
|
43
|
-
},
|
|
44
|
-
});
|
|
45
|
-
```
|
|
27
|
+
## Usage
|
|
46
28
|
|
|
47
|
-
|
|
29
|
+
Register the plugin on `@FrontMcp`, to gate every app's tools, or on an `@App`. Mark the tools that need approval,
|
|
30
|
+
and give the user a way to grant it:
|
|
48
31
|
|
|
49
|
-
```
|
|
50
|
-
import {
|
|
51
|
-
import { Tool, ToolContext } from '@frontmcp/sdk';
|
|
32
|
+
```ts
|
|
33
|
+
import { ApprovalPlugin, userGrantor } from '@frontmcp/plugin-approval';
|
|
34
|
+
import { App, FrontMcp, Tool, ToolContext, z } from '@frontmcp/sdk';
|
|
52
35
|
|
|
53
36
|
@Tool({
|
|
54
|
-
name: '
|
|
37
|
+
name: 'delete_ticket',
|
|
38
|
+
description: 'Delete a support ticket for good. Needs approval: call approve_delete first.',
|
|
39
|
+
inputSchema: { id: z.string() },
|
|
55
40
|
approval: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
category: 'write',
|
|
41
|
+
approvalMessage: 'delete_ticket needs the user to approve it. Call approve_delete first.',
|
|
42
|
+
category: 'delete',
|
|
59
43
|
riskLevel: 'high',
|
|
60
|
-
approvalMessage: 'Allow dangerous operation?',
|
|
61
44
|
},
|
|
62
45
|
})
|
|
63
|
-
class
|
|
64
|
-
async execute() {
|
|
65
|
-
|
|
66
|
-
|
|
46
|
+
class DeleteTicket extends ToolContext {
|
|
47
|
+
async execute({ id }: { id: string }) {
|
|
48
|
+
return { id, deleted: true };
|
|
49
|
+
}
|
|
50
|
+
}
|
|
67
51
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
52
|
+
@Tool({ name: 'approve_delete', description: 'Ask the user to allow delete_ticket for this session', inputSchema: {} })
|
|
53
|
+
class ApproveDelete extends ToolContext {
|
|
54
|
+
async execute() {
|
|
55
|
+
// The user answers this form in the client. The model can't.
|
|
56
|
+
const answer = await this.elicit(
|
|
57
|
+
'Allow the assistant to delete tickets in this session?',
|
|
58
|
+
z.object({ allow: z.boolean() }),
|
|
59
|
+
);
|
|
60
|
+
if (answer.status !== 'accept' || !answer.content?.allow) return { approved: false };
|
|
61
|
+
|
|
62
|
+
await this.approval.grantSessionApproval('help-desk:delete_ticket', {
|
|
63
|
+
grantedBy: userGrantor(this.auth.user.sub),
|
|
64
|
+
});
|
|
65
|
+
return { approved: true };
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
|
-
```
|
|
74
68
|
|
|
75
|
-
|
|
76
|
-
|
|
69
|
+
@App({ id: 'help-desk', name: 'Help Desk', tools: [DeleteTicket, ApproveDelete] })
|
|
70
|
+
class HelpDeskApp {}
|
|
77
71
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
72
|
+
@FrontMcp({
|
|
73
|
+
info: { name: 'help-desk', version: '1.0.0' },
|
|
74
|
+
apps: [HelpDeskApp],
|
|
75
|
+
elicitation: { enabled: true },
|
|
76
|
+
plugins: [ApprovalPlugin.init()],
|
|
77
|
+
})
|
|
78
|
+
export default class Server {}
|
|
79
|
+
```
|
|
81
80
|
|
|
82
|
-
|
|
81
|
+
- **Tool ids are `<app id>:<tool name>`**, like `help-desk:delete_ticket`. Granting `'delete_ticket'` records an
|
|
82
|
+
approval nothing checks.
|
|
83
|
+
- **Approvals belong to the caller**, so use the plugin with signed-in users. An anonymous caller can get a new
|
|
84
|
+
identity on every request, and an approval granted to them then never applies to their next call.
|
|
85
|
+
- **Don't let the model approve its own calls.** A tool that grants without asking a person makes the gate protect
|
|
86
|
+
nothing. Grant after a form the user answers, as above, or from a caller with more rights.
|
|
87
|
+
- **A field needs its plugin.** A server where a tool has `approval` and no `ApprovalPlugin` reaches it doesn't start:
|
|
88
|
+
it fails with `UnenforcedMetadataError`.
|
|
89
|
+
- `ApprovalPlugin.init()` with no argument, and `plugins: [ApprovalPlugin]`, use the defaults.
|
|
90
|
+
|
|
91
|
+
## What the client sees
|
|
92
|
+
|
|
93
|
+
A refused call is a tool error the model can read: `isError: true`, `_meta.code: 'APPROVAL_REQUIRED'`, and the text
|
|
94
|
+
of the tool's `approvalMessage`, in production too (the approval errors extend `PublicMcpError`). The default
|
|
95
|
+
message, `Tool "<id>" requires approval to execute. Allow?`, doesn't tell the model what to do next, so write your
|
|
96
|
+
own. The tool's `category`, `riskLevel` and other fields stay on the server.
|
|
97
|
+
|
|
98
|
+
## The `approval` field on `@Tool`
|
|
99
|
+
|
|
100
|
+
`approval: true` means `{ required: true, defaultScope: ApprovalScope.SESSION }`. Any object requires approval unless
|
|
101
|
+
it says `required: false`.
|
|
102
|
+
|
|
103
|
+
| Field | What it does |
|
|
104
|
+
| --------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `required` | `false` turns the gate off. Default `true`. |
|
|
106
|
+
| `skipApproval` | `true` turns the gate off too. |
|
|
107
|
+
| `alwaysPrompt` | Each approval lets one call run and is used up by it. |
|
|
108
|
+
| `approvalMessage` | The text of the refusal. |
|
|
109
|
+
| `allowedScopes` | The scopes an approval of this tool may have. A grant through `this.approval` of another scope throws `ApprovalScopeNotAllowedError`. |
|
|
110
|
+
| `maxTtlMs` | The longest an approval of this tool lasts. |
|
|
111
|
+
| `preApprovedContexts` | Lets a call run without an approval when `authInfo.extra.approvalContext` matches. FrontMCP's auth modes don't set it, so your own code has to. |
|
|
112
|
+
| `category`, `riskLevel`, `defaultScope` | Kept on the error's `details`, which clients don't see. |
|
|
113
|
+
|
|
114
|
+
## `this.approval`
|
|
115
|
+
|
|
116
|
+
The plugin adds `this.approval` to the tools, resources and prompts of the apps it's registered for. It acts for the
|
|
117
|
+
current caller, and takes tool ids in the `<app id>:<tool name>` form.
|
|
118
|
+
|
|
119
|
+
| Method | What it does |
|
|
120
|
+
| --------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- |
|
|
121
|
+
| `isApproved(toolId, context?)` | Whether the gate would let the caller run the tool. |
|
|
122
|
+
| `grantSessionApproval(toolId, options?)` | Approves for the caller's session. |
|
|
123
|
+
| `grantUserApproval(toolId, options?)` | Approves for the caller in every session. |
|
|
124
|
+
| `grantTimeLimitedApproval(toolId, ttlMs, options?)` | Approves for `ttlMs` milliseconds. |
|
|
125
|
+
| `grantContextApproval(toolId, context, options?)` | Approves in one context, `{ type, identifier }` (see `preApprovedContexts`). |
|
|
126
|
+
| `revokeApproval(toolId, options?)` | Deletes the caller's approvals of the tool, keeping a copy for 24 hours. |
|
|
127
|
+
| `getRevocations(toolId)` | The caller's approvals of the tool revoked in the last 24 hours. |
|
|
128
|
+
| `getApproval`, `getSessionApprovals`, `getUserApprovals`, `queryApprovals`, `clearSessionApprovals` | Read or clear the caller's records. |
|
|
129
|
+
|
|
130
|
+
Grant `options` are `{ grantedBy?, reason?, metadata? }`, and revoke options `{ revokedBy?, reason? }`. Without
|
|
131
|
+
`grantedBy`, a grant records the signed-in caller with `method: 'implicit'`, which says nobody was asked:
|
|
132
|
+
`{ source: 'user', identifier: <user id>, method: 'implicit' }`, or `{ source: 'user', method: 'implicit' }` with no
|
|
133
|
+
signed-in user. After the user says yes, pass a grantor that says so:
|
|
134
|
+
|
|
135
|
+
```ts
|
|
83
136
|
import { policyGrantor, userGrantor } from '@frontmcp/plugin-approval';
|
|
84
137
|
|
|
138
|
+
// { source: 'user', identifier: 'user-123', displayName: 'Jane Doe', method: 'interactive' }
|
|
139
|
+
await this.approval.grantUserApproval('ops:deploy', { grantedBy: userGrantor('user-123', 'Jane Doe') });
|
|
140
|
+
|
|
141
|
+
// { source: 'policy', identifier: 'safe-list', method: 'implicit' }
|
|
85
142
|
await this.approval.grantSessionApproval('ops:deploy', { grantedBy: policyGrantor('safe-list') });
|
|
86
|
-
await this.approval.grantUserApproval('ops:deploy', {
|
|
87
|
-
grantedBy: userGrantor('user-123', 'Jane Doe', { method: 'interactive' }),
|
|
88
|
-
});
|
|
89
143
|
```
|
|
90
144
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
maxAttempts?: number;
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
// Webhook mode options
|
|
124
|
-
webhook?: {
|
|
125
|
-
url?: string;
|
|
126
|
-
includeJwt?: boolean; // default: false (security)
|
|
127
|
-
challengeTtl?: number; // seconds, default: 300
|
|
128
|
-
callbackPath?: string; // default: '/approval/callback'
|
|
129
|
-
};
|
|
130
|
-
|
|
131
|
-
// Audit options
|
|
132
|
-
enableAudit?: boolean; // default: true
|
|
133
|
-
maxDelegationDepth?: number; // default: 3
|
|
134
|
-
cleanupIntervalSeconds?: number; // default: 60
|
|
135
|
-
}
|
|
145
|
+
The other grantor helpers are `adminGrantor`, `systemGrantor`, `agentGrantor`, `apiGrantor`, `oauthGrantor`,
|
|
146
|
+
`testGrantor` and `customGrantor`, with matching revoker helpers (`userRevoker`, `adminRevoker`, `policyRevoker`, and
|
|
147
|
+
others).
|
|
148
|
+
|
|
149
|
+
To grant or revoke for someone other than the caller, like a lead approving a teammate, use the store:
|
|
150
|
+
`this.get(ApprovalStoreToken)` returns it, with `grantApproval({ toolId, scope, userId?, sessionId?, ttlMs?, grantedBy?, ... })`
|
|
151
|
+
and `revokeApproval(...)`.
|
|
152
|
+
|
|
153
|
+
## Scopes
|
|
154
|
+
|
|
155
|
+
`ApprovalScope` is a string enum:
|
|
156
|
+
|
|
157
|
+
| Scope | Value | What it does |
|
|
158
|
+
| ------------------ | -------------------- | ---------------------------------------------------------------------------------------- |
|
|
159
|
+
| `SESSION` | `'session'` | Approves for the session. |
|
|
160
|
+
| `USER` | `'user'` | Approves for the user, in every session. |
|
|
161
|
+
| `TIME_LIMITED` | `'time_limited'` | Needs a `ttlMs`, and approves until it expires. |
|
|
162
|
+
| `CONTEXT_SPECIFIC` | `'context_specific'` | Approves only for calls in that context, which `authInfo.extra.approvalContext` carries. |
|
|
163
|
+
| `TOOL_SPECIFIC` | `'tool_specific'` | A label. Nothing in the plugin grants it. |
|
|
164
|
+
|
|
165
|
+
Under MCP protocol 2026-07-28, clients have no sessions, so a session approval is kept per user and lasts until it's
|
|
166
|
+
revoked or expires. Grant time-limited approvals when that matters.
|
|
167
|
+
|
|
168
|
+
## Options
|
|
169
|
+
|
|
170
|
+
```ts
|
|
171
|
+
ApprovalPlugin.init({
|
|
172
|
+
storage: { type: 'redis', redis: { url: process.env.REDIS_URL } },
|
|
173
|
+
});
|
|
136
174
|
```
|
|
137
175
|
|
|
138
|
-
|
|
176
|
+
| Option | Default | Description |
|
|
177
|
+
| ------------------------ | ------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
178
|
+
| `storage` | `{ type: 'auto' }` | Where approvals are kept: `'memory'`, `'redis'`, `'vercel-kv'`, `'upstash'`, `'cloudflare-kv'` or `'auto'`. `'auto'` picks Upstash, Vercel KV or Redis from their environment variables, and memory otherwise. |
|
|
179
|
+
| `storageInstance` | | A storage you made with `createStorage()` from `@frontmcp/utils`. Wins over `storage`. |
|
|
180
|
+
| `namespace` | `'approval'` | The prefix of the plugin's keys. |
|
|
181
|
+
| `cleanupIntervalSeconds` | `60` | How often expired approvals are deleted. `0` turns it off. |
|
|
182
|
+
| `mode` | `'recheck'` | `'webhook'` also registers a `ChallengeService` (below). Neither mode contacts an external system. |
|
|
183
|
+
| `webhook.challengeTtl` | `300` | How long the `ChallengeService`'s challenges last, in seconds. |
|
|
184
|
+
|
|
185
|
+
`webhook.url`, `webhook.callbackPath`, `webhook.includeJwt`, the `recheck` options, `enableAudit` and
|
|
186
|
+
`maxDelegationDepth` are accepted and not used: nothing is sent, polled or served.
|
|
187
|
+
|
|
188
|
+
## Webhook mode
|
|
189
|
+
|
|
190
|
+
With `mode: 'webhook'`, `this.get(ChallengeServiceToken)` returns a `ChallengeService`: a store of one-time PKCE
|
|
191
|
+
(Proof Key for Code Exchange, RFC 7636) challenges you can build an external approval flow on.
|
|
192
|
+
`createChallenge({ toolId, sessionId, requestedScope, requestInfo, ... })` returns a code verifier and its SHA-256
|
|
193
|
+
challenge, and `verifyAndConsume(codeVerifier)` returns the stored request once, or throws `ChallengeValidationError`.
|
|
194
|
+
The plugin itself doesn't call it, send a webhook or serve a callback route.
|
|
195
|
+
|
|
196
|
+
## Docs
|
|
197
|
+
|
|
198
|
+
- [Approval plugin reference](https://frontmcp.dev/reference/plugins/approval): every option, method, error and
|
|
199
|
+
caveat, with runnable examples
|
|
200
|
+
- [Asking for Approval](https://frontmcp.dev/learn/asking-for-approval): builds the gate and the asking step by step
|
|
201
|
+
- [Plugins and adapters](https://frontmcp.dev/reference/plugins): where to register a plugin
|
|
139
202
|
|
|
140
|
-
|
|
203
|
+
## Related packages
|
|
141
204
|
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
6. Grant approval if valid
|
|
205
|
+
- [`@frontmcp/sdk`](https://www.npmjs.com/package/@frontmcp/sdk): the framework this plugin extends
|
|
206
|
+
- [`@frontmcp/plugin-feature-flags`](https://www.npmjs.com/package/@frontmcp/plugin-feature-flags): hides and blocks
|
|
207
|
+
tools behind feature flags
|
|
208
|
+
- [`@frontmcp/plugin-remember`](https://www.npmjs.com/package/@frontmcp/plugin-remember): `this.remember`, a memory
|
|
209
|
+
for tools
|
|
148
210
|
|
|
149
|
-
|
|
211
|
+
## Contributing
|
|
150
212
|
|
|
151
|
-
-
|
|
152
|
-
|
|
153
|
-
- Challenge expires after TTL
|
|
154
|
-
- Only holder of `code_verifier` can complete approval
|
|
213
|
+
Source: [`plugins/plugin-approval`](https://github.com/agentfront/frontmcp/tree/main/plugins/plugin-approval). Issues
|
|
214
|
+
and pull requests are welcome; see [CONTRIBUTING.md](https://github.com/agentfront/frontmcp/blob/main/CONTRIBUTING.md).
|
|
155
215
|
|
|
156
216
|
## License
|
|
157
217
|
|
|
158
|
-
Apache-2.0
|
|
218
|
+
Apache-2.0. See [LICENSE](https://github.com/agentfront/frontmcp/blob/main/LICENSE).
|
package/esm/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-approval",
|
|
3
|
-
"version": "1.9.
|
|
4
|
-
"description": "Approval plugin for FrontMCP
|
|
3
|
+
"version": "1.9.7",
|
|
4
|
+
"description": "Approval plugin for FrontMCP: refuses to run marked tools until an approval is recorded for the caller",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=24.0.0"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
|
+
"frontmcp",
|
|
11
12
|
"mcp",
|
|
13
|
+
"model-context-protocol",
|
|
12
14
|
"approval",
|
|
15
|
+
"tool-approval",
|
|
16
|
+
"human-in-the-loop",
|
|
13
17
|
"authorization",
|
|
14
|
-
"pkce",
|
|
15
|
-
"webhook",
|
|
16
18
|
"plugin",
|
|
17
|
-
"frontmcp",
|
|
18
19
|
"agentfront"
|
|
19
20
|
],
|
|
20
21
|
"repository": {
|
|
@@ -49,13 +50,13 @@
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@frontmcp/
|
|
53
|
-
"@frontmcp/utils": "1.9.5",
|
|
53
|
+
"@frontmcp/utils": "1.9.7",
|
|
54
54
|
"ioredis": "^5.8.0",
|
|
55
55
|
"reflect-metadata": "^0.2.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@frontmcp/lazy-zod": "1.9.
|
|
58
|
+
"@frontmcp/lazy-zod": "1.9.7",
|
|
59
|
+
"@frontmcp/sdk": "1.9.7",
|
|
59
60
|
"@vercel/kv": "^2.0.0 || ^3.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependenciesMeta": {
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
68
|
+
"@frontmcp/sdk": "1.9.7",
|
|
67
69
|
"reflect-metadata": "^0.2.2"
|
|
68
70
|
}
|
|
69
71
|
}
|
package/index.d.ts
CHANGED
|
@@ -9,26 +9,18 @@
|
|
|
9
9
|
* ```typescript
|
|
10
10
|
* import { ApprovalPlugin } from '@frontmcp/plugin-approval';
|
|
11
11
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
12
|
+
* @FrontMcp({
|
|
13
|
+
* info: { name: 'my-server', version: '1.0.0' },
|
|
14
|
+
* apps: [MyApp],
|
|
15
|
+
* plugins: [ApprovalPlugin.init()],
|
|
16
|
+
* })
|
|
17
|
+
* class MyServer {}
|
|
14
18
|
*
|
|
15
|
-
* //
|
|
16
|
-
* const plugin = ApprovalPlugin.init({
|
|
17
|
-
* mode: 'webhook',
|
|
18
|
-
* webhook: {
|
|
19
|
-
* url: 'https://approval.example.com/webhook',
|
|
20
|
-
* challengeTtl: 300,
|
|
21
|
-
* },
|
|
22
|
-
* });
|
|
23
|
-
*
|
|
24
|
-
* // Install into scope
|
|
25
|
-
* await plugin.install(scope);
|
|
26
|
-
*
|
|
27
|
-
* // In tools, use this.approval
|
|
19
|
+
* // In tools, use this.approval with `<app id>:<tool name>` ids
|
|
28
20
|
* class MyTool extends ToolContext {
|
|
29
21
|
* async execute() {
|
|
30
|
-
* const approved = await this.approval.isApproved('
|
|
31
|
-
* await this.approval.grantSessionApproval('
|
|
22
|
+
* const approved = await this.approval.isApproved('my-app:other_tool');
|
|
23
|
+
* await this.approval.grantSessionApproval('my-app:helper_tool');
|
|
32
24
|
* }
|
|
33
25
|
* }
|
|
34
26
|
* ```
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,EACL,OAAO,IAAI,cAAc,EACzB,cAAc,IAAI,mBAAmB,EACrC,KAAK,qBAAqB,GAC3B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAGrG,cAAc,SAAS,CAAC;AAGxB,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,oBAAoB,EACpB,KAAK,2BAA2B,EAChC,yBAAyB,GAC1B,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,gBAAgB,EAChB,4BAA4B,EAC5B,KAAK,uBAAuB,EAC5B,KAAK,sBAAsB,GAC5B,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAG9C,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAG/E,OAAO,EAEL,aAAa,EACb,qBAAqB,EACrB,sBAAsB,EACtB,4BAA4B,EAC5B,oBAAoB,EACpB,wBAAwB,EAExB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,EACb,YAAY,EACZ,UAAU,EACV,YAAY,EACZ,WAAW,EACX,aAAa,EACb,gBAAgB,EAEhB,WAAW,EACX,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,aAAa,EACb,gBAAgB,EAEhB,eAAe,EACf,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontmcp/plugin-approval",
|
|
3
|
-
"version": "1.9.
|
|
4
|
-
"description": "Approval plugin for FrontMCP
|
|
3
|
+
"version": "1.9.7",
|
|
4
|
+
"description": "Approval plugin for FrontMCP: refuses to run marked tools until an approval is recorded for the caller",
|
|
5
5
|
"author": "AgentFront <info@agentfront.dev>",
|
|
6
6
|
"license": "Apache-2.0",
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": ">=24.0.0"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
|
+
"frontmcp",
|
|
11
12
|
"mcp",
|
|
13
|
+
"model-context-protocol",
|
|
12
14
|
"approval",
|
|
15
|
+
"tool-approval",
|
|
16
|
+
"human-in-the-loop",
|
|
13
17
|
"authorization",
|
|
14
|
-
"pkce",
|
|
15
|
-
"webhook",
|
|
16
18
|
"plugin",
|
|
17
|
-
"frontmcp",
|
|
18
19
|
"agentfront"
|
|
19
20
|
],
|
|
20
21
|
"repository": {
|
|
@@ -49,13 +50,13 @@
|
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
"dependencies": {
|
|
52
|
-
"@frontmcp/
|
|
53
|
-
"@frontmcp/utils": "1.9.5",
|
|
53
|
+
"@frontmcp/utils": "1.9.7",
|
|
54
54
|
"ioredis": "^5.8.0",
|
|
55
55
|
"reflect-metadata": "^0.2.2"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@frontmcp/lazy-zod": "1.9.
|
|
58
|
+
"@frontmcp/lazy-zod": "1.9.7",
|
|
59
|
+
"@frontmcp/sdk": "1.9.7",
|
|
59
60
|
"@vercel/kv": "^2.0.0 || ^3.0.0"
|
|
60
61
|
},
|
|
61
62
|
"peerDependenciesMeta": {
|
|
@@ -64,6 +65,7 @@
|
|
|
64
65
|
}
|
|
65
66
|
},
|
|
66
67
|
"devDependencies": {
|
|
68
|
+
"@frontmcp/sdk": "1.9.7",
|
|
67
69
|
"reflect-metadata": "^0.2.2"
|
|
68
70
|
}
|
|
69
71
|
}
|