@tool-bridge/server 0.20.0 → 0.21.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.
Files changed (111) hide show
  1. package/dist/{airtable-ZNWHIJMO.js → airtable-LLZDFN7M.js} +19 -16
  2. package/dist/{alt_text_generator_ai-X7RMDDM5.js → alt_text_generator_ai-W7O34SNG.js} +4 -4
  3. package/dist/{amap-3VER75VH.js → amap-VOX4T2AW.js} +4 -4
  4. package/dist/{anthropic-N7NTB3UC.js → anthropic-G23NN3X5.js} +23 -25
  5. package/dist/{apify-JB5P5AJI.js → apify-Y3SS734K.js} +20 -19
  6. package/dist/{brave_search-USL5OOBS.js → brave_search-ZC7OAPSZ.js} +16 -14
  7. package/dist/{chunk-6ANLYNFB.js → chunk-ATK45BXV.js} +1 -1
  8. package/dist/{chunk-6X55ALDX.js → chunk-E6JCVKW6.js} +6 -5
  9. package/dist/{chunk-RVUERWUZ.js → chunk-KMTT3I6D.js} +768 -1048
  10. package/dist/chunk-R6P4XAE5.js +248 -0
  11. package/dist/{chunk-3WL6EXYX.js → chunk-U7B6DS2O.js} +1 -1
  12. package/dist/{chunk-WIGQCP6O.js → chunk-UZM2RXZH.js} +159 -182
  13. package/dist/chunk-XYBU3WZH.js +71 -0
  14. package/dist/{circleci-LBGB25LP.js → circleci-3BAX5FCG.js} +20 -24
  15. package/dist/{clerk-6RX37CNZ.js → clerk-6LEM6TNU.js} +22 -21
  16. package/dist/{cloudflare_dns-NQGW7FHV.js → cloudflare_dns-KINYTJUD.js} +21 -17
  17. package/dist/{cohere-XPC2NAEW.js → cohere-XCJ5AJ6B.js} +19 -17
  18. package/dist/{confluence-ZUG2LT5A.js → confluence-B3EWPZVE.js} +16 -11
  19. package/dist/{convertapi-ZLXKWV3L.js → convertapi-EUWSQYPF.js} +3 -3
  20. package/dist/{currencyapi-T3A3HSOD.js → currencyapi-KVTIK3GL.js} +23 -26
  21. package/dist/{deepseek-NJMOD23E.js → deepseek-PC5YGNC5.js} +27 -17
  22. package/dist/{docker_hub-D2MQCSJ7.js → docker_hub-C3MA5FU6.js} +4 -4
  23. package/dist/{dropbox-MI6U3SOT.js → dropbox-XBV7Z2IR.js} +9 -8
  24. package/dist/{dub-P2BYBYV4.js → dub-LDOFG3HC.js} +22 -19
  25. package/dist/{e2b-BGKIAE54.js → e2b-JMCPSVBW.js} +20 -20
  26. package/dist/{exa-EUY7VV4C.js → exa-RAK7O7RD.js} +22 -25
  27. package/dist/{fal_ai-AAOG5FYJ.js → fal_ai-23E7JPNT.js} +18 -17
  28. package/dist/feishu-7QRIDUV6.js +12019 -0
  29. package/dist/{feishu_custom_bot-BWGMNVXF.js → feishu_custom_bot-TJ4K7QNJ.js} +3 -3
  30. package/dist/{figma-SJSWYCGD.js → figma-E6IX5DTH.js} +21 -23
  31. package/dist/{firehydrant-MOXK2PST.js → firehydrant-ZBLPQREE.js} +15 -15
  32. package/dist/{fixer-ISIDUDZU.js → fixer-BWON27UO.js} +4 -4
  33. package/dist/{fly-U4KPSGBF.js → fly-ZH3HFCZJ.js} +20 -16
  34. package/dist/{front-ZHM2YX2E.js → front-QCGXYEDJ.js} +20 -23
  35. package/dist/{geocodio-SVCCAXAV.js → geocodio-YGNI7DA4.js} +4 -4
  36. package/dist/{ghost-INTR7FIY.js → ghost-EVSGKH2Q.js} +4 -4
  37. package/dist/{github-T275VVWR.js → github-MA2BGRCJ.js} +28 -27
  38. package/dist/{gmail-KSSPOE67.js → gmail-E5E6AADE.js} +17 -17
  39. package/dist/{googlecalendar-JB5RW27L.js → googlecalendar-BTLFPXTD.js} +22 -19
  40. package/dist/{googledocs-G522PUGW.js → googledocs-BUHL4J2H.js} +6 -5
  41. package/dist/{grafana-44ZPIV5P.js → grafana-GLU2DWF2.js} +24 -25
  42. package/dist/{graphhopper-2MORXLOW.js → graphhopper-WSMB3TCD.js} +4 -4
  43. package/dist/index.d.ts +31 -30
  44. package/dist/index.js +4 -3
  45. package/dist/{ip2proxy-R4K4KEMI.js → ip2proxy-EZ64Y4ZH.js} +4 -4
  46. package/dist/{ipgeolocation_io-H4J55OGI.js → ipgeolocation_io-AA7HAS22.js} +4 -4
  47. package/dist/{ipqualityscore-XGID4OHA.js → ipqualityscore-BHJXVTJT.js} +4 -4
  48. package/dist/{jina_ai-7ZVDOR3Z.js → jina_ai-EFBHTBXL.js} +20 -21
  49. package/dist/{jira-CTIYZTT3.js → jira-HQSHAA5K.js} +20 -16
  50. package/dist/{langsmith-ISP567FS.js → langsmith-5W6SCT6F.js} +25 -25
  51. package/dist/{lemlist-OGKK272F.js → lemlist-HJWH6UMK.js} +23 -24
  52. package/dist/{linear-6JX4E3JI.js → linear-K7RYFYAD.js} +6 -5
  53. package/dist/{logsnag-BVB36ZCL.js → logsnag-4KFOHL37.js} +20 -22
  54. package/dist/main.js +103 -102
  55. package/dist/{mattermost-UECVPZGY.js → mattermost-S2BRCWLQ.js} +21 -17
  56. package/dist/{mem0-EUA7S2OO.js → mem0-CAW43CIC.js} +15 -15
  57. package/dist/{memos-BYSBJRWZ.js → memos-TWEGPKFM.js} +39 -34
  58. package/dist/{metabase-4JXZH3YG.js → metabase-MMSEPCOF.js} +22 -18
  59. package/dist/{mistral_ai-2C5BTBKW.js → mistral_ai-64BGZQHP.js} +24 -21
  60. package/dist/{mother_duck-ZGNNNR3X.js → mother_duck-H7PCQNZ2.js} +23 -19
  61. package/dist/{ngrok-NTPGMRXI.js → ngrok-GQCUGZKJ.js} +17 -22
  62. package/dist/{notes-KGYXX6N6.js → notes-PFMKRO33.js} +1 -1
  63. package/dist/{notion-EX3X2G7G.js → notion-DQWZWP4N.js} +20 -17
  64. package/dist/{open_exchange_rates-2V2LIGPS.js → open_exchange_rates-QMMD735E.js} +4 -4
  65. package/dist/{openai-KQFQPK7Z.js → openai-W6PX32NZ.js} +22 -16
  66. package/dist/{opengraph_io-B63SEYJY.js → opengraph_io-HNDBXYNW.js} +4 -4
  67. package/dist/{openrouter-62A4H62Q.js → openrouter-JJYMEAUL.js} +19 -14
  68. package/dist/{outline-QC33XLCK.js → outline-MCBNQZYY.js} +18 -20
  69. package/dist/{paddle-HDZG35Y7.js → paddle-D2SKLUDN.js} +17 -15
  70. package/dist/{perplexity-M7LOMJWA.js → perplexity-XIFMKUAE.js} +19 -23
  71. package/dist/{pinecone-Y7YCJRZM.js → pinecone-HUFTALV2.js} +19 -24
  72. package/dist/{pipedrive-FLJA62UX.js → pipedrive-Y2O7QGFF.js} +22 -23
  73. package/dist/{polar-AE55Q425.js → polar-TYTOMOSR.js} +19 -17
  74. package/dist/{posthog-IAY5D3YW.js → posthog-43JAR3VW.js} +29 -24
  75. package/dist/{postmark-NMKAXDXZ.js → postmark-KL2QJYSG.js} +19 -17
  76. package/dist/{prerender-CDJM7I7N.js → prerender-MENYM2TY.js} +4 -4
  77. package/dist/{pubmed-N437ZJOR.js → pubmed-GOXUVVH5.js} +6 -5
  78. package/dist/{railway-NBWYXCUM.js → railway-V2SID4WV.js} +3 -3
  79. package/dist/{readwise-QRO3UC3R.js → readwise-CI4GIMMJ.js} +16 -15
  80. package/dist/{render-NEW7SROG.js → render-SUBJ6YRZ.js} +21 -20
  81. package/dist/{replicate-73YQLRTY.js → replicate-756MXPYX.js} +20 -21
  82. package/dist/{resend-R5BAZFHZ.js → resend-ZKH3BTBI.js} +15 -11
  83. package/dist/{rootly-5BLALPCS.js → rootly-CD2LJHPI.js} +19 -18
  84. package/dist/{scrapfly-EHFLNNUZ.js → scrapfly-NSRHFDIQ.js} +4 -4
  85. package/dist/{scrapingbee-UXLYS72S.js → scrapingbee-OQHLAVEY.js} +4 -4
  86. package/dist/{screenshot_fyi-KC3NLTJ6.js → screenshot_fyi-DVWG3AXC.js} +4 -4
  87. package/dist/{semantic_scholar-SA5OIUWA.js → semantic_scholar-T4A252KW.js} +21 -20
  88. package/dist/{sentry-BAE3XLJN.js → sentry-546MNDJG.js} +22 -19
  89. package/dist/{shodan-FJR6MKKW.js → shodan-C3OON3Z3.js} +4 -4
  90. package/dist/{shopify-7OA6SLN5.js → shopify-Y2HN2MCQ.js} +23 -19
  91. package/dist/{stripe-MUWDZGGF.js → stripe-VE3CD3AY.js} +3 -3
  92. package/dist/{supabase-SWWGNWYR.js → supabase-U2SL4D63.js} +18 -17
  93. package/dist/{tavily-XQNJ5EDI.js → tavily-KCZHK6HE.js} +20 -20
  94. package/dist/{telegram-RR6JPZOG.js → telegram-3URFBCMY.js} +4 -4
  95. package/dist/{telnyx-7PKXOWSO.js → telnyx-CXQ4EZUX.js} +19 -19
  96. package/dist/{todoist-63X5IUJE.js → todoist-HNPWNYTD.js} +18 -17
  97. package/dist/{trello-MOG63DAI.js → trello-3W2MIXRP.js} +4 -4
  98. package/dist/{turso-ENWTSHDL.js → turso-2EQF7C2Z.js} +23 -30
  99. package/dist/{twilio-FDXUN7VX.js → twilio-4PDBJKWX.js} +6 -5
  100. package/dist/{umami-TM7PROWF.js → umami-5REN7TGP.js} +23 -28
  101. package/dist/{unsplash-NWXLKSOW.js → unsplash-EIXL424F.js} +19 -18
  102. package/dist/{upstash_redis-CUTQ5L2N.js → upstash_redis-G4LQBYHA.js} +17 -13
  103. package/dist/{uptimerobot-NNO32M3I.js → uptimerobot-KNJ3EYLY.js} +3 -3
  104. package/dist/{v2ex-24KMSWS7.js → v2ex-RHJ234PZ.js} +35 -18
  105. package/dist/{vercel-B45LPF6I.js → vercel-AS6NCIC7.js} +21 -18
  106. package/dist/{wolfram_alpha_api-DKJWVR6G.js → wolfram_alpha_api-3G4PUJWB.js} +4 -4
  107. package/dist/{wordpress-XYFSDZXY.js → wordpress-KNDAAUV7.js} +21 -17
  108. package/dist/{workos-BEM7EPHM.js → workos-R6UITSJ7.js} +26 -27
  109. package/dist/{zhihu-CFHZ4NC7.js → zhihu-AGK4HILK.js} +21 -21
  110. package/package.json +5 -5
  111. package/dist/feishu-AN5IJYOW.js +0 -231
