@tool-bridge/server 0.21.0 → 0.22.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 (178) hide show
  1. package/dist/admin.js +170 -0
  2. package/dist/airtable-ML2GIGCH.js +790 -0
  3. package/dist/{alt_text_generator_ai-RELFQ5FV.js → alt_text_generator_ai-FGYQAF2A.js} +12 -11
  4. package/dist/{amap-YSYEACKQ.js → amap-G7V65NGK.js} +221 -220
  5. package/dist/anthropic-6ZK24TBB.js +203 -0
  6. package/dist/apify-VDGYHP6W.js +248 -0
  7. package/dist/brave_search-TAATLZOS.js +302 -0
  8. package/dist/chunk-2IAI3XQM.js +302 -0
  9. package/dist/chunk-7ISGFRC6.js +161 -0
  10. package/dist/{chunk-Q74GLIDK.js → chunk-BNMLA2RC.js} +6 -5
  11. package/dist/chunk-HA4BGL6C.js +8429 -0
  12. package/dist/{chunk-MDY7K5CX.js → chunk-RMAWSG7E.js} +20135 -26920
  13. package/dist/{chunk-JEWFX6Z6.js → chunk-RTW5VRTK.js} +3 -3
  14. package/dist/chunk-U7PTOA3U.js +7320 -0
  15. package/dist/chunk-UY6ANCOY.js +378 -0
  16. package/dist/{chunk-QR4LK3HF.js → chunk-X7ZUTKHR.js} +4 -2
  17. package/dist/circleci-BQ2UWXL2.js +389 -0
  18. package/dist/clerk-2JYWQNOI.js +1019 -0
  19. package/dist/cohere-6MI7AQM4.js +185 -0
  20. package/dist/{confluence-52I37IUT.js → confluence-6Y6GDETF.js} +105 -104
  21. package/dist/{convertapi-3TRJ3WEO.js → convertapi-HBZCSWOX.js} +32 -31
  22. package/dist/{currencyapi-LWEANWVI.js → currencyapi-337U5TGI.js} +71 -71
  23. package/dist/deepseek-OSPASO7O.js +210 -0
  24. package/dist/docker_hub-3ATQOY5L.js +933 -0
  25. package/dist/dropbox-LSA4GM2Y.js +1305 -0
  26. package/dist/dub-VZPJSPI6.js +680 -0
  27. package/dist/e2b-6SDYQZL2.js +278 -0
  28. package/dist/exa-B6EUYDVP.js +332 -0
  29. package/dist/{fal_ai-VJPMCNRH.js → fal_ai-K4Q27IME.js} +81 -80
  30. package/dist/feishu-4TKXG4SU.js +11975 -0
  31. package/dist/{feishu_custom_bot-ADSE23KU.js → feishu_custom_bot-7CTEAKRB.js} +57 -53
  32. package/dist/figma-OUKSZLD5.js +777 -0
  33. package/dist/firehydrant-7MOYL7QH.js +563 -0
  34. package/dist/{fixer-OAMF4DKP.js → fixer-H2BV2NO4.js} +34 -33
  35. package/dist/fly-PXKY6PNH.js +469 -0
  36. package/dist/{front-6GTVYKUM.js → front-UZYIV5DW.js} +104 -104
  37. package/dist/geocodio-NSYO7TFP.js +213 -0
  38. package/dist/ghost-QBKKQQMF.js +338 -0
  39. package/dist/github-ENLSJ4CL.js +5421 -0
  40. package/dist/gmail-KQSDEB47.js +1887 -0
  41. package/dist/googlecalendar-5YCX4SZF.js +2524 -0
  42. package/dist/{googledocs-YNKKBM6Q.js → googledocs-SSWIVFKA.js} +343 -341
  43. package/dist/{grafana-353VSGXN.js → grafana-TF2LXDQA.js} +221 -220
  44. package/dist/graphhopper-CURBVHYK.js +325 -0
  45. package/dist/index.d.ts +1132 -332
  46. package/dist/index.js +31 -13
  47. package/dist/{ip2proxy-DBGRWH7S.js → ip2proxy-YNVMTZEM.js} +28 -27
  48. package/dist/ipgeolocation_io-NAU7VJ4J.js +315 -0
  49. package/dist/ipqualityscore-OT63L4TI.js +279 -0
  50. package/dist/{jina_ai-L5BH455V.js → jina_ai-6WBMBGWM.js} +23 -23
  51. package/dist/{jira-IGTILUZA.js → jira-DVDVTHNO.js} +118 -117
  52. package/dist/langsmith-IM5N4YAU.js +593 -0
  53. package/dist/lemlist-277SHUQF.js +289 -0
  54. package/dist/{linear-HLGOWISN.js → linear-AEPH7B5V.js} +329 -327
  55. package/dist/logsnag-VEWRAGBG.js +150 -0
  56. package/dist/main.js +57 -279
  57. package/dist/{mattermost-BONGXVC7.js → mattermost-Q3A2BIZA.js} +59 -58
  58. package/dist/mem0-AXS7GZGI.js +544 -0
  59. package/dist/memos-7TXG4ZTU.js +744 -0
  60. package/dist/{metabase-ZHXHRHZK.js → metabase-NSVACWQM.js} +90 -89
  61. package/dist/mistral_ai-YZ52RGD4.js +1196 -0
  62. package/dist/{mother_duck-TKVQM35M.js → mother_duck-XLLL6FVL.js} +94 -93
  63. package/dist/ngrok-4O4W3WZW.js +356 -0
  64. package/dist/{notes-KXRNNYDW.js → notes-YTB3TJOO.js} +11 -9
  65. package/dist/notion-4W4O7J7V.js +940 -0
  66. package/dist/open_exchange_rates-23QJXVO5.js +215 -0
  67. package/dist/openai-ZS7GLSLH.js +800 -0
  68. package/dist/opengraph_io-PMVH7OYI.js +362 -0
  69. package/dist/openrouter-ONRGFNB6.js +441 -0
  70. package/dist/outline-UCUYZZ7J.js +599 -0
  71. package/dist/paddle-35HTKTUL.js +454 -0
  72. package/dist/perplexity-NVOBYN24.js +220 -0
  73. package/dist/pinecone-55CJY73C.js +571 -0
  74. package/dist/{pipedrive-CW7HONYW.js → pipedrive-WMCAKS72.js} +99 -98
  75. package/dist/polar-SM4ZM53B.js +395 -0
  76. package/dist/posthog-NWCXVXNJ.js +3464 -0
  77. package/dist/postmark-QJV5PHUQ.js +427 -0
  78. package/dist/{prerender-5EAY7GDM.js → prerender-2W7UT4SC.js} +31 -30
  79. package/dist/{pubmed-GRQUBGVA.js → pubmed-VVV7XYLU.js} +241 -239
  80. package/dist/{railway-FTM75TMX.js → railway-KGI57S3O.js} +118 -117
  81. package/dist/readwise-AGHTQB42.js +470 -0
  82. package/dist/render-O4HBROCK.js +461 -0
  83. package/dist/{replicate-RJCMDB7H.js → replicate-KWBOMX7D.js} +81 -80
  84. package/dist/{resend-YYN22NIL.js → resend-DRH6Y6I4.js} +20 -16
  85. package/dist/rootly-XGCUDW6X.js +336 -0
  86. package/dist/{scrapfly-ZJJ6XM4Q.js → scrapfly-OIQ3OY6L.js} +62 -61
  87. package/dist/{scrapingbee-QNGEOD6D.js → scrapingbee-OCZO4FHX.js} +56 -56
  88. package/dist/{screenshot_fyi-SPZAABVD.js → screenshot_fyi-CUNGFZOC.js} +16 -16
  89. package/dist/semantic_scholar-3UJRLKES.js +611 -0
  90. package/dist/{sentry-SJ5NN4C4.js → sentry-5BWVZFJV.js} +208 -207
  91. package/dist/{shodan-YMGOY7KW.js → shodan-HI37CTEW.js} +62 -61
  92. package/dist/shopify-LJ2EV2HH.js +610 -0
  93. package/dist/stripe-3LHMV55K.js +585 -0
  94. package/dist/{supabase-GQ2OFVIL.js → supabase-H2KPX3Q2.js} +245 -244
  95. package/dist/tavily-FBEWGH3Z.js +326 -0
  96. package/dist/telegram-MYYO3JND.js +1767 -0
  97. package/dist/{telnyx-4JGMC3K7.js → telnyx-H4ALEGAX.js} +57 -56
  98. package/dist/todoist-OBWICA5Q.js +664 -0
  99. package/dist/trello-GUFUJRWO.js +1080 -0
  100. package/dist/turso-NIAK4UMS.js +416 -0
  101. package/dist/{twilio-VYF3HUU6.js → twilio-K6SLK2CX.js} +72 -70
  102. package/dist/umami-42RS2EPS.js +389 -0
  103. package/dist/unsplash-V7TOTETT.js +351 -0
  104. package/dist/{upstash_redis-IUM2HDLU.js → upstash_redis-AWQMB6Y3.js} +51 -50
  105. package/dist/uptimerobot-AZC2DHOT.js +483 -0
  106. package/dist/v2ex-4TVRNMLS.js +667 -0
  107. package/dist/vercel-DPHTJ3XR.js +1076 -0
  108. package/dist/{wolfram_alpha_api-6CRVUZOJ.js → wolfram_alpha_api-XAG7IXBW.js} +36 -35
  109. package/dist/wordpress-KMPKVGUX.js +812 -0
  110. package/dist/workos-PKB2YR7S.js +664 -0
  111. package/dist/zhihu-Y4H4XYPB.js +254 -0
  112. package/package.json +18 -9
  113. package/dist/airtable-DMJEEGJP.js +0 -789
  114. package/dist/anthropic-D5X5GSYE.js +0 -202
  115. package/dist/apify-5NVFU3IZ.js +0 -247
  116. package/dist/brave_search-X557FMGO.js +0 -301
  117. package/dist/chunk-MZCIPUNQ.js +0 -23424
  118. package/dist/chunk-ZTTN6AJG.js +0 -977
  119. package/dist/circleci-3P3QTUX2.js +0 -388
  120. package/dist/clerk-GNMZQ2MY.js +0 -1019
  121. package/dist/cloudflare_dns-VWZH3ZTR.js +0 -588
  122. package/dist/cohere-C7QVIIMG.js +0 -185
  123. package/dist/deepseek-5U24YG4P.js +0 -209
  124. package/dist/docker_hub-CMISLRSE.js +0 -932
  125. package/dist/dropbox-TW4QN6FT.js +0 -1304
  126. package/dist/dub-EFXGI5UH.js +0 -679
  127. package/dist/e2b-PHM63OVF.js +0 -277
  128. package/dist/exa-DYOQWURR.js +0 -331
  129. package/dist/feishu-TFIZXPIN.js +0 -231
  130. package/dist/figma-4AK47AYY.js +0 -773
  131. package/dist/firehydrant-RGPTW4EA.js +0 -562
  132. package/dist/fly-YB4AQD4O.js +0 -468
  133. package/dist/geocodio-YRT4K25M.js +0 -212
  134. package/dist/ghost-JCW6UIP2.js +0 -337
  135. package/dist/github-CEGVRMNX.js +0 -5420
  136. package/dist/gmail-JCMJD55P.js +0 -1886
  137. package/dist/googlecalendar-2EAW4MNM.js +0 -2522
  138. package/dist/graphhopper-H3IVJNDS.js +0 -324
  139. package/dist/ipgeolocation_io-5I2BDVMG.js +0 -315
  140. package/dist/ipqualityscore-ILV7TQCV.js +0 -277
  141. package/dist/langsmith-BYRX4AOF.js +0 -592
  142. package/dist/lemlist-ZGNYTIQO.js +0 -288
  143. package/dist/logsnag-5RGTMTU2.js +0 -150
  144. package/dist/mem0-RUVNUPTE.js +0 -543
  145. package/dist/memos-TED4HI54.js +0 -739
  146. package/dist/mistral_ai-NGP5SHU7.js +0 -1195
  147. package/dist/ngrok-BYCUJ7QV.js +0 -356
  148. package/dist/notion-2ILYKJOO.js +0 -936
  149. package/dist/open_exchange_rates-JU4DC6HZ.js +0 -214
  150. package/dist/openai-6SOT26ZK.js +0 -799
  151. package/dist/opengraph_io-ZEFHV2OL.js +0 -361
  152. package/dist/openrouter-R4P7JL5L.js +0 -437
  153. package/dist/outline-VCTQ5V2X.js +0 -595
  154. package/dist/paddle-AZOAKBJS.js +0 -453
  155. package/dist/perplexity-OMRLGVAT.js +0 -219
  156. package/dist/pinecone-DI62W3ZX.js +0 -570
  157. package/dist/polar-5DRGTXNR.js +0 -394
  158. package/dist/posthog-3DTHFCKE.js +0 -3463
  159. package/dist/postmark-ME2V2XXI.js +0 -426
  160. package/dist/readwise-IJQGV6IQ.js +0 -469
  161. package/dist/render-TMSPHRTY.js +0 -460
  162. package/dist/rootly-7RXE4K7L.js +0 -336
  163. package/dist/semantic_scholar-SDPVGDDI.js +0 -610
  164. package/dist/shopify-SU5ABP54.js +0 -609
  165. package/dist/stripe-JAC425KE.js +0 -584
  166. package/dist/tavily-Y7MDA5CI.js +0 -326
  167. package/dist/telegram-OIDT3ZLH.js +0 -1766
  168. package/dist/todoist-O7S2OUGX.js +0 -663
  169. package/dist/trello-3LDE4TAQ.js +0 -1079
  170. package/dist/turso-MUQ44KCA.js +0 -415
  171. package/dist/umami-SVQIK26J.js +0 -388
  172. package/dist/unsplash-333XYDCJ.js +0 -350
  173. package/dist/uptimerobot-7ZRU2NJV.js +0 -482
  174. package/dist/v2ex-AVSJCQPS.js +0 -666
  175. package/dist/vercel-J7RGXNSA.js +0 -1075
  176. package/dist/wordpress-THOJLPKA.js +0 -811
  177. package/dist/workos-ENTGRWF2.js +0 -663
  178. package/dist/zhihu-W2BXICTX.js +0 -253
@@ -1,231 +0,0 @@
1
- import {
2
- createGuardedFetch
3
- } from "./chunk-ZTTN6AJG.js";
4
- import {
5
- TBError,
6
- createPlugin,
7
- isTBError,
8
- normalizeUpstreamError
9
- } from "./chunk-MZCIPUNQ.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
- };