linkedin-relay-mcp 1.2.0 → 1.2.2
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/dist/cli.js +47 -26
- package/dist/cli.js.map +1 -1
- package/dist/mcp-shim.js +39 -18
- package/dist/mcp-shim.js.map +1 -1
- package/package.json +1 -1
package/dist/mcp-shim.js
CHANGED
|
@@ -319,10 +319,16 @@ function shapeSearchRow(node) {
|
|
|
319
319
|
url: cleanUrl(node.navigationUrl)
|
|
320
320
|
});
|
|
321
321
|
}
|
|
322
|
-
function
|
|
322
|
+
function postUrn(node) {
|
|
323
323
|
const meta = node.updateMetadata;
|
|
324
|
+
if (typeof meta?.urn === "string") return meta.urn;
|
|
325
|
+
const entityUrn = node.entityUrn;
|
|
326
|
+
if (typeof entityUrn !== "string") return void 0;
|
|
327
|
+
return /urn:li:(activity|ugcPost|share):\d+/.exec(entityUrn)?.[0];
|
|
328
|
+
}
|
|
329
|
+
function shapePost(node, index) {
|
|
324
330
|
const actor = node.actor;
|
|
325
|
-
const urn =
|
|
331
|
+
const urn = postUrn(node);
|
|
326
332
|
const social = deref(node, "*socialDetail", index);
|
|
327
333
|
const counts = social === void 0 ? void 0 : deref(social, "*totalSocialActivityCounts", index);
|
|
328
334
|
return defined({
|
|
@@ -796,9 +802,10 @@ function classify(res) {
|
|
|
796
802
|
if (res.status === 404) {
|
|
797
803
|
return fail("NOT_FOUND", "no such resource");
|
|
798
804
|
}
|
|
799
|
-
if (res.status
|
|
805
|
+
if (res.status < 200 || res.status >= 300) {
|
|
800
806
|
return fail("FETCH_FAILED", `unexpected status ${res.status}`);
|
|
801
807
|
}
|
|
808
|
+
if (res.body.trim() === "") return { outcome: "ok", retry: false, json: null };
|
|
802
809
|
return classifyBody(res.body);
|
|
803
810
|
}
|
|
804
811
|
function referencesUrns(data) {
|
|
@@ -974,6 +981,16 @@ var CONTRACTS = {
|
|
|
974
981
|
},
|
|
975
982
|
// The member's own posts. Verified 200; returns an empty collection on an
|
|
976
983
|
// account with no posts, which is a true empty rather than a failure.
|
|
984
|
+
// Needs the `fsd_profile` namespace, NOT the `fs_miniProfile` urn `whoami`
|
|
985
|
+
// returns — the legacy form answers 200 with an empty result rather than an
|
|
986
|
+
// error. That was invisible until the account had a post to return, and is
|
|
987
|
+
// why engine.myPosts canonicalises the urn before sending it.
|
|
988
|
+
//
|
|
989
|
+
// KNOWN INCOMPLETE (2026-08-13): with the namespace fixed this returns the
|
|
990
|
+
// owner's posts, but a post created minutes earlier did not appear here, nor
|
|
991
|
+
// in `feed`, over ~1.5 hours. Whether that is an indexing lag or a coverage
|
|
992
|
+
// limit of this projection is UNRESOLVED — do not treat this endpoint as an
|
|
993
|
+
// authoritative "all my posts" until it is settled.
|
|
977
994
|
myPosts: {
|
|
978
995
|
name: "myPosts",
|
|
979
996
|
transport: "voyager-graphql",
|
|
@@ -1301,7 +1318,11 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1301
1318
|
async myPosts(profileUrn, limit) {
|
|
1302
1319
|
const contract = contractFor("myPosts");
|
|
1303
1320
|
if (contract === void 0) return missingContract("myPosts");
|
|
1304
|
-
const variables = encodeVariables({
|
|
1321
|
+
const variables = encodeVariables({
|
|
1322
|
+
count: Math.min(limit, 100),
|
|
1323
|
+
start: 0,
|
|
1324
|
+
profileUrn: canonicalUrn(profileUrn)
|
|
1325
|
+
});
|
|
1305
1326
|
const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
|
|
1306
1327
|
const res = await client.request({ url, spendClass: "page", operation: "myPosts" });
|
|
1307
1328
|
if (!res.ok) return res;
|
|
@@ -1352,13 +1373,13 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1352
1373
|
const envelope = res.json;
|
|
1353
1374
|
return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
|
|
1354
1375
|
},
|
|
1355
|
-
async post(
|
|
1376
|
+
async post(postUrn2, limit) {
|
|
1356
1377
|
const contract = contractFor("comments");
|
|
1357
1378
|
if (contract === void 0) return missingContract("comments");
|
|
1358
1379
|
const variables = encodeVariables({
|
|
1359
1380
|
count: Math.min(limit, 100),
|
|
1360
1381
|
numReplies: 1,
|
|
1361
|
-
socialDetailUrn: socialDetailUrn(
|
|
1382
|
+
socialDetailUrn: socialDetailUrn(postUrn2),
|
|
1362
1383
|
sortOrder: "RELEVANCE",
|
|
1363
1384
|
start: 0
|
|
1364
1385
|
});
|
|
@@ -1374,13 +1395,13 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1374
1395
|
const envelope = res.json;
|
|
1375
1396
|
return { ok: true, value: { parsed, index: indexIncluded(envelope.included) } };
|
|
1376
1397
|
},
|
|
1377
|
-
async reactions(
|
|
1398
|
+
async reactions(postUrn2, limit) {
|
|
1378
1399
|
const contract = contractFor("reactions");
|
|
1379
1400
|
if (contract === void 0) return missingContract("reactions");
|
|
1380
1401
|
const variables = encodeVariables({
|
|
1381
1402
|
count: Math.min(limit, 100),
|
|
1382
1403
|
start: 0,
|
|
1383
|
-
threadUrn:
|
|
1404
|
+
threadUrn: postUrn2
|
|
1384
1405
|
});
|
|
1385
1406
|
const url = `${contract.path}?includeWebMetadata=true&variables=${variables}&queryId=${contract.queryId}`;
|
|
1386
1407
|
const res = await client.request({ url, spendClass: "page", operation: "reactions" });
|
|
@@ -1423,8 +1444,8 @@ function createEngine(session, deps, quiet = false) {
|
|
|
1423
1444
|
}
|
|
1424
1445
|
};
|
|
1425
1446
|
}
|
|
1426
|
-
function socialDetailUrn(
|
|
1427
|
-
return `urn:li:fsd_socialDetail:(${
|
|
1447
|
+
function socialDetailUrn(postUrn2) {
|
|
1448
|
+
return `urn:li:fsd_socialDetail:(${postUrn2},${postUrn2},urn:li:highlightedReply:-)`;
|
|
1428
1449
|
}
|
|
1429
1450
|
function totalResultCount(json) {
|
|
1430
1451
|
const found = JSON.stringify(json ?? {}).match(/"totalResultCount":(\d+)/);
|
|
@@ -1523,8 +1544,8 @@ async function runSearch(kind, query, limit, opts = {}) {
|
|
|
1523
1544
|
return ok("search", { query, kind, ...collection(result.value, opts) });
|
|
1524
1545
|
}
|
|
1525
1546
|
async function runPost(urn, limit, opts = {}) {
|
|
1526
|
-
const
|
|
1527
|
-
if (
|
|
1547
|
+
const postUrn2 = normalisePostUrn(urn);
|
|
1548
|
+
if (postUrn2 === void 0) {
|
|
1528
1549
|
return err(
|
|
1529
1550
|
"post",
|
|
1530
1551
|
"INVALID_INPUT",
|
|
@@ -1534,20 +1555,20 @@ async function runPost(urn, limit, opts = {}) {
|
|
|
1534
1555
|
}
|
|
1535
1556
|
const ctx = withSession("post", opts.quiet === true);
|
|
1536
1557
|
if ("ok" in ctx) return ctx;
|
|
1537
|
-
const result = await ctx.engine.post(
|
|
1558
|
+
const result = await ctx.engine.post(postUrn2, limit);
|
|
1538
1559
|
if (!result.ok) return toEnvelope("post", result);
|
|
1539
|
-
return ok("post", { urn:
|
|
1560
|
+
return ok("post", { urn: postUrn2, ...collection(result.value, opts) });
|
|
1540
1561
|
}
|
|
1541
1562
|
async function runReactions(urn, limit, opts = {}) {
|
|
1542
|
-
const
|
|
1543
|
-
if (
|
|
1563
|
+
const postUrn2 = normalisePostUrn(urn);
|
|
1564
|
+
if (postUrn2 === void 0) {
|
|
1544
1565
|
return err("reactions", "INVALID_INPUT", "a post urn or feed URL is required");
|
|
1545
1566
|
}
|
|
1546
1567
|
const ctx = withSession("reactions", opts.quiet === true);
|
|
1547
1568
|
if ("ok" in ctx) return ctx;
|
|
1548
|
-
const result = await ctx.engine.reactions(
|
|
1569
|
+
const result = await ctx.engine.reactions(postUrn2, limit);
|
|
1549
1570
|
if (!result.ok) return toEnvelope("reactions", result);
|
|
1550
|
-
return ok("reactions", { urn:
|
|
1571
|
+
return ok("reactions", { urn: postUrn2, ...collection(result.value, opts) });
|
|
1551
1572
|
}
|
|
1552
1573
|
function normalisePostUrn(input) {
|
|
1553
1574
|
if (input === void 0 || input === "") return void 0;
|