@hachej/boring-mcp 0.1.84 → 0.1.85

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.
@@ -169,6 +169,23 @@ interface CreateBoringMcpAgentToolsOptions {
169
169
  }
170
170
  declare function createBoringMcpAgentTools(options: CreateBoringMcpAgentToolsOptions): AgentTool[];
171
171
 
172
+ interface CreateBoringMcpServerPluginOptions {
173
+ systemPrompt?: string;
174
+ registry?: McpSourceRegistry;
175
+ transport?: McpTransportClient;
176
+ resolveActor?: BoringMcpAgentToolActorResolver;
177
+ templates?: readonly McpProviderTemplate[];
178
+ maxReadonlyInputBytes?: number;
179
+ audit?: McpReadonlyCallAuditSink;
180
+ hardening?: McpProviderHardeningOptions;
181
+ }
182
+ declare function createBoringMcpServerPlugin(options?: CreateBoringMcpServerPluginOptions): {
183
+ id: string;
184
+ label: string;
185
+ systemPrompt: string;
186
+ agentTools: _hachej_boring_workspace.AgentTool[] | undefined;
187
+ };
188
+
172
189
  type ManagedConnectorSecretStorage = "server-env" | "server-vault";
173
190
  type ManagedConnectorRiskStatus = "approved" | "owner-accepted-gap";
