@linkedapi/mcp 0.3.11 → 1.0.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 (67) hide show
  1. package/.github/workflows/merge-main.yaml +9 -9
  2. package/.github/workflows/pr-main.yaml +4 -4
  3. package/dist/linked-api-server.d.ts.map +1 -1
  4. package/dist/linked-api-server.js +27 -5
  5. package/dist/linked-api-server.js.map +1 -1
  6. package/dist/linked-api-tools.d.ts +3 -0
  7. package/dist/linked-api-tools.d.ts.map +1 -1
  8. package/dist/linked-api-tools.js +26 -0
  9. package/dist/linked-api-tools.js.map +1 -1
  10. package/dist/tools/admin-connect-account.d.ts +14 -0
  11. package/dist/tools/admin-connect-account.d.ts.map +1 -0
  12. package/dist/tools/admin-connect-account.js +27 -0
  13. package/dist/tools/admin-connect-account.js.map +1 -0
  14. package/dist/tools/admin-disconnect-account.d.ts +16 -0
  15. package/dist/tools/admin-disconnect-account.d.ts.map +1 -0
  16. package/dist/tools/admin-disconnect-account.js +35 -0
  17. package/dist/tools/admin-disconnect-account.js.map +1 -0
  18. package/dist/tools/admin-get-accounts.d.ts +14 -0
  19. package/dist/tools/admin-get-accounts.d.ts.map +1 -0
  20. package/dist/tools/admin-get-accounts.js +27 -0
  21. package/dist/tools/admin-get-accounts.js.map +1 -0
  22. package/dist/tools/admin-get-limits-usage.d.ts +20 -0
  23. package/dist/tools/admin-get-limits-usage.d.ts.map +1 -0
  24. package/dist/tools/admin-get-limits-usage.js +35 -0
  25. package/dist/tools/admin-get-limits-usage.js.map +1 -0
  26. package/dist/tools/admin-get-seats.d.ts +18 -0
  27. package/dist/tools/admin-get-seats.d.ts.map +1 -0
  28. package/dist/tools/admin-get-seats.js +27 -0
  29. package/dist/tools/admin-get-seats.js.map +1 -0
  30. package/dist/tools/admin-get-subscription-status.d.ts +14 -0
  31. package/dist/tools/admin-get-subscription-status.d.ts.map +1 -0
  32. package/dist/tools/admin-get-subscription-status.js +27 -0
  33. package/dist/tools/admin-get-subscription-status.js.map +1 -0
  34. package/dist/tools/admin-regenerate-token.d.ts +16 -0
  35. package/dist/tools/admin-regenerate-token.d.ts.map +1 -0
  36. package/dist/tools/admin-regenerate-token.js +35 -0
  37. package/dist/tools/admin-regenerate-token.js.map +1 -0
  38. package/dist/tools/admin-reset-limits.d.ts +16 -0
  39. package/dist/tools/admin-reset-limits.d.ts.map +1 -0
  40. package/dist/tools/admin-reset-limits.js +35 -0
  41. package/dist/tools/admin-reset-limits.js.map +1 -0
  42. package/dist/tools/admin-set-limits.d.ts +26 -0
  43. package/dist/tools/admin-set-limits.d.ts.map +1 -0
  44. package/dist/tools/admin-set-limits.js +68 -0
  45. package/dist/tools/admin-set-limits.js.map +1 -0
  46. package/dist/tools/admin-set-seats.d.ts +24 -0
  47. package/dist/tools/admin-set-seats.d.ts.map +1 -0
  48. package/dist/tools/admin-set-seats.js +47 -0
  49. package/dist/tools/admin-set-seats.js.map +1 -0
  50. package/dist/utils/admin-tool.d.ts +14 -0
  51. package/dist/utils/admin-tool.d.ts.map +1 -0
  52. package/dist/utils/admin-tool.js +10 -0
  53. package/dist/utils/admin-tool.js.map +1 -0
  54. package/package.json +2 -2
  55. package/src/linked-api-server.ts +35 -12
  56. package/src/linked-api-tools.ts +29 -0
  57. package/src/tools/admin-connect-account.ts +34 -0
  58. package/src/tools/admin-disconnect-account.ts +40 -0
  59. package/src/tools/admin-get-accounts.ts +30 -0
  60. package/src/tools/admin-get-limits-usage.ts +42 -0
  61. package/src/tools/admin-get-seats.ts +34 -0
  62. package/src/tools/admin-get-subscription-status.ts +33 -0
  63. package/src/tools/admin-regenerate-token.ts +43 -0
  64. package/src/tools/admin-reset-limits.ts +39 -0
  65. package/src/tools/admin-set-limits.ts +75 -0
  66. package/src/tools/admin-set-seats.ts +52 -0
  67. package/src/utils/admin-tool.ts +22 -0
