@calybur/mcp 0.1.0 → 0.2.0

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 CHANGED
@@ -19,10 +19,7 @@ Add to `.cursor/mcp.json`:
19
19
  "command": "npx",
20
20
  "args": ["-y", "@calybur/mcp@latest"],
21
21
  "env": {
22
- "CALYBUR_API_KEY": "ezg_live_your_key_here",
23
- "CALYBUR_API_BASE_URL": "https://YOUR_PROJECT.supabase.co/functions/v1",
24
- "CALYBUR_SUPABASE_PUBLISHABLE_KEY": "your_supabase_publishable_key",
25
- "CALYBUR_PLAN": "starter"
22
+ "CALYBUR_API_KEY": "ezg_live_your_key_here"
26
23
  }
27
24
  }
28
25
  }
@@ -36,9 +33,9 @@ Restart Cursor and enable the Calybur MCP tools.
36
33
  | Variable | Required | Description |
37
34
  |----------|----------|-------------|
38
35
  | `CALYBUR_API_KEY` | Yes | Partner API key (`ezg_live_*`) |
39
- | `CALYBUR_API_BASE_URL` | Yes | Supabase Edge Functions base URL |
40
- | `CALYBUR_SUPABASE_PUBLISHABLE_KEY` | Yes | Supabase publishable key (same as app frontend) |
41
36
  | `CALYBUR_PLAN` | No | `starter` (default), `professional`, or `enterprise` |
37
+ | `CALYBUR_API_BASE_URL` | No | Defaults to `https://api.calybur.com` |
38
+ | `CALYBUR_SUPABASE_PUBLISHABLE_KEY` | No | Only if bypassing the gateway with a direct Supabase URL |
42
39
 
43
40
  ## Tools (MVP — read-only)
44
41
 
@@ -66,7 +63,7 @@ cd packages/calybur-mcp
66
63
  npm install
67
64
  npm test
68
65
  npm run build