174
191
  interface ManagedConnectorAcceptedGap {
@@ -367,6 +384,69 @@ interface RegisterBoringMcpRoutesOptions {
367
384
  whenDisabled?: 'skip' | 'serve-503';
368
385
  }
369
386
  declare function registerBoringMcpRoutes(app: BoringMcpAppServer, options: RegisterBoringMcpRoutesOptions): void;
387
+ /**
388
+ * Full per-app configuration for {@link createBoringMcpAppBindings}. Extends the
389
+ * connector/secret binding config with the two remaining knobs a host used to
390
+ * hardcode: how routes behave while disabled, and the agent system prompt.
391
+ */
392
+ interface BoringMcpAppBindingsConfig extends BoringMcpBindingConfig {
393
+ /**
394
+ * Behavior when boring-mcp is disabled for this deployment. Forwarded to
395
+ * {@link registerBoringMcpRoutes}. Defaults to `skip`.
396
+ */
397
+ whenDisabled?: 'skip' | 'serve-503';
398
+ /** System prompt applied to the boring-mcp server plugin this host contributes. */
399
+ systemPrompt?: string;
400
+ /**
401
+ * Default trusted-workspace resolver applied to every route registration for
402
+ * this deployment (e.g. D1 host request scoping). A per-call
403
+ * `resolveTrustedWorkspaceId` passed to `registerRoutes` overrides it.
404
+ */
405
+ resolveTrustedWorkspaceId?: (request: FastifyRequest) => string | undefined;
406
+ }
407
+ interface BoringMcpAppBindingsAgentToolsOptions {
408
+ env?: NodeJS.ProcessEnv;
409
+ transport?: McpTransportClient;
410
+ }
411
+ interface BoringMcpAppBindingsRoutesOptions {
412
+ provider?: ManagedConnectorProvider;
413
+ env?: NodeJS.ProcessEnv;
414
+ transport?: McpTransportClient;
415
+ resolveTrustedWorkspaceId?: (request: FastifyRequest) => string | undefined;
416
+ }
417
+ /**
418
+ * The complete set of per-app boring-mcp bindings, each pre-bound to a single
419
+ * {@link BoringMcpAppBindingsConfig}. Host apps expose these members instead of
420
+ * copying the ~110 lines of forwarding glue they used to hand-write.
421
+ */
422
+ interface BoringMcpAppBindings {
423
+ readConfig(env?: NodeJS.ProcessEnv): BoringMcpServerRuntimeConfig;
424
+ createSecretResolver(env?: NodeJS.ProcessEnv): ManagedConnectorSecretResolver;
425
+ createConnectorAdapter(options: {
426
+ registry: ManagedConnectorSourceRegistry;
427
+ env?: NodeJS.ProcessEnv;
428
+ provider?: ManagedConnectorProvider;
429
+ }): ManagedConnectorAdapter;
430
+ agentSessionNamespace(ctx: {
431
+ workspaceId: string;
432
+ request?: FastifyRequest;
433
+ userId?: string;
434
+ }): string;
435
+ createMcpSourceRegistry(app: Pick<BoringMcpAppServer, 'userStore' | 'config'>, actorScope: McpActor): ManagedConnectorSourceRegistry;
436
+ createAgentTools(app: Pick<BoringMcpAppServer, 'userStore' | 'config'>, actor: McpActor, options?: BoringMcpAppBindingsAgentToolsOptions): AgentTool[];
437
+ createAgentToolsForRequest(app: Pick<BoringMcpAppServer, 'userStore' | 'config'>, ctx: {
438
+ workspaceId: string;
439
+ authSubject?: string;
440
+ }, options?: BoringMcpAppBindingsAgentToolsOptions): AgentTool[];
441
+ registerRoutes(app: BoringMcpAppServer, options?: BoringMcpAppBindingsRoutesOptions): void;
442
+ createServerPlugins(env?: NodeJS.ProcessEnv): ReturnType<typeof createBoringMcpServerPlugin>[];
443
+ }
444
+ /**
445
+ * Build the full set of boring-mcp server bindings for a host app from a single
446
+ * config object. Every member is pre-bound to `config`, so a host wires MCP with
447
+ * ~15 lines of configuration instead of re-copying the forwarding glue.
448
+ */
449
+ declare function createBoringMcpAppBindings(config: BoringMcpAppBindingsConfig): BoringMcpAppBindings;
370
450
 
371
451
  interface ComposioMcpSession {
372
452
  id: string;
@@ -422,22 +502,6 @@ declare function requireActorOwnedMcpSource(registry: McpSourceRegistry, actor:
422
502
  declare function assertMcpPublicPayloadSecretFree(value: unknown): void;
423
503
  declare function createMcpSourceStatusPayload(source: McpSource): McpSourceStatusPayload;
424
504
 
425
- interface CreateBoringMcpServerPluginOptions {
426
- systemPrompt?: string;
427
- registry?: McpSourceRegistry;
428
- transport?: McpTransportClient;
429
- resolveActor?: BoringMcpAgentToolActorResolver;
430
- templates?: readonly McpProviderTemplate[];
431
- maxReadonlyInputBytes?: number;
432
- audit?: McpReadonlyCallAuditSink;
433
- hardening?: McpProviderHardeningOptions;
434
- }
435
- declare function createBoringMcpServerPlugin(options?: CreateBoringMcpServerPluginOptions): {
436
- id: string;
437
- label: string;
438
- systemPrompt: string;
439
- agentTools: _hachej_boring_workspace.AgentTool[] | undefined;
440
- };
441
505
  declare const _default: {
442
506
  id: string;
443
507
  label: string;
@@ -445,4 +509,4 @@ declare const _default: {
445
509
  agentTools: _hachej_boring_workspace.AgentTool[] | undefined;
446
510
  };
447
511
 
448
- export { BORING_MCP_AGENT_BRIDGE_TOOL_DEFINITIONS, BORING_MCP_AGENT_BRIDGE_TOOL_NAMES, type BoringMcpAgentBridgeContext, type BoringMcpAgentBridgeRegistry, type BoringMcpAgentBridgeTool, type BoringMcpAgentBridgeToolDefinition, type BoringMcpAgentBridgeToolName, type BoringMcpAgentToolActorResolver, type BoringMcpAppServer, type BoringMcpBindingConfig, type BoringMcpLaunchGateInput, type BoringMcpLaunchGateIssue, type BoringMcpLaunchGateIssueCode, type BoringMcpLaunchGateResult, type BoringMcpReadonlyCallOptions, type BoringMcpReadonlyCaller, type BoringMcpServerRuntimeConfig, type BoringMcpSourceHandlers, type BoringMcpSourceHandlersOptions, type BoringMcpToolCatalog, type BoringMcpToolCatalogOptions, type ComposioManagedConnectorProviderOptions, type ComposioMcpSession, type CreateBoringMcpAgentToolsOptions, type CreateBoringMcpAppAgentToolsOptions, type CreateBoringMcpServerPluginOptions, type CreateManagedConnectorAdapterOptions, type CreateManagedConnectorSecretResolverOptions, InMemoryMcpRateBudgetGate, type InMemoryMcpRateBudgetGateOptions, InMemoryMcpToolCatalogCache, type ManagedConnectorAcceptedGap, type ManagedConnectorAdapter, type ManagedConnectorAdapterOptions, type ManagedConnectorConfig, type ManagedConnectorPreflightCheck, type ManagedConnectorPreflightEvidence, type ManagedConnectorPreflightResult, type ManagedConnectorProbeResponse, type ManagedConnectorProvider, type ManagedConnectorRiskStatus, type ManagedConnectorSecret, type ManagedConnectorSecretResolver, type ManagedConnectorSecretStorage, type ManagedConnectorSourceRegistry, type ManagedConnectorStartInput, type ManagedConnectorStartResponse, type ManagedConnectorStartResult, type ManagedConnectorStatusResponse, type ManagedConnectorVendorRiskEvidence, McpActor, McpConnectorRef, McpDiscoveredResource, McpDiscoveredTool, McpDoctorResult, McpErrorCode, McpProbeResult, type McpProviderCallContext, type McpProviderHardeningOptions, McpProviderId, type McpProviderOperation, type McpProviderRateBudgetGate, McpProviderTemplate, McpReadonlyCallAuditEvent, type McpReadonlyCallAuditSink, McpReadonlyCallInput, McpReadonlyCallResult, type McpSdkEndpoint, type McpSdkEndpointResolverInput, type McpSdkTransportOptions, McpSource, McpSourceDto, McpSourceRegistry, McpSourceStatus, McpSourceStatusPayload, type McpToolCatalogCache, McpToolCatalogEntry, type McpToolDescribeInput, McpToolDescribeResult, McpToolSearchResult, type McpToolsSearchInput, McpTransportClient, type RegisterBoringMcpRoutesOptions, type ResolveComposioMcpSessionInput, assertManagedConnectorPreflight, assertMcpPublicPayloadSecretFree, boringMcpAgentSessionNamespace, createBoringMcpAgentBridgeRegistry, createBoringMcpAgentTools, createBoringMcpAppAgentTools, createBoringMcpAppAgentToolsForRequest, createBoringMcpManagedConnectorAdapter, createBoringMcpReadonlyCaller, createBoringMcpServerPlugin, createBoringMcpSourceHandlers, createBoringMcpToolCatalog, createComposioManagedConnectorProvider, createComposioMcpTransport, createHardenedMcpTransport, createLegacyManagedConnectorSourceId, createManagedConnectorAdapter, createManagedConnectorSecretResolver, createManagedConnectorSourceId, createMcpSchemaHash, createMcpSdkStreamableHttpTransport, createMcpSourceStatusPayload, createUserSettingsMcpSourceRegistry, _default as default, evaluateBoringMcpLaunchGate, isActorOwnedMcpSource, listBoringMcpAgentBridgeTools, normalizeMcpCatalogTool, readBoringMcpServerConfig, registerBoringMcpRoutes, requireActorOwnedMcpSource, resolveComposioMcpSession, validateManagedConnectorPreflight, validateMcpSourceId, verifyMcpDisconnectResult };
512
+ export { BORING_MCP_AGENT_BRIDGE_TOOL_DEFINITIONS, BORING_MCP_AGENT_BRIDGE_TOOL_NAMES, type BoringMcpAgentBridgeContext, type BoringMcpAgentBridgeRegistry, type BoringMcpAgentBridgeTool, type BoringMcpAgentBridgeToolDefinition, type BoringMcpAgentBridgeToolName, type BoringMcpAgentToolActorResolver, type BoringMcpAppBindings, type BoringMcpAppBindingsAgentToolsOptions, type BoringMcpAppBindingsConfig, type BoringMcpAppBindingsRoutesOptions, type BoringMcpAppServer, type BoringMcpBindingConfig, type BoringMcpLaunchGateInput, type BoringMcpLaunchGateIssue, type BoringMcpLaunchGateIssueCode, type BoringMcpLaunchGateResult, type BoringMcpReadonlyCallOptions, type BoringMcpReadonlyCaller, type BoringMcpServerRuntimeConfig, type BoringMcpSourceHandlers, type BoringMcpSourceHandlersOptions, type BoringMcpToolCatalog, type BoringMcpToolCatalogOptions, type ComposioManagedConnectorProviderOptions, type ComposioMcpSession, type CreateBoringMcpAgentToolsOptions, type CreateBoringMcpAppAgentToolsOptions, type CreateBoringMcpServerPluginOptions, type CreateManagedConnectorAdapterOptions, type CreateManagedConnectorSecretResolverOptions, InMemoryMcpRateBudgetGate, type InMemoryMcpRateBudgetGateOptions, InMemoryMcpToolCatalogCache, type ManagedConnectorAcceptedGap, type ManagedConnectorAdapter, type ManagedConnectorAdapterOptions, type ManagedConnectorConfig, type ManagedConnectorPreflightCheck, type ManagedConnectorPreflightEvidence, type ManagedConnectorPreflightResult, type ManagedConnectorProbeResponse, type ManagedConnectorProvider, type ManagedConnectorRiskStatus, type ManagedConnectorSecret, type ManagedConnectorSecretResolver, type ManagedConnectorSecretStorage, type ManagedConnectorSourceRegistry, type ManagedConnectorStartInput, type ManagedConnectorStartResponse, type ManagedConnectorStartResult, type ManagedConnectorStatusResponse, type ManagedConnectorVendorRiskEvidence, McpActor, McpConnectorRef, McpDiscoveredResource, McpDiscoveredTool, McpDoctorResult, McpErrorCode, McpProbeResult, type McpProviderCallContext, type McpProviderHardeningOptions, McpProviderId, type McpProviderOperation, type McpProviderRateBudgetGate, McpProviderTemplate, McpReadonlyCallAuditEvent, type McpReadonlyCallAuditSink, McpReadonlyCallInput, McpReadonlyCallResult, type McpSdkEndpoint, type McpSdkEndpointResolverInput, type McpSdkTransportOptions, McpSource, McpSourceDto, McpSourceRegistry, McpSourceStatus, McpSourceStatusPayload, type McpToolCatalogCache, McpToolCatalogEntry, type McpToolDescribeInput, McpToolDescribeResult, McpToolSearchResult, type McpToolsSearchInput, McpTransportClient, type RegisterBoringMcpRoutesOptions, type ResolveComposioMcpSessionInput, assertManagedConnectorPreflight, assertMcpPublicPayloadSecretFree, boringMcpAgentSessionNamespace, createBoringMcpAgentBridgeRegistry, createBoringMcpAgentTools, createBoringMcpAppAgentTools, createBoringMcpAppAgentToolsForRequest, createBoringMcpAppBindings, createBoringMcpManagedConnectorAdapter, createBoringMcpReadonlyCaller, createBoringMcpServerPlugin, createBoringMcpSourceHandlers, createBoringMcpToolCatalog, createComposioManagedConnectorProvider, createComposioMcpTransport, createHardenedMcpTransport, createLegacyManagedConnectorSourceId, createManagedConnectorAdapter, createManagedConnectorSecretResolver, createManagedConnectorSourceId, createMcpSchemaHash, createMcpSdkStreamableHttpTransport, createMcpSourceStatusPayload, createUserSettingsMcpSourceRegistry, _default as default, evaluateBoringMcpLaunchGate, isActorOwnedMcpSource, listBoringMcpAgentBridgeTools, normalizeMcpCatalogTool, readBoringMcpServerConfig, registerBoringMcpRoutes, requireActorOwnedMcpSource, resolveComposioMcpSession, validateManagedConnectorPreflight, validateMcpSourceId, verifyMcpDisconnectResult };
@@ -1,4 +1,4 @@
1
- // src/server/index.ts
1
+ // src/server/serverPlugin.ts
2
2
  import { defineServerPlugin } from "@hachej/boring-workspace/server";
3
3
 
4
4
  // src/shared/index.ts
@@ -883,6 +883,25 @@ function createBoringMcpAgentTools(options) {
883
883
  }));
884
884
  }
885
885
 
886
+ // src/server/serverPlugin.ts
887
+ function createBoringMcpServerPlugin(options = {}) {
888
+ const hasAgentToolWiring = Boolean(options.registry && options.transport && options.resolveActor);
889
+ return defineServerPlugin({
890
+ id: BORING_MCP_PLUGIN_ID,
891
+ label: "Sources",
892
+ systemPrompt: options.systemPrompt ?? "Use boring-mcp bridge tools only when an app has enabled them. Treat MCP sources as read-only unless a tool is explicitly allowed.",
893
+ agentTools: hasAgentToolWiring ? createBoringMcpAgentTools({
894
+ registry: options.registry,
895
+ transport: options.transport,
896
+ resolveActor: options.resolveActor,
897
+ templates: options.templates,
898
+ maxReadonlyInputBytes: options.maxReadonlyInputBytes,
899
+ audit: options.audit,
900
+ hardening: options.hardening
901
+ }) : void 0
902
+ });
903
+ }
904
+
886
905
  // src/server/appServerBinding.ts
887
906
  import { createHash as createHash3 } from "crypto";
888
907
  import { HttpError, ERROR_CODES } from "@hachej/boring-core/shared";
@@ -1971,6 +1990,29 @@ function registerBoringMcpRoutes(app, options) {
1971
1990
  return { tools: result.tools };
1972
1991
  });
