@talonic/mcp 0.1.73 → 0.1.74
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/http-server.js +172 -5
- package/dist/http-server.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.js +148 -3
- package/dist/index.js.map +1 -1
- package/dist/server.js +161 -4
- package/dist/server.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -40,6 +40,13 @@ interface CreateServerOptions {
|
|
|
40
40
|
* Stdio installs do not need this; they should use `apiKey` instead.
|
|
41
41
|
*/
|
|
42
42
|
tokenProvider?: () => string;
|
|
43
|
+
/**
|
|
44
|
+
* Register the Talonic-internal growth analytics tools (superadmin-only).
|
|
45
|
+
* Callers set this ONLY after `probeGrowthAccess` passed for the session's
|
|
46
|
+
* credential — the platform re-checks the principal on every call, so this
|
|
47
|
+
* flag controls listing visibility, never access. Defaults to false.
|
|
48
|
+
*/
|
|
49
|
+
includeGrowthTools?: boolean;
|
|
43
50
|
}
|
|
44
51
|
/**
|
|
45
52
|
* Build a Talonic MCP server, ready to be connected to a transport
|
package/dist/index.js
CHANGED
|
@@ -1291,7 +1291,7 @@ var DESCRIPTION6 = [
|
|
|
1291
1291
|
"NOT FOR: full text (use talonic_to_markdown) \xB7 extracted fields (use talonic_extract).",
|
|
1292
1292
|
"BY NAME: if the user names a file, call talonic_search first to get its document_id, then call this.",
|
|
1293
1293
|
"ARGS: document_id.",
|
|
1294
|
-
"RETURNS: filename, pages, type_detected, language, and `status`. Status lifecycle: pending_upload -> queued -> extracting -> completed. Wait for `completed` before calling talonic_extract on a freshly uploaded doc. To read the document's text, call talonic_to_markdown with this id."
|
|
1294
|
+
"RETURNS: filename, pages, type_detected, language, and `status`. Status lifecycle: pending_upload -> uploading -> queued -> extracting -> completed. Wait for `completed` before calling talonic_extract on a freshly uploaded doc. Terminal failure statuses: ocr_failed, extraction_failed, error \u2014 stop polling and report the failure to the user if any of these appear. To read the document's text, call talonic_to_markdown with this id."
|
|
1295
1295
|
].join("\n");
|
|
1296
1296
|
var inputSchema6 = {
|
|
1297
1297
|
document_id: z.string().min(1).describe(
|
|
@@ -1625,7 +1625,7 @@ var DESCRIPTION10 = [
|
|
|
1625
1625
|
"USE WHEN: the user wants to upload a document and you cannot pass it directly \u2014 hosted/sandboxed clients (ChatGPT, Claude.ai) or files too large for tool-call arguments.",
|
|
1626
1626
|
"NOT FOR: a document already in the workspace (use its document_id) \xB7 a file already on a public URL (use file_url on talonic_extract).",
|
|
1627
1627
|
"ARGS: filename (with extension).",
|
|
1628
|
-
"RETURNS: upload_url, document_id, expires_at. After the user uploads, poll talonic_get_document on that document_id until status is 'completed', then call talonic_extract."
|
|
1628
|
+
"RETURNS: upload_url, document_id, expires_at. After the user uploads, poll talonic_get_document on that document_id until status is 'completed', then call talonic_extract. If status becomes ocr_failed, extraction_failed, or error, stop polling and report the failure to the user."
|
|
1629
1629
|
].join("\n");
|
|
1630
1630
|
var inputSchema9 = {
|
|
1631
1631
|
filename: z.string().min(1).describe(
|
|
@@ -1690,6 +1690,148 @@ function registerRequestUpload(server, getToken, baseUrl) {
|
|
|
1690
1690
|
async (args) => handleRequestUpload(getToken, baseUrl, args)
|
|
1691
1691
|
);
|
|
1692
1692
|
}
|
|
1693
|
+
var DEFAULT_BASE = "https://api.talonic.com";
|
|
1694
|
+
var RANGES = ["7d", "30d", "90d"];
|
|
1695
|
+
async function growthGet(getToken, baseUrl, path, params) {
|
|
1696
|
+
try {
|
|
1697
|
+
const qs = new URLSearchParams();
|
|
1698
|
+
for (const [k, v] of Object.entries(params)) if (v !== void 0 && v !== "") qs.set(k, v);
|
|
1699
|
+
const url = `${baseUrl ?? DEFAULT_BASE}/v1/growth/${path}${qs.size ? `?${qs}` : ""}`;
|
|
1700
|
+
const res = await fetch(url, {
|
|
1701
|
+
headers: { Authorization: `Bearer ${getToken()}`, Accept: "application/json" }
|
|
1702
|
+
});
|
|
1703
|
+
if (res.status === 403) {
|
|
1704
|
+
return toolError(
|
|
1705
|
+
new Error(
|
|
1706
|
+
"Talonic growth analytics require an active superadmin account. Sign in to the connector with your Talonic staff account (or use a superadmin-created API key)."
|
|
1707
|
+
)
|
|
1708
|
+
);
|
|
1709
|
+
}
|
|
1710
|
+
if (!res.ok) {
|
|
1711
|
+
const body = await res.text().catch(() => "");
|
|
1712
|
+
return toolError(
|
|
1713
|
+
new Error(`Talonic API error: HTTP ${res.status}${body ? ` \u2014 ${body}` : ""}`)
|
|
1714
|
+
);
|
|
1715
|
+
}
|
|
1716
|
+
return jsonOk(await res.json());
|
|
1717
|
+
} catch (err) {
|
|
1718
|
+
return toolError(err);
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
var rangeArg = z.enum(RANGES).optional().describe("Trailing window (default 30d).");
|
|
1722
|
+
var FUNNEL_DESCRIPTION = [
|
|
1723
|
+
"Read Talonic's agentic product funnel: WAEW (weekly active extracting workspaces \u2014 the North Star),",
|
|
1724
|
+
"time-to-first-extraction p50/p90 + 24h activation rate, W2/W4 creation-cohort retention, and",
|
|
1725
|
+
"acquisition by surface (claude_ai, cursor, raw_api, ...).",
|
|
1726
|
+
"",
|
|
1727
|
+
"USE WHEN: asked about WAEW, activation, retention, or which surfaces drive extractions.",
|
|
1728
|
+
"INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
|
|
1729
|
+
"ARGS: range (optional: 7d | 30d | 90d, default 30d).",
|
|
1730
|
+
"RETURNS: { configured, rangeDays, waew, ttfe, retention[], bySurface[] } \u2014 configured:false means PostHog is unwired, not zero usage."
|
|
1731
|
+
].join("\n");
|
|
1732
|
+
var FUNNELS_DESCRIPTION = [
|
|
1733
|
+
"Read Talonic's website conversion funnels: Platform registration (Visit \u2192 Sign-up click \u2192 Account created \u2192 Activated)",
|
|
1734
|
+
"and Sales call booking (Visit \u2192 Book-demo click \u2192 Contact page \u2192 Demo booked).",
|
|
1735
|
+
"",
|
|
1736
|
+
"USE WHEN: asked about signups, activation counts, demo bookings, or website conversion.",
|
|
1737
|
+
"INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
|
|
1738
|
+
"ARGS: range (optional: 7d | 30d | 90d, default 30d).",
|
|
1739
|
+
"RETURNS: { rangeDays, funnels[] } \u2014 each stage carries { count, pending }; pending:true means that stage's source is not wired yet, not zero."
|
|
1740
|
+
].join("\n");
|
|
1741
|
+
var TRAFFIC_DESCRIPTION = [
|
|
1742
|
+
"Read talonic.com traffic: visitors, pageviews, top pages, and referrers split into AI assistants",
|
|
1743
|
+
"(ChatGPT, Claude, Perplexity, ...) vs other domains.",
|
|
1744
|
+
"",
|
|
1745
|
+
"USE WHEN: asked about website traffic, top pages, or how many visitors AI assistants refer.",
|
|
1746
|
+
"INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
|
|
1747
|
+
"ARGS: range (optional: 7d | 30d | 90d, default 30d).",
|
|
1748
|
+
"RETURNS: { configured, visitors, pageviews, topPages[], topReferrers[], aiReferrers[] }."
|
|
1749
|
+
].join("\n");
|
|
1750
|
+
var TOOLS_USAGE_DESCRIPTION = [
|
|
1751
|
+
"Read anonymous visitor behavior on the free tools at talonic.com/tools: views, attempt/success/bounce",
|
|
1752
|
+
"rates, dwell, CTA clicks, per-tool leaderboard, and country/device/acquisition splits.",
|
|
1753
|
+
"",
|
|
1754
|
+
"USE WHEN: asked how the free tools perform, which tools convert, or where tool visitors come from.",
|
|
1755
|
+
"INTERNAL: Talonic-superadmin-only; other accounts are rejected by the platform.",
|
|
1756
|
+
"ARGS: all optional \u2014 range (today | 7d | 30d | 90d | all, default 30d), tool (slug), category, country (ISO code), device (desktop | mobile | tablet), source (utm/referrer key), funnel_stage (attempted | succeeded | downloaded | cta).",
|
|
1757
|
+
"RETURNS: the Tools Usage dashboard payload: totals, rates, tools[] leaderboard, breakdowns, trend. Rates are ratios of independent counts, not per-visitor funnels."
|
|
1758
|
+
].join("\n");
|
|
1759
|
+
var toolsUsageInput = {
|
|
1760
|
+
range: z.enum(["today", "7d", "30d", "90d", "all"]).optional().describe("Window (default 30d)."),
|
|
1761
|
+
tool: z.string().optional().describe("Restrict to one tool slug (e.g. 'pdf-to-csv')."),
|
|
1762
|
+
category: z.string().optional().describe("Restrict to a tool category."),
|
|
1763
|
+
country: z.string().optional().describe("Restrict to a visitor country (ISO code, e.g. 'DE')."),
|
|
1764
|
+
device: z.string().optional().describe("Restrict to a device type: desktop, mobile, or tablet."),
|
|
1765
|
+
source: z.string().optional().describe("Restrict to an acquisition source (UTM value or referrer host)."),
|
|
1766
|
+
funnel_stage: z.enum(["attempted", "succeeded", "downloaded", "cta"]).optional().describe("Keep only tools with at least one event at this funnel stage.")
|
|
1767
|
+
};
|
|
1768
|
+
async function handleGrowthFunnel(getToken, baseUrl, args) {
|
|
1769
|
+
return growthGet(getToken, baseUrl, "funnel", { range: args.range });
|
|
1770
|
+
}
|
|
1771
|
+
async function handleGrowthFunnels(getToken, baseUrl, args) {
|
|
1772
|
+
return growthGet(getToken, baseUrl, "funnels", { range: args.range });
|
|
1773
|
+
}
|
|
1774
|
+
async function handleGrowthTraffic(getToken, baseUrl, args) {
|
|
1775
|
+
return growthGet(getToken, baseUrl, "traffic", { range: args.range });
|
|
1776
|
+
}
|
|
1777
|
+
async function handleGrowthToolsUsage(getToken, baseUrl, args) {
|
|
1778
|
+
return growthGet(getToken, baseUrl, "tools-usage", {
|
|
1779
|
+
range: args.range,
|
|
1780
|
+
tool: args.tool,
|
|
1781
|
+
category: args.category,
|
|
1782
|
+
country: args.country,
|
|
1783
|
+
device: args.device,
|
|
1784
|
+
source: args.source,
|
|
1785
|
+
funnelStage: args.funnel_stage
|
|
1786
|
+
});
|
|
1787
|
+
}
|
|
1788
|
+
var READ_ONLY = {
|
|
1789
|
+
readOnlyHint: true,
|
|
1790
|
+
destructiveHint: false,
|
|
1791
|
+
openWorldHint: false
|
|
1792
|
+
};
|
|
1793
|
+
function registerGrowthTools(server, getToken, baseUrl) {
|
|
1794
|
+
server.registerTool(
|
|
1795
|
+
"talonic_growth_funnel",
|
|
1796
|
+
{
|
|
1797
|
+
title: "Growth: Product Funnel",
|
|
1798
|
+
description: FUNNEL_DESCRIPTION,
|
|
1799
|
+
inputSchema: { range: rangeArg },
|
|
1800
|
+
annotations: { title: "Growth: Product Funnel", ...READ_ONLY }
|
|
1801
|
+
},
|
|
1802
|
+
async (args) => handleGrowthFunnel(getToken, baseUrl, args)
|
|
1803
|
+
);
|
|
1804
|
+
server.registerTool(
|
|
1805
|
+
"talonic_growth_funnels",
|
|
1806
|
+
{
|
|
1807
|
+
title: "Growth: Conversion Funnels",
|
|
1808
|
+
description: FUNNELS_DESCRIPTION,
|
|
1809
|
+
inputSchema: { range: rangeArg },
|
|
1810
|
+
annotations: { title: "Growth: Conversion Funnels", ...READ_ONLY }
|
|
1811
|
+
},
|
|
1812
|
+
async (args) => handleGrowthFunnels(getToken, baseUrl, args)
|
|
1813
|
+
);
|
|
1814
|
+
server.registerTool(
|
|
1815
|
+
"talonic_growth_traffic",
|
|
1816
|
+
{
|
|
1817
|
+
title: "Growth: Website Traffic",
|
|
1818
|
+
description: TRAFFIC_DESCRIPTION,
|
|
1819
|
+
inputSchema: { range: rangeArg },
|
|
1820
|
+
annotations: { title: "Growth: Website Traffic", ...READ_ONLY }
|
|
1821
|
+
},
|
|
1822
|
+
async (args) => handleGrowthTraffic(getToken, baseUrl, args)
|
|
1823
|
+
);
|
|
1824
|
+
server.registerTool(
|
|
1825
|
+
"talonic_growth_tools_usage",
|
|
1826
|
+
{
|
|
1827
|
+
title: "Growth: Free-Tools Usage",
|
|
1828
|
+
description: TOOLS_USAGE_DESCRIPTION,
|
|
1829
|
+
inputSchema: toolsUsageInput,
|
|
1830
|
+
annotations: { title: "Growth: Free-Tools Usage", ...READ_ONLY }
|
|
1831
|
+
},
|
|
1832
|
+
async (args) => handleGrowthToolsUsage(getToken, baseUrl, args)
|
|
1833
|
+
);
|
|
1834
|
+
}
|
|
1693
1835
|
var DESCRIPTION11 = [
|
|
1694
1836
|
"Get the OCR-converted markdown text of a document.",
|
|
1695
1837
|
"",
|
|
@@ -1797,7 +1939,7 @@ function registerToMarkdown(server, getTalonic) {
|
|
|
1797
1939
|
|
|
1798
1940
|
// package.json
|
|
1799
1941
|
var package_default = {
|
|
1800
|
-
version: "0.1.
|
|
1942
|
+
version: "0.1.74"};
|
|
1801
1943
|
|
|
1802
1944
|
// src/version.ts
|
|
1803
1945
|
var VERSION = package_default.version;
|
|
@@ -1912,6 +2054,9 @@ function createServer(options) {
|
|
|
1912
2054
|
registerGetPricing(server, getTalonic);
|
|
1913
2055
|
registerGetUsage(server, getTalonic);
|
|
1914
2056
|
registerRequestUpload(server, getToken, baseUrl);
|
|
2057
|
+
if (options.includeGrowthTools) {
|
|
2058
|
+
registerGrowthTools(server, getToken, baseUrl);
|
|
2059
|
+
}
|
|
1915
2060
|
registerSchemasResource(server, getTalonic);
|
|
1916
2061
|
registerWebhooksResource(server, getToken, baseUrl);
|
|
1917
2062
|
registerWidgets(server);
|