jobseek-mcp 0.8.1 → 0.9.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/dist/server.js CHANGED
@@ -10,6 +10,7 @@ import { myApplicationsTool, handleMyApplications } from "./tools/my-application
10
10
  import { getFormDataTool, handleGetFormData } from "./tools/get-form-data.js";
11
11
  import { evaluateJobTool, handleEvaluateJob } from "./tools/evaluate-job.js";
12
12
  import { updateApplicationStatusTool, handleUpdateApplicationStatus } from "./tools/update-application-status.js";
13
+ import { tokenBalanceTool, handleGetTokenBalance } from "./tools/token-balance.js";
13
14
  import { allResources, handleReadResource } from "./resources.js";
14
15
  import { allPrompts, getPromptMessages } from "./prompts.js";
15
16
  export function createServer(apiKey) {
@@ -19,7 +20,7 @@ export function createServer(apiKey) {
19
20
  // Create the MCP server
20
21
  const server = new Server({
21
22
  name: "jobseek-mcp",
22
- version: "0.7.0",
23
+ version: "0.8.0",
23
24
  }, {
24
25
  capabilities: {
25
26
  tools: {},
@@ -41,6 +42,7 @@ export function createServer(apiKey) {
41
42
  getFormDataTool,
42
43
  evaluateJobTool,
43
44
  updateApplicationStatusTool,
45
+ tokenBalanceTool,
44
46
  ],
45
47
  };
46
48
  });
@@ -68,6 +70,8 @@ export function createServer(apiKey) {
68
70
  return handleEvaluateJob(args, JOBSEEK_API_URL, apiKey);
69
71
  case "update_application_status":
70
72
  return handleUpdateApplicationStatus(args, JOBSEEK_API_URL, apiKey);
73
+ case "get_token_balance":
74
+ return handleGetTokenBalance(args, JOBSEEK_API_URL, apiKey);
71
75
  default:
72
76
  throw new Error(`Unknown tool: ${name}`);
73
77
  }
@@ -0,0 +1,15 @@
1
+ export declare const tokenBalanceTool: {
2
+ name: string;
3
+ description: string;
4
+ inputSchema: {
5
+ type: string;
6
+ properties: {};
7
+ required: never[];
8
+ };
9
+ };
10
+ export declare function handleGetTokenBalance(args: unknown, apiUrl: string, apiKey?: string): Promise<{
11
+ content: Array<{
12
+ type: string;
13
+ text: string;
14
+ }>;
15
+ }>;
@@ -0,0 +1,98 @@
1
+ import { z } from "zod";
2
+ // Tool definition
3
+ export const tokenBalanceTool = {
4
+ name: "get_token_balance",
5
+ description: "Check your current AI credit/token balance. Shows how many tokens you've used, your total budget, and how many remain. Use this to understand your usage before performing token-intensive operations.",
6
+ inputSchema: {
7
+ type: "object",
8
+ properties: {},
9
+ required: []
10
+ }
11
+ };
12
+ // Input validation (no inputs required)
13
+ const TokenBalanceInput = z.object({});
14
+ // Tool handler
15
+ export async function handleGetTokenBalance(args, apiUrl, apiKey) {
16
+ TokenBalanceInput.parse(args);
17
+ if (!apiKey) {
18
+ return {
19
+ content: [{
20
+ type: "text",
21
+ text: `❌ **API Key Required**\n\nGet your API key at: ${apiUrl}/dashboard/api-keys`
22
+ }]
23
+ };
24
+ }
25
+ try {
26
+ const response = await fetch(`${apiUrl}/api/usage`, {
27
+ headers: {
28
+ "Authorization": `Bearer ${apiKey}`,
29
+ },
30
+ });
31
+ if (!response.ok) {
32
+ if (response.status === 401) {
33
+ return {
34
+ content: [{
35
+ type: "text",
36
+ text: `❌ **Invalid API Key**\n\nGenerate a new key at: ${apiUrl}/dashboard/api-keys`
37
+ }]
38
+ };
39
+ }
40
+ const error = await response.json().catch(() => ({}));
41
+ return {
42
+ content: [{
43
+ type: "text",
44
+ text: `❌ **Error**\n\n${error.error || 'Failed to fetch token balance'}`
45
+ }]
46
+ };
47
+ }
48
+ const data = await response.json();
49
+ const { tokenUsage, tokenBudget, isAdmin } = data;
50
+ const remaining = tokenBudget - tokenUsage;
51
+ const percentUsed = tokenBudget > 0 ? Math.round((tokenUsage / tokenBudget) * 100) : 0;
52
+ let statusEmoji = '🟢';
53
+ let statusText = 'Healthy';
54
+ if (percentUsed >= 90) {
55
+ statusEmoji = '🔴';
56
+ statusText = 'Low - Consider purchasing more credits';
57
+ }
58
+ else if (percentUsed >= 70) {
59
+ statusEmoji = '🟡';
60
+ statusText = 'Moderate';
61
+ }
62
+ let output = `# ⚡ AI Credit Balance\n\n`;
63
+ if (isAdmin) {
64
+ output += `| Metric | Value |\n`;
65
+ output += `|--------|-------|\n`;
66
+ output += `| **Tokens Used** | ${tokenUsage.toLocaleString()} |\n`;
67
+ output += `| **Budget** | ∞ Unlimited (Admin) |\n`;
68
+ output += `| **Status** | 🟢 No limits |\n`;
69
+ }
70
+ else {
71
+ output += `| Metric | Value |\n`;
72
+ output += `|--------|-------|\n`;
73
+ output += `| **Tokens Used** | ${tokenUsage.toLocaleString()} |\n`;
74
+ output += `| **Total Budget** | ${tokenBudget.toLocaleString()} |\n`;
75
+ output += `| **Remaining** | ${remaining.toLocaleString()} |\n`;
76
+ output += `| **Used** | ${percentUsed}% |\n`;
77
+ output += `| **Status** | ${statusEmoji} ${statusText} |\n`;
78
+ if (percentUsed >= 70) {
79
+ output += `\n---\n\n`;
80
+ output += `💡 **Tip:** Purchase more credits at: ${apiUrl}/dashboard/tokens\n`;
81
+ }
82
+ }
83
+ return {
84
+ content: [{
85
+ type: "text",
86
+ text: output
87
+ }]
88
+ };
89
+ }
90
+ catch (error) {
91
+ return {
92
+ content: [{
93
+ type: "text",
94
+ text: `❌ **Error**\n\nFailed to fetch token balance: ${error.message}`
95
+ }]
96
+ };
97
+ }
98
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jobseek-mcp",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "JobSeek MCP Server - AI-powered job search automation for Claude. Enables automated job searching with Claude for Chrome browser control.",
5
5
  "author": "Shawn Mitchell",
6
6
  "license": "MIT",