1973
1992
  }
1993
+ function createBoringMcpAppBindings(config) {
1994
+ return {
1995
+ readConfig: (env) => readBoringMcpServerConfig(env, { secretEnvVars: config.secretEnvVars }),
1996
+ createSecretResolver: (env) => createManagedConnectorSecretResolver({ env, configs: config.connectorConfigs, secretEnvVars: config.secretEnvVars }),
1997
+ createConnectorAdapter: (options) => createBoringMcpManagedConnectorAdapter({ config, registry: options.registry, env: options.env, provider: options.provider }),
1998
+ agentSessionNamespace: boringMcpAgentSessionNamespace,
1999
+ createMcpSourceRegistry: createUserSettingsMcpSourceRegistry,
2000
+ createAgentTools: (app, actor, options = {}) => createBoringMcpAppAgentTools(app, actor, { config, env: options.env, transport: options.transport }),
2001
+ createAgentToolsForRequest: (app, ctx, options = {}) => createBoringMcpAppAgentToolsForRequest(app, ctx, { config, env: options.env, transport: options.transport }),
2002
+ registerRoutes: (app, options = {}) => registerBoringMcpRoutes(app, {
2003
+ config,
2004
+ whenDisabled: config.whenDisabled,
2005
+ provider: options.provider,
2006
+ env: options.env,
2007
+ transport: options.transport,
2008
+ resolveTrustedWorkspaceId: options.resolveTrustedWorkspaceId ?? config.resolveTrustedWorkspaceId
2009
+ }),
2010
+ createServerPlugins: (env = process.env) => {
2011
+ if (!readBoringMcpServerConfig(env, { secretEnvVars: config.secretEnvVars }).enabled) return [];
2012
+ return [createBoringMcpServerPlugin({ systemPrompt: config.systemPrompt })];
2013
+ }
2014
+ };
2015
+ }
1974
2016
 
