@sargonpiraev/hh-mcp-server 1.12.0 → 1.14.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/build/index.js +174 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -301,7 +301,7 @@ const logger = {
|
|
|
301
301
|
debug: (...message) => mcpServer.server.sendLoggingMessage({ level: 'debug', data: message.join(' ') }),
|
|
302
302
|
};
|
|
303
303
|
const apiClient = axios.create({
|
|
304
|
-
baseURL: '',
|
|
304
|
+
baseURL: 'https://api.hh.ru',
|
|
305
305
|
headers: {
|
|
306
306
|
Accept: 'application/json',
|
|
307
307
|
},
|
|
@@ -315,6 +315,179 @@ apiClient.interceptors.request.use((config) => {
|
|
|
315
315
|
}, (error) => {
|
|
316
316
|
return Promise.reject(error);
|
|
317
317
|
});
|
|
318
|
+
function handleResult(data) {
|
|
319
|
+
return {
|
|
320
|
+
content: [
|
|
321
|
+
{
|
|
322
|
+
type: 'text',
|
|
323
|
+
text: JSON.stringify(data, null, 2),
|
|
324
|
+
},
|
|
325
|
+
],
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function handleError(error) {
|
|
329
|
+
console.error(error);
|
|
330
|
+
logger.error('Error occurred:', JSON.stringify(error));
|
|
331
|
+
if (axios.isAxiosError(error)) {
|
|
332
|
+
const message = error.response?.data?.message || error.message;
|
|
333
|
+
return {
|
|
334
|
+
isError: true,
|
|
335
|
+
content: [{ type: 'text', text: `API Error: ${message}` }],
|
|
336
|
+
};
|
|
337
|
+
}
|
|
338
|
+
return {
|
|
339
|
+
isError: true,
|
|
340
|
+
content: [{ type: 'text', text: `Error: ${error}` }],
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
mcpServer.tool('confirm-phone-in-resume', `Verify phone with a code`, {}, async (args) => {
|
|
344
|
+
try {
|
|
345
|
+
const response = await apiClient.post('/resume_phone_confirm', args);
|
|
346
|
+
return handleResult(response.data);
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
return handleError(error);
|
|
350
|
+
}
|
|
351
|
+
});
|
|
352
|
+
mcpServer.tool('get-manager-settings', `Manager preferences`, {
|
|
353
|
+
employer_id: z.string(),
|
|
354
|
+
manager_id: z.string(),
|
|
355
|
+
}, async (args) => {
|
|
356
|
+
try {
|
|
357
|
+
const { employer_id, manager_id, ...queryParams } = args;
|
|
358
|
+
const url = `/employers/${employer_id}/managers/${manager_id}/settings`;
|
|
359
|
+
const response = await apiClient.get(url, {
|
|
360
|
+
params: queryParams,
|
|
361
|
+
});
|
|
362
|
+
return handleResult(response.data);
|
|
363
|
+
}
|
|
364
|
+
catch (error) {
|
|
365
|
+
return handleError(error);
|
|
366
|
+
}
|
|
367
|
+
});
|
|
368
|
+
mcpServer.tool('get-employer-manager-limits', `Daily limit of resume views for current manager`, {
|
|
369
|
+
employer_id: z.string(),
|
|
370
|
+
manager_id: z.string(),
|
|
371
|
+
}, async (args) => {
|
|
372
|
+
try {
|
|
373
|
+
const { employer_id, manager_id, ...queryParams } = args;
|
|
374
|
+
const url = `/employers/${employer_id}/managers/${manager_id}/limits/resume`;
|
|
375
|
+
const response = await apiClient.get(url, {
|
|
376
|
+
params: queryParams,
|
|
377
|
+
});
|
|
378
|
+
return handleResult(response.data);
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
return handleError(error);
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
mcpServer.tool('get-employer-addresses', `Directory of employer's addresses`, {
|
|
385
|
+
employer_id: z.string(),
|
|
386
|
+
changed_after: z.string().optional(),
|
|
387
|
+
manager_id: z.string().optional(),
|
|
388
|
+
with_manager: z.string().optional(),
|
|
389
|
+
per_page: z.string().optional(),
|
|
390
|
+
page: z.string().optional(),
|
|
391
|
+
}, async (args) => {
|
|
392
|
+
try {
|
|
393
|
+
const { employer_id, ...queryParams } = args;
|
|
394
|
+
const url = `/employers/${employer_id}/addresses`;
|
|
395
|
+
const response = await apiClient.get(url, {
|
|
396
|
+
params: queryParams,
|
|
397
|
+
});
|
|
398
|
+
return handleResult(response.data);
|
|
399
|
+
}
|
|
400
|
+
catch (error) {
|
|
401
|
+
return handleError(error);
|
|
402
|
+
}
|
|
403
|
+
});
|
|
404
|
+
mcpServer.tool('get-employer-managers', `Directory of employer's managers`, {
|
|
405
|
+
employer_id: z.string(),
|
|
406
|
+
page: z.string().optional(),
|
|
407
|
+
per_page: z.string().optional(),
|
|
408
|
+
search_text: z.string().optional(),
|
|
409
|
+
}, async (args) => {
|
|
410
|
+
try {
|
|
411
|
+
const { employer_id, ...queryParams } = args;
|
|
412
|
+
const url = `/employers/${employer_id}/managers`;
|
|
413
|
+
const response = await apiClient.get(url, {
|
|
414
|
+
params: queryParams,
|
|
415
|
+
});
|
|
416
|
+
return handleResult(response.data);
|
|
417
|
+
}
|
|
418
|
+
catch (error) {
|
|
419
|
+
return handleError(error);
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
mcpServer.tool('add-employer-manager', `Adding a manager`, {
|
|
423
|
+
employer_id: z.string(),
|
|
424
|
+
}, async (args) => {
|
|
425
|
+
try {
|
|
426
|
+
const { employer_id, ...requestData } = args;
|
|
427
|
+
const url = `/employers/${employer_id}/managers`;
|
|
428
|
+
const response = await apiClient.post(url, requestData);
|
|
429
|
+
return handleResult(response.data);
|
|
430
|
+
}
|
|
431
|
+
catch (error) {
|
|
432
|
+
return handleError(error);
|
|
433
|
+
}
|
|
434
|
+
});
|
|
435
|
+
mcpServer.tool('get-employer-manager-types', `Directory of manager types and privileges`, {
|
|
436
|
+
employer_id: z.string(),
|
|
437
|
+
}, async (args) => {
|
|
438
|
+
try {
|
|
439
|
+
const { employer_id, ...queryParams } = args;
|
|
440
|
+
const url = `/employers/${employer_id}/manager_types`;
|
|
441
|
+
const response = await apiClient.get(url, {
|
|
442
|
+
params: queryParams,
|
|
443
|
+
});
|
|
444
|
+
return handleResult(response.data);
|
|
445
|
+
}
|
|
446
|
+
catch (error) {
|
|
447
|
+
return handleError(error);
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
mcpServer.tool('get-manager-accounts', `Manager's work accounts`, {}, async (args) => {
|
|
451
|
+
try {
|
|
452
|
+
const response = await apiClient.get('/manager_accounts/mine', {
|
|
453
|
+
params: args,
|
|
454
|
+
});
|
|
455
|
+
return handleResult(response.data);
|
|
456
|
+
}
|
|
457
|
+
catch (error) {
|
|
458
|
+
return handleError(error);
|
|
459
|
+
}
|
|
460
|
+
});
|
|
461
|
+
mcpServer.tool('get-applicant-phone-info', `Get information about the applicant's phone number`, {
|
|
462
|
+
phone: z.string(),
|
|
463
|
+
}, async (args) => {
|
|
464
|
+
try {
|
|
465
|
+
const response = await apiClient.get('/resume_should_send_sms', {
|
|
466
|
+
params: args,
|
|
467
|
+
});
|
|
468
|
+
return handleResult(response.data);
|
|
469
|
+
}
|
|
470
|
+
catch (error) {
|
|
471
|
+
return handleError(error);
|
|
472
|
+
}
|
|
473
|
+
});
|
|
474
|
+
mcpServer.tool('get-address', `Get address by ID`, {
|
|
475
|
+
employer_id: z.string(),
|
|
476
|
+
address_id: z.string(),
|
|
477
|
+
with_manager: z.string().optional(),
|
|
478
|
+
}, async (args) => {
|
|
479
|
+
try {
|
|
480
|
+
const { employer_id, address_id, ...queryParams } = args;
|
|
481
|
+
const url = `/employers/${employer_id}/addresses/${address_id}`;
|
|
482
|
+
const response = await apiClient.get(url, {
|
|
483
|
+
params: queryParams,
|
|
484
|
+
});
|
|
485
|
+
return handleResult(response.data);
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
return handleError(error);
|
|
489
|
+
}
|
|
490
|
+
});
|
|
318
491
|
async function main() {
|
|
319
492
|
const transport = new StdioServerTransport();
|
|
320
493
|
await mcpServer.server.connect(transport);
|