@cdnmn/sdk
v0.1.1
Published
Typed client for the CDN.MN agent API (MCP over /api/mcp + the device-claim flow).
Maintainers
Readme
@cdnmn/sdk
A typed, zero-dependency client for the CDN.MN agent API —
JSON-RPC (MCP) over POST /api/mcp, plus the RFC 8628 device-claim flow for
obtaining a scoped bearer token. Powers
@cdnmn/cli.
Install
npm install @cdnmn/sdkUse
import { CdnmnClient, register, pollForToken } from "@cdnmn/sdk";
// 1. Obtain a token via the device-claim flow (a human approves in the dashboard).
const reg = await register({
apiBase: "https://app.cdn.mn",
scopes: ["project:read"],
});
console.log("Approve at:", reg.verificationUriComplete);
const token = await pollForToken({
apiBase: "https://app.cdn.mn",
deviceCode: reg.deviceCode,
interval: reg.interval,
expiresIn: reg.expiresIn,
});
// 2. Call tools.
const client = new CdnmnClient({
apiBase: "https://app.cdn.mn",
token: token.accessToken,
});
const { projects } = await client.listProjects();fetch is injectable (defaults to the global). Sensitive mutations return a
typed MutationResult (executed | approval_required | dry_run), and
waitForApproval polls get_approval_status until the owner decides. The token
is never printed by the SDK; read it from your environment or a secret store at
the point of use.
Docs
https://app.cdn.mn/docs/cli · Auth & scopes: https://app.cdn.mn/auth.md
MIT licensed.
