Licence
MIT
Version
0.1.0
Deps
2
Size
77 kB
Vulns
0
Weekly
0
keygate
Monetize your MCP server: API keys, plans, usage metering, and rate limits for any server built on the official @modelcontextprotocol/sdk — fully local, no cloud account required.
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { withKeygate, fileKeyStore } from "keygate";
const gated = withKeygate(server, {
keyStore: fileKeyStore("./keygate-keys.json"),
freeTools: ["search"],
paidTools: { generate_report: { plan: "pro" } },
limits: { pro: { unitsPerDay: 1000 } },
upgradeUrl: "https://example.com/upgrade",
});
await gated.connect(new StdioServerTransport());
Create keys with the bundled CLI: npx keygate keys create --plan pro.
Full documentation: https://github.com/AliHaram/keygate