@virsanghavi/axis-server 1.6.0 → 1.7.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.
Files changed (2) hide show
  1. package/dist/mcp-server.mjs +23 -23
  2. package/package.json +1 -1
@@ -1035,12 +1035,13 @@ ${conventions}`;
1035
1035
  }
1036
1036
  // --- Billing & Usage ---
1037
1037
  async getSubscriptionStatus(email) {
1038
- logger.info(`[getSubscriptionStatus] Starting - email: ${email}`);
1038
+ logger.info(`[getSubscriptionStatus] Starting - email: ${email || "(API key identity)"}`);
1039
1039
  logger.info(`[getSubscriptionStatus] Config - apiUrl: ${this.contextManager.apiUrl}, apiSecret: ${this.contextManager.apiSecret ? "SET" : "NOT SET"}, useSupabase: ${this.useSupabase}`);
1040
1040
  if (this.contextManager.apiUrl) {
1041
1041
  try {
1042
- logger.info(`[getSubscriptionStatus] Attempting API call to: usage?email=${encodeURIComponent(email)}`);
1043
- const result = await this.callCoordination(`usage?email=${encodeURIComponent(email)}`);
1042
+ const endpoint = email ? `usage?email=${encodeURIComponent(email)}` : "usage";
1043
+ logger.info(`[getSubscriptionStatus] Attempting API call to: ${endpoint}`);
1044
+ const result = await this.callCoordination(endpoint);
1044
1045
  logger.info(`[getSubscriptionStatus] API call successful: ${JSON.stringify(result).substring(0, 200)}`);
1045
1046
  return result;
1046
1047
  } catch (e) {
@@ -1050,8 +1051,8 @@ ${conventions}`;
1050
1051
  } else {
1051
1052
  logger.warn("[getSubscriptionStatus] No API URL configured");
1052
1053
  }