@@ -1,231 +0,0 @@
1
- import {
2
- createGuardedFetch
3
- } from "./chunk-3WL6EXYX.js";
4
- import {
5
- TBError,
6
- createPlugin,
7
- isTBError,
8
- normalizeUpstreamError
9
- } from "./chunk-WIGQCP6O.js";
10
- import "./chunk-U67V476Y.js";
11
-
12
- // ../plugins/src/feishu/feishuMcp.ts
13
- import {
14
- StreamableHTTPClientTransport,
15
- StreamableHTTPError
16
- } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
17
- import { CfWorkerJsonSchemaValidator } from "@modelcontextprotocol/sdk/validation/cfworker";
18
- import { Client } from "@modelcontextprotocol/sdk/client/index.js";
19
- var DEFAULT_MCP_URL = "https://mcp.feishu.cn/mcp";
20
- var sessions = /* @__PURE__ */ new Map();
21
- var feishuMcpFetch = createGuardedFetch({
22
- crossOriginRedirect: "error",
23
- sensitiveHeaders: ["x-lark-mcp-tat"]
24
- });
25
- var noStandaloneSseFetch = (input, init) => {
26
- const method = init?.method ?? (input instanceof Request ? input.method : "GET");
27
- if (String(method).toUpperCase() === "GET") {
28
- return Promise.resolve(new Response(null, { status: 405, statusText: "Method Not Allowed" }));
29
- }
30
- return feishuMcpFetch(input, init);
31
- };
32
- function isSessionInvalid(err) {
33
- return err instanceof StreamableHTTPError && (err.code === 404 || err.code === 400);
34
- }
35
- function isUnauthorized(err) {
36
- return err instanceof StreamableHTTPError && err.code === 401;
37
- }
38
- async function withSession(cfg, fn) {
39
- const makeTransport = (sessionId) => new StreamableHTTPClientTransport(new URL(cfg.url), {
40
- fetch: noStandaloneSseFetch,
41
- requestInit: {
42
- headers: {
43
- "X-Lark-MCP-TAT": cfg.tat,
44
- "X-Lark-MCP-Allowed-Tools": cfg.allowedTools
45
- }
46
- },
47
- ...sessionId !== void 0 ? { sessionId } : {}
48
- });
49
- const makeClient = () => new Client(
50
- { name: "tb-plugin-feishu", version: "0.1.0" },
51
- { jsonSchemaValidator: new CfWorkerJsonSchemaValidator() }
52
- );
53
- const runFresh = async () => {
54
- const transport = makeTransport(void 0);
55
- const client = makeClient();
56
- await client.connect(transport);
57
- if (transport.sessionId !== void 0) {
58
- sessions.set(cfg.appId, {
59
- sessionId: transport.sessionId,
60
- ...transport.protocolVersion !== void 0 ? { protocolVersion: transport.protocolVersion } : {}
61
- });
62
- } else {
63
- sessions.delete(cfg.appId);
64
- }
65
- return await fn(client);
66
- };
67
- const session = sessions.get(cfg.appId);
68
- if (session !== void 0) {
69
- const transport = makeTransport(session.sessionId);
70
- const client = makeClient();
71
- await client.connect(transport);
72
- if (session.protocolVersion !== void 0) {
73
- transport.setProtocolVersion(session.protocolVersion);
74
- }
75
- try {
76
- return await fn(client);
77
- } catch (err) {
78
- if (!isSessionInvalid(err)) throw err;
79
- sessions.delete(cfg.appId);
80
- }
81
- }
82
- return await runFresh();
83
- }
84
- async function guard(fn) {
85
- try {
86
- return await fn();
87
- } catch (err) {
88
- if (isTBError(err) || isUnauthorized(err)) throw err;
89
- if (err instanceof StreamableHTTPError && err.code !== void 0) {
90
- throw normalizeUpstreamError({ kind: "http", status: err.code, message: err.message });
91
- }
92
- throw normalizeUpstreamError({
93
- kind: "network",
94
- message: err instanceof Error ? err.message : String(err)
95
- });
96
- }
97
- }
98
- async function listTools(cfg) {
99
- return guard(async () => {
100
- const res = await withSession(cfg, (c) => c.listTools());
101
- if (res.tools.length === 0 && cfg.allowedTools.trim() === "") {
102
- throw new TBError("unavailable", "FEISHU_ALLOWED_TOOLS \u4E3A\u7A7A:\u98DE\u4E66 MCP \u4E0D\u5BA3\u544A\u4EFB\u4F55\u5DE5\u5177", {
103
- retryable: false
104
- });
105
- }
106
- return res.tools;
107
- });
108
- }
109
- async function callTool(cfg, name, args) {
110
- return guard(async () => {
111
- const res = await withSession(cfg, (c) => c.callTool({ name, arguments: args }));
112
- return res;
113
- });
114
- }
115
-
116
- // ../plugins/src/feishu/tat.ts
117
- var DEFAULT_AUTH_URL = "https://open.feishu.cn/open-apis/auth/v3/tenant_access_token/internal";
118
- var REFRESH_MARGIN_MS = 5 * 6e4;
119
- var feishuAuthFetch = createGuardedFetch({ crossOriginRedirect: "error" });
120
- var cache = /* @__PURE__ */ new Map();
121
- async function tenantAccessToken(cfg, force = false) {
122
- const cached = cache.get(cfg.appId);
123
- if (!force && cached !== void 0 && cached.expiresAtMs - Date.now() > REFRESH_MARGIN_MS) {
124
- return cached.token;
125
- }
126
- let resp;
127
- try {
128
- resp = await feishuAuthFetch(cfg.authUrl ?? DEFAULT_AUTH_URL, {
129
- method: "POST",
130
- headers: { "content-type": "application/json; charset=utf-8" },
131
- body: JSON.stringify({ app_id: cfg.appId, app_secret: cfg.appSecret })
132
- });
133
- } catch (err) {
134
- throw new TBError(
135
- "unavailable",
136
- `\u98DE\u4E66 TAT \u6362\u53D1\u7F51\u7EDC\u5931\u8D25:${err instanceof Error ? err.message : String(err)}`,
137
- { retryable: true }
138
- );
139
- }
140
- const body = await resp.json().catch(() => null);
141
- if (!resp.ok || body === null || body.code !== 0 || typeof body.tenant_access_token !== "string") {
142
- throw new TBError(
143
- "unavailable",
144
- `\u98DE\u4E66 TAT \u6362\u53D1\u5931\u8D25:HTTP ${resp.status} code=${body?.code ?? "?"} ${body?.msg ?? ""}`.trim(),
145
- { retryable: false }
146
- );
147
- }
148
- const expireSec = typeof body.expire === "number" ? body.expire : 0;
149
- cache.set(cfg.appId, {
150
- token: body.tenant_access_token,
151
- expiresAtMs: Date.now() + expireSec * 1e3
152
- });
153
- return body.tenant_access_token;
154
- }
155
-
156
- // ../plugins/src/feishu/index.ts
157
- function credentialOf(ctx) {
158
- const values = ctx.credentials;
159
- if (values === void 0) {
160
- throw new TBError(
161
- "unavailable",
162
- "\u7F3A\u4E0A\u6E38\u51ED\u8BC1:\u6302\u8F7D\u8282\u70B9\u987B\u914D\u7F6E authRef,\u51ED\u8BC1\u7528 `tb secret set <name> --field app_id=... --field app_secret=...` \u5199\u5165",
163
- { retryable: false }
164
- );
165
- }
166
- return { app_id: values.app_id, app_secret: values.app_secret };
167
- }
168
- function toSpec(t) {
169
- const spec = { name: t.name };
170
- if (t.description !== void 0) spec.description = t.description;
171
- if (t.inputSchema !== void 0) spec.inputSchema = t.inputSchema;
172
- if (t.annotations?.readOnlyHint === true) spec.effect = "read";
173
- else if (t.annotations?.destructiveHint === true) spec.effect = "destructive";
174
- return spec;
175
- }
176
- async function mcpConfig(env, cred, forceTat = false) {
177
- const tat = await tenantAccessToken(
178
- {
179
- appId: cred.app_id,
180
- appSecret: cred.app_secret,
181
- ...env.FEISHU_AUTH_URL !== void 0 ? { authUrl: env.FEISHU_AUTH_URL } : {}
182
- },
183
- forceTat
184
- );
185
- return {
186
- url: env.FEISHU_MCP_URL ?? DEFAULT_MCP_URL,
187
- appId: cred.app_id,
188
- tat,
189
- allowedTools: env.FEISHU_ALLOWED_TOOLS ?? ""
190
- };
191
- }
192
- async function withTatRetry(ctx, fn) {
193
- const cred = credentialOf(ctx);
194
- try {
195
- return await fn(await mcpConfig(ctx.env, cred));
196
- } catch (err) {
197
- if (!isUnauthorized(err)) throw err;
198
- return await fn(await mcpConfig(ctx.env, cred, true));
199
- }
200
- }
201
- function createFeishuPlugin() {
202
- const plugin = createPlugin({ token: (env) => env.PLUGIN_TOKEN });
203
- plugin.proxyTools("actions", {
204
- description: "Feishu actions (docs, wiki, messaging) via the official MCP upstream",
205
- // 飞书自建应用凭证:两个字段,由平台在挂载时校验齐全(见 core PluginExport.credentialFields)。
206
- credentialFields: [
207
- {
208
- key: "app_id",
209
- label: "App ID",
210
- required: true,
211
- description: "\u98DE\u4E66\u81EA\u5EFA\u5E94\u7528\u7684 app_id(\u5F00\u653E\u5E73\u53F0\u300C\u51ED\u8BC1\u4E0E\u57FA\u7840\u4FE1\u606F\u300D\u9875)"
212
- },
213
- {
214
- key: "app_secret",
215
- label: "App Secret",
216
- required: true,
217
- secret: true,
218
- description: "\u98DE\u4E66\u81EA\u5EFA\u5E94\u7528\u7684 app_secret,\u7528\u4E8E\u6362\u53D1 tenant_access_token"
219
- }
220
- ],
221
- list: async (ctx) => (await withTatRetry(ctx, listTools)).map(toSpec),
222
- // MCP RPC 业务错误(isError)是正常返回值,原样进 ToolResult。
223
- call: async ({ name, args }, ctx) => await withTatRetry(ctx, (cfg) => callTool(cfg, name, args))
224
- });
225
- return plugin;
226
- }
227
- var feishu_default = createFeishuPlugin();
228
- export {
229
- createFeishuPlugin,
230
- feishu_default as default
231
- };