Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@linkedapi/mcp",
"version": "2.2.1",
"version": "2.3.0",
"description": "MCP server that lets AI assistants control LinkedIn accounts and retrieve real-time data.",
"main": "dist/index.js",
"bin": {
Expand Down Expand Up @@ -30,7 +30,7 @@
"author": "Linked API",
"license": "MIT",
"dependencies": {
"@linkedapi/node": "^2.2.1",
"@linkedapi/node": "^2.3.0",
"@modelcontextprotocol/sdk": "^1.17.4",
"zod": "^4.1.1"
},
Expand Down
4 changes: 4 additions & 0 deletions src/linked-api-tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { FetchPostTool } from './tools/fetch-post.js';
import { GetApiUsageTool } from './tools/get-api-usage-stats.js';
import { GetConversationTool } from './tools/get-conversation.js';
import { GetInboxTool } from './tools/get-inbox.js';
import { GetNetworkTool } from './tools/get-network.js';
import { GetWorkflowResultTool } from './tools/get-workflow-result.js';
import { IgnoreConnectionRequestTool } from './tools/ignore-connection-request.js';
import { ManageConversationTool } from './tools/manage-conversation.js';
Expand All @@ -54,6 +55,7 @@ import { SearchPeopleTool } from './tools/search-people.js';
import { SendConnectionRequestTool } from './tools/send-connection-request.js';
import { SendMessageTool } from './tools/send-message.js';
import { SyncInboxTool } from './tools/sync-inbox.js';
import { SyncNetworkTool } from './tools/sync-network.js';
import { WithdrawConnectionRequestTool } from './tools/withdraw-connection-request.js';
import type { TLinkedApiToolResult } from './types/linked-api-tool-result.type.js';
import { AdminTool } from './utils/admin-tool.js';
Expand All @@ -80,6 +82,8 @@ export class LinkedApiTools {
new GetConversationTool(),
new SyncInboxTool(),
new GetInboxTool(),
new SyncNetworkTool(),
new GetNetworkTool(),
new ManageConversationTool(),
new CheckConnectionStatusTool(),
new RetrieveConnectionsTool(),
Expand Down
55 changes: 55 additions & 0 deletions src/tools/get-network.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import LinkedApi, {
TMappedResponse,
TNetworkPollRequest,
TNetworkPollResult,
} from '@linkedapi/node';
import { Tool } from '@modelcontextprotocol/sdk/types.js';
import z from 'zod';

import { LinkedApiTool } from '../utils/linked-api-tool.js';

export class GetNetworkTool extends LinkedApiTool<TNetworkPollRequest, TNetworkPollResult> {
public readonly name = 'get_network';
protected readonly schema = z.object({
since: z.string().optional(),
type: z.enum(['connectionAccepted', 'connectionAdded', 'connectionRequestReceived']).optional(),
});

public override async execute({
linkedapi,
args: { since, type },
}: {
linkedapi: LinkedApi;
args: TNetworkPollRequest;
}): Promise<TMappedResponse<TNetworkPollResult>> {
return linkedapi.pollNetwork({
since,
type,
});
}

public override getTool(): Tool {
return {
name: this.name,
description:
'Get connection events from the monitored network, newest first. Requires network monitoring to be enabled once with sync_network. Event types: "connectionAccepted" (a connection request you sent was accepted), "connectionAdded" (a new connection appeared in your network), "connectionRequestReceived" (someone sent you a connection request).',
inputSchema: {
type: 'object',
properties: {
since: {
type: 'string',
description:
"Optional ISO 8601 timestamp to only retrieve events after this date (e.g., '2024-01-15T10:30:00Z'). If not provided, all captured events are returned.",
},
type: {
type: 'string',
enum: ['connectionAccepted', 'connectionAdded', 'connectionRequestReceived'],
description:
'Optional event type filter: "connectionAccepted", "connectionAdded", or "connectionRequestReceived". If omitted, all event types are returned.',
},
},
required: [],
},
};
}
}
24 changes: 24 additions & 0 deletions src/tools/sync-network.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { OPERATION_NAME, TSyncNetworkParams } from '@linkedapi/node';
import { Tool } from '@modelcontextprotocol/sdk/types.js';
import { z } from 'zod';

import { OperationTool } from '../utils/linked-api-tool.js';

export class SyncNetworkTool extends OperationTool<TSyncNetworkParams, unknown> {
public override readonly name = 'sync_network';
public override readonly operationName = OPERATION_NAME.syncNetwork;
protected override readonly schema = z.object({});

public override getTool(): Tool {
return {
name: this.name,
description:
'Enable background network monitoring so connection events can be polled with get_network (st.syncNetwork action). Run once per account; only changes that happen after it is enabled are captured.',
inputSchema: {
type: 'object',
properties: {},
required: [],
},
};
}
}