69
- CALYBUR_API_KEY=... CALYBUR_API_BASE_URL=... npm run dev
66
+ CALYBUR_API_KEY=ezg_live_... npm run dev
70
67
  ```
71
68
 
72
69
  ## Rate Limits
package/dist/client.js CHANGED
@@ -12,14 +12,17 @@ export class CalyburClient {
12
12
  }
13
13
  const query = new URLSearchParams(params).toString();
14
14
  const url = `${this.config.baseUrl}/${functionPath}${query ? `?${query}` : ''}`;
15
+ const headers = {
16
+ 'x-api-key': this.config.apiKey,
17
+ Accept: 'application/json',
18
+ };
19
+ if (!this.config.gatewayMode) {
20
+ headers.apikey = this.config.publishableKey;
21
+ headers.Authorization = `Bearer ${this.config.publishableKey}`;
22
+ }
15
23
  const response = await fetch(url, {
16
24
  method: 'GET',
17
- headers: {
18
- 'x-api-key': this.config.apiKey,
19
- apikey: this.config.publishableKey,
20
- Authorization: `Bearer ${this.config.publishableKey}`,
21
- Accept: 'application/json',
22
- },
25
+ headers,
23
26
  });
24
27
  const body = await response.json().catch(() => ({}));
25
28
  if (!response.ok) {
package/dist/config.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  export type CalyburPlan = 'starter' | 'professional' | 'enterprise';
2
+ export declare const DEFAULT_PARTNER_API_BASE_URL = "https://api.calybur.com";
2
3
  export interface CalyburConfig {
3
4
  apiKey: string;
4
5
  baseUrl: string;
5
6
  publishableKey: string;
6
7
  plan: CalyburPlan;
8
+ gatewayMode: boolean;
7
9
  }
10
+ export declare function isGatewayBaseUrl(baseUrl: string): boolean;
8
11
  export declare function loadConfig(env?: NodeJS.ProcessEnv): CalyburConfig;
9
12
  export declare function defaultLimitForPlan(plan: CalyburPlan): number;
package/dist/config.js CHANGED
@@ -1,27 +1,34 @@
1
+ export const DEFAULT_PARTNER_API_BASE_URL = 'https://api.calybur.com';
1
2
  const VALID_PLANS = ['starter', 'professional', 'enterprise'];
3
+ export function isGatewayBaseUrl(baseUrl) {
4
+ try {
5
+ return new URL(baseUrl).hostname === 'api.calybur.com';
6
+ }
7
+ catch {
8
+ return false;
9
+ }
10
+ }
2
11
  export function loadConfig(env = process.env) {
3
12
  const apiKey = env.CALYBUR_API_KEY?.trim();
4
- const baseUrl = env.CALYBUR_API_BASE_URL?.trim().replace(/\/$/, '');
13
+ const baseUrl = (env.CALYBUR_API_BASE_URL?.trim() || DEFAULT_PARTNER_API_BASE_URL).replace(/\/$/, '');
5
14
  const publishableKey = env.CALYBUR_SUPABASE_PUBLISHABLE_KEY?.trim() ||
6
15
  env.CALYBUR_SUPABASE_ANON_KEY?.trim() ||
7
16
  '';
8
17
  const planRaw = (env.CALYBUR_PLAN?.trim().toLowerCase() || 'starter');
18
+ const gatewayMode = isGatewayBaseUrl(baseUrl);
9
19
  if (!apiKey) {
10
20
  throw new Error('CALYBUR_API_KEY is required');
11
21
  }
12
22
  if (!apiKey.startsWith('ezg_')) {
13
23
  throw new Error('CALYBUR_API_KEY must start with ezg_');
14
24
  }
15
- if (!baseUrl) {
16
- throw new Error('CALYBUR_API_BASE_URL is required');
17
- }
18
- if (!publishableKey) {
19
- throw new Error('CALYBUR_SUPABASE_PUBLISHABLE_KEY is required (Supabase gateway auth for Edge Functions)');
25
+ if (!gatewayMode && !publishableKey) {
26
+ throw new Error('CALYBUR_SUPABASE_PUBLISHABLE_KEY is required when using a direct Supabase API URL');
20
27
  }
21
28
  if (!VALID_PLANS.includes(planRaw)) {
22
29
  throw new Error(`CALYBUR_PLAN must be one of: ${VALID_PLANS.join(', ')}`);
23
30
  }
24
- return { apiKey, baseUrl, publishableKey, plan: planRaw };
31
+ return { apiKey, baseUrl, publishableKey, plan: planRaw, gatewayMode };
25
32
  }
26
33
  export function defaultLimitForPlan(plan) {
27
34
  if (plan === 'enterprise')
package/dist/errors.js CHANGED
@@ -12,7 +12,7 @@ export function formatApiError(error) {
12
12
  if (error.status === 401) {
13
13
  const body = error.body;
14
14
  if (body?.code === 'UNAUTHORIZED_NO_AUTH_HEADER') {
15
- return 'Missing Supabase publishable key. Set CALYBUR_SUPABASE_PUBLISHABLE_KEY in MCP config.';
15
+ return 'Gateway misconfigured. Use https://api.calybur.com or set CALYBUR_SUPABASE_PUBLISHABLE_KEY for direct Supabase access.';
16
16
  }
17
17
  return 'API key invalid or expired. Regenerate at Calybur Settings → API Keys.';
18
18
  }
@@ -19,8 +19,9 @@ Create keys at Calybur Settings → API Keys.`,
19
19
  {
20
20
  title: 'MCP Setup',
21
21
  keywords: ['mcp', 'cursor', 'claude', 'setup', 'config'],
22
- body: `Configure Cursor MCP with npx @calybur/mcp and env vars:
23
- CALYBUR_API_KEY, CALYBUR_API_BASE_URL (Supabase functions/v1 base), optional CALYBUR_PLAN (starter|professional|enterprise).`,
22
+ body: `Configure Cursor MCP with npx @calybur/mcp and env:
23
+ CALYBUR_API_KEY (required). Optional: CALYBUR_PLAN (starter|professional|enterprise).
24
+ Uses https://api.calybur.com gateway — no Supabase keys needed.`,
24
25
  },
25
26
  {
26
27
  title: 'Rate Limits',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@calybur/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "MCP server for Calybur payroll and HR Partner API",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -26,10 +26,13 @@
26
26
  "access": "public"
27
27
  },
28
28
  "bin": {
29
- "calybur-mcp": "./dist/index.js"
29
+ "calybur-mcp": "dist/index.js"
30
30
  },
31
31
  "main": "./dist/index.js",
32
- "files": ["dist", "README.md"],
32
+ "files": [
33
+ "dist",
34
+ "README.md"
35
+ ],
33
36
  "scripts": {
34
37
  "build": "tsc -p tsconfig.json",
35
38
  "dev": "tsx src/index.ts",