@burdenoff/mcp-libs 2026.1115.1 → 2026.1118.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/dist/{core-zmkvPNsI.js → context-CNN-D9dE.js} +78 -606
- package/dist/context-CNN-D9dE.js.map +1 -0
- package/dist/{core-BKgeqlnN.cjs → context-DE1SuHyv.cjs} +87 -741
- package/dist/context-DE1SuHyv.cjs.map +1 -0
- package/dist/core/auth/memory-store.d.ts +2 -0
- package/dist/core/auth/store.d.ts +1 -0
- package/dist/core/context.d.ts +2 -1
- package/dist/core/index.cjs +19 -16
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.js +3 -2
- package/dist/core/tool-governance.d.ts +1 -1
- package/dist/core-AqyC7YJc.js +605 -0
- package/dist/core-AqyC7YJc.js.map +1 -0
- package/dist/core-Es_IX0FS.cjs +748 -0
- package/dist/core-Es_IX0FS.cjs.map +1 -0
- package/dist/index.cjs +4 -3
- package/dist/index.js +3 -2
- package/dist/{legacy-auth-BdSPFaEf.js → legacy-auth-DK_-m6hi.js} +2 -2
- package/dist/{legacy-auth-BdSPFaEf.js.map → legacy-auth-DK_-m6hi.js.map} +1 -1
- package/dist/{legacy-auth-C66oObd-.cjs → legacy-auth-Sk9KJHLW.cjs} +4 -4
- package/dist/{legacy-auth-C66oObd-.cjs.map → legacy-auth-Sk9KJHLW.cjs.map} +1 -1
- package/dist/modules/adaptercloud/index.cjs +1 -1
- package/dist/modules/adaptercloud/index.js +1 -1
- package/dist/modules/artistrybase/index.cjs +1 -1
- package/dist/modules/artistrybase/index.js +1 -1
- package/dist/modules/assethandler/index.cjs +1 -1
- package/dist/modules/assethandler/index.js +1 -1
- package/dist/modules/atheletebridge/index.cjs +1 -1
- package/dist/modules/atheletebridge/index.js +1 -1
- package/dist/modules/auth/index.cjs +4 -3
- package/dist/modules/auth/index.cjs.map +1 -1
- package/dist/modules/auth/index.js +3 -2
- package/dist/modules/auth/index.js.map +1 -1
- package/dist/modules/bigconsole/index.cjs +1 -1
- package/dist/modules/bigconsole/index.js +1 -1
- package/dist/modules/billing/index.cjs +1 -1
- package/dist/modules/billing/index.js +1 -1
- package/dist/modules/botmanor/index.cjs +1 -1
- package/dist/modules/botmanor/index.js +1 -1
- package/dist/modules/brainyrich/index.cjs +1 -1
- package/dist/modules/brainyrich/index.js +1 -1
- package/dist/modules/buildmyiq/index.cjs +1 -1
- package/dist/modules/buildmyiq/index.js +1 -1
- package/dist/modules/channels/index.cjs +1 -1
- package/dist/modules/channels/index.js +1 -1
- package/dist/modules/collabkin/index.cjs +1 -1
- package/dist/modules/collabkin/index.js +1 -1
- package/dist/modules/comradecircle/index.cjs +1 -1
- package/dist/modules/comradecircle/index.js +1 -1
- package/dist/modules/conversations/index.cjs +1 -1
- package/dist/modules/conversations/index.js +1 -1
- package/dist/modules/coolandlovely/index.cjs +1 -1
- package/dist/modules/coolandlovely/index.js +1 -1
- package/dist/modules/cosmicintersection/index.cjs +1 -1
- package/dist/modules/cosmicintersection/index.js +1 -1
- package/dist/modules/crewfoundry/index.cjs +1 -1
- package/dist/modules/crewfoundry/index.js +1 -1
- package/dist/modules/devportal/index.cjs +1 -1
- package/dist/modules/devportal/index.js +1 -1
- package/dist/modules/ecoimpacthub/index.cjs +1 -1
- package/dist/modules/ecoimpacthub/index.js +1 -1
- package/dist/modules/eventfullymanaged/index.cjs +1 -1
- package/dist/modules/eventfullymanaged/index.js +1 -1
- package/dist/modules/export/index.cjs +1 -1
- package/dist/modules/export/index.js +1 -1
- package/dist/modules/files/index.cjs +1 -1
- package/dist/modules/files/index.js +1 -1
- package/dist/modules/fluidgrids/index.cjs +1 -1
- package/dist/modules/fluidgrids/index.js +1 -1
- package/dist/modules/ggnomad/index.cjs +1 -1
- package/dist/modules/ggnomad/index.js +1 -1
- package/dist/modules/govcitizenhub/index.cjs +1 -1
- package/dist/modules/govcitizenhub/index.js +1 -1
- package/dist/modules/groups/index.cjs +1 -1
- package/dist/modules/groups/index.js +1 -1
- package/dist/modules/headshotmarketing/index.cjs +1 -1
- package/dist/modules/headshotmarketing/index.js +1 -1
- package/dist/modules/health/index.cjs +1 -1
- package/dist/modules/health/index.js +1 -1
- package/dist/modules/healthybowl/index.cjs +1 -1
- package/dist/modules/healthybowl/index.js +1 -1
- package/dist/modules/hookmovies/index.cjs +1 -1
- package/dist/modules/hookmovies/index.js +1 -1
- package/dist/modules/housingvista/index.cjs +1 -1
- package/dist/modules/housingvista/index.js +1 -1
- package/dist/modules/integrations/index.cjs +1 -1
- package/dist/modules/integrations/index.js +1 -1
- package/dist/modules/intelwatchtower/index.cjs +1 -1
- package/dist/modules/intelwatchtower/index.js +1 -1
- package/dist/modules/kadaikodi/index.cjs +1 -1
- package/dist/modules/kadaikodi/index.js +1 -1
- package/dist/modules/labsofscience/index.cjs +1 -1
- package/dist/modules/labsofscience/index.js +1 -1
- package/dist/modules/manufacturedops/index.cjs +1 -1
- package/dist/modules/manufacturedops/index.js +1 -1
- package/dist/modules/movethewheels/index.cjs +1 -1
- package/dist/modules/movethewheels/index.js +1 -1
- package/dist/modules/mybodyshield/index.cjs +1 -1
- package/dist/modules/mybodyshield/index.js +1 -1
- package/dist/modules/notifications/index.cjs +1 -1
- package/dist/modules/notifications/index.js +1 -1
- package/dist/modules/organizations/index.cjs +1 -1
- package/dist/modules/organizations/index.js +1 -1
- package/dist/modules/planmagnet/index.cjs +1 -1
- package/dist/modules/planmagnet/index.js +1 -1
- package/dist/modules/products/index.cjs +1 -1
- package/dist/modules/products/index.js +1 -1
- package/dist/modules/proserviceworld/index.cjs +1 -1
- package/dist/modules/proserviceworld/index.js +1 -1
- package/dist/modules/rbac/index.cjs +1 -1
- package/dist/modules/rbac/index.js +1 -1
- package/dist/modules/sandbox/index.cjs +1 -1
- package/dist/modules/sandbox/index.js +1 -1
- package/dist/modules/scheduler/index.cjs +1 -1
- package/dist/modules/scheduler/index.js +1 -1
- package/dist/modules/security/index.cjs +1 -1
- package/dist/modules/security/index.js +1 -1
- package/dist/modules/semanticfed/index.cjs +1 -1
- package/dist/modules/semanticfed/index.js +1 -1
- package/dist/modules/store/index.cjs +1 -1
- package/dist/modules/store/index.js +1 -1
- package/dist/modules/subscriberbot/index.cjs +1 -1
- package/dist/modules/subscriberbot/index.js +1 -1
- package/dist/modules/support/index.cjs +1 -1
- package/dist/modules/support/index.js +1 -1
- package/dist/modules/tags/index.cjs +1 -1
- package/dist/modules/tags/index.js +1 -1
- package/dist/modules/technospam/index.cjs +1 -1
- package/dist/modules/technospam/index.js +1 -1
- package/dist/modules/theculturepost/index.cjs +1 -1
- package/dist/modules/theculturepost/index.js +1 -1
- package/dist/modules/theglobalfuel/index.cjs +1 -1
- package/dist/modules/theglobalfuel/index.js +1 -1
- package/dist/modules/timecampus/index.cjs +1 -1
- package/dist/modules/timecampus/index.js +1 -1
- package/dist/modules/tours/index.cjs +1 -1
- package/dist/modules/tours/index.js +1 -1
- package/dist/modules/vibecontrols/index.cjs +2 -2
- package/dist/modules/vibecontrols/index.js +2 -2
- package/dist/modules/workspaces/index.cjs +1 -1
- package/dist/modules/workspaces/index.js +1 -1
- package/dist/transports/hosted.d.ts +33 -0
- package/dist/transports/index.cjs +3 -1
- package/dist/transports/index.d.ts +1 -0
- package/dist/transports/index.js +2 -2
- package/dist/transports-CWPyypes.js +478 -0
- package/dist/transports-CWPyypes.js.map +1 -0
- package/dist/transports-LHVn9JhI.cjs +537 -0
- package/dist/transports-LHVn9JhI.cjs.map +1 -0
- package/package.json +4 -3
- package/dist/core-BKgeqlnN.cjs.map +0 -1
- package/dist/core-zmkvPNsI.js.map +0 -1
- package/dist/transports-BUwYHMg1.js +0 -206
- package/dist/transports-BUwYHMg1.js.map +0 -1
- package/dist/transports-Cz4PCHmm.cjs +0 -253
- package/dist/transports-Cz4PCHmm.cjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as mcpToolName, h as mcpResourceUri, m as mcpPromptName, n as jsonResult, t as errorResult } from "../../core-
|
|
1
|
+
import { g as mcpToolName, h as mcpResourceUri, m as mcpPromptName, n as jsonResult, t as errorResult } from "../../core-AqyC7YJc.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/modules/theglobalfuel/operations.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as mcpToolName, h as mcpResourceUri, m as mcpPromptName, n as jsonResult, t as errorResult } from "../../core-
|
|
1
|
+
import { g as mcpToolName, h as mcpResourceUri, m as mcpPromptName, n as jsonResult, t as errorResult } from "../../core-AqyC7YJc.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/modules/timecampus/operations.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const require_core = require("../../core-
|
|
1
|
+
const require_core = require("../../core-Es_IX0FS.cjs");
|
|
2
2
|
const require_operations = require("../../operations-DP4x9B3a.cjs");
|
|
3
|
-
const require_legacy_auth = require("../../legacy-auth-
|
|
3
|
+
const require_legacy_auth = require("../../legacy-auth-Sk9KJHLW.cjs");
|
|
4
4
|
let zod = require("zod");
|
|
5
5
|
|
|
6
6
|
// src/modules/vibecontrols/tool-annotations.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as withToolAnnotations, g as mcpToolName, n as jsonResult, t as errorResult } from "../../core-
|
|
1
|
+
import { c as withToolAnnotations, g as mcpToolName, n as jsonResult, t as errorResult } from "../../core-AqyC7YJc.js";
|
|
2
2
|
import { $ as DELETE_DOCS_PAGE, $i as UPDATE_VIBEDECK_BUTTON, $n as LIST_VIBE_DECK_SHARE_LINKS, $r as SESSION_COLLABORATORS, $t as GET_SANDBOX_TAGS, A as CREATE_GITOPS_PROVIDER_M, Ai as UPDATE_AGENT, An as LIST_COMPONENTS, Ar as RESOLVE_INTEGRATION_TOKEN_M, At as GET_AGENT, B as CREATE_TUNNEL, Bi as UPDATE_REPOSITORY_SECURITY_CONFIG_M, Bn as LIST_SCHEDULED_JOBS, Br as ROTATE_TUNNEL_CREDENTIALS, Bt as GET_CONFIGURATION, C as CREATE_AGENT, Ci as TRANSFER_SESSION_CONTROL, Cn as LIST_ACTION_EXECUTIONS, Cr as REMOVE_VIBE_FROM_CATALOG, Ct as EXPORT_AUDIT_LOGS, D as CREATE_COMPONENT, Di as UNPIN_NOTE, Dn as LIST_ALL_SANDBOXES, Dr as REQUEST_SESSION_CONTROL, Dt as FORK_GITHUB_REPO, E as CREATE_CATALOG, Ei as TUNNEL_USAGE, En as LIST_AI_TOOL_EVENTS, Er as REPOSITORY_SECURITY_CONFIG_Q, Et as EXTEND_SANDBOX_TTL, F as CREATE_SCHEDULED_JOB, Fi as UPDATE_DOCS_SITE, Fn as LIST_NOTES, Fr as REVOKE_SESSION_SHARE, Ft as GET_CATALOG_SBOM, G as CREATE_WEBHOOK, Gi as UPDATE_SESSION, Gn as LIST_TUNNELS, Gr as SEARCH_VIBES, Gt as GET_RECENT_SANDBOX_ACTIVITY, H as CREATE_VIBEDECK, Hi as UPDATE_SANDBOX_TEMPLATE, Hn as LIST_SETTINGS_SECRETS_Q, Hr as SAVE_UI_SESSION, Ht as GET_DOCS_SITE, I as CREATE_SECURITY_EXCEPTION_M, Ii as UPDATE_GITOPS_PROVIDER_M, In as LIST_SANDBOXES, Ir as REVOKE_SESSION_SHARE_LINK, It as GET_CI_PIPELINE_DETAILS_Q, J as DELETE_AI_PROMPT, Ji as UPDATE_TARGET, Jn as LIST_TUNNEL_SESSIONS, Jr as SECURITY_PROVIDERS_Q, Jt as GET_SANDBOX_ARTIFACT_BYTES, K as DELETE_ACTION, Ki as UPDATE_SESSION_SHARE, Kn as LIST_TUNNEL_DOMAINS, Kr as SECURITY_FINDINGS_Q, Kt as GET_REPO_STATS_Q, L as CREATE_SESSION, Li as UPDATE_NOTE, Ln as LIST_SANDBOX_EXPORT_JOBS, Lr as REVOKE_TUNNEL_SESSION, Lt as GET_CI_PIPELINE_RUNS_Q, M as CREATE_SANDBOX, Mi as UPDATE_CATALOG, Mn as LIST_DOCS_PAGES, Mr as RESTART_SESSION_TERMINAL, Mt as GET_AUDIT_LOG, N as CREATE_SANDBOX_TAG, Ni as UPDATE_COMPONENT, Nn as LIST_DOCS_SITES, Nr as RESTORE_VIBE, Nt as GET_CATALOG, O as CREATE_DOCS_PAGE, Oi as UNTAG_SANDBOX, On as LIST_AUDIT_LOGS, Or as RESERVE_TUNNEL_SUBDOMAIN, Ot as GET_ACTION, P as CREATE_SANDBOX_TEMPLATE, Pi as UPDATE_DOCS_PAGE, Pn as LIST_GITOPS_PROVIDERS_Q, Pr as REVOKE_SECURITY_EXCEPTION_M, Pt as GET_CATALOG_DEPENDENCY_GRAPH, Q as DELETE_CONFIGURATION, Qi as UPDATE_VIBEDECK, Qn as LIST_VIBES, Qr as SESSIONS_SHARED_WITH_ME, Qt as GET_SANDBOX_STATS, R as CREATE_SESSION_SHARE_LINK, Ri as UPDATE_NOTIFICATION_PREFERENCES_M, Rn as LIST_SANDBOX_NODES, Rr as REVOKE_VIBE_DECK_SHARE_LINK, Rt as GET_CI_STATUS_Q, S as CREATE_ACTION, Si as TEST_WEBHOOK, Sn as LIST_ACTIONS, Sr as REMOVE_SCORECARD_METRIC, St as EXECUTE_VIBEDECK_BUTTON, T as CREATE_AI_TOOL_EVENT, Ti as TUNNEL_AUDIT, Tn as LIST_AI_PROMPTS, Tr as REPLACE_SANDBOX_TAGS, Tt as EXPORT_SESSIONS, U as CREATE_VIBEDECK_BUTTON, Ui as UPDATE_SCORECARD_METRIC, Un as LIST_TARGETS, Ur as SCAN_SSH_CONFIG, Ut as GET_GITOPS_PROVIDER_Q, V as CREATE_VIBE, Vi as UPDATE_SANDBOX_CONFIG, Vn as LIST_SESSIONS, Vr as RUN_SECURITY_SCAN_M, Vt as GET_DOCS_PAGE, W as CREATE_VIBE_DECK_SHARE_LINK, Wi as UPDATE_SECURITY_FINDING_STATUS_M, Wn as LIST_TEMPLATES, Wr as SEARCH_NOTES, Wt as GET_NOTE, X as DELETE_CATALOG, Xi as UPDATE_TUNNEL, Xn as LIST_VIBEDECKS, Xr as SECURITY_STATUS_Q, Xt as GET_SANDBOX_EXPORT_JOB, Y as DELETE_AUDIT_LOG, Yi as UPDATE_TEMPLATE, Yn as LIST_TUNNEL_SHARDS, Yr as SECURITY_SCAN_Q, Yt as GET_SANDBOX_CONFIG, Z as DELETE_COMPONENT, Zi as UPDATE_VIBE, Zn as LIST_VIBEDECK_BUTTONS, Zr as SEND_SESSION_INPUT, Zt as GET_SANDBOX_LOGS, _ as CANCEL_SECURITY_SCAN_M, _i as STOP_TARGET_TERMINAL, _n as INSTANTIATE_TEMPLATE, _r as REFRESH_REPO_STATS_M, _t as DUPLICATE_ACTION, a as ADD_VIBE_TO_CATALOG, aa as UPSERT_SCORECARD, ai as SET_SECURITY_PROVIDER_M, an as GET_TUNNEL, ar as PINNED_NOTES, at as DELETE_SCHEDULED_JOB, b as COMPILE_DOCS_SITE, bi as TERMINATE_SESSION, bn as KILL_SESSION, br as REMOVE_AGENT_PLUGIN, bt as EXECUTE_ACTION, c as ALL_SECURITY_SCANS_Q, ca as VIBECONTROLS_ANALYTICS, ci as SHARE_SESSION, cn as GET_TUNNEL_PROVIDER, cr as PROBE_AGENT_CONNECTION, ct as DELETE_TARGET, d as AUDIT_LOG_STATS, di as START_SESSION_TERMINAL, dn as GET_VIBEDECK, dr as PUBLISH_COMPONENT_AS_TEMPLATE, dt as DELETE_TUNNEL_DOMAIN, ea as UPDATE_VIBE_DECK_SHARE_LINK, ei as SESSION_OUTPUT, en as GET_SANDBOX_TEMPLATE, er as LIST_WEBHOOKS, et as DELETE_DOCS_SITE, f as AVAILABLE_SANDBOX_TAGS, fi as START_TARGET_TERMINAL, fn as GET_WEBHOOK, fr as PUBLISH_DOCS_REVISION, ft as DELETE_VIBE, g as CANCEL_ACTION_EXECUTION, gi as STOP_SESSION_TERMINAL, gn as INSTALL_AGENT_PLUGIN, gr as REFRESH_CI_STATUS_M, gt as DETACH_TUNNEL_DOMAIN, h as BULK_TERMINATE_SESSIONS, hi as STOP_SESSION, hn as INSTALL_AGENT_ON_TARGET, hr as RECORD_AI_PROMPT_USAGE, ht as DELETE_WEBHOOK, i as ADD_SCORECARD_METRIC, ia as UPDATE_WORKSPACE_DEFAULTS_M, ii as SET_DEFAULT_VIBEDECK, in as GET_TEMPLATE, ir as MY_SETTINGS_Q, it as DELETE_SANDBOX_TEMPLATE, j as CREATE_NOTE, ji as UPDATE_AI_PROMPT, jn as LIST_CONFIGURATIONS, jr as RESTART_SESSION, jt as GET_AI_PROMPT, k as CREATE_DOCS_SITE, ki as UPDATE_ACTION, kn as LIST_CATALOGS, kr as RESET_SETTINGS_M, kt as GET_ACTIVE_SANDBOXES, l as ARCHIVE_VIBE, la as VIBE_HIERARCHY, li as START_SANDBOX, ln as GET_UI_SESSION, lr as PROBE_AGENT_TUNNEL, lt as DELETE_TEMPLATE, m as BULK_STOP_SESSIONS, mi as STOP_SANDBOX, mn as INSTALL_ACTION_FROM_STORE, mr as RECENT_AI_TOOL_EVENTS, mt as DELETE_VIBEDECK_BUTTON, n as ADD_AGENT_FROM_TUNNEL, na as UPDATE_VIBE_STATUS, ni as SESSION_SHARE_LINKS, nn as GET_SESSION, nr as MY_SECURITY_SCANS_Q, nt as DELETE_NOTE, o as AGENT_HEALTH_PROBES, oa as VALIDATE_VIBE_DECK_SHARE_LINK, oi as SET_SETTINGS_SECRET_M, on as GET_TUNNEL_BY_SLUG, or as PIN_NOTE, ot as DELETE_SESSION, p as BULK_RESTART_SESSIONS, pi as START_TUNNEL, pn as IMPORT_TARGETS_FROM_CONFIG, pr as PUSH_SECURITY_SCAN_RUN_M, pt as DELETE_VIBEDECK, q as DELETE_AGENT, qi as UPDATE_SESSION_STATUS, qn as LIST_TUNNEL_PROVIDERS, qr as SECURITY_POLICY_DECISION_Q, qt as GET_SANDBOX, r as ADD_COMPONENT_TO_CATALOG, ra as UPDATE_WEBHOOK, ri as SET_CONFIGURATION, rn as GET_TARGET, rr as MY_SETTINGS_BY_CATEGORY_Q, rt as DELETE_SANDBOX, s as AGENT_PLUGINS, sa as VERIFY_TUNNEL_DOMAIN, si as SHARED_VIBE_DECK, sn as GET_TUNNEL_DOMAIN, sr as PRESIGN_SECURITY_EVIDENCE_M, st as DELETE_SETTINGS_SECRET_M, t as ACTIVE_SESSIONS, ta as UPDATE_VIBE_GIT, ti as SESSION_SHARES, tn as GET_SCORECARD, tr as MOVE_VIBE, tt as DELETE_GITOPS_PROVIDER_M, u as ATTACH_TUNNEL_DOMAIN, ui as START_SESSION, un as GET_VIBE, ur as PROXY_SANDBOX_REQUEST, ut as DELETE_TUNNEL, v as CHECK_SESSION_HEALTH, vi as STOP_TUNNEL, vn as ISSUE_TUNNEL_SESSION, vr as REGISTER_CUSTOM_TUNNEL_DOMAIN, vt as DUPLICATE_AI_PROMPT, w as CREATE_AI_PROMPT, wi as TRIGGER_WEBHOOK, wn as LIST_AGENTS, wr as RENDER_AI_PROMPT, wt as EXPORT_SANDBOXES, x as CONFIGURATIONS_BY_SCOPE, xi as TEST_TARGET, xn as LEAVE_SHARED_SESSION, xr as REMOVE_COMPONENT_FROM_CATALOG, xt as EXECUTE_SHARED_VIBE_DECK_BUTTON, y as CLEAR_UI_SESSION, yi as TAG_SANDBOX, yn as JOIN_SHARED_SESSION, yr as RELEASE_SESSION_CONTROL, yt as DUPLICATE_VIBEDECK, z as CREATE_TARGET, zi as UPDATE_PREFERENCES_M, zn as LIST_SANDBOX_TEMPLATES, zr as ROLLBACK_DOCS_REVISION, zt as GET_COMPONENT } from "../../operations-D6fWf6v_.js";
|
|
3
|
-
import { t as getAuth } from "../../legacy-auth-
|
|
3
|
+
import { t as getAuth } from "../../legacy-auth-DK_-m6hi.js";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
6
6
|
// src/modules/vibecontrols/tool-annotations.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as mcpToolName, h as mcpResourceUri, m as mcpPromptName, n as jsonResult, t as errorResult } from "../../core-
|
|
1
|
+
import { g as mcpToolName, h as mcpResourceUri, m as mcpPromptName, n as jsonResult, t as errorResult } from "../../core-AqyC7YJc.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
|
|
4
4
|
// src/modules/workspaces/operations.ts
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { type McpContext } from '../core/context.js';
|
|
3
|
+
export interface HostedAuth {
|
|
4
|
+
token: string;
|
|
5
|
+
userId: string;
|
|
6
|
+
workspaceId?: string;
|
|
7
|
+
scopes: string[];
|
|
8
|
+
readOnly: boolean;
|
|
9
|
+
clientId?: string;
|
|
10
|
+
expiresAt: number;
|
|
11
|
+
}
|
|
12
|
+
export interface HostedMcpOptions {
|
|
13
|
+
baseContext: McpContext;
|
|
14
|
+
resourceUrl: string;
|
|
15
|
+
authorizationServers: string[];
|
|
16
|
+
resourceName: string;
|
|
17
|
+
scopesSupported?: string[];
|
|
18
|
+
createServer: (ctx: McpContext, auth: HostedAuth) => McpServer;
|
|
19
|
+
preflight?: (ctx: McpContext, auth: HostedAuth) => Promise<boolean>;
|
|
20
|
+
allowedOrigins?: string[];
|
|
21
|
+
now?: () => number;
|
|
22
|
+
}
|
|
23
|
+
type TokenCheck = {
|
|
24
|
+
ok: true;
|
|
25
|
+
auth: HostedAuth;
|
|
26
|
+
} | {
|
|
27
|
+
ok: false;
|
|
28
|
+
reason: 'missing' | 'invalid';
|
|
29
|
+
description?: string;
|
|
30
|
+
};
|
|
31
|
+
export declare function checkBearerToken(header: string | null, resourceUrl: string, nowSeconds: number): TokenCheck;
|
|
32
|
+
export declare function createHostedMcpHandler(options: HostedMcpOptions): (request: Request) => Promise<Response>;
|
|
33
|
+
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_transports = require("../transports-
|
|
2
|
+
const require_transports = require("../transports-LHVn9JhI.cjs");
|
|
3
3
|
|
|
4
4
|
exports.assertTransportAuthConfigured = require_transports.assertTransportAuthConfigured;
|
|
5
|
+
exports.checkBearerToken = require_transports.checkBearerToken;
|
|
6
|
+
exports.createHostedMcpHandler = require_transports.createHostedMcpHandler;
|
|
5
7
|
exports.createHttpApp = require_transports.createHttpApp;
|
|
6
8
|
exports.isAuthorizedRequest = require_transports.isAuthorizedRequest;
|
|
7
9
|
exports.isValidSessionId = require_transports.isValidSessionId;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { startStdioServer, type StdioOptions } from './stdio.js';
|
|
2
2
|
export { startHttpServer, createHttpApp, type HttpServerOptions, type CreateServerFn, } from './http.js';
|
|
3
|
+
export { createHostedMcpHandler, checkBearerToken, type HostedAuth, type HostedMcpOptions, } from './hosted.js';
|
|
3
4
|
export { parseCorsOrigins, isAuthorizedRequest, requireAuthorizedRequest, isValidSessionId, assertTransportAuthConfigured, } from './security.js';
|
package/dist/transports/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as assertTransportAuthConfigured, c as parseCorsOrigins, i as startHttpServer, l as requireAuthorizedRequest, n as createHostedMcpHandler, o as isAuthorizedRequest, r as createHttpApp, s as isValidSessionId, t as checkBearerToken, u as startStdioServer } from "../transports-CWPyypes.js";
|
|
2
2
|
|
|
3
|
-
export { assertTransportAuthConfigured, createHttpApp, isAuthorizedRequest, isValidSessionId, parseCorsOrigins, requireAuthorizedRequest, startHttpServer, startStdioServer };
|
|
3
|
+
export { assertTransportAuthConfigured, checkBearerToken, createHostedMcpHandler, createHttpApp, isAuthorizedRequest, isValidSessionId, parseCorsOrigins, requireAuthorizedRequest, startHttpServer, startStdioServer };
|
|
@@ -0,0 +1,478 @@
|
|
|
1
|
+
import { _ as decodeJwtPayload, n as contextForRequest } from "./context-CNN-D9dE.js";
|
|
2
|
+
import { isInitializeRequest } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import { randomUUID } from "node:crypto";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6
|
+
import { WebStandardStreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/webStandardStreamableHttp.js";
|
|
7
|
+
|
|
8
|
+
// src/transports/stdio.ts
|
|
9
|
+
/**
|
|
10
|
+
* Stdio transport — connects an existing McpServer over process.stdin/stdout.
|
|
11
|
+
*
|
|
12
|
+
* Stdio reserves stdout for JSON-RPC; ALL diagnostic output must go to stderr.
|
|
13
|
+
* Modules that use ctx.logger are safe; raw console.log is not.
|
|
14
|
+
*/
|
|
15
|
+
async function startStdioServer(server, ctx, _opts = {}) {
|
|
16
|
+
ctx.logger.info("Starting MCP server with stdio transport", {
|
|
17
|
+
name: ctx.serverName,
|
|
18
|
+
version: ctx.serverVersion
|
|
19
|
+
});
|
|
20
|
+
const transport = new StdioServerTransport();
|
|
21
|
+
await server.connect(transport);
|
|
22
|
+
ctx.logger.info("MCP stdio server started");
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/transports/security.ts
|
|
26
|
+
const SESSION_ID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
27
|
+
function parseCorsOrigins(origins) {
|
|
28
|
+
if (Array.isArray(origins)) return origins;
|
|
29
|
+
const value = origins?.trim();
|
|
30
|
+
if (!value || value === "*") return ["http://127.0.0.1", "http://localhost"];
|
|
31
|
+
return value.split(",").map((origin) => origin.trim()).filter(Boolean);
|
|
32
|
+
}
|
|
33
|
+
function isAuthorizedRequest(req, apiKey) {
|
|
34
|
+
return req.headers.authorization === `Bearer ${apiKey}` || req.headers["x-api-key"] === apiKey;
|
|
35
|
+
}
|
|
36
|
+
function requireAuthorizedRequest(req, res, apiKey) {
|
|
37
|
+
if (!apiKey) {
|
|
38
|
+
res.status(503).json({ error: "Transport authentication is not configured" });
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
if (!isAuthorizedRequest(req, apiKey)) {
|
|
42
|
+
res.status(401).json({ error: "Unauthorized" });
|
|
43
|
+
return false;
|
|
44
|
+
}
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
function assertTransportAuthConfigured(transport, apiKey) {
|
|
48
|
+
if ((transport === "sse" || transport === "http") && !apiKey) throw new Error("MCP_API_KEY must be configured for HTTP/SSE transports");
|
|
49
|
+
}
|
|
50
|
+
function isValidSessionId(sessionId) {
|
|
51
|
+
return SESSION_ID_PATTERN.test(sessionId);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// src/transports/http.ts
|
|
55
|
+
/**
|
|
56
|
+
* HTTP transport — Streamable HTTP via Express + CORS.
|
|
57
|
+
*
|
|
58
|
+
* express + cors are OPTIONAL peer deps; we dynamic-import them so stdio-only
|
|
59
|
+
* consumers don't pay the install cost.
|
|
60
|
+
*
|
|
61
|
+
* Ported from vibecontrols-mcp/src/transports/http-simple.ts. Notable:
|
|
62
|
+
* - DNS-rebinding protection ON by default (don't relax!)
|
|
63
|
+
* - Per-session UUID transport instances (multi-client multiplex)
|
|
64
|
+
* - Optional API-key auth (Bearer or X-API-Key)
|
|
65
|
+
*
|
|
66
|
+
* NOTE: each new MCP session re-runs the createServerFn to mint a fresh
|
|
67
|
+
* server instance. The shell passes a factory so each session gets its own
|
|
68
|
+
* registered tools/resources/prompts (current vibecontrols-mcp pattern).
|
|
69
|
+
*/
|
|
70
|
+
/**
|
|
71
|
+
* Build an Express app exposing /mcp + /health endpoints. The createServerFn
|
|
72
|
+
* is invoked once per new MCP session.
|
|
73
|
+
*/
|
|
74
|
+
async function createHttpApp(ctx, createServerFn, options = {}) {
|
|
75
|
+
const expressMod = await import("express");
|
|
76
|
+
const corsMod = await import("cors");
|
|
77
|
+
const express = expressMod.default ?? expressMod;
|
|
78
|
+
const cors = corsMod.default ?? corsMod;
|
|
79
|
+
const cfg = ctx.config.read();
|
|
80
|
+
const app = express();
|
|
81
|
+
app.use(express.json());
|
|
82
|
+
if (options.enableCors !== false) {
|
|
83
|
+
const corsOrigins = options.corsOrigins ?? cfg.corsOrigins;
|
|
84
|
+
app.use(cors({
|
|
85
|
+
origin: parseCorsOrigins(corsOrigins),
|
|
86
|
+
exposedHeaders: ["Mcp-Session-Id"],
|
|
87
|
+
allowedHeaders: [
|
|
88
|
+
"Content-Type",
|
|
89
|
+
"Authorization",
|
|
90
|
+
"X-API-Key",
|
|
91
|
+
"mcp-session-id"
|
|
92
|
+
]
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
const transports = {};
|
|
96
|
+
const apiKey = options.apiKey ?? cfg.apiKey;
|
|
97
|
+
app.post("/mcp", async (req, res) => {
|
|
98
|
+
if (!requireAuthorizedRequest(req, res, apiKey)) return;
|
|
99
|
+
try {
|
|
100
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
101
|
+
let transport;
|
|
102
|
+
if (sessionId && !isValidSessionId(sessionId)) {
|
|
103
|
+
res.status(400).json({
|
|
104
|
+
jsonrpc: "2.0",
|
|
105
|
+
error: {
|
|
106
|
+
code: -32e3,
|
|
107
|
+
message: "Bad Request: Invalid session ID provided"
|
|
108
|
+
},
|
|
109
|
+
id: null
|
|
110
|
+
});
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (sessionId && transports[sessionId]) transport = transports[sessionId];
|
|
114
|
+
else if (!sessionId && isInitializeRequest(req.body)) {
|
|
115
|
+
transport = new StreamableHTTPServerTransport({
|
|
116
|
+
sessionIdGenerator: () => randomUUID(),
|
|
117
|
+
onsessioninitialized: (sid) => {
|
|
118
|
+
transports[sid] = transport;
|
|
119
|
+
ctx.logger.info("New MCP session initialized", { sessionId: sid });
|
|
120
|
+
},
|
|
121
|
+
enableDnsRebindingProtection: options.enableDnsRebindingProtection ?? true,
|
|
122
|
+
allowedHosts: options.allowedHosts ?? cfg.allowedHosts.split(",")
|
|
123
|
+
});
|
|
124
|
+
transport.onclose = () => {
|
|
125
|
+
if (transport.sessionId) {
|
|
126
|
+
delete transports[transport.sessionId];
|
|
127
|
+
ctx.logger.info("MCP session closed", { sessionId: transport.sessionId });
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
await createServerFn().connect(transport);
|
|
131
|
+
} else {
|
|
132
|
+
res.status(400).json({
|
|
133
|
+
jsonrpc: "2.0",
|
|
134
|
+
error: {
|
|
135
|
+
code: -32e3,
|
|
136
|
+
message: "Bad Request: No valid session ID provided"
|
|
137
|
+
},
|
|
138
|
+
id: null
|
|
139
|
+
});
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
await transport.handleRequest(req, res, req.body);
|
|
143
|
+
} catch (error) {
|
|
144
|
+
ctx.logger.error("Error handling MCP request", { error: error instanceof Error ? error.message : String(error) });
|
|
145
|
+
if (!res.headersSent) res.status(500).json({
|
|
146
|
+
jsonrpc: "2.0",
|
|
147
|
+
error: {
|
|
148
|
+
code: -32603,
|
|
149
|
+
message: "Internal server error"
|
|
150
|
+
},
|
|
151
|
+
id: null
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
const handleSessionRequest = async (req, res) => {
|
|
156
|
+
if (!requireAuthorizedRequest(req, res, apiKey)) return;
|
|
157
|
+
const sessionId = req.headers["mcp-session-id"];
|
|
158
|
+
if (!sessionId || !isValidSessionId(sessionId) || !transports[sessionId]) {
|
|
159
|
+
res.status(400).send("Invalid or missing session ID");
|
|
160
|
+
return;
|
|
161
|
+
}
|
|
162
|
+
await transports[sessionId].handleRequest(req, res);
|
|
163
|
+
};
|
|
164
|
+
app.get("/mcp", handleSessionRequest);
|
|
165
|
+
app.delete("/mcp", handleSessionRequest);
|
|
166
|
+
app.get("/health", (_req, res) => {
|
|
167
|
+
res.json({
|
|
168
|
+
status: "healthy",
|
|
169
|
+
server: ctx.serverName,
|
|
170
|
+
version: ctx.serverVersion,
|
|
171
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
172
|
+
uptime: process.uptime(),
|
|
173
|
+
activeSessions: Object.keys(transports).length
|
|
174
|
+
});
|
|
175
|
+
});
|
|
176
|
+
return app;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Start the HTTP transport. The shell passes a factory because each new MCP
|
|
180
|
+
* session needs a fresh server instance with its own per-session state.
|
|
181
|
+
*/
|
|
182
|
+
async function startHttpServer(ctx, createServerFn, options = {}) {
|
|
183
|
+
const cfg = ctx.config.read();
|
|
184
|
+
const port = options.port ?? cfg.httpPort;
|
|
185
|
+
const host = options.host ?? cfg.host;
|
|
186
|
+
ctx.logger.info("Starting MCP server with HTTP transport", {
|
|
187
|
+
port,
|
|
188
|
+
host,
|
|
189
|
+
name: ctx.serverName,
|
|
190
|
+
version: ctx.serverVersion
|
|
191
|
+
});
|
|
192
|
+
const app = await createHttpApp(ctx, createServerFn, options);
|
|
193
|
+
await new Promise((resolve, reject) => {
|
|
194
|
+
app.listen(port, host, (err) => {
|
|
195
|
+
if (err) reject(err);
|
|
196
|
+
else {
|
|
197
|
+
ctx.logger.info("MCP HTTP server started", {
|
|
198
|
+
port,
|
|
199
|
+
host
|
|
200
|
+
});
|
|
201
|
+
resolve();
|
|
202
|
+
}
|
|
203
|
+
}).on("error", reject);
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// src/transports/hosted.ts
|
|
208
|
+
/**
|
|
209
|
+
* Hosted MCP transport (BOFF-15144): one public, multi-user MCP endpoint that
|
|
210
|
+
* Claude, ChatGPT and other remote MCP clients connect to with OAuth.
|
|
211
|
+
*
|
|
212
|
+
* - Stateless Streamable HTTP: every POST /mcp gets its own server, context
|
|
213
|
+
* and transport (no session id, JSON responses), so requests from different
|
|
214
|
+
* users never share credentials and any replica can serve any request.
|
|
215
|
+
* - OAuth 2.1 protected resource (RFC 9728): `/.well-known/oauth-protected-resource`
|
|
216
|
+
* names the authorization server. A request without a usable bearer token is
|
|
217
|
+
* answered 401 with `WWW-Authenticate: Bearer resource_metadata="..."`, which
|
|
218
|
+
* is how MCP clients discover where to sign the user in.
|
|
219
|
+
* - The token is checked here only for shape, type, expiry and audience. This
|
|
220
|
+
* server never authorizes anything itself: it forwards the user's token to
|
|
221
|
+
* the platform gateways, which verify the signature, the delegation and the
|
|
222
|
+
* user's role on every GraphQL call.
|
|
223
|
+
*
|
|
224
|
+
* Framework-free: a `(Request) => Promise<Response>` handler, served with
|
|
225
|
+
* `Bun.serve` (or any Web-standard server) by the product shell.
|
|
226
|
+
*/
|
|
227
|
+
const READ_SCOPE = "delegation:read";
|
|
228
|
+
const WRITE_SCOPES = /* @__PURE__ */ new Set(["delegation:write", "agent:act"]);
|
|
229
|
+
/** Tolerate small clock differences between the auth service and this pod. */
|
|
230
|
+
const CLOCK_SKEW_SECONDS = 30;
|
|
231
|
+
const MAX_BODY_BYTES = 4194304;
|
|
232
|
+
const CORS_HEADERS = Object.freeze({
|
|
233
|
+
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
234
|
+
"Access-Control-Allow-Headers": "Authorization, Content-Type, Accept, MCP-Protocol-Version, Mcp-Session-Id, Last-Event-ID",
|
|
235
|
+
"Access-Control-Expose-Headers": "WWW-Authenticate, Mcp-Session-Id, MCP-Protocol-Version",
|
|
236
|
+
"Access-Control-Max-Age": "600"
|
|
237
|
+
});
|
|
238
|
+
/** Decode and sanity-check a bearer token. The gateways do the real verification. */
|
|
239
|
+
function checkBearerToken(header, resourceUrl, nowSeconds) {
|
|
240
|
+
const token = (header?.match(/^Bearer\s+(\S+)$/i))?.[1];
|
|
241
|
+
if (!token) return {
|
|
242
|
+
ok: false,
|
|
243
|
+
reason: "missing"
|
|
244
|
+
};
|
|
245
|
+
const claims = decodeJwtPayload(token);
|
|
246
|
+
if (!claims) return {
|
|
247
|
+
ok: false,
|
|
248
|
+
reason: "invalid",
|
|
249
|
+
description: "malformed token"
|
|
250
|
+
};
|
|
251
|
+
if (claims["type"] !== "app_as_user") return {
|
|
252
|
+
ok: false,
|
|
253
|
+
reason: "invalid",
|
|
254
|
+
description: "not a connector token"
|
|
255
|
+
};
|
|
256
|
+
const exp = claims["exp"];
|
|
257
|
+
if (typeof exp !== "number" || exp + CLOCK_SKEW_SECONDS <= nowSeconds) return {
|
|
258
|
+
ok: false,
|
|
259
|
+
reason: "invalid",
|
|
260
|
+
description: "token expired"
|
|
261
|
+
};
|
|
262
|
+
const aud = claims["aud"];
|
|
263
|
+
if (!(Array.isArray(aud) ? aud : [aud]).includes(resourceUrl)) return {
|
|
264
|
+
ok: false,
|
|
265
|
+
reason: "invalid",
|
|
266
|
+
description: "token was issued for another resource"
|
|
267
|
+
};
|
|
268
|
+
const sub = claims["sub"];
|
|
269
|
+
if (typeof sub !== "string" || !sub) return {
|
|
270
|
+
ok: false,
|
|
271
|
+
reason: "invalid",
|
|
272
|
+
description: "token has no subject"
|
|
273
|
+
};
|
|
274
|
+
const scopes = Array.isArray(claims["scopes"]) ? claims["scopes"].filter((s) => typeof s === "string") : [];
|
|
275
|
+
const workspaceId = claims["workspace_id"];
|
|
276
|
+
const act = claims["act"];
|
|
277
|
+
return {
|
|
278
|
+
ok: true,
|
|
279
|
+
auth: {
|
|
280
|
+
token,
|
|
281
|
+
userId: sub,
|
|
282
|
+
...typeof workspaceId === "string" ? { workspaceId } : {},
|
|
283
|
+
scopes,
|
|
284
|
+
readOnly: scopes.includes(READ_SCOPE) && !scopes.some((s) => WRITE_SCOPES.has(s)),
|
|
285
|
+
...typeof act?.clientId === "string" ? { clientId: act.clientId } : {},
|
|
286
|
+
expiresAt: exp
|
|
287
|
+
}
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
function metadataUrl(resourceUrl) {
|
|
291
|
+
return `${new URL(resourceUrl).origin}/.well-known/oauth-protected-resource`;
|
|
292
|
+
}
|
|
293
|
+
var BodyTooLargeError = class extends Error {};
|
|
294
|
+
/** Read and parse a JSON body, refusing more than `max` bytes even without Content-Length. */
|
|
295
|
+
async function readBoundedJson(request, max) {
|
|
296
|
+
if (!request.body) throw new SyntaxError("empty body");
|
|
297
|
+
const reader = request.body.getReader();
|
|
298
|
+
const chunks = [];
|
|
299
|
+
let size = 0;
|
|
300
|
+
for (;;) {
|
|
301
|
+
const { done, value } = await reader.read();
|
|
302
|
+
if (done) break;
|
|
303
|
+
size += value.byteLength;
|
|
304
|
+
if (size > max) {
|
|
305
|
+
await reader.cancel();
|
|
306
|
+
throw new BodyTooLargeError();
|
|
307
|
+
}
|
|
308
|
+
chunks.push(value);
|
|
309
|
+
}
|
|
310
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
311
|
+
}
|
|
312
|
+
/** Whether a request body is a JSON-RPC initialize (single or batched). */
|
|
313
|
+
function containsInitialize(body) {
|
|
314
|
+
return (Array.isArray(body) ? body : [body]).some((message) => !!message && typeof message === "object" && message.method === "initialize");
|
|
315
|
+
}
|
|
316
|
+
function createHostedMcpHandler(options) {
|
|
317
|
+
const now = options.now ?? Date.now;
|
|
318
|
+
const resourcePath = new URL(options.resourceUrl).pathname;
|
|
319
|
+
const metadataLink = metadataUrl(options.resourceUrl);
|
|
320
|
+
const allowedOrigins = new Set(options.allowedOrigins ?? []);
|
|
321
|
+
const logger = options.baseContext.logger;
|
|
322
|
+
const resourceMetadata = {
|
|
323
|
+
resource: options.resourceUrl,
|
|
324
|
+
authorization_servers: options.authorizationServers,
|
|
325
|
+
scopes_supported: options.scopesSupported ?? [READ_SCOPE, "delegation:write"],
|
|
326
|
+
bearer_methods_supported: ["header"],
|
|
327
|
+
resource_name: options.resourceName
|
|
328
|
+
};
|
|
329
|
+
const withCors = (response, origin) => {
|
|
330
|
+
const headers = new Headers(response.headers);
|
|
331
|
+
for (const [name, value] of Object.entries(CORS_HEADERS)) headers.set(name, value);
|
|
332
|
+
headers.set("Access-Control-Allow-Origin", origin && allowedOrigins.has(origin) ? origin : "*");
|
|
333
|
+
headers.append("Vary", "Origin");
|
|
334
|
+
return new Response(response.body, {
|
|
335
|
+
status: response.status,
|
|
336
|
+
headers
|
|
337
|
+
});
|
|
338
|
+
};
|
|
339
|
+
const json = (status, body, extra = {}) => new Response(JSON.stringify(body), {
|
|
340
|
+
status,
|
|
341
|
+
headers: {
|
|
342
|
+
"Content-Type": "application/json",
|
|
343
|
+
"Cache-Control": "no-store",
|
|
344
|
+
...extra
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
const unauthorized = (reason, description) => {
|
|
348
|
+
const params = [`resource_metadata="${metadataLink}"`];
|
|
349
|
+
if (reason === "invalid") {
|
|
350
|
+
params.push("error=\"invalid_token\"");
|
|
351
|
+
if (description) params.push(`error_description="${description}"`);
|
|
352
|
+
}
|
|
353
|
+
return json(401, {
|
|
354
|
+
jsonrpc: "2.0",
|
|
355
|
+
error: {
|
|
356
|
+
code: -32001,
|
|
357
|
+
message: "Authentication required"
|
|
358
|
+
},
|
|
359
|
+
id: null
|
|
360
|
+
}, { "WWW-Authenticate": `Bearer ${params.join(", ")}` });
|
|
361
|
+
};
|
|
362
|
+
const handleMcpPost = async (request) => {
|
|
363
|
+
if (Number(request.headers.get("content-length") ?? "0") > MAX_BODY_BYTES) return json(413, {
|
|
364
|
+
jsonrpc: "2.0",
|
|
365
|
+
error: {
|
|
366
|
+
code: -32600,
|
|
367
|
+
message: "Request too large"
|
|
368
|
+
},
|
|
369
|
+
id: null
|
|
370
|
+
});
|
|
371
|
+
const check = checkBearerToken(request.headers.get("authorization"), options.resourceUrl, Math.floor(now() / 1e3));
|
|
372
|
+
if (!check.ok) return unauthorized(check.reason, check.description);
|
|
373
|
+
const { auth } = check;
|
|
374
|
+
let body;
|
|
375
|
+
try {
|
|
376
|
+
body = await readBoundedJson(request, MAX_BODY_BYTES);
|
|
377
|
+
} catch (error) {
|
|
378
|
+
if (error instanceof BodyTooLargeError) return json(413, {
|
|
379
|
+
jsonrpc: "2.0",
|
|
380
|
+
error: {
|
|
381
|
+
code: -32600,
|
|
382
|
+
message: "Request too large"
|
|
383
|
+
},
|
|
384
|
+
id: null
|
|
385
|
+
});
|
|
386
|
+
return json(400, {
|
|
387
|
+
jsonrpc: "2.0",
|
|
388
|
+
error: {
|
|
389
|
+
code: -32700,
|
|
390
|
+
message: "Parse error"
|
|
391
|
+
},
|
|
392
|
+
id: null
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
const ctx = contextForRequest(options.baseContext, {
|
|
396
|
+
accessToken: auth.token,
|
|
397
|
+
refreshToken: "",
|
|
398
|
+
...auth.workspaceId ? { workspaceId: auth.workspaceId } : {}
|
|
399
|
+
});
|
|
400
|
+
if (options.preflight && containsInitialize(body)) {
|
|
401
|
+
let accepted;
|
|
402
|
+
try {
|
|
403
|
+
accepted = await options.preflight(ctx, auth);
|
|
404
|
+
} catch (error) {
|
|
405
|
+
logger.error("Hosted MCP preflight failed", { error: error instanceof Error ? error.message : String(error) });
|
|
406
|
+
return json(503, {
|
|
407
|
+
jsonrpc: "2.0",
|
|
408
|
+
error: {
|
|
409
|
+
code: -32603,
|
|
410
|
+
message: "Platform temporarily unavailable"
|
|
411
|
+
},
|
|
412
|
+
id: null
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (!accepted) return unauthorized("invalid", "token no longer accepted");
|
|
416
|
+
}
|
|
417
|
+
const server = options.createServer(ctx, auth);
|
|
418
|
+
const transport = new WebStandardStreamableHTTPServerTransport({
|
|
419
|
+
sessionIdGenerator: void 0,
|
|
420
|
+
enableJsonResponse: true
|
|
421
|
+
});
|
|
422
|
+
try {
|
|
423
|
+
await server.connect(transport);
|
|
424
|
+
return await transport.handleRequest(request, { parsedBody: body });
|
|
425
|
+
} finally {
|
|
426
|
+
await server.close().catch(() => void 0);
|
|
427
|
+
}
|
|
428
|
+
};
|
|
429
|
+
return async (request) => {
|
|
430
|
+
const url = new URL(request.url);
|
|
431
|
+
const origin = request.headers.get("origin");
|
|
432
|
+
const method = request.method.toUpperCase();
|
|
433
|
+
if (url.pathname === "/health" && method === "GET") return json(200, {
|
|
434
|
+
status: "healthy",
|
|
435
|
+
server: options.baseContext.serverName,
|
|
436
|
+
version: options.baseContext.serverVersion
|
|
437
|
+
});
|
|
438
|
+
if (url.pathname === "/.well-known/oauth-protected-resource" || url.pathname === `/.well-known/oauth-protected-resource${resourcePath}`) {
|
|
439
|
+
if (method === "OPTIONS") return withCors(new Response(null, { status: 204 }), origin);
|
|
440
|
+
if (method !== "GET") return withCors(json(405, { error: "method not allowed" }, { Allow: "GET" }), origin);
|
|
441
|
+
return withCors(json(200, resourceMetadata, { "Cache-Control": "public, max-age=300" }), origin);
|
|
442
|
+
}
|
|
443
|
+
if (url.pathname !== resourcePath) return json(404, { error: "not found" });
|
|
444
|
+
if (origin && !allowedOrigins.has(origin)) return json(403, {
|
|
445
|
+
jsonrpc: "2.0",
|
|
446
|
+
error: {
|
|
447
|
+
code: -32e3,
|
|
448
|
+
message: "Origin not allowed"
|
|
449
|
+
},
|
|
450
|
+
id: null
|
|
451
|
+
});
|
|
452
|
+
if (method === "OPTIONS") return withCors(new Response(null, { status: 204 }), origin);
|
|
453
|
+
if (method !== "POST") return withCors(json(405, {
|
|
454
|
+
jsonrpc: "2.0",
|
|
455
|
+
error: {
|
|
456
|
+
code: -32e3,
|
|
457
|
+
message: "Method not allowed"
|
|
458
|
+
},
|
|
459
|
+
id: null
|
|
460
|
+
}, { Allow: "POST, OPTIONS" }), origin);
|
|
461
|
+
try {
|
|
462
|
+
return withCors(await handleMcpPost(request), origin);
|
|
463
|
+
} catch (error) {
|
|
464
|
+
logger.error("Hosted MCP request failed", { error: error instanceof Error ? error.message : String(error) });
|
|
465
|
+
return withCors(json(500, {
|
|
466
|
+
jsonrpc: "2.0",
|
|
467
|
+
error: {
|
|
468
|
+
code: -32603,
|
|
469
|
+
message: "Internal server error"
|
|
470
|
+
},
|
|
471
|
+
id: null
|
|
472
|
+
}), origin);
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
export { assertTransportAuthConfigured as a, parseCorsOrigins as c, startHttpServer as i, requireAuthorizedRequest as l, createHostedMcpHandler as n, isAuthorizedRequest as o, createHttpApp as r, isValidSessionId as s, checkBearerToken as t, startStdioServer as u };
|
|
478
|
+
//# sourceMappingURL=transports-CWPyypes.js.map
|