@talonic/mcp 0.1.111 → 0.1.112
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/CHANGELOG.md +6 -0
- package/dist/content.js +1 -1
- package/dist/content.js.map +1 -1
- package/dist/http-server.js +68 -2
- package/dist/http-server.js.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.js +28 -1
- package/dist/index.js.map +1 -1
- package/dist/server.js +28 -1
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/http-server.js
CHANGED
|
@@ -10023,6 +10023,42 @@ function handleFigure(getToken, baseUrl, args) {
|
|
|
10023
10023
|
})
|
|
10024
10024
|
);
|
|
10025
10025
|
}
|
|
10026
|
+
var THREAD_RECONNECT_TOOL = "talonic_thread_reconnect";
|
|
10027
|
+
var THREAD_READ_SCOPE = "thread:read";
|
|
10028
|
+
var THREAD_RECONNECT_TEXT = "This Talonic connection was made before the personal agent was part of it, so it cannot reach the agent yet. Reconnect Talonic once: in Claude, open Settings > Connectors, remove Talonic and add it again (in Claude Code: /mcp, Talonic, re-authenticate), then accept the Talonic consent screen. Your agent then acts with exactly your own Talonic permissions.";
|
|
10029
|
+
function tokenLacksThreadScopes(token) {
|
|
10030
|
+
if (token.startsWith("tlnc_")) return false;
|
|
10031
|
+
const parts = token.split(".");
|
|
10032
|
+
if (parts.length !== 3) return false;
|
|
10033
|
+
try {
|
|
10034
|
+
const payload = JSON.parse(Buffer.from(parts[1] ?? "", "base64url").toString("utf8"));
|
|
10035
|
+
return Array.isArray(payload.scopes) && !payload.scopes.includes(THREAD_READ_SCOPE);
|
|
10036
|
+
} catch {
|
|
10037
|
+
return false;
|
|
10038
|
+
}
|
|
10039
|
+
}
|
|
10040
|
+
function registerThreadReconnectTool(server) {
|
|
10041
|
+
server.registerTool(
|
|
10042
|
+
THREAD_RECONNECT_TOOL,
|
|
10043
|
+
{
|
|
10044
|
+
title: "Connect your Talonic agent",
|
|
10045
|
+
description: [
|
|
10046
|
+
"The person's Talonic personal agent (their thread, requests colleagues sent them, drafts waiting for approval) is not reachable over this connection yet. " + THREAD_RECONNECT_TEXT,
|
|
10047
|
+
"USE WHEN: the person asks for their Talonic agent, their thread, what to work on, or open requests from colleagues.",
|
|
10048
|
+
"ARGS: none.",
|
|
10049
|
+
"RETURNS: what the person has to do; tell them in one or two sentences."
|
|
10050
|
+
].join("\n"),
|
|
10051
|
+
inputSchema: {},
|
|
10052
|
+
annotations: {
|
|
10053
|
+
readOnlyHint: true,
|
|
10054
|
+
destructiveHint: false,
|
|
10055
|
+
idempotentHint: true,
|
|
10056
|
+
openWorldHint: false
|
|
10057
|
+
}
|
|
10058
|
+
},
|
|
10059
|
+
async () => ({ content: [{ type: "text", text: THREAD_RECONNECT_TEXT }] })
|
|
10060
|
+
);
|
|
10061
|
+
}
|
|
10026
10062
|
function registerThreadTools(server, getToken, baseUrl) {
|
|
10027
10063
|
const tools2 = [
|
|
10028
10064
|
[
|
|
@@ -18202,7 +18238,7 @@ function registerOperationsTools(server, getToken, baseUrl, families) {
|
|
|
18202
18238
|
|
|
18203
18239
|
// package.json
|
|
18204
18240
|
var package_default = {
|
|
18205
|
-
version: "0.1.
|
|
18241
|
+
version: "0.1.112"};
|
|
18206
18242
|
|
|
18207
18243
|
// src/version.ts
|
|
18208
18244
|
var VERSION = package_default.version;
|
|
@@ -18456,6 +18492,9 @@ function createServer(options) {
|
|
|
18456
18492
|
if (options.includeSchemaReviewTools) {
|
|
18457
18493
|
registerSchemaReviewTools(server, rawToken, baseUrl);
|
|
18458
18494
|
}
|
|
18495
|
+
if (!options.includeThreadTools && options.includeThreadReconnect) {
|
|
18496
|
+
registerThreadReconnectTool(server);
|
|
18497
|
+
}
|
|
18459
18498
|
if (options.includeThreadTools) {
|
|
18460
18499
|
registerThreadTools(server, rawToken, baseUrl);
|
|
18461
18500
|
}
|
|
@@ -18692,6 +18731,16 @@ function extractBearerToken(req) {
|
|
|
18692
18731
|
}
|
|
18693
18732
|
return void 0;
|
|
18694
18733
|
}
|
|
18734
|
+
function insufficientScopeChallenge(path) {
|
|
18735
|
+
const suffix = isMcpPath(path) ? "/mcp" : "";
|
|
18736
|
+
return `Bearer error="insufficient_scope", scope="${SCOPES_SUPPORTED.join(" ")}", resource_metadata="${RESOURCE_URL}/.well-known/oauth-protected-resource${suffix}", error_description="The personal agent needs the thread scopes; reconnect to grant them."`;
|
|
18737
|
+
}
|
|
18738
|
+
function threadToolCallId(parsed) {
|
|
18739
|
+
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return void 0;
|
|
18740
|
+
const msg = parsed;
|
|
18741
|
+
if (msg.method !== "tools/call" || typeof msg.params?.name !== "string") return void 0;
|
|
18742
|
+
return msg.params.name.startsWith("talonic_thread_") ? { id: msg.id ?? null } : void 0;
|
|
18743
|
+
}
|
|
18695
18744
|
function wwwAuthenticate(path) {
|
|
18696
18745
|
const suffix = isMcpPath(path) ? "/mcp" : "";
|
|
18697
18746
|
return `Bearer error="invalid_token", resource_metadata="${RESOURCE_URL}/.well-known/oauth-protected-resource${suffix}"`;
|
|
@@ -18973,6 +19022,22 @@ function createRequestHandler(options = {}) {
|
|
|
18973
19022
|
(options.myDataAccess ?? myDataAccessCached)(token),
|
|
18974
19023
|
(options.appWorkflowGroups ?? appWorkflowGroupsCached)(token)
|
|
18975
19024
|
]);
|
|
19025
|
+
const threadNeedsConsent = !includeThreadTools && tokenLacksThreadScopes(token);
|
|
19026
|
+
const threadCall = threadNeedsConsent ? threadToolCallId(parsed) : void 0;
|
|
19027
|
+
if (threadCall) {
|
|
19028
|
+
res.writeHead(403, {
|
|
19029
|
+
"Content-Type": "application/json",
|
|
19030
|
+
"WWW-Authenticate": insufficientScopeChallenge(path)
|
|
19031
|
+
});
|
|
19032
|
+
res.end(
|
|
19033
|
+
JSON.stringify({
|
|
19034
|
+
jsonrpc: "2.0",
|
|
19035
|
+
id: threadCall.id,
|
|
19036
|
+
error: { code: -32001, message: THREAD_RECONNECT_TEXT }
|
|
19037
|
+
})
|
|
19038
|
+
);
|
|
19039
|
+
return;
|
|
19040
|
+
}
|
|
18976
19041
|
const includeDecisionTaskTools = externalAppsInUse || includeMiningDriverTools;
|
|
18977
19042
|
const mcpServer = createServer({
|
|
18978
19043
|
tokenProvider: () => token,
|
|
@@ -19005,6 +19070,7 @@ function createRequestHandler(options = {}) {
|
|
|
19005
19070
|
includeRecordsAdminTools,
|
|
19006
19071
|
includeWorkspaceTools,
|
|
19007
19072
|
includeThreadTools,
|
|
19073
|
+
includeThreadReconnect: threadNeedsConsent,
|
|
19008
19074
|
includeAgentTurnTools,
|
|
19009
19075
|
includeMyDataTools,
|
|
19010
19076
|
appWorkflowGroups,
|
|
@@ -19055,6 +19121,6 @@ if (isDirectInvocation()) {
|
|
|
19055
19121
|
});
|
|
19056
19122
|
}
|
|
19057
19123
|
|
|
19058
|
-
export { PRODUCTS_SCOPES, SCOPES_SUPPORTED, THREAD_SCOPES, adminAgentTaskAccessCached, agentTasksAccessCached, agentTurnsAccessCached, apAccessCached, appWorkflowAccessCached, appWorkflowGroupsCached, appsToolsetAccessCached, casesAccessCached, contractsAccessCached, createRequestHandler, dataPoliciesAccessCached, dataProductsAccessCached, decisionTasksAccessCached, docGenAccessCached, growthAccessCached, integrationsAccessCached, isOpenAiClient, masterRecordsAccessCached, miningAccessCached, myDataAccessCached, operationsAccessCached, partiesAccessCached, portfolioAccessCached, priceBaselineAccessCached, processesAccessCached, recordsAdminAccessCached, reviewAccessCached, schemaReviewAccessCached, specAuthoringAccessCached, submissionsAccessCached, teamAdminAccessCached, threadAccessCached, tokenAcceptedCached, toolGroupsAccessCached, workspaceAccessCached, workspaceDataAccessCached };
|
|
19124
|
+
export { PRODUCTS_SCOPES, SCOPES_SUPPORTED, THREAD_SCOPES, adminAgentTaskAccessCached, agentTasksAccessCached, agentTurnsAccessCached, apAccessCached, appWorkflowAccessCached, appWorkflowGroupsCached, appsToolsetAccessCached, casesAccessCached, contractsAccessCached, createRequestHandler, dataPoliciesAccessCached, dataProductsAccessCached, decisionTasksAccessCached, docGenAccessCached, growthAccessCached, insufficientScopeChallenge, integrationsAccessCached, isOpenAiClient, masterRecordsAccessCached, miningAccessCached, myDataAccessCached, operationsAccessCached, partiesAccessCached, portfolioAccessCached, priceBaselineAccessCached, processesAccessCached, recordsAdminAccessCached, reviewAccessCached, schemaReviewAccessCached, specAuthoringAccessCached, submissionsAccessCached, teamAdminAccessCached, threadAccessCached, tokenAcceptedCached, toolGroupsAccessCached, workspaceAccessCached, workspaceDataAccessCached };
|
|
19059
19125
|
//# sourceMappingURL=http-server.js.map
|
|
19060
19126
|
//# sourceMappingURL=http-server.js.map
|