whistler-mcp 1.0.3 → 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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +47 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "whistler-mcp",
3
- "version": "1.0.3",
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.' };