- Home
- Skills
- Agents & Orchestration
- Agent Permission Kit
More screenshots
Works with the AI Agents you already use
Agent Permission Kit
Allow, deny or require human approval for every AI agent tool call and MCP tool, fail-closed.
Free
Agent Permission Kit
Example session with this skill installed
I need to add a permission layer to my MCP server. Some tools like db.delete should be admin-only, and payments.send needs human approval if it's over $100. Every other tool should be blocked until I decide. Use agent-permission-kit.
- Read your context and instructions
- Compiled the agent permission kit
I inventoried the tools in src/server.ts and put one fail-closed policy in front of all of them.
Policy
| Tool | Effect | Rule |
|---|---|---|
db.query | read | allow |
db.delete | destructive | admins only |
payments.send | money | up to $100 allowed; above $100 needs a human |
| any other tool | — | denied until it gets a rule |
src/tool-policy.ts
import { createGuard } from "agent-permission-kit";
type Ctx = { role: "member" | "admin"; userId: string };
export const guard = createGuard<Record<string, unknown>, Ctx>({
rules: {
"db.query": "allow",
"db.delete": ({ context }) =>
context?.role === "admin" ? "allow" : { decision: "deny", reason: "Only admins can delete records" },
"payments.send": ({ input }) =>
(input as { amount: number }).amount > 100
? { decision: "require_approval", reason: "Payments above $100 need a human" }
: "allow",
},
onApprovalRequired: async (req) => {
const ok = await askOnSlack(`Send $${(req.input as { amount: number }).amount}?`, req.signal);
return ok ? { approved: true, approvedBy: ok.userId } : { approved: false };
},
onAudit: (event) => logger.info(event, `tool ${event.type}: ${event.tool}`),
});
src/server.ts
import { guardMcpServer } from "agent-permission-kit/mcp";
const server = new McpServer({ name: "billing", version: "1.0.0" });
guardMcpServer(server, guard, {
context: (extra) => ({ role: roleFrom(extra.authInfo), userId: userFrom(extra.authInfo) }),
});
// every registerTool below is now guarded; unknown tools are denied
test/tool-policy.test.ts
import { expectDecisions } from "agent-permission-kit/testing";
await expectDecisions(guard, [
["db.query", {}, "allow", member],
["db.delete", { id: 1 }, "deny", member],
["db.delete", { id: 1 }, "allow", admin],
["payments.send", { amount: 40 }, "allow", member],
["payments.send", { amount: 250 }, "require_approval", member],
["shell.exec", {}, "deny", admin],
]);
Next steps
- Replace
askOnSlackwith your approval channel, and authenticate who approves. - Add a coverage test: every registered tool must have a rule, so new tools fail CI until someone decides.
- Make sure
info-level logs reach production, so allowed calls are audited too.
Connects securely to your tools. The creator never sees your data.
About this skill
AI agents now call tools that write to databases, send emails and move money, and the model chooses the arguments. This skill teaches your agent to put one policy table in front of every tool call, using the open-source agent-permission-kit library (MIT, zero dependencies).
What your agent will do
- Inventory your tools: find every tool definition, classify it (read, write, destructive, money, external send) and surface any authorization already buried inside handlers.
- Write the policy table:
allow,denyorrequire_approvalper tool, with conditional rules on the input and the caller's role. Unknown tools are denied by default. - Wire it in wherever tools execute: MCP servers (official TypeScript SDK v1 and v2), Vercel AI SDK, OpenAI Agents JS, Claude Agent SDK, or a custom agent loop.
- Set up human approval: an approval callback, or preview-then-confirm for stateless servers.
- Audit every call without logging sensitive arguments.
- Add tests: a coverage test that fails CI when a new tool has no rule, and a decision table pinned per role.
Why it's safe by default
- Fails closed: a policy that throws, times out or returns garbage denies. Only
{ approved: true }approves. - The handler receives a frozen copy of the exact arguments that were authorized, so they can't change between check and execution.
- Replayed tool-call ids are refused, and a polluted
Object.prototypecan't grant access.
Good fit when
- your agent or MCP server exposes tools with side effects;
- you need role-based rules (viewer / editor / admin) for agent actions;
- you want new tools blocked until someone decides who may use them.
Requires Node.js 22+ and TypeScript or JavaScript.
How to use
Skills on Agensi run inside your AI agent. Copy the prompt, paste it into your agent, and it connects to Agensi and installs this skill for you. If a payment is needed, your agent shows it to you first.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill passes our trust checks below.
Security scanned
Passed our 8-point scan before listing
Fresh listing
Recently published to Agensi
Free forever
No account required to browse
Trust & safety
Security scanned
Verified clean today
- Free to download with an account
Requires