@pipeshub-ai/mcp 2.2.0 → 2.3.1
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/README.md +2 -0
- package/bin/mcp-server.js +703 -189
- package/bin/mcp-server.js.map +19 -13
- package/bin/pipeshub.js +946 -0
- package/bin/pipeshub.js.map +14 -0
- package/esm/cli/client.d.ts +54 -0
- package/esm/cli/client.d.ts.map +1 -0
- package/esm/cli/client.js +235 -0
- package/esm/cli/client.js.map +1 -0
- package/esm/cli/commands.d.ts +30 -0
- package/esm/cli/commands.d.ts.map +1 -0
- package/esm/cli/commands.js +321 -0
- package/esm/cli/commands.js.map +1 -0
- package/esm/cli/config.d.ts +73 -0
- package/esm/cli/config.d.ts.map +1 -0
- package/esm/cli/config.js +218 -0
- package/esm/cli/config.js.map +1 -0
- package/esm/cli/init-qm.d.ts +11 -0
- package/esm/cli/init-qm.d.ts.map +1 -0
- package/esm/cli/init-qm.js +170 -0
- package/esm/cli/init-qm.js.map +1 -0
- package/esm/cli/pipeshub.d.ts +2 -0
- package/esm/cli/pipeshub.d.ts.map +1 -0
- package/esm/cli/pipeshub.js +296 -0
- package/esm/cli/pipeshub.js.map +1 -0
- package/esm/funcs/connectorLookupRecordByIdentifier.d.ts +68 -0
- package/esm/funcs/connectorLookupRecordByIdentifier.d.ts.map +1 -0
- package/esm/funcs/connectorLookupRecordByIdentifier.js +138 -0
- package/esm/funcs/connectorLookupRecordByIdentifier.js.map +1 -0
- package/esm/funcs/connectorNavigateKnowledgeGraph.d.ts +75 -0
- package/esm/funcs/connectorNavigateKnowledgeGraph.d.ts.map +1 -0
- package/esm/funcs/connectorNavigateKnowledgeGraph.js +152 -0
- package/esm/funcs/connectorNavigateKnowledgeGraph.js.map +1 -0
- package/esm/lib/base64.d.ts +1 -1
- package/esm/lib/base64.d.ts.map +1 -1
- package/esm/lib/base64.js +6 -3
- package/esm/lib/base64.js.map +1 -1
- package/esm/lib/bytes-to-base64.d.ts +16 -0
- package/esm/lib/bytes-to-base64.d.ts.map +1 -0
- package/esm/lib/bytes-to-base64.js +23 -0
- package/esm/lib/bytes-to-base64.js.map +1 -0
- package/esm/mcp-server/instructions.d.ts +1 -1
- package/esm/mcp-server/instructions.d.ts.map +1 -1
- package/esm/mcp-server/instructions.js +30 -0
- package/esm/mcp-server/instructions.js.map +1 -1
- package/esm/mcp-server/shared.d.ts +2 -2
- package/esm/mcp-server/shared.d.ts.map +1 -1
- package/esm/mcp-server/shared.js +7 -3
- package/esm/mcp-server/shared.js.map +1 -1
- package/esm/mcp-server/tools/_agui.d.ts +34 -0
- package/esm/mcp-server/tools/_agui.d.ts.map +1 -0
- package/esm/mcp-server/tools/_agui.js +91 -0
- package/esm/mcp-server/tools/_agui.js.map +1 -0
- package/esm/mcp-server/tools/_helpers.d.ts +20 -3
- package/esm/mcp-server/tools/_helpers.d.ts.map +1 -1
- package/esm/mcp-server/tools/_helpers.js +54 -10
- package/esm/mcp-server/tools/_helpers.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubChat.d.ts +0 -3
- package/esm/mcp-server/tools/pipeshubChat.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubChat.js +75 -98
- package/esm/mcp-server/tools/pipeshubChat.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubDirectory.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubDirectory.js +62 -8
- package/esm/mcp-server/tools/pipeshubDirectory.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubGetRecordContent.d.ts +118 -1
- package/esm/mcp-server/tools/pipeshubGetRecordContent.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubGetRecordContent.js +180 -29
- package/esm/mcp-server/tools/pipeshubGetRecordContent.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubSearch.d.ts.map +1 -1
- package/esm/mcp-server/tools/pipeshubSearch.js +15 -2
- package/esm/mcp-server/tools/pipeshubSearch.js.map +1 -1
- package/esm/mcp-server/tools/pipeshubSources.js +2 -2
- package/esm/mcp-server/tools/pipeshubSources.js.map +1 -1
- package/esm/models/lookuprecordbyidentifierop.d.ts +7 -0
- package/esm/models/lookuprecordbyidentifierop.d.ts.map +1 -0
- package/esm/models/lookuprecordbyidentifierop.js +14 -0
- package/esm/models/lookuprecordbyidentifierop.js.map +1 -0
- package/esm/models/navigateknowledgegraphop.d.ts +14 -0
- package/esm/models/navigateknowledgegraphop.d.ts.map +1 -0
- package/esm/models/navigateknowledgegraphop.js +25 -0
- package/esm/models/navigateknowledgegraphop.js.map +1 -0
- package/esm/tool-names.js +4 -4
- package/esm/tool-names.js.map +1 -1
- package/package.json +3 -2
- package/qm/README.md +247 -0
- package/qm/SECURITY.md +134 -0
- package/qm/TROUBLESHOOTING.md +218 -0
- package/qm/qm.config.fragment.jsonc +42 -0
- package/qm/sandbox/Dockerfile +22 -0
- package/qm/sandbox/skills/pipeshub/SKILL.md +69 -0
- package/qm/sandbox/tools/pipeshub/tool.json +36 -0
- package/src/cli/client.ts +279 -0
- package/src/cli/commands.ts +403 -0
- package/src/cli/config.ts +229 -0
- package/src/cli/init-qm.ts +215 -0
- package/src/cli/pipeshub.ts +333 -0
- package/src/funcs/connectorLookupRecordByIdentifier.ts +200 -0
- package/src/funcs/connectorNavigateKnowledgeGraph.ts +215 -0
- package/src/lib/base64.ts +6 -3
- package/src/lib/bytes-to-base64.ts +24 -0
- package/src/mcp-server/instructions.ts +30 -0
- package/src/mcp-server/shared.ts +7 -3
- package/src/mcp-server/tools/_agui.ts +138 -0
- package/src/mcp-server/tools/_helpers.ts +55 -8
- package/src/mcp-server/tools/pipeshubChat.ts +78 -97
- package/src/mcp-server/tools/pipeshubDirectory.ts +65 -7
- package/src/mcp-server/tools/pipeshubGetRecordContent.ts +213 -29
- package/src/mcp-server/tools/pipeshubSearch.ts +15 -2
- package/src/mcp-server/tools/pipeshubSources.ts +2 -2
- package/src/models/lookuprecordbyidentifierop.ts +26 -0
- package/src/models/navigateknowledgegraphop.ts +56 -0
- package/src/tool-names.ts +4 -4
|
@@ -1,34 +1,26 @@
|
|
|
1
1
|
// `POST /conversations/stream` (and
|
|
2
2
|
// `POST /conversations/{conversationId}/messages/stream` for follow-ups),
|
|
3
3
|
// accumulate the frames server-side, and hand the LLM a single trimmed
|
|
4
|
-
// `CallToolResult` once the stream
|
|
5
|
-
// `error`) frame.
|
|
4
|
+
// `CallToolResult` once the stream reaches a terminal frame.
|
|
6
5
|
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
// `accumulated` as a fallback in case the stream
|
|
13
|
-
// ends without a `complete` frame
|
|
14
|
-
// - tool_call — model invoked an internal tool; we collect these
|
|
15
|
-
// as observability breadcrumbs but the LLM doesn't
|
|
16
|
-
// need them to answer
|
|
17
|
-
// - tool_success — paired with tool_call; same treatment
|
|
18
|
-
// - complete — terminal; payload is `{ conversation, meta }`,
|
|
19
|
-
// matching the non-stream response shape, so we
|
|
20
|
-
// feed it through `trimConversation` like before
|
|
21
|
-
// - error — terminal; surface to the LLM as a tool error
|
|
6
|
+
// The wire protocol is AG-UI. The legacy `connected` / `answer_chunk` /
|
|
7
|
+
// `complete` / `error` vocabulary was removed with the new agent loop and is
|
|
8
|
+
// never emitted. The frames that matter — CUSTOM{conversation_created},
|
|
9
|
+
// TEXT_MESSAGE_CONTENT, RUN_FINISHED, RUN_ERROR — are folded by `./_agui.js`,
|
|
10
|
+
// which is kept separate so the fold stays a pure function over frames.
|
|
22
11
|
import * as z from "zod";
|
|
23
12
|
import { conversationsStreamConversation } from "../../funcs/conversationsStreamConversation.js";
|
|
24
13
|
import { conversationsStreamMessage } from "../../funcs/conversationsStreamMessage.js";
|
|
25
14
|
import { agentsStreamConversation } from "../../funcs/agentsStreamConversation.js";
|
|
26
15
|
import { agentsStreamMessage } from "../../funcs/agentsStreamMessage.js";
|
|
16
|
+
import { applyAGUIFrame, newChatStreamState, salvagedText, } from "./_agui.js";
|
|
27
17
|
import { errorResult, httpErrorResult, iterateSSE, jsonResult, trimConversation, } from "./_helpers.js";
|
|
28
18
|
const FiltersShape = z.object({
|
|
29
|
-
apps: z.array(z.string()).optional().describe("Source-scoping ids
|
|
30
|
-
+ "
|
|
31
|
-
+ "
|
|
19
|
+
apps: z.array(z.string()).optional().describe("Source-scoping ids from `pipeshub_sources` — connector instance and / "
|
|
20
|
+
+ "or knowledge base ids, mixed freely. The legacy org-wide "
|
|
21
|
+
+ "`knowledgeBase_<orgId>` id is still accepted on deployments that "
|
|
22
|
+
+ "predate per-KB sources. Empty / omitted means no app-side "
|
|
23
|
+
+ "restriction."),
|
|
32
24
|
kb: z.array(z.string()).optional().describe("Legacy / unused. Leave empty."),
|
|
33
25
|
}).optional();
|
|
34
26
|
const args = {
|
|
@@ -52,44 +44,49 @@ const args = {
|
|
|
52
44
|
chatMode: z.enum([
|
|
53
45
|
"internal_search",
|
|
54
46
|
"web_search",
|
|
55
|
-
"auto",
|
|
56
47
|
"quick",
|
|
57
|
-
"verification",
|
|
58
|
-
"deep",
|
|
59
48
|
]).optional().describe("Response strategy. The valid values depend on whether `agentId` is set:\n"
|
|
60
49
|
+ "- WITHOUT `agentId` (plain chat): `internal_search` — answer from the "
|
|
61
50
|
+ "org's indexed knowledge (default) — or `web_search` — answer from the "
|
|
62
51
|
+ "live web.\n"
|
|
63
|
-
+ "- WITH `agentId` (agent chat): `
|
|
64
|
-
+ "
|
|
52
|
+
+ "- WITH `agentId` (agent chat): `quick` is the only supported mode and "
|
|
53
|
+
+ "is sent automatically, so this argument can be omitted."),
|
|
65
54
|
};
|
|
66
55
|
export const tool$pipeshubChat = {
|
|
67
56
|
name: "pipeshub_chat",
|
|
68
|
-
description:
|
|
57
|
+
description: `Ask a question, get an answer grounded in the org's indexed data with
|
|
58
|
+
citations. It reads a few retrieved passages — never a whole document,
|
|
59
|
+
never a complete list.
|
|
69
60
|
|
|
70
|
-
**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
61
|
+
**Three questions this tool gets WRONG. Check them first:**
|
|
62
|
+
- **Structure** — "what's under this epic?", "which pages are in this
|
|
63
|
+
space?", "what links to this ticket?", "what's in this folder?" →
|
|
64
|
+
\`pipeshub_get_record_content\` \`mode:"navigate"\`. Ranking cannot see how
|
|
65
|
+
records relate.
|
|
66
|
+
- **Exhaustive** — "how many X?", "list ALL the Y", "every Z" →
|
|
67
|
+
\`mode:"navigate"\`, which reports the group's real total. This tool
|
|
68
|
+
undercounts and will not say so.
|
|
69
|
+
- **One named document** — summarize it, extract from it, what does it say
|
|
70
|
+
about X → \`pipeshub_search\` for the \`recordId\`, then \`mode:"content"\`.
|
|
78
71
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
72
|
+
Everything else about the org's knowledge belongs here: policies,
|
|
73
|
+
processes, decisions, history, "what do we know about X", and any question
|
|
74
|
+
spanning several documents.
|
|
75
|
+
|
|
76
|
+
**Internal search** (default, \`chatMode: "internal_search"\`): the user's
|
|
77
|
+
documents, files, knowledge base, company policies — anything in their
|
|
78
|
+
PipesHub-indexed sources (Drive, Box, Confluence, Slack, Gmail, Jira, the
|
|
79
|
+
org's KB, ...).
|
|
80
|
+
|
|
81
|
+
**Web search** (\`chatMode: "web_search"\`): current events or public
|
|
82
|
+
information unlikely to be in the org's knowledge base.
|
|
83
|
+
|
|
84
|
+
Both are plain-chat modes. **Agent chat** — pass an \`agentId\` from
|
|
85
|
+
\`pipeshub_agents\` — runs against that agent's own prompt, tools and knowledge;
|
|
86
|
+
\`quick\` is its only mode, requires the \`agentId\`, and is sent automatically.
|
|
83
87
|
|
|
84
|
-
**When to pick this over other tools:**
|
|
85
|
-
- "Summarize <doc>" / "key points of <doc>" / "what does <document> say
|
|
86
|
-
about X?" → NOT this tool. Use \`pipeshub_search\` →
|
|
87
|
-
\`pipeshub_get_record_content\`: answering for a specific document
|
|
88
|
-
requires its full content, and chat only sees a few retrieved
|
|
89
|
-
passages, never the whole document.
|
|
90
88
|
- "What's our policy on Y?" → \`pipeshub_chat\` (internal_search)
|
|
91
89
|
- "What's in the news about Z?" → \`pipeshub_chat\` (web_search)
|
|
92
|
-
- "What is the latest version of <library>?" → \`pipeshub_chat\` (web_search)
|
|
93
90
|
- "Find / locate the file named X" → \`pipeshub_search\` (then
|
|
94
91
|
\`pipeshub_download_record\` if the user wants the bytes).
|
|
95
92
|
|
|
@@ -119,10 +116,18 @@ cited document, take \`citations[*].recordId\` and call
|
|
|
119
116
|
args,
|
|
120
117
|
tool: async (client, args, ctx) => {
|
|
121
118
|
const fetchOptions = { signal: ctx.signal };
|
|
119
|
+
// `quick` is agent-only. The plain stream schemas accept internal_search /
|
|
120
|
+
// web_search / agent, so collapse anything else to the default rather than
|
|
121
|
+
// forwarding a value that path would reject.
|
|
122
|
+
const plainChatMode = args.chatMode === "web_search"
|
|
123
|
+
? "web_search"
|
|
124
|
+
: "internal_search";
|
|
122
125
|
let response;
|
|
123
126
|
if (args.agentId) {
|
|
124
|
-
//
|
|
125
|
-
|
|
127
|
+
// `quick` is the only value the agent stream schemas accept, and it is
|
|
128
|
+
// required — so ignore whatever the caller passed rather than forwarding
|
|
129
|
+
// a value the gateway would reject.
|
|
130
|
+
const agentChatMode = "quick";
|
|
126
131
|
if (args.conversationId) {
|
|
127
132
|
// Continue an existing agent conversation.
|
|
128
133
|
const [result] = await agentsStreamMessage(client, {
|
|
@@ -167,7 +172,7 @@ cited document, take \`citations[*].recordId\` and call
|
|
|
167
172
|
modelKey: args.modelKey,
|
|
168
173
|
modelName: args.modelName,
|
|
169
174
|
modelFriendlyName: args.modelFriendlyName,
|
|
170
|
-
chatMode:
|
|
175
|
+
chatMode: plainChatMode,
|
|
171
176
|
},
|
|
172
177
|
}, { fetchOptions }).$inspect();
|
|
173
178
|
if (!result.ok)
|
|
@@ -182,7 +187,7 @@ cited document, take \`citations[*].recordId\` and call
|
|
|
182
187
|
modelKey: args.modelKey,
|
|
183
188
|
modelName: args.modelName,
|
|
184
189
|
modelFriendlyName: args.modelFriendlyName,
|
|
185
|
-
chatMode:
|
|
190
|
+
chatMode: plainChatMode,
|
|
186
191
|
}, { fetchOptions }).$inspect();
|
|
187
192
|
if (!result.ok)
|
|
188
193
|
return errorResult(result.error.message);
|
|
@@ -194,72 +199,44 @@ cited document, take \`citations[*].recordId\` and call
|
|
|
194
199
|
const httpErr = await httpErrorResult(response, "PipesHub chat request");
|
|
195
200
|
if (httpErr)
|
|
196
201
|
return httpErr;
|
|
197
|
-
// Drain the
|
|
198
|
-
//
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
let lastAccumulated = null;
|
|
202
|
-
let errorMessage = null;
|
|
202
|
+
// Drain the AG-UI stream. `applyAGUIFrame` returns true only on a
|
|
203
|
+
// genuinely terminal frame — a sub-agent's RUN_FINISHED carries no
|
|
204
|
+
// `result` and must not end the loop.
|
|
205
|
+
const state = newChatStreamState();
|
|
203
206
|
try {
|
|
204
207
|
for await (const frame of iterateSSE(response)) {
|
|
205
|
-
|
|
206
|
-
case "complete": {
|
|
207
|
-
const d = frame.data ?? {};
|
|
208
|
-
finalConversation = d.conversation ?? null;
|
|
209
|
-
recordsUsed = d.recordsUsed ?? d.meta?.recordsUsed;
|
|
210
|
-
break;
|
|
211
|
-
}
|
|
212
|
-
case "error": {
|
|
213
|
-
const d = frame.data ?? {};
|
|
214
|
-
errorMessage = typeof d === "string"
|
|
215
|
-
? d
|
|
216
|
-
: (d.error ?? d.message ?? frame.raw ?? "Stream error");
|
|
217
|
-
break;
|
|
218
|
-
}
|
|
219
|
-
case "answer_chunk": {
|
|
220
|
-
const d = frame.data ?? {};
|
|
221
|
-
if (typeof d.accumulated === "string") {
|
|
222
|
-
lastAccumulated = d.accumulated;
|
|
223
|
-
}
|
|
224
|
-
else if (typeof d.content === "string") {
|
|
225
|
-
lastAccumulated = (lastAccumulated ?? "") + d.content;
|
|
226
|
-
}
|
|
227
|
-
break;
|
|
228
|
-
}
|
|
229
|
-
// status / tool_call / tool_success / connected — ignored.
|
|
230
|
-
default:
|
|
231
|
-
break;
|
|
232
|
-
}
|
|
233
|
-
if (finalConversation || errorMessage)
|
|
208
|
+
if (applyAGUIFrame(state, frame))
|
|
234
209
|
break;
|
|
235
210
|
}
|
|
236
211
|
}
|
|
237
212
|
catch (e) {
|
|
238
213
|
return errorResult(`SSE stream failed: ${e.message}`);
|
|
239
214
|
}
|
|
240
|
-
if (
|
|
241
|
-
return errorResult(
|
|
242
|
-
if (
|
|
215
|
+
if (state.error)
|
|
216
|
+
return errorResult(state.error);
|
|
217
|
+
if (state.conversation) {
|
|
243
218
|
return jsonResult({
|
|
244
|
-
...trimConversation(
|
|
245
|
-
recordsUsed,
|
|
219
|
+
...trimConversation(state.conversation),
|
|
220
|
+
recordsUsed: state.recordsUsed,
|
|
246
221
|
});
|
|
247
222
|
}
|
|
248
|
-
// Stream ended without a terminal frame — unusual, but salvage what
|
|
249
|
-
//
|
|
250
|
-
|
|
223
|
+
// Stream ended without a terminal frame — unusual, but salvage what we
|
|
224
|
+
// accumulated so the LLM has something to work with. `conversation_created`
|
|
225
|
+
// arrives before any answer text, so a follow-up turn can still resume.
|
|
226
|
+
const salvaged = salvagedText(state);
|
|
227
|
+
if (salvaged) {
|
|
251
228
|
return jsonResult({
|
|
252
|
-
conversationId:
|
|
253
|
-
title:
|
|
229
|
+
conversationId: state.conversationId,
|
|
230
|
+
title: state.title,
|
|
254
231
|
status: "Inprogress",
|
|
255
|
-
answer:
|
|
232
|
+
answer: salvaged,
|
|
256
233
|
confidence: null,
|
|
257
234
|
citations: [],
|
|
258
235
|
followUpQuestions: [],
|
|
259
236
|
messageCount: 0,
|
|
260
|
-
recordsUsed,
|
|
261
|
-
warning: "Stream ended without a
|
|
262
|
-
+ "
|
|
237
|
+
recordsUsed: state.recordsUsed,
|
|
238
|
+
warning: "Stream ended without a terminal RUN_FINISHED; answer is the "
|
|
239
|
+
+ "accumulated TEXT_MESSAGE_CONTENT and citations are unavailable.",
|
|
263
240
|
});
|
|
264
241
|
}
|
|
265
242
|
return errorResult("Stream ended without any usable frames.");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeshubChat.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/pipeshubChat.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,0EAA0E;AAC1E,uEAAuE;AACvE,
|
|
1
|
+
{"version":3,"file":"pipeshubChat.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/pipeshubChat.ts"],"names":[],"mappings":"AAAA,oCAAoC;AACpC,0EAA0E;AAC1E,uEAAuE;AACvE,6DAA6D;AAC7D,EAAE;AACF,wEAAwE;AACxE,6EAA6E;AAC7E,wEAAwE;AACxE,8EAA8E;AAC9E,wEAAwE;AAExE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,+BAA+B,EAAE,MAAM,gDAAgD,CAAC;AACjG,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,wBAAwB,EAAE,MAAM,yCAAyC,CAAC;AACnF,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,eAAe,EACf,UAAU,EACV,UAAU,EACV,gBAAgB,GACjB,MAAM,eAAe,CAAC;AAEvB,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAC3C,wEAAwE;UACpE,2DAA2D;UAC3D,mEAAmE;UACnE,4DAA4D;UAC5D,cAAc,CACnB;IACD,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,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,CAAC;gBAChB,GAAG,gBAAgB,CAAC,KAAK,CAAC,YAAY,CAAC;gBACvC,WAAW,EAAE,KAAK,CAAC,WAAW;aAC/B,CAAC,CAAC;QACL,CAAC;QAED,uEAAuE;QACvE,4EAA4E;QAC5E,wEAAwE;QACxE,MAAM,QAAQ,GAAG,YAAY,CAAC,KAAK,CAAC,CAAC;QACrC,IAAI,QAAQ,EAAE,CAAC;YACb,OAAO,UAAU,CAAC;gBAChB,cAAc,EAAE,KAAK,CAAC,cAAc;gBACpC,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,YAAY;gBACpB,MAAM,EAAE,QAAQ;gBAChB,UAAU,EAAE,IAAI;gBAChB,SAAS,EAAE,EAAE;gBACb,iBAAiB,EAAE,EAAE;gBACrB,YAAY,EAAE,CAAC;gBACf,WAAW,EAAE,KAAK,CAAC,WAAW;gBAC9B,OAAO,EAAE,8DAA8D;sBACnE,iEAAiE;aACtE,CAAC,CAAC;QACL,CAAC;QAED,OAAO,WAAW,CAAC,yCAAyC,CAAC,CAAC;IAChE,CAAC;CACF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeshubDirectory.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/pipeshubDirectory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeshubDirectory.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/pipeshubDirectory.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAKzB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAS7C,QAAA,MAAM,IAAI;;;;;;;;;;;;CA+BT,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,cAAc,CAAC,OAAO,IAAI,CA+J9D,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { usersGetAllUsers } from "../../funcs/usersGetAllUsers.js";
|
|
|
6
6
|
import { usersGetUserById } from "../../funcs/usersGetUserById.js";
|
|
7
7
|
import { userGroupsGetAllUserGroups } from "../../funcs/userGroupsGetAllUserGroups.js";
|
|
8
8
|
import { teamsGetUserTeams } from "../../funcs/teamsGetUserTeams.js";
|
|
9
|
-
import { decodeBearer, errorResult, jsonResult, readJson, } from "./_helpers.js";
|
|
9
|
+
import { decodeBearer, errorResult, jsonResult, expiredTokenError, readJson, } from "./_helpers.js";
|
|
10
10
|
const args = {
|
|
11
11
|
action: z.enum([
|
|
12
12
|
"whoami",
|
|
@@ -15,8 +15,8 @@ const args = {
|
|
|
15
15
|
"list_groups",
|
|
16
16
|
"list_my_teams",
|
|
17
17
|
]).describe("What to do:\n"
|
|
18
|
-
+ "- `whoami` — return the authenticated user's identity
|
|
19
|
-
+ "the
|
|
18
|
+
+ "- `whoami` — return the authenticated user's identity, confirmed "
|
|
19
|
+
+ "against the server. No other args needed.\n"
|
|
20
20
|
+ "- `list_users` — paginated list of org users. Optional `page`, "
|
|
21
21
|
+ "`limit`, `search` (substring match against name or email).\n"
|
|
22
22
|
+ "- `get_user` — full profile for one user. Required `userId`. "
|
|
@@ -36,7 +36,8 @@ actions — pick the right \`action\`:
|
|
|
36
36
|
|
|
37
37
|
- \`whoami\` — who is the caller? Use this whenever you need the
|
|
38
38
|
authenticated user's own id, email, or full name (e.g. before
|
|
39
|
-
\`get_user\` on themselves).
|
|
39
|
+
\`get_user\` on themselves). Errors if the credential is expired
|
|
40
|
+
or revoked.
|
|
40
41
|
- \`list_users\` — search / page through org users.
|
|
41
42
|
- \`get_user\` — full \`User\` document for one user (requires \`userId\`).
|
|
42
43
|
- \`list_groups\` — list user groups with \`userCount\`.
|
|
@@ -63,6 +64,53 @@ Output shape varies by action; see each action's docs above.`,
|
|
|
63
64
|
+ "cannot resolve the caller's identity. Ask the user for "
|
|
64
65
|
+ "their email and use `list_users` with `search`.");
|
|
65
66
|
}
|
|
67
|
+
// The claims come out of the local token, which proves nothing about
|
|
68
|
+
// whether the server still accepts it — a revoked token carries a
|
|
69
|
+
// perfectly good name and org. Since whoami is the command people run
|
|
70
|
+
// to check "is my login working?", answering from the token alone
|
|
71
|
+
// gives a confident yes in exactly the case that matters.
|
|
72
|
+
//
|
|
73
|
+
// Expiry is checkable offline, so check it first: it is the common
|
|
74
|
+
// case and costs no round-trip.
|
|
75
|
+
const exp = claims["exp"];
|
|
76
|
+
const expired = expiredTokenError(exp);
|
|
77
|
+
if (expired)
|
|
78
|
+
return expired;
|
|
79
|
+
const tokenExpiresAt = typeof exp === "number"
|
|
80
|
+
? new Date(exp * 1000).toISOString()
|
|
81
|
+
: undefined;
|
|
82
|
+
// Revocation can only be established by asking the server. get_user on
|
|
83
|
+
// the caller's own id needs `user:read`, which whoami's callers already
|
|
84
|
+
// hold, and returns 401 for a rejected credential.
|
|
85
|
+
const userId = claims["userId"];
|
|
86
|
+
let verified = "unchecked";
|
|
87
|
+
let unverifiedReason = "No userId claim in the token, so the identity could not be "
|
|
88
|
+
+ "confirmed with the server.";
|
|
89
|
+
if (typeof userId === "string" && userId) {
|
|
90
|
+
const [probe] = await usersGetUserById(client, { id: userId }, {
|
|
91
|
+
fetchOptions,
|
|
92
|
+
}).$inspect();
|
|
93
|
+
if (!probe.ok) {
|
|
94
|
+
unverifiedReason = `Could not reach PipesHub to confirm the `
|
|
95
|
+
+ `identity (${probe.error.message}). The details below come `
|
|
96
|
+
+ `from the token itself.`;
|
|
97
|
+
}
|
|
98
|
+
else if (probe.value.status === 401) {
|
|
99
|
+
return errorResult("PipesHub rejected this access token (HTTP 401 Unauthorized), "
|
|
100
|
+
+ "so the identity in it is no longer valid — it has most "
|
|
101
|
+
+ "likely been revoked. Mint a new personal access token "
|
|
102
|
+
+ "under Developer Settings → Personal Access Tokens.");
|
|
103
|
+
}
|
|
104
|
+
else if (probe.value.ok) {
|
|
105
|
+
verified = true;
|
|
106
|
+
unverifiedReason = undefined;
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
unverifiedReason = `PipesHub returned HTTP ${probe.value.status} `
|
|
110
|
+
+ `when confirming the identity, so it could not be checked. `
|
|
111
|
+
+ `The details below come from the token itself.`;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
66
114
|
return jsonResult({
|
|
67
115
|
userId: claims["userId"],
|
|
68
116
|
orgId: claims["orgId"],
|
|
@@ -70,6 +118,12 @@ Output shape varies by action; see each action's docs above.`,
|
|
|
70
118
|
fullName: claims["fullName"],
|
|
71
119
|
mobile: claims["mobile"],
|
|
72
120
|
userSlug: claims["userSlug"],
|
|
121
|
+
tokenExpiresAt,
|
|
122
|
+
// Never `false`: that reads as "the server rejected this identity",
|
|
123
|
+
// which is a different and much more alarming claim than "this was
|
|
124
|
+
// not checked". A rejection returns an error above instead.
|
|
125
|
+
identityVerified: verified,
|
|
126
|
+
note: unverifiedReason,
|
|
73
127
|
});
|
|
74
128
|
}
|
|
75
129
|
case "list_users": {
|
|
@@ -80,7 +134,7 @@ Output shape varies by action; see each action's docs above.`,
|
|
|
80
134
|
}, { fetchOptions }).$inspect();
|
|
81
135
|
if (!result.ok)
|
|
82
136
|
return errorResult(result.error.message);
|
|
83
|
-
const parsed = await readJson(result.value);
|
|
137
|
+
const parsed = await readJson(result.value, "User listing");
|
|
84
138
|
if (!parsed.ok)
|
|
85
139
|
return parsed.result;
|
|
86
140
|
return jsonResult(parsed.value);
|
|
@@ -96,7 +150,7 @@ Output shape varies by action; see each action's docs above.`,
|
|
|
96
150
|
}, { fetchOptions }).$inspect();
|
|
97
151
|
if (!result.ok)
|
|
98
152
|
return errorResult(result.error.message);
|
|
99
|
-
const parsed = await readJson(result.value);
|
|
153
|
+
const parsed = await readJson(result.value, "User lookup");
|
|
100
154
|
if (!parsed.ok)
|
|
101
155
|
return parsed.result;
|
|
102
156
|
return jsonResult(parsed.value);
|
|
@@ -109,7 +163,7 @@ Output shape varies by action; see each action's docs above.`,
|
|
|
109
163
|
}, { fetchOptions }).$inspect();
|
|
110
164
|
if (!result.ok)
|
|
111
165
|
return errorResult(result.error.message);
|
|
112
|
-
const parsed = await readJson(result.value);
|
|
166
|
+
const parsed = await readJson(result.value, "Group listing");
|
|
113
167
|
if (!parsed.ok)
|
|
114
168
|
return parsed.result;
|
|
115
169
|
return jsonResult(parsed.value);
|
|
@@ -122,7 +176,7 @@ Output shape varies by action; see each action's docs above.`,
|
|
|
122
176
|
}, { fetchOptions }).$inspect();
|
|
123
177
|
if (!result.ok)
|
|
124
178
|
return errorResult(result.error.message);
|
|
125
|
-
const parsed = await readJson(result.value);
|
|
179
|
+
const parsed = await readJson(result.value, "Team listing");
|
|
126
180
|
if (!parsed.ok)
|
|
127
181
|
return parsed.result;
|
|
128
182
|
return jsonResult(parsed.value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeshubDirectory.js","sourceRoot":"","sources":["../../../src/mcp-server/tools/pipeshubDirectory.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,2EAA2E;AAC3E,0BAA0B;AAE1B,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AACzB,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAErE,OAAO,EACL,YAAY,EACZ,WAAW,EACX,UAAU,EACV,QAAQ,GACT,MAAM,eAAe,CAAC;AAEvB,MAAM,IAAI,GAAG;IACX,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC;QACb,QAAQ;QACR,YAAY;QACZ,UAAU;QACV,aAAa;QACb,eAAe;KAChB,CAAC,CAAC,QAAQ,CACT,eAAe;UACX,
|
|
1
|
+
{"version":3,"file":"pipeshubDirectory.js","sourceRoot":"","sources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AC,KAAK,CAAC,OAAO,CAAC,CAAC;gBACzD,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC;gBAC5D,IAAI,CAAC,MAAM,CAAC,EAAE;oBAAE,OAAO,MAAM,CAAC,MAAM,CAAC;gBACrC,OAAO,UAAU,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAClC,CAAC;QACH,CAAC;IACH,CAAC;CACF,CAAC"}
|
|
@@ -1,7 +1,124 @@
|
|
|
1
1
|
import * as z from "zod";
|
|
2
2
|
import { ToolDefinition } from "../tools.js";
|
|
3
|
+
/**
|
|
4
|
+
* Navigate and lookup return a server-rendered `text` view alongside the
|
|
5
|
+
* structured fields. It ends in a `Next:` line naming the exact follow-up call,
|
|
6
|
+
* so hand the LLM that string; fall back to JSON if the field is missing.
|
|
7
|
+
*/
|
|
8
|
+
export declare function renderedResult(response: Response): Promise<{
|
|
9
|
+
[x: string]: unknown;
|
|
10
|
+
content: ({
|
|
11
|
+
type: "text";
|
|
12
|
+
text: string;
|
|
13
|
+
annotations?: {
|
|
14
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
15
|
+
priority?: number | undefined;
|
|
16
|
+
lastModified?: string | undefined;
|
|
17
|
+
} | undefined;
|
|
18
|
+
_meta?: {
|
|
19
|
+
[x: string]: unknown;
|
|
20
|
+
} | undefined;
|
|
21
|
+
} | {
|
|
22
|
+
type: "image";
|
|
23
|
+
data: string;
|
|
24
|
+
mimeType: string;
|
|
25
|
+
annotations?: {
|
|
26
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
27
|
+
priority?: number | undefined;
|
|
28
|
+
lastModified?: string | undefined;
|
|
29
|
+
} | undefined;
|
|
30
|
+
_meta?: {
|
|
31
|
+
[x: string]: unknown;
|
|
32
|
+
} | undefined;
|
|
33
|
+
} | {
|
|
34
|
+
type: "audio";
|
|
35
|
+
data: string;
|
|
36
|
+
mimeType: string;
|
|
37
|
+
annotations?: {
|
|
38
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
39
|
+
priority?: number | undefined;
|
|
40
|
+
lastModified?: string | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
_meta?: {
|
|
43
|
+
[x: string]: unknown;
|
|
44
|
+
} | undefined;
|
|
45
|
+
} | {
|
|
46
|
+
uri: string;
|
|
47
|
+
name: string;
|
|
48
|
+
type: "resource_link";
|
|
49
|
+
description?: string | undefined;
|
|
50
|
+
mimeType?: string | undefined;
|
|
51
|
+
annotations?: {
|
|
52
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
53
|
+
priority?: number | undefined;
|
|
54
|
+
lastModified?: string | undefined;
|
|
55
|
+
} | undefined;
|
|
56
|
+
_meta?: {
|
|
57
|
+
[x: string]: unknown;
|
|
58
|
+
} | undefined;
|
|
59
|
+
icons?: {
|
|
60
|
+
src: string;
|
|
61
|
+
mimeType?: string | undefined;
|
|
62
|
+
sizes?: string[] | undefined;
|
|
63
|
+
theme?: "light" | "dark" | undefined;
|
|
64
|
+
}[] | undefined;
|
|
65
|
+
title?: string | undefined;
|
|
66
|
+
} | {
|
|
67
|
+
type: "resource";
|
|
68
|
+
resource: {
|
|
69
|
+
uri: string;
|
|
70
|
+
text: string;
|
|
71
|
+
mimeType?: string | undefined;
|
|
72
|
+
_meta?: {
|
|
73
|
+
[x: string]: unknown;
|
|
74
|
+
} | undefined;
|
|
75
|
+
} | {
|
|
76
|
+
uri: string;
|
|
77
|
+
blob: string;
|
|
78
|
+
mimeType?: string | undefined;
|
|
79
|
+
_meta?: {
|
|
80
|
+
[x: string]: unknown;
|
|
81
|
+
} | undefined;
|
|
82
|
+
};
|
|
83
|
+
annotations?: {
|
|
84
|
+
audience?: ("user" | "assistant")[] | undefined;
|
|
85
|
+
priority?: number | undefined;
|
|
86
|
+
lastModified?: string | undefined;
|
|
87
|
+
} | undefined;
|
|
88
|
+
_meta?: {
|
|
89
|
+
[x: string]: unknown;
|
|
90
|
+
} | undefined;
|
|
91
|
+
})[];
|
|
92
|
+
_meta?: {
|
|
93
|
+
[x: string]: unknown;
|
|
94
|
+
progressToken?: string | number | undefined;
|
|
95
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
96
|
+
taskId: string;
|
|
97
|
+
} | undefined;
|
|
98
|
+
} | undefined;
|
|
99
|
+
structuredContent?: {
|
|
100
|
+
[x: string]: unknown;
|
|
101
|
+
} | undefined;
|
|
102
|
+
isError?: boolean | undefined;
|
|
103
|
+
}>;
|
|
3
104
|
declare const args: {
|
|
4
|
-
|
|
105
|
+
mode: z.ZodDefault<z.ZodEnum<{
|
|
106
|
+
navigate: "navigate";
|
|
107
|
+
content: "content";
|
|
108
|
+
lookup: "lookup";
|
|
109
|
+
}>>;
|
|
110
|
+
recordId: z.ZodOptional<z.ZodString>;
|
|
111
|
+
nodeId: z.ZodOptional<z.ZodString>;
|
|
112
|
+
page: z.ZodDefault<z.ZodInt>;
|
|
113
|
+
limit: z.ZodDefault<z.ZodInt>;
|
|
114
|
+
depth: z.ZodDefault<z.ZodInt>;
|
|
115
|
+
nodeTypes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
116
|
+
createdAfter: z.ZodOptional<z.ZodString>;
|
|
117
|
+
createdBefore: z.ZodOptional<z.ZodString>;
|
|
118
|
+
modifiedAfter: z.ZodOptional<z.ZodString>;
|
|
119
|
+
modifiedBefore: z.ZodOptional<z.ZodString>;
|
|
120
|
+
identifiers: z.ZodOptional<z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>;
|
|
121
|
+
connectorName: z.ZodOptional<z.ZodString>;
|
|
5
122
|
};
|
|
6
123
|
export declare const tool$pipeshubGetRecordContent: ToolDefinition<typeof args>;
|
|
7
124
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pipeshubGetRecordContent.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/pipeshubGetRecordContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"pipeshubGetRecordContent.d.ts","sourceRoot":"","sources":["../../../src/mcp-server/tools/pipeshubGetRecordContent.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC;AAIzB,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAQ7C;;;;GAIG;AACH,wBAAsB,cAAc,CAAC,QAAQ,EAAE,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAOtD;AAED,QAAA,MAAM,IAAI;;;;;;;;;;;;;;;;;;CAyET,CAAC;AAEF,eAAO,MAAM,6BAA6B,EAAE,cAAc,CAAC,OAAO,IAAI,CAqJrE,CAAC"}
|