1053
- if (this.useSupabase && this.supabase) {
1054
- const { data: profile, error } = await this.supabase.from("profiles").select("subscription_status, stripe_customer_id, current_period_end").eq("email", email).single();
1054
+ if (this.useSupabase && this.supabase && email) {
1055
+ const { data: profile, error } = await this.supabase.from("profiles").select("subscription_status, stripe_customer_id, current_period_end").ilike("email", email).single();
1055
1056
  if (error || !profile) {
1056
1057
  return { status: "unknown", message: "Profile not found." };
1057
1058
  }
@@ -1066,21 +1067,22 @@ ${conventions}`;
1066
1067
  return { error: "Coordination not configured. API URL not set and Supabase not available." };
1067
1068
  }
1068
1069
  async getUsageStats(email) {
1069
- logger.info(`[getUsageStats] Starting - email: ${email}`);
1070
+ logger.info(`[getUsageStats] Starting - email: ${email || "(API key identity)"}`);
1070
1071
  logger.info(`[getUsageStats] Config - apiUrl: ${this.contextManager.apiUrl}, apiSecret: ${this.contextManager.apiSecret ? "SET" : "NOT SET"}, useSupabase: ${this.useSupabase}`);
1071
1072
  if (this.contextManager.apiUrl) {
1072
1073
  try {
1073
- logger.info(`[getUsageStats] Attempting API call to: usage?email=${encodeURIComponent(email)}`);
1074
- const result = await this.callCoordination(`usage?email=${encodeURIComponent(email)}`);
1074
+ const endpoint = email ? `usage?email=${encodeURIComponent(email)}` : "usage";
1075
+ logger.info(`[getUsageStats] Attempting API call to: ${endpoint}`);
1076
+ const result = await this.callCoordination(endpoint);
1075
1077
  logger.info(`[getUsageStats] API call successful: ${JSON.stringify(result).substring(0, 200)}`);
1076
- return { email, usageCount: result.usageCount || 0 };
1078
+ return { email: email || result.email, usageCount: result.usageCount || 0 };
1077
1079
  } catch (e) {
1078
1080
  logger.error(`[getUsageStats] API call failed: ${e.message}`, e);
1079
1081
  return { error: `API call failed: ${e.message}` };
1080
1082
  }
1081
1083
  }
1082
- if (this.useSupabase && this.supabase) {
1083
- const { data: profile } = await this.supabase.from("profiles").select("usage_count").eq("email", email).single();
1084
+ if (this.useSupabase && this.supabase && email) {
1085
+ const { data: profile } = await this.supabase.from("profiles").select("usage_count").ilike("email", email).single();
1084
1086
  return { email, usageCount: profile?.usage_count || 0 };
1085
1087
  }
1086
1088
  return { error: "Coordination not configured. API URL not set and Supabase not available." };
@@ -1888,24 +1890,22 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
1888
1890
  // --- Billing & Usage ---
1889
1891
  {
1890
1892
  name: "get_subscription_status",
1891
- description: "**BILLING CHECK**: specific to the Axis business logic.\n- Returns the user's subscription tier (Pro vs Free), Stripe customer ID, and current period end.\n- Critical for gating features behind paywalls.\n- Returns 'Profile not found' if the user doesn't exist in the database.",
1893
+ description: "**BILLING CHECK**: Returns the user's subscription tier (Pro vs Free), Stripe customer ID, and current period end.\n- If no email is provided, returns the subscription status of the current API key owner.\n- Critical for gating features behind paywalls.",
1892
1894
  inputSchema: {
1893
1895
  type: "object",
1894
1896
  properties: {
1895
- email: { type: "string", description: "User email to check." }
1896
- },
1897
- required: ["email"]
1897
+ email: { type: "string", description: "Optional. User email to check. If omitted, checks the subscription of the current API key owner." }
1898
+ }
1898
1899
  }
1899
1900
  },
1900
1901
  {
1901
1902
  name: "get_usage_stats",
1902
- description: "**API USAGE**: Returns a user's token usage and request counts.\n- Useful for debugging rate limits or explaining quota usage to users.",
1903
+ description: "**API USAGE**: Returns token usage and request counts.\n- If no email is provided, returns usage for the current API key owner.\n- Useful for debugging rate limits or explaining quota usage to users.",
1903
1904
  inputSchema: {
1904
1905
  type: "object",
1905
1906
  properties: {
1906
- email: { type: "string", description: "User email to check." }
1907
- },
1908
- required: ["email"]
1907
+ email: { type: "string", description: "Optional. User email to check. If omitted, checks usage of the current API key owner." }
1908
+ }
1909
1909
  }
1910
1910
  },
1911
1911
  {
@@ -2144,8 +2144,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2144
2144
  return { content: [{ type: "text", text: parts.join("\n\n---\n\n") }] };
2145
2145
  }
2146
2146
  if (name === "get_subscription_status") {
2147
- const email = String(args?.email);
2148
- logger.info(`[get_subscription_status] Called with email: ${email}`);
2147
+ const email = args?.email ? String(args.email) : void 0;
2148
+ logger.info(`[get_subscription_status] Called with email: ${email || "(using API key identity)"}`);
2149
2149
  try {
2150
2150
  const result = await nerveCenter.getSubscriptionStatus(email);
2151
2151
  logger.info(`[get_subscription_status] Result: ${JSON.stringify(result).substring(0, 200)}`);
@@ -2156,8 +2156,8 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
2156
2156
  }
2157
2157
  }
2158
2158
  if (name === "get_usage_stats") {
2159
- const email = String(args?.email);
2160
- logger.info(`[get_usage_stats] Called with email: ${email}`);
2159
+ const email = args?.email ? String(args.email) : void 0;
2160
+ logger.info(`[get_usage_stats] Called with email: ${email || "(using API key identity)"}`);
2161
2161
  try {
2162
2162
  const result = await nerveCenter.getUsageStats(email);
2163
2163
  logger.info(`[get_usage_stats] Result: ${JSON.stringify(result).substring(0, 200)}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@virsanghavi/axis-server",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "Axis MCP Server CLI",
5
5
  "main": "dist/index.js",
6
6
  "bin": {