Installation
@majico/sdk
Requires Node.js 18+.
npm install @majico/sdkCredentials
Create a project API key on Account → Integrations (Pro or Creator). Set:
| Variable | Description |
|---|---|
MAJICO_API_KEY | Project API key |
MAJICO_PROJECT_ID | Project UUID (also in your guidelines URL) |
MAJICO_API_URL | Optional — defaults to https://api.majico.xyz |
import { MajicoClient } from "@majico/sdk";
const client = new MajicoClient({
apiKey: process.env.MAJICO_API_KEY!,
projectId: process.env.MAJICO_PROJECT_ID!,
baseUrl: process.env.MAJICO_API_URL ?? "https://api.majico.xyz",
});Verify
const tokens = await client.tokens.get();
console.log(tokens.headingFont, Object.keys(tokens.tokens.light).length);user-majico-mcp
No global install required — Cursor runs it via npx:
npx -y user-majico-mcp@0.5.0Set the same env vars in your MCP config (MAJICO_API_URL, MAJICO_PROJECT_ID, MAJICO_API_KEY). Full setup: MCP server.
Errors
The SDK throws MajicoError with status, code, and isRetryable:
import { MajicoError } from "@majico/sdk";
try {
await client.guidelines.get();
} catch (err) {
if (err instanceof MajicoError) {
console.error(err.status, err.code, err.isRetryable);
}
}401 usually means a bad or revoked API key. 403 often means the project tier does not include API access.
Next: API reference · MCP server