@ldraney/mcp-linkedin 0.1.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/LICENSE +21 -0
- package/README.md +128 -0
- package/package.json +50 -0
- package/src/auth-server.js +223 -0
- package/src/database.js +288 -0
- package/src/index.js +654 -0
- package/src/linkedin-api.js +631 -0
- package/src/scheduler.js +201 -0
- package/src/schemas.js +629 -0
- package/src/tools.js +853 -0
- package/src/types.js +575 -0
package/src/types.js
ADDED
|
@@ -0,0 +1,575 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Type definitions for MCP-LinkedIn
|
|
3
|
+
* All types are defined with JSDoc comments for IDE support and documentation.
|
|
4
|
+
* These types are validated at runtime using Zod schemas.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// ============================================================================
|
|
8
|
+
// LinkedIn API Types
|
|
9
|
+
// ============================================================================
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* LinkedIn post visibility levels
|
|
13
|
+
* @typedef {'PUBLIC' | 'CONNECTIONS' | 'LOGGED_IN' | 'CONTAINER'} Visibility
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Feed distribution options
|
|
18
|
+
* @typedef {'MAIN_FEED' | 'NONE'} FeedDistribution
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Post lifecycle state
|
|
23
|
+
* @typedef {'PUBLISHED' | 'DRAFT'} LifecycleState
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* LinkedIn URN for a person
|
|
28
|
+
* Format: "urn:li:person:{id}"
|
|
29
|
+
* @typedef {string} PersonURN
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* LinkedIn URN for a post (share or ugcPost)
|
|
34
|
+
* Format: "urn:li:share:{id}" or "urn:li:ugcPost:{id}"
|
|
35
|
+
* @typedef {string} PostURN
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* LinkedIn URN for an image
|
|
40
|
+
* Format: "urn:li:image:{id}"
|
|
41
|
+
* @typedef {string} ImageURN
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Distribution configuration for a post
|
|
46
|
+
* @typedef {Object} Distribution
|
|
47
|
+
* @property {FeedDistribution} feedDistribution - Where the post appears
|
|
48
|
+
* @property {Array<string>} [targetEntities] - Optional targeting criteria
|
|
49
|
+
* @property {Array<string>} [thirdPartyDistributionChannels] - External channels
|
|
50
|
+
*/
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Article/link content for a post
|
|
54
|
+
* @typedef {Object} Article
|
|
55
|
+
* @property {string} source - URL of the article/link
|
|
56
|
+
* @property {string} [title] - Custom title (overrides scraped data)
|
|
57
|
+
* @property {string} [description] - Custom description
|
|
58
|
+
*/
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Media content for a post (image/video)
|
|
62
|
+
* @typedef {Object} Media
|
|
63
|
+
* @property {ImageURN} id - URN of the uploaded media
|
|
64
|
+
* @property {string} [altText] - Accessibility text
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Content for a LinkedIn post
|
|
69
|
+
* @typedef {Object} PostContent
|
|
70
|
+
* @property {Article} [article] - Link/article preview
|
|
71
|
+
* @property {Media} [media] - Image or video
|
|
72
|
+
*/
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Complete LinkedIn post object (API request format)
|
|
76
|
+
* @typedef {Object} LinkedInPost
|
|
77
|
+
* @property {PersonURN} author - Author's person URN
|
|
78
|
+
* @property {string} commentary - Post text content
|
|
79
|
+
* @property {Visibility} visibility - Who can see the post
|
|
80
|
+
* @property {Distribution} distribution - Distribution settings
|
|
81
|
+
* @property {LifecycleState} lifecycleState - Publication state
|
|
82
|
+
* @property {PostContent} [content] - Optional media/link content
|
|
83
|
+
* @property {boolean} [isReshareDisabledByAuthor] - Disable sharing
|
|
84
|
+
*/
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* LinkedIn API response for post creation
|
|
88
|
+
* @typedef {Object} CreatePostResponse
|
|
89
|
+
* @property {PostURN} postUrn - URN of the created post
|
|
90
|
+
* @property {number} statusCode - HTTP status code (201 for success)
|
|
91
|
+
*/
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* LinkedIn post metadata (API response format)
|
|
95
|
+
* @typedef {Object} PostMetadata
|
|
96
|
+
* @property {PostURN} id - Post URN
|
|
97
|
+
* @property {PersonURN} author - Author URN
|
|
98
|
+
* @property {string} commentary - Post text
|
|
99
|
+
* @property {Visibility} visibility - Visibility level
|
|
100
|
+
* @property {string} createdAt - ISO timestamp
|
|
101
|
+
* @property {string} [lastModifiedAt] - ISO timestamp of last edit
|
|
102
|
+
* @property {LifecycleState} lifecycleState - Current state
|
|
103
|
+
*/
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Paginated list of posts (API response)
|
|
107
|
+
* @typedef {Object} PostList
|
|
108
|
+
* @property {Array<PostMetadata>} elements - Array of posts
|
|
109
|
+
* @property {Object} paging - Pagination info
|
|
110
|
+
* @property {number} paging.count - Results in this page
|
|
111
|
+
* @property {number} paging.start - Offset of this page
|
|
112
|
+
* @property {number} [paging.total] - Total available results
|
|
113
|
+
*/
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* LinkedIn user profile information
|
|
117
|
+
* @typedef {Object} UserInfo
|
|
118
|
+
* @property {string} sub - Person ID (used in URN)
|
|
119
|
+
* @property {string} name - Full name
|
|
120
|
+
* @property {string} given_name - First name
|
|
121
|
+
* @property {string} family_name - Last name
|
|
122
|
+
* @property {string} email - Email address
|
|
123
|
+
* @property {boolean} email_verified - Email verification status
|
|
124
|
+
* @property {string} picture - Profile picture URL
|
|
125
|
+
* @property {Object} locale - Locale settings
|
|
126
|
+
* @property {string} locale.country - Country code
|
|
127
|
+
* @property {string} locale.language - Language code
|
|
128
|
+
*/
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* OAuth 2.0 token response
|
|
132
|
+
* @typedef {Object} TokenResponse
|
|
133
|
+
* @property {string} access_token - Bearer token for API requests
|
|
134
|
+
* @property {number} expires_in - Seconds until expiry
|
|
135
|
+
* @property {string} scope - Granted permissions (space-separated)
|
|
136
|
+
* @property {string} token_type - Always "Bearer"
|
|
137
|
+
* @property {string} [refresh_token] - Token for renewal (if supported)
|
|
138
|
+
* @property {string} [id_token] - OpenID Connect ID token (JWT)
|
|
139
|
+
*/
|
|
140
|
+
|
|
141
|
+
// ============================================================================
|
|
142
|
+
// MCP Tool Input/Output Types
|
|
143
|
+
// ============================================================================
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* Input parameters for creating a simple text post
|
|
147
|
+
* @typedef {Object} CreatePostInput
|
|
148
|
+
* @property {string} commentary - Post text (supports hashtags, mentions)
|
|
149
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
150
|
+
*/
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Input parameters for creating a post with a link
|
|
154
|
+
* @typedef {Object} CreatePostWithLinkInput
|
|
155
|
+
* @property {string} commentary - Post text
|
|
156
|
+
* @property {string} url - Link URL (GitHub, blog, etc.)
|
|
157
|
+
* @property {string} [title] - Custom title for link preview
|
|
158
|
+
* @property {string} [description] - Custom description for link preview
|
|
159
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
160
|
+
*/
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Input parameters for retrieving posts
|
|
164
|
+
* @typedef {Object} GetPostsInput
|
|
165
|
+
* @property {number} [limit=10] - Max posts to retrieve (1-100)
|
|
166
|
+
* @property {number} [offset=0] - Pagination offset
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Input parameters for deleting a post
|
|
171
|
+
* @typedef {Object} DeletePostInput
|
|
172
|
+
* @property {PostURN} postUrn - URN of the post to delete
|
|
173
|
+
*/
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Input parameters for updating a post
|
|
177
|
+
* @typedef {Object} UpdatePostInput
|
|
178
|
+
* @property {PostURN} postUrn - URN of the post to update
|
|
179
|
+
* @property {string} [commentary] - New post text (1-3000 characters)
|
|
180
|
+
* @property {string} [contentCallToActionLabel] - New CTA label
|
|
181
|
+
* @property {string} [contentLandingPage] - New landing page URL
|
|
182
|
+
*/
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Input parameters for creating a post with an image
|
|
186
|
+
* @typedef {Object} CreatePostWithImageInput
|
|
187
|
+
* @property {string} commentary - Post text (supports hashtags, mentions)
|
|
188
|
+
* @property {string} imagePath - Local file path to the image (PNG, JPG, GIF)
|
|
189
|
+
* @property {string} [altText] - Accessibility text for the image
|
|
190
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
191
|
+
*/
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Input parameters for exchanging OAuth code for token
|
|
195
|
+
* @typedef {Object} ExchangeCodeInput
|
|
196
|
+
* @property {string} authorizationCode - Code from OAuth callback
|
|
197
|
+
*/
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Output from successful post creation
|
|
201
|
+
* @typedef {Object} CreatePostOutput
|
|
202
|
+
* @property {PostURN} postUrn - URN of created post
|
|
203
|
+
* @property {string} message - Success message
|
|
204
|
+
* @property {string} url - Link to view post on LinkedIn (if available)
|
|
205
|
+
*/
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Output from retrieving posts
|
|
209
|
+
* @typedef {Object} GetPostsOutput
|
|
210
|
+
* @property {Array<PostMetadata>} posts - Array of post metadata
|
|
211
|
+
* @property {number} count - Number of posts returned
|
|
212
|
+
* @property {number} offset - Current pagination offset
|
|
213
|
+
* @property {boolean} hasMore - Whether more posts are available
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Output from deleting a post
|
|
218
|
+
* @typedef {Object} DeletePostOutput
|
|
219
|
+
* @property {PostURN} postUrn - URN of deleted post
|
|
220
|
+
* @property {string} message - Success message
|
|
221
|
+
* @property {boolean} success - Always true if no error
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* Output from updating a post
|
|
226
|
+
* @typedef {Object} UpdatePostOutput
|
|
227
|
+
* @property {PostURN} postUrn - URN of updated post
|
|
228
|
+
* @property {string} message - Success message
|
|
229
|
+
* @property {boolean} success - Always true if no error
|
|
230
|
+
*/
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Output from creating a post with image
|
|
234
|
+
* @typedef {Object} CreatePostWithImageOutput
|
|
235
|
+
* @property {PostURN} postUrn - URN of created post
|
|
236
|
+
* @property {ImageURN} imageUrn - URN of uploaded image
|
|
237
|
+
* @property {string} message - Success message
|
|
238
|
+
* @property {string} url - Link to view post on LinkedIn
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* Output from refreshing an access token
|
|
243
|
+
* @typedef {Object} RefreshTokenOutput
|
|
244
|
+
* @property {string} accessToken - New access token
|
|
245
|
+
* @property {number} expiresIn - Seconds until expiry
|
|
246
|
+
* @property {string} message - Success message with save instructions
|
|
247
|
+
*/
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Output from getting OAuth authorization URL
|
|
251
|
+
* @typedef {Object} GetAuthUrlOutput
|
|
252
|
+
* @property {string} authUrl - URL for user to visit
|
|
253
|
+
* @property {string} state - CSRF protection state value
|
|
254
|
+
* @property {string} instructions - How to use the URL
|
|
255
|
+
*/
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Output from exchanging OAuth code
|
|
259
|
+
* @typedef {Object} ExchangeCodeOutput
|
|
260
|
+
* @property {string} accessToken - Bearer token for API
|
|
261
|
+
* @property {number} expiresIn - Seconds until expiry
|
|
262
|
+
* @property {PersonURN} personUrn - User's person URN
|
|
263
|
+
* @property {string} message - Success message with save instructions
|
|
264
|
+
*/
|
|
265
|
+
|
|
266
|
+
/**
|
|
267
|
+
* Output from getting user info
|
|
268
|
+
* @typedef {Object} GetUserInfoOutput
|
|
269
|
+
* @property {PersonURN} personUrn - User's person URN
|
|
270
|
+
* @property {string} name - Full name
|
|
271
|
+
* @property {string} email - Email address
|
|
272
|
+
* @property {string} pictureUrl - Profile picture URL
|
|
273
|
+
*/
|
|
274
|
+
|
|
275
|
+
// ============================================================================
|
|
276
|
+
// Scheduling Types
|
|
277
|
+
// ============================================================================
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Status of a scheduled post
|
|
281
|
+
* @typedef {'pending' | 'published' | 'failed' | 'cancelled'} ScheduledPostStatus
|
|
282
|
+
*/
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* A scheduled LinkedIn post stored in the database
|
|
286
|
+
* @typedef {Object} ScheduledPost
|
|
287
|
+
* @property {string} id - Unique UUID for the scheduled post
|
|
288
|
+
* @property {string} commentary - Post text content
|
|
289
|
+
* @property {string|null} url - Optional URL for link posts
|
|
290
|
+
* @property {Visibility} visibility - Post visibility level
|
|
291
|
+
* @property {string} scheduledTime - ISO 8601 datetime when post should be published
|
|
292
|
+
* @property {ScheduledPostStatus} status - Current status of the scheduled post
|
|
293
|
+
* @property {string} createdAt - ISO 8601 datetime when the post was scheduled
|
|
294
|
+
* @property {string|null} publishedAt - ISO 8601 datetime when the post was actually published
|
|
295
|
+
* @property {PostURN|null} postUrn - URN of the post after publishing
|
|
296
|
+
* @property {string|null} errorMessage - Error message if publishing failed
|
|
297
|
+
* @property {number} retryCount - Number of publish attempts
|
|
298
|
+
*/
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Input parameters for scheduling a post
|
|
302
|
+
* @typedef {Object} SchedulePostInput
|
|
303
|
+
* @property {string} commentary - Post text (supports hashtags, mentions)
|
|
304
|
+
* @property {string} scheduledTime - ISO 8601 datetime (must be in the future)
|
|
305
|
+
* @property {string} [url] - Optional URL for link posts
|
|
306
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
307
|
+
*/
|
|
308
|
+
|
|
309
|
+
/**
|
|
310
|
+
* Input parameters for listing scheduled posts
|
|
311
|
+
* @typedef {Object} ListScheduledPostsInput
|
|
312
|
+
* @property {ScheduledPostStatus} [status] - Filter by status
|
|
313
|
+
* @property {number} [limit=50] - Max posts to retrieve (1-100)
|
|
314
|
+
*/
|
|
315
|
+
|
|
316
|
+
/**
|
|
317
|
+
* Input parameters for cancelling a scheduled post
|
|
318
|
+
* @typedef {Object} CancelScheduledPostInput
|
|
319
|
+
* @property {string} postId - UUID of the scheduled post to cancel
|
|
320
|
+
*/
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Input parameters for getting a single scheduled post
|
|
324
|
+
* @typedef {Object} GetScheduledPostInput
|
|
325
|
+
* @property {string} postId - UUID of the scheduled post
|
|
326
|
+
*/
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
* Output from scheduling a post
|
|
330
|
+
* @typedef {Object} SchedulePostOutput
|
|
331
|
+
* @property {string} postId - UUID of the scheduled post
|
|
332
|
+
* @property {string} scheduledTime - ISO 8601 datetime when post will be published
|
|
333
|
+
* @property {ScheduledPostStatus} status - Current status (always 'pending')
|
|
334
|
+
* @property {string} message - Success message
|
|
335
|
+
*/
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Output from listing scheduled posts
|
|
339
|
+
* @typedef {Object} ListScheduledPostsOutput
|
|
340
|
+
* @property {Array<ScheduledPost>} posts - Array of scheduled posts
|
|
341
|
+
* @property {number} count - Number of posts returned
|
|
342
|
+
* @property {string} message - Summary message
|
|
343
|
+
*/
|
|
344
|
+
|
|
345
|
+
/**
|
|
346
|
+
* Output from cancelling a scheduled post
|
|
347
|
+
* @typedef {Object} CancelScheduledPostOutput
|
|
348
|
+
* @property {string} postId - UUID of the cancelled post
|
|
349
|
+
* @property {'cancelled'} status - Status after cancellation
|
|
350
|
+
* @property {string} message - Success message
|
|
351
|
+
* @property {boolean} success - Always true if no error
|
|
352
|
+
*/
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Output from getting a scheduled post
|
|
356
|
+
* @typedef {Object} GetScheduledPostOutput
|
|
357
|
+
* @property {ScheduledPost} post - The scheduled post details
|
|
358
|
+
* @property {string} message - Status message
|
|
359
|
+
*/
|
|
360
|
+
|
|
361
|
+
// ============================================================================
|
|
362
|
+
// Poll Types
|
|
363
|
+
// ============================================================================
|
|
364
|
+
|
|
365
|
+
/**
|
|
366
|
+
* Duration options for a poll
|
|
367
|
+
* @typedef {'ONE_DAY' | 'THREE_DAYS' | 'SEVEN_DAYS' | 'FOURTEEN_DAYS'} PollDuration
|
|
368
|
+
*/
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* A single poll option
|
|
372
|
+
* @typedef {Object} PollOption
|
|
373
|
+
* @property {string} text - Option text (max 30 characters)
|
|
374
|
+
*/
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Input parameters for creating a poll post
|
|
378
|
+
* @typedef {Object} CreatePollInput
|
|
379
|
+
* @property {string} question - Poll question (max 140 characters)
|
|
380
|
+
* @property {Array<PollOption>} options - Poll options (2-4 options)
|
|
381
|
+
* @property {PollDuration} [duration='THREE_DAYS'] - How long the poll runs
|
|
382
|
+
* @property {string} [commentary] - Optional post text (max 3000 characters)
|
|
383
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
384
|
+
*/
|
|
385
|
+
|
|
386
|
+
/**
|
|
387
|
+
* Output from creating a poll post
|
|
388
|
+
* @typedef {Object} CreatePollOutput
|
|
389
|
+
* @property {PostURN} postUrn - URN of created post
|
|
390
|
+
* @property {string} message - Success message
|
|
391
|
+
* @property {string} url - Link to view poll on LinkedIn
|
|
392
|
+
* @property {string} pollQuestion - The poll question
|
|
393
|
+
* @property {number} optionCount - Number of poll options
|
|
394
|
+
* @property {PollDuration} duration - Poll duration
|
|
395
|
+
*/
|
|
396
|
+
|
|
397
|
+
// ============================================================================
|
|
398
|
+
// Document Types
|
|
399
|
+
// ============================================================================
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* LinkedIn URN for a document
|
|
403
|
+
* Format: "urn:li:document:{id}"
|
|
404
|
+
* @typedef {string} DocumentURN
|
|
405
|
+
*/
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Input parameters for creating a post with a document
|
|
409
|
+
* @typedef {Object} CreatePostWithDocumentInput
|
|
410
|
+
* @property {string} commentary - Post text (max 3000 characters)
|
|
411
|
+
* @property {string} documentPath - Local file path to the document (PDF, DOC, DOCX, PPT, PPTX)
|
|
412
|
+
* @property {string} [title] - Custom title for the document (max 400 characters)
|
|
413
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
414
|
+
*/
|
|
415
|
+
|
|
416
|
+
/**
|
|
417
|
+
* Output from creating a post with document
|
|
418
|
+
* @typedef {Object} CreatePostWithDocumentOutput
|
|
419
|
+
* @property {PostURN} postUrn - URN of created post
|
|
420
|
+
* @property {DocumentURN} documentUrn - URN of uploaded document
|
|
421
|
+
* @property {string} message - Success message
|
|
422
|
+
* @property {string} url - Link to view post on LinkedIn
|
|
423
|
+
*/
|
|
424
|
+
|
|
425
|
+
// ============================================================================
|
|
426
|
+
// Video Types
|
|
427
|
+
// ============================================================================
|
|
428
|
+
|
|
429
|
+
/**
|
|
430
|
+
* LinkedIn URN for a video
|
|
431
|
+
* Format: "urn:li:video:{id}"
|
|
432
|
+
* @typedef {string} VideoURN
|
|
433
|
+
*/
|
|
434
|
+
|
|
435
|
+
/**
|
|
436
|
+
* Input parameters for creating a post with a video
|
|
437
|
+
* @typedef {Object} CreatePostWithVideoInput
|
|
438
|
+
* @property {string} commentary - Post text (max 3000 characters)
|
|
439
|
+
* @property {string} videoPath - Local file path to the video (MP4, MOV, AVI, etc.)
|
|
440
|
+
* @property {string} [title] - Custom title for the video (max 400 characters)
|
|
441
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
442
|
+
*/
|
|
443
|
+
|
|
444
|
+
/**
|
|
445
|
+
* Output from creating a post with video
|
|
446
|
+
* @typedef {Object} CreatePostWithVideoOutput
|
|
447
|
+
* @property {PostURN} postUrn - URN of created post
|
|
448
|
+
* @property {VideoURN} videoUrn - URN of uploaded video
|
|
449
|
+
* @property {string} message - Success message
|
|
450
|
+
* @property {string} url - Link to view post on LinkedIn
|
|
451
|
+
*/
|
|
452
|
+
|
|
453
|
+
// ============================================================================
|
|
454
|
+
// Multi-Image Types
|
|
455
|
+
// ============================================================================
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Input parameters for creating a post with multiple images
|
|
459
|
+
* @typedef {Object} CreatePostWithMultiImagesInput
|
|
460
|
+
* @property {string} commentary - Post text (max 3000 characters)
|
|
461
|
+
* @property {Array<string>} imagePaths - Array of local file paths to images (2-20 images)
|
|
462
|
+
* @property {Array<string>} [altTexts] - Optional accessibility texts for each image
|
|
463
|
+
* @property {Visibility} [visibility='PUBLIC'] - Who can see the post
|
|
464
|
+
*/
|
|
465
|
+
|
|
466
|
+
/**
|
|
467
|
+
* Output from creating a post with multiple images
|
|
468
|
+
* @typedef {Object} CreatePostWithMultiImagesOutput
|
|
469
|
+
* @property {PostURN} postUrn - URN of created post
|
|
470
|
+
* @property {Array<ImageURN>} imageUrns - URNs of uploaded images
|
|
471
|
+
* @property {string} message - Success message
|
|
472
|
+
* @property {string} url - Link to view post on LinkedIn
|
|
473
|
+
*/
|
|
474
|
+
|
|
475
|
+
// ============================================================================
|
|
476
|
+
// Error Types
|
|
477
|
+
// ============================================================================
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Standardized error response
|
|
481
|
+
* @typedef {Object} ErrorResponse
|
|
482
|
+
* @property {string} error - Error type/code
|
|
483
|
+
* @property {string} message - Human-readable error message
|
|
484
|
+
* @property {number} [statusCode] - HTTP status code (if from API)
|
|
485
|
+
* @property {Object} [details] - Additional error context
|
|
486
|
+
*/
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* LinkedIn API error response
|
|
490
|
+
* @typedef {Object} LinkedInAPIError
|
|
491
|
+
* @property {string} error - Error code
|
|
492
|
+
* @property {string} error_description - Error message
|
|
493
|
+
* @property {number} status - HTTP status code
|
|
494
|
+
*/
|
|
495
|
+
|
|
496
|
+
// ============================================================================
|
|
497
|
+
// Configuration Types
|
|
498
|
+
// ============================================================================
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* LinkedIn OAuth configuration
|
|
502
|
+
* @typedef {Object} OAuthConfig
|
|
503
|
+
* @property {string} clientId - LinkedIn app client ID
|
|
504
|
+
* @property {string} clientSecret - LinkedIn app client secret
|
|
505
|
+
* @property {string} redirectUri - OAuth callback URL
|
|
506
|
+
* @property {Array<string>} scope - Requested permissions
|
|
507
|
+
*/
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* LinkedIn API configuration
|
|
511
|
+
* @typedef {Object} APIConfig
|
|
512
|
+
* @property {string} baseUrl - API base URL (https://api.linkedin.com)
|
|
513
|
+
* @property {string} version - API version (YYYYMM format)
|
|
514
|
+
* @property {string} accessToken - Bearer token
|
|
515
|
+
* @property {PersonURN} personId - User's person URN
|
|
516
|
+
*/
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Complete application configuration
|
|
520
|
+
* @typedef {Object} AppConfig
|
|
521
|
+
* @property {OAuthConfig} oauth - OAuth settings
|
|
522
|
+
* @property {APIConfig} api - API settings
|
|
523
|
+
*/
|
|
524
|
+
|
|
525
|
+
// ============================================================================
|
|
526
|
+
// Utility Types
|
|
527
|
+
// ============================================================================
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Retry configuration for API requests
|
|
531
|
+
* @typedef {Object} RetryConfig
|
|
532
|
+
* @property {number} maxRetries - Max retry attempts (default: 3)
|
|
533
|
+
* @property {number} initialDelay - Initial delay in ms (default: 1000)
|
|
534
|
+
* @property {number} maxDelay - Max delay in ms (default: 30000)
|
|
535
|
+
* @property {number} backoffMultiplier - Delay multiplier (default: 2)
|
|
536
|
+
*/
|
|
537
|
+
|
|
538
|
+
/**
|
|
539
|
+
* Result of a retry attempt
|
|
540
|
+
* @typedef {Object} RetryResult
|
|
541
|
+
* @property {boolean} success - Whether operation succeeded
|
|
542
|
+
* @property {*} [data] - Result data if successful
|
|
543
|
+
* @property {Error} [error] - Error if failed
|
|
544
|
+
* @property {number} attempts - Number of attempts made
|
|
545
|
+
*/
|
|
546
|
+
|
|
547
|
+
// ============================================================================
|
|
548
|
+
// MCP Server Types
|
|
549
|
+
// ============================================================================
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* MCP tool definition
|
|
553
|
+
* @typedef {Object} MCPTool
|
|
554
|
+
* @property {string} name - Tool name (e.g., "linkedin_create_post")
|
|
555
|
+
* @property {string} description - What the tool does
|
|
556
|
+
* @property {Object} inputSchema - JSON schema for input validation
|
|
557
|
+
* @property {Function} handler - Async function to execute the tool
|
|
558
|
+
*/
|
|
559
|
+
|
|
560
|
+
/**
|
|
561
|
+
* MCP tool call arguments
|
|
562
|
+
* @typedef {Object} ToolCallArguments
|
|
563
|
+
* @property {string} name - Tool name being called
|
|
564
|
+
* @property {Object} arguments - Tool-specific arguments
|
|
565
|
+
*/
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* MCP tool execution result
|
|
569
|
+
* @typedef {Object} ToolExecutionResult
|
|
570
|
+
* @property {Array<Object>} content - Result content blocks
|
|
571
|
+
* @property {boolean} [isError] - Whether execution failed
|
|
572
|
+
*/
|
|
573
|
+
|
|
574
|
+
// Export JSDoc types (for documentation purposes)
|
|
575
|
+
module.exports = {};
|