@@ -0,0 +1,33 @@
1
+ import { LinkedApiAdmin, TSubscriptionStatus } from '@linkedapi/node';
2
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import z from 'zod';
4
+
5
+ import { AdminTool } from '../utils/admin-tool.js';
6
+
7
+ export class AdminGetSubscriptionStatusTool extends AdminTool<
8
+ Record<string, never>,
9
+ TSubscriptionStatus
10
+ > {
11
+ public readonly name = 'admin_get_subscription_status';
12
+ protected readonly schema = z.object({});
13
+
14
+ public override async execute({
15
+ admin,
16
+ }: {
17
+ admin: LinkedApiAdmin;
18
+ args: Record<string, never>;
19
+ }): Promise<TSubscriptionStatus> {
20
+ return await admin.subscription.getStatus();
21
+ }
22
+
23
+ public override getTool(): Tool {
24
+ return {
25
+ name: this.name,
26
+ description: 'Get current subscription status, trial eligibility, and cancellation schedule.',
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {},
30
+ },
31
+ };
32
+ }
33
+ }
@@ -0,0 +1,43 @@
1
+ import { LinkedApiAdmin, TRegenerateTokenParams, TRegenerateTokenResult } from '@linkedapi/node';
2
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import z from 'zod';
4
+
5
+ import { AdminTool } from '../utils/admin-tool.js';
6
+
7
+ export class AdminRegenerateTokenTool extends AdminTool<
8
+ TRegenerateTokenParams,
9
+ TRegenerateTokenResult
10
+ > {
11
+ public readonly name = 'admin_regenerate_token';
12
+ protected readonly schema = z.object({
13
+ accountId: z.string(),
14
+ });
15
+
16
+ public override async execute({
17
+ admin,
18
+ args,
19
+ }: {
20
+ admin: LinkedApiAdmin;
21
+ args: TRegenerateTokenParams;
22
+ }): Promise<TRegenerateTokenResult> {
23
+ return await admin.accounts.regenerateIdentificationToken(args);
24
+ }
25
+
26
+ public override getTool(): Tool {
27
+ return {
28
+ name: this.name,
29
+ description:
30
+ 'Regenerate identification token for an account. The old token becomes invalid immediately.',
31
+ inputSchema: {
32
+ type: 'object',
33
+ properties: {
34
+ accountId: {
35
+ type: 'string',
36
+ description: 'UUID of the account',
37
+ },
38
+ },
39
+ required: ['accountId'],
40
+ },
41
+ };
42
+ }
43
+ }
@@ -0,0 +1,39 @@
1
+ import { LinkedApiAdmin, TResetLimitsParams } from '@linkedapi/node';
2
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import z from 'zod';
4
+
5
+ import { AdminTool } from '../utils/admin-tool.js';
6
+
7
+ export class AdminResetLimitsTool extends AdminTool<TResetLimitsParams, void> {
8
+ public readonly name = 'admin_reset_limits';
9
+ protected readonly schema = z.object({
10
+ accountId: z.string(),
11
+ });
12
+
13
+ public override async execute({
14
+ admin,
15
+ args,
16
+ }: {
17
+ admin: LinkedApiAdmin;
18
+ args: TResetLimitsParams;
19
+ }): Promise<void> {
20
+ await admin.limits.resetToDefaults(args);
21
+ }
22
+
23
+ public override getTool(): Tool {
24
+ return {
25
+ name: this.name,
26
+ description: 'Reset all rate limits for an account to the system defaults.',
27
+ inputSchema: {
28
+ type: 'object',
29
+ properties: {
30
+ accountId: {
31
+ type: 'string',
32
+ description: 'Account UUID',
33
+ },
34
+ },
35
+ required: ['accountId'],
36
+ },
37
+ };
38
+ }
39
+ }
@@ -0,0 +1,75 @@
1
+ import { LinkedApiAdmin, TSetLimitsParams } from '@linkedapi/node';
2
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import z from 'zod';
4
+
5
+ import { AdminTool } from '../utils/admin-tool.js';
6
+
7
+ export class AdminSetLimitsTool extends AdminTool<TSetLimitsParams, void> {
8
+ public readonly name = 'admin_set_limits';
9
+ protected readonly schema = z.object({
10
+ accountId: z.string(),
11
+ limits: z.array(
12
+ z.object({
13
+ category: z.string(),
14
+ period: z.enum(['daily', 'weekly', 'monthly']),
15
+ maxValue: z.number().int().min(0),
16
+ isEnabled: z.boolean().optional(),
17
+ }),
18
+ ),
19
+ });
20
+
21
+ public override async execute({
22
+ admin,
23
+ args,
24
+ }: {
25
+ admin: LinkedApiAdmin;
26
+ args: TSetLimitsParams;
27
+ }): Promise<void> {
28
+ await admin.limits.set(args);
29
+ }
30
+
31
+ public override getTool(): Tool {
32
+ return {
33
+ name: this.name,
34
+ description:
35
+ 'Set rate limits for an account. Only specified limits are created or updated; other limits remain unchanged. Categories: stPersonProfileViews, stCompanyPageViews, stConnectionRequests, stMessages, stSearchQueries, stReactions, stComments, stPosts, nvPersonProfileViews, nvCompanyPageViews, nvMessages.',
36
+ inputSchema: {
37
+ type: 'object',
38
+ properties: {
39
+ accountId: {
40
+ type: 'string',
41
+ description: 'Account UUID',
42
+ },
43
+ limits: {
44
+ type: 'array',
45
+ description: 'Array of limit configurations',
46
+ items: {
47
+ type: 'object',
48
+ properties: {
49
+ category: {
50
+ type: 'string',
51
+ description: 'Limit category',
52
+ },
53
+ period: {
54
+ type: 'string',
55
+ enum: ['daily', 'weekly', 'monthly'],
56
+ description: 'Limit period',
57
+ },
58
+ maxValue: {
59
+ type: 'number',
60
+ description: 'Maximum allowed actions (>= 0)',
61
+ },
62
+ isEnabled: {
63
+ type: 'boolean',
64
+ description: 'Whether this limit is enforced (default: true)',
65
+ },
66
+ },
67
+ required: ['category', 'period', 'maxValue'],
68
+ },
69
+ },
70
+ },
71
+ required: ['accountId', 'limits'],
72
+ },
73
+ };
74
+ }
75
+ }
@@ -0,0 +1,52 @@
1
+ import { LinkedApiAdmin, TSetSeatsParams, TSetSeatsResult } from '@linkedapi/node';
2
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import z from 'zod';
4
+
5
+ import { AdminTool } from '../utils/admin-tool.js';
6
+
7
+ export class AdminSetSeatsTool extends AdminTool<TSetSeatsParams, TSetSeatsResult> {
8
+ public readonly name = 'admin_set_seats';
9
+ protected readonly schema = z.object({
10
+ quantity: z.number().int().min(1).max(1000),
11
+ seatType: z.enum(['core', 'plus']),
12
+ billingPeriod: z.enum(['month', 'year']),
13
+ });
14
+
15
+ public override async execute({
16
+ admin,
17
+ args,
18
+ }: {
19
+ admin: LinkedApiAdmin;
20
+ args: TSetSeatsParams;
21
+ }): Promise<TSetSeatsResult> {
22
+ return await admin.subscription.setSeats(args);
23
+ }
24
+
25
+ public override getTool(): Tool {
26
+ return {
27
+ name: this.name,
28
+ description:
29
+ 'Set number of subscription seats. Returns checkout link if no active subscription, otherwise updates immediately.',
30
+ inputSchema: {
31
+ type: 'object',
32
+ properties: {
33
+ quantity: {
34
+ type: 'number',
35
+ description: 'Number of seats (1-1000)',
36
+ },
37
+ seatType: {
38
+ type: 'string',
39
+ enum: ['core', 'plus'],
40
+ description: 'Seat type. "plus" unlocks Sales Navigator actions.',
41
+ },
42
+ billingPeriod: {
43
+ type: 'string',
44
+ enum: ['month', 'year'],
45
+ description: 'Billing period',
46
+ },
47
+ },
48
+ required: ['quantity', 'seatType', 'billingPeriod'],
49
+ },
50
+ };
51
+ }
52
+ }
@@ -0,0 +1,22 @@
1
+ import { LinkedApiAdmin } from '@linkedapi/node';
2
+ import { Tool } from '@modelcontextprotocol/sdk/types.js';
3
+ import z from 'zod';
4
+
5
+ export abstract class AdminTool<TParams, TResult> {
6
+ public abstract readonly name: string;
7
+ protected abstract readonly schema: z.ZodSchema;
8
+
9
+ public abstract getTool(): Tool;
10
+
11
+ public validate(args: unknown): TParams {
12
+ return this.schema.parse(args) as TParams;
13
+ }
14
+
15
+ public abstract execute({
16
+ admin,
17
+ args,
18
+ }: {
19
+ admin: LinkedApiAdmin;
20
+ args: TParams;
21
+ }): Promise<TResult>;
22
+ }