1975
2017
  // src/server/managedConnectorPreflight.ts
1976
2018
  var VENDOR_RISK_FIELDS = [
@@ -2019,23 +2061,6 @@ function assertManagedConnectorPreflight(evidence) {
2019
2061
  }
2020
2062
 
2021
2063
  // src/server/index.ts
2022
- function createBoringMcpServerPlugin(options = {}) {
2023
- const hasAgentToolWiring = Boolean(options.registry && options.transport && options.resolveActor);
2024
- return defineServerPlugin({
2025
- id: BORING_MCP_PLUGIN_ID,
2026
- label: "Sources",
2027
- systemPrompt: options.systemPrompt ?? "Use boring-mcp bridge tools only when an app has enabled them. Treat MCP sources as read-only unless a tool is explicitly allowed.",
2028
- agentTools: hasAgentToolWiring ? createBoringMcpAgentTools({
2029
- registry: options.registry,
2030
- transport: options.transport,
2031
- resolveActor: options.resolveActor,
2032
- templates: options.templates,
2033
- maxReadonlyInputBytes: options.maxReadonlyInputBytes,
2034
- audit: options.audit,
2035
- hardening: options.hardening
2036
- }) : void 0
2037
- });
2038
- }
2039
2064
  var server_default = createBoringMcpServerPlugin();
2040
2065
  export {
2041
2066
  AIRTABLE_MCP_TEMPLATE,
@@ -2065,6 +2090,7 @@ export {
2065
2090
  createBoringMcpAgentTools,
2066
2091
  createBoringMcpAppAgentTools,
2067
2092
  createBoringMcpAppAgentToolsForRequest,
2093
+ createBoringMcpAppBindings,
2068
2094
  createBoringMcpManagedConnectorAdapter,
2069
2095
  createBoringMcpReadonlyCaller,
2070
2096
  createBoringMcpServerPlugin,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hachej/boring-mcp",
3
- "version": "0.1.84",
3
+ "version": "0.1.85",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "license": "MIT",
@@ -49,8 +49,8 @@
49
49
  "fastify": "^5.9.0",
50
50
  "react": "^18.0.0 || ^19.0.0",
51
51
  "react-dom": "^18.0.0 || ^19.0.0",
52
- "@hachej/boring-core": "0.1.84",
53
- "@hachej/boring-workspace": "0.1.84"
52
+ "@hachej/boring-core": "0.1.85",
53
+ "@hachej/boring-workspace": "0.1.85"
54
54
  },
55
55
  "devDependencies": {
56
56
  "fastify": "^5.9.0",
@@ -66,8 +66,8 @@
66
66
  "tsup": "^8.4.0",
67
67
  "typescript": "~6.0.3",
68
68
  "vitest": "^4.1.9",
69
- "@hachej/boring-workspace": "0.1.84",
70
- "@hachej/boring-core": "0.1.84"
69
+ "@hachej/boring-core": "0.1.85",
70
+ "@hachej/boring-workspace": "0.1.85"
71
71
  },
72
72
  "dependencies": {
73
73
  "@modelcontextprotocol/sdk": "^1.29.0"