whistler-mcp 1.0.2 → 1.0.4

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.
@@ -3,7 +3,7 @@ import fs from 'fs';
3
3
  import path from 'path';
4
4
  import os from 'os';
5
5
 
6
- const API_BASE_URL = process.env.API_URL || 'http://localhost:5000/api';
6
+ const API_BASE_URL = process.env.API_URL || 'https://whistler-backend.onrender.com/api';
7
7
  export const TOKEN_PATH = path.join(os.homedir(), '.whistler_mcp_token.json');
8
8
 
9
9
  export function getSavedToken() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistler-mcp",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "An MCP Server for retrieving placement data, job roles, and platform statistics from the Whistler API.",
5
5
  "main": "server.js",
6
6
  "bin": {
package/server.js CHANGED
@@ -33,6 +33,31 @@ const toolsDefinition = {
33
33
  schema: z.object({ email: z.string().email(), password: z.string() }),
34
34
  inputSchema: { type: "object", properties: { email: { type: "string" }, password: { type: "string" } }, required: ["email", "password"] }
35
35
  },
36
+ signup_to_whistler: {
37
+ description: "Create a new Whistler account. Use this if the user doesn't have an account yet.",
38
+ schema: z.object({
39
+ name: z.string(),
40
+ email: z.string().email(),
41
+ password: z.string().min(6),
42
+ branch: z.string().describe("Department/Branch e.g. CSE, EE, ME"),
43
+ program: z.string().describe("Program e.g. B.Tech, M.Tech, PhD"),
44
+ graduationYear: z.number().int(),
45
+ currentCPI: z.number().min(0).max(10)
46
+ }),
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {
50
+ name: { type: "string" },
51
+ email: { type: "string" },
52
+ password: { type: "string" },
53
+ branch: { type: "string" },
54
+ program: { type: "string" },
55
+ graduationYear: { type: "number" },
56
+ currentCPI: { type: "number" }
57
+ },
58
+ required: ["name", "email", "password", "branch", "program", "graduationYear", "currentCPI"]
59
+ }
60
+ },
36
61
  logout_whistler: {
37
62
  description: "Log out of Whistler and clear the saved authentication token.",
38
63
  schema: z.object({}),
@@ -147,6 +172,28 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
147
172
  result = { success: true, message: `Successfully authenticated! Token saved securely.` };
148
173
  break;
149
174
  }
175
+ case 'signup_to_whistler': {
176
+ const signupRes = await fetch(`${API_BASE_URL}/auth/signup`, {
177
+ method: 'POST',
178
+ headers: { 'Content-Type': 'application/json' },
179
+ body: JSON.stringify({ ...params, acceptedTerms: true })
180
+ });
181
+
182
+ let signupData = {};
183
+ try {
184
+ signupData = await signupRes.json();
185
+ } catch(e) {
186
+ const text = await signupRes.text();
187
+ throw new Error(`Signup failed with weird response: ${text.substring(0, 100)}`);
188
+ }
189
+
190
+ if (!signupRes.ok) throw new Error(signupData.message || 'Signup failed');
191
+ if (!signupData.token) throw new Error('Signup succeeded but no token was returned.');
192
+
193
+ saveToken(signupData.token, signupData);
194
+ result = { success: true, message: `Account created and authenticated successfully! Welcome to Whistler.` };
195
+ break;
196
+ }
150
197
  case 'logout_whistler':
151
198
  clearToken();
152
199
  result = { success: true, message: 'Logged out successfully. Token cleared.' };