open-multi-agent-kit 0.99.0 → 1.2.0
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/CHANGELOG.md +30 -1
- package/README.md +3 -3
- package/dist/bun/cli.d.ts.map +1 -1
- package/dist/bun/cli.js +1 -0
- package/dist/bun/cli.js.map +1 -1
- package/dist/bun/register-bundled-coding-agent.d.ts +10 -0
- package/dist/bun/register-bundled-coding-agent.d.ts.map +1 -0
- package/dist/bun/register-bundled-coding-agent.js +12 -0
- package/dist/bun/register-bundled-coding-agent.js.map +1 -0
- package/dist/cli/args.d.ts +1 -1
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +2 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +14 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/neo-cli.d.ts +9 -0
- package/dist/commands/neo-cli.d.ts.map +1 -0
- package/dist/commands/neo-cli.js +61 -0
- package/dist/commands/neo-cli.js.map +1 -0
- package/dist/coordination/awareness.d.ts +32 -0
- package/dist/coordination/awareness.d.ts.map +1 -0
- package/dist/coordination/awareness.js +55 -0
- package/dist/coordination/awareness.js.map +1 -0
- package/dist/coordination/broker.d.ts +79 -0
- package/dist/coordination/broker.d.ts.map +1 -0
- package/dist/coordination/broker.js +195 -0
- package/dist/coordination/broker.js.map +1 -0
- package/dist/coordination/index.d.ts +16 -0
- package/dist/coordination/index.d.ts.map +1 -0
- package/dist/coordination/index.js +16 -0
- package/dist/coordination/index.js.map +1 -0
- package/dist/coordination/integration.d.ts +59 -0
- package/dist/coordination/integration.d.ts.map +1 -0
- package/dist/coordination/integration.js +126 -0
- package/dist/coordination/integration.js.map +1 -0
- package/dist/coordination/operation.d.ts +106 -0
- package/dist/coordination/operation.d.ts.map +1 -0
- package/dist/coordination/operation.js +179 -0
- package/dist/coordination/operation.js.map +1 -0
- package/dist/coordination/resource.d.ts +33 -0
- package/dist/coordination/resource.d.ts.map +1 -0
- package/dist/coordination/resource.js +89 -0
- package/dist/coordination/resource.js.map +1 -0
- package/dist/coordination/session.d.ts +74 -0
- package/dist/coordination/session.d.ts.map +1 -0
- package/dist/coordination/session.js +143 -0
- package/dist/coordination/session.js.map +1 -0
- package/dist/coordination/types.d.ts +68 -0
- package/dist/coordination/types.d.ts.map +1 -0
- package/dist/coordination/types.js +26 -0
- package/dist/coordination/types.js.map +1 -0
- package/dist/core/agent-session.d.ts +29 -2
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +135 -37
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/bundled-skills.d.ts +4 -0
- package/dist/core/bundled-skills.d.ts.map +1 -0
- package/dist/core/bundled-skills.js +32 -0
- package/dist/core/bundled-skills.js.map +1 -0
- package/dist/core/cli-diagnostics.d.ts +6 -0
- package/dist/core/cli-diagnostics.d.ts.map +1 -0
- package/dist/core/cli-diagnostics.js +20 -0
- package/dist/core/cli-diagnostics.js.map +1 -0
- package/dist/core/compaction/control-state.d.ts +41 -0
- package/dist/core/compaction/control-state.d.ts.map +1 -0
- package/dist/core/compaction/control-state.js +85 -0
- package/dist/core/compaction/control-state.js.map +1 -0
- package/dist/core/compaction/fallback.d.ts +60 -0
- package/dist/core/compaction/fallback.d.ts.map +1 -0
- package/dist/core/compaction/fallback.js +117 -0
- package/dist/core/compaction/fallback.js.map +1 -0
- package/dist/core/compaction/index.d.ts +2 -0
- package/dist/core/compaction/index.d.ts.map +1 -1
- package/dist/core/compaction/index.js +2 -0
- package/dist/core/compaction/index.js.map +1 -1
- package/dist/core/context-budget-headroom-candidates.d.ts +16 -1
- package/dist/core/context-budget-headroom-candidates.d.ts.map +1 -1
- package/dist/core/context-budget-headroom-candidates.js +31 -13
- package/dist/core/context-budget-headroom-candidates.js.map +1 -1
- package/dist/core/context-budget-headroom-types.d.ts +7 -1
- package/dist/core/context-budget-headroom-types.d.ts.map +1 -1
- package/dist/core/context-budget-headroom-types.js +0 -1
- package/dist/core/context-budget-headroom-types.js.map +1 -1
- package/dist/core/context-budget-headroom.d.ts +22 -0
- package/dist/core/context-budget-headroom.d.ts.map +1 -1
- package/dist/core/context-budget-headroom.js +46 -2
- package/dist/core/context-budget-headroom.js.map +1 -1
- package/dist/core/context-budget-v2-global-pass.d.ts +21 -0
- package/dist/core/context-budget-v2-global-pass.d.ts.map +1 -0
- package/dist/core/context-budget-v2-global-pass.js +203 -0
- package/dist/core/context-budget-v2-global-pass.js.map +1 -0
- package/dist/core/context-budget-v2-input-validation.d.ts +4 -0
- package/dist/core/context-budget-v2-input-validation.d.ts.map +1 -0
- package/dist/core/context-budget-v2-input-validation.js +79 -0
- package/dist/core/context-budget-v2-input-validation.js.map +1 -0
- package/dist/core/context-budget-v2-observability.d.ts +15 -0
- package/dist/core/context-budget-v2-observability.d.ts.map +1 -0
- package/dist/core/context-budget-v2-observability.js +35 -0
- package/dist/core/context-budget-v2-observability.js.map +1 -0
- package/dist/core/context-budget-v2-planned-items.d.ts +17 -0
- package/dist/core/context-budget-v2-planned-items.d.ts.map +1 -0
- package/dist/core/context-budget-v2-planned-items.js +59 -0
- package/dist/core/context-budget-v2-planned-items.js.map +1 -0
- package/dist/core/context-budget-v2-planner.d.ts.map +1 -1
- package/dist/core/context-budget-v2-planner.js +69 -51
- package/dist/core/context-budget-v2-planner.js.map +1 -1
- package/dist/core/context-budget-v2-scoring.d.ts +7 -1
- package/dist/core/context-budget-v2-scoring.d.ts.map +1 -1
- package/dist/core/context-budget-v2-scoring.js.map +1 -1
- package/dist/core/context-budget-v2-selection.d.ts +22 -3
- package/dist/core/context-budget-v2-selection.d.ts.map +1 -1
- package/dist/core/context-budget-v2-selection.js +41 -59
- package/dist/core/context-budget-v2-selection.js.map +1 -1
- package/dist/core/context-budget-v2-tiers.d.ts.map +1 -1
- package/dist/core/context-budget-v2-tiers.js +9 -42
- package/dist/core/context-budget-v2-tiers.js.map +1 -1
- package/dist/core/context-budget-v2-types.d.ts +14 -2
- package/dist/core/context-budget-v2-types.d.ts.map +1 -1
- package/dist/core/context-budget-v2-types.js +6 -1
- package/dist/core/context-budget-v2-types.js.map +1 -1
- package/dist/core/extensions/bundled-virtual-modules.d.ts +15 -0
- package/dist/core/extensions/bundled-virtual-modules.d.ts.map +1 -0
- package/dist/core/extensions/bundled-virtual-modules.js +63 -0
- package/dist/core/extensions/bundled-virtual-modules.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +2 -42
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +1 -0
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +6 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +10 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/index.d.ts +2 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/loadout-runtime.d.ts +2 -8
- package/dist/core/loadout-runtime.d.ts.map +1 -1
- package/dist/core/loadout-runtime.js.map +1 -1
- package/dist/core/mcp/client.d.ts +27 -6
- package/dist/core/mcp/client.d.ts.map +1 -1
- package/dist/core/mcp/client.js +80 -20
- package/dist/core/mcp/client.js.map +1 -1
- package/dist/core/mcp/manager.d.ts +10 -1
- package/dist/core/mcp/manager.d.ts.map +1 -1
- package/dist/core/mcp/manager.js +68 -9
- package/dist/core/mcp/manager.js.map +1 -1
- package/dist/core/mcp/protocol.d.ts +9 -3
- package/dist/core/mcp/protocol.d.ts.map +1 -1
- package/dist/core/mcp/protocol.js +61 -15
- package/dist/core/mcp/protocol.js.map +1 -1
- package/dist/core/mcp/stdio-transport.d.ts +12 -1
- package/dist/core/mcp/stdio-transport.d.ts.map +1 -1
- package/dist/core/mcp/stdio-transport.js +30 -2
- package/dist/core/mcp/stdio-transport.js.map +1 -1
- package/dist/core/mcp-descriptor-injection.d.ts +26 -0
- package/dist/core/mcp-descriptor-injection.d.ts.map +1 -0
- package/dist/core/mcp-descriptor-injection.js +25 -0
- package/dist/core/mcp-descriptor-injection.js.map +1 -0
- package/dist/core/mcp-public-presets.d.ts +1 -3
- package/dist/core/mcp-public-presets.d.ts.map +1 -1
- package/dist/core/mcp-public-presets.js +3 -15
- package/dist/core/mcp-public-presets.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +24 -3
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/neo/catalog.d.ts +20 -0
- package/dist/core/neo/catalog.d.ts.map +1 -0
- package/dist/core/neo/catalog.js +50 -0
- package/dist/core/neo/catalog.js.map +1 -0
- package/dist/core/neo/setup.d.ts +3 -0
- package/dist/core/neo/setup.d.ts.map +1 -0
- package/dist/core/neo/setup.js +47 -0
- package/dist/core/neo/setup.js.map +1 -0
- package/dist/core/provider-default-models.d.ts +2 -0
- package/dist/core/provider-default-models.d.ts.map +1 -1
- package/dist/core/provider-default-models.js +2 -0
- package/dist/core/provider-default-models.js.map +1 -1
- package/dist/core/provider-display-names.d.ts.map +1 -1
- package/dist/core/provider-display-names.js +2 -0
- package/dist/core/provider-display-names.js.map +1 -1
- package/dist/core/provider-error-classification.d.ts +57 -0
- package/dist/core/provider-error-classification.d.ts.map +1 -0
- package/dist/core/provider-error-classification.js +103 -0
- package/dist/core/provider-error-classification.js.map +1 -0
- package/dist/core/provider-resilience.d.ts +10 -0
- package/dist/core/provider-resilience.d.ts.map +1 -1
- package/dist/core/provider-resilience.js +36 -3
- package/dist/core/provider-resilience.js.map +1 -1
- package/dist/core/provider-usage-commandcode.d.ts +9 -0
- package/dist/core/provider-usage-commandcode.d.ts.map +1 -0
- package/dist/core/provider-usage-commandcode.js +198 -0
- package/dist/core/provider-usage-commandcode.js.map +1 -0
- package/dist/core/provider-usage-devin.d.ts +5 -3
- package/dist/core/provider-usage-devin.d.ts.map +1 -1
- package/dist/core/provider-usage-devin.js +15 -5
- package/dist/core/provider-usage-devin.js.map +1 -1
- package/dist/core/provider-usage-types.d.ts +1 -1
- package/dist/core/provider-usage-types.d.ts.map +1 -1
- package/dist/core/provider-usage-types.js.map +1 -1
- package/dist/core/provider-usage.d.ts.map +1 -1
- package/dist/core/provider-usage.js +6 -0
- package/dist/core/provider-usage.js.map +1 -1
- package/dist/core/reasoning-router-resolver.d.ts +7 -0
- package/dist/core/reasoning-router-resolver.d.ts.map +1 -1
- package/dist/core/reasoning-router-resolver.js +21 -3
- package/dist/core/reasoning-router-resolver.js.map +1 -1
- package/dist/core/reasoning-router-v4.d.ts +8 -5
- package/dist/core/reasoning-router-v4.d.ts.map +1 -1
- package/dist/core/reasoning-router-v4.js +8 -5
- package/dist/core/reasoning-router-v4.js.map +1 -1
- package/dist/core/resource-admission.d.ts +36 -0
- package/dist/core/resource-admission.d.ts.map +1 -1
- package/dist/core/resource-admission.js +59 -0
- package/dist/core/resource-admission.js.map +1 -1
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +2 -2
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/run-usage-ledger.d.ts +47 -0
- package/dist/core/run-usage-ledger.d.ts.map +1 -0
- package/dist/core/run-usage-ledger.js +162 -0
- package/dist/core/run-usage-ledger.js.map +1 -0
- package/dist/core/run-usage-operation.d.ts +8 -0
- package/dist/core/run-usage-operation.d.ts.map +1 -0
- package/dist/core/run-usage-operation.js +12 -0
- package/dist/core/run-usage-operation.js.map +1 -0
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +5 -6
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-compaction-service.d.ts +15 -0
- package/dist/core/session-compaction-service.d.ts.map +1 -1
- package/dist/core/session-compaction-service.js +17 -4
- package/dist/core/session-compaction-service.js.map +1 -1
- package/dist/core/session-failure-cause.d.ts.map +1 -1
- package/dist/core/session-failure-cause.js +14 -5
- package/dist/core/session-failure-cause.js.map +1 -1
- package/dist/core/session-prompt-lifecycle.d.ts +6 -0
- package/dist/core/session-prompt-lifecycle.d.ts.map +1 -1
- package/dist/core/session-prompt-lifecycle.js +47 -2
- package/dist/core/session-prompt-lifecycle.js.map +1 -1
- package/dist/core/session-termination.d.ts.map +1 -1
- package/dist/core/session-termination.js +4 -2
- package/dist/core/session-termination.js.map +1 -1
- package/dist/core/subagent-lane-authority.d.ts +28 -0
- package/dist/core/subagent-lane-authority.d.ts.map +1 -0
- package/dist/core/subagent-lane-authority.js +119 -0
- package/dist/core/subagent-lane-authority.js.map +1 -0
- package/dist/core/subagent-lane-contract.d.ts +114 -0
- package/dist/core/subagent-lane-contract.d.ts.map +1 -0
- package/dist/core/subagent-lane-contract.js +18 -0
- package/dist/core/subagent-lane-contract.js.map +1 -0
- package/dist/core/subagent-lane-launcher.d.ts +3 -6
- package/dist/core/subagent-lane-launcher.d.ts.map +1 -1
- package/dist/core/subagent-lane-launcher.js +53 -12
- package/dist/core/subagent-lane-launcher.js.map +1 -1
- package/dist/core/subagent-orchestration.d.ts +4 -17
- package/dist/core/subagent-orchestration.d.ts.map +1 -1
- package/dist/core/subagent-orchestration.js.map +1 -1
- package/dist/core/todo-runtime-state.d.ts +12 -0
- package/dist/core/todo-runtime-state.d.ts.map +1 -1
- package/dist/core/todo-runtime-state.js +23 -0
- package/dist/core/todo-runtime-state.js.map +1 -1
- package/dist/core/verified-run/broker.d.ts.map +1 -1
- package/dist/core/verified-run/broker.js +4 -1
- package/dist/core/verified-run/broker.js.map +1 -1
- package/dist/core/workload-permit-pool.d.ts +1 -1
- package/dist/core/workload-permit-pool.d.ts.map +1 -1
- package/dist/core/workload-permit-pool.js +3 -0
- package/dist/core/workload-permit-pool.js.map +1 -1
- package/dist/guardrails/strict-evidence-approval-adapter.d.ts +34 -0
- package/dist/guardrails/strict-evidence-approval-adapter.d.ts.map +1 -0
- package/dist/guardrails/strict-evidence-approval-adapter.js +70 -0
- package/dist/guardrails/strict-evidence-approval-adapter.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +11 -18
- package/dist/main.js.map +1 -1
- package/dist/metacognition/calibration-selective.d.ts +78 -0
- package/dist/metacognition/calibration-selective.d.ts.map +1 -0
- package/dist/metacognition/calibration-selective.js +161 -0
- package/dist/metacognition/calibration-selective.js.map +1 -0
- package/dist/metacognition/calibration.d.ts +62 -0
- package/dist/metacognition/calibration.d.ts.map +1 -0
- package/dist/metacognition/calibration.js +122 -0
- package/dist/metacognition/calibration.js.map +1 -0
- package/dist/metacognition/checkpoint.d.ts +60 -0
- package/dist/metacognition/checkpoint.d.ts.map +1 -0
- package/dist/metacognition/checkpoint.js +57 -0
- package/dist/metacognition/checkpoint.js.map +1 -0
- package/dist/metacognition/context7.d.ts +48 -0
- package/dist/metacognition/context7.d.ts.map +1 -0
- package/dist/metacognition/context7.js +154 -0
- package/dist/metacognition/context7.js.map +1 -0
- package/dist/metacognition/decision.d.ts +44 -0
- package/dist/metacognition/decision.d.ts.map +1 -0
- package/dist/metacognition/decision.js +111 -0
- package/dist/metacognition/decision.js.map +1 -0
- package/dist/metacognition/evaluation.d.ts +73 -0
- package/dist/metacognition/evaluation.d.ts.map +1 -0
- package/dist/metacognition/evaluation.js +97 -0
- package/dist/metacognition/evaluation.js.map +1 -0
- package/dist/metacognition/index.d.ts +31 -0
- package/dist/metacognition/index.d.ts.map +1 -0
- package/dist/metacognition/index.js +31 -0
- package/dist/metacognition/index.js.map +1 -0
- package/dist/metacognition/knowledge-action.d.ts +43 -0
- package/dist/metacognition/knowledge-action.d.ts.map +1 -0
- package/dist/metacognition/knowledge-action.js +60 -0
- package/dist/metacognition/knowledge-action.js.map +1 -0
- package/dist/metacognition/knowledge.d.ts +84 -0
- package/dist/metacognition/knowledge.d.ts.map +1 -0
- package/dist/metacognition/knowledge.js +165 -0
- package/dist/metacognition/knowledge.js.map +1 -0
- package/dist/metacognition/obligations.d.ts +82 -0
- package/dist/metacognition/obligations.d.ts.map +1 -0
- package/dist/metacognition/obligations.js +139 -0
- package/dist/metacognition/obligations.js.map +1 -0
- package/dist/metacognition/observation-validity.d.ts +83 -0
- package/dist/metacognition/observation-validity.d.ts.map +1 -0
- package/dist/metacognition/observation-validity.js +118 -0
- package/dist/metacognition/observation-validity.js.map +1 -0
- package/dist/metacognition/observe.d.ts +45 -0
- package/dist/metacognition/observe.d.ts.map +1 -0
- package/dist/metacognition/observe.js +59 -0
- package/dist/metacognition/observe.js.map +1 -0
- package/dist/metacognition/policy.d.ts +53 -0
- package/dist/metacognition/policy.d.ts.map +1 -0
- package/dist/metacognition/policy.js +155 -0
- package/dist/metacognition/policy.js.map +1 -0
- package/dist/metacognition/predictions.d.ts +78 -0
- package/dist/metacognition/predictions.d.ts.map +1 -0
- package/dist/metacognition/predictions.js +181 -0
- package/dist/metacognition/predictions.js.map +1 -0
- package/dist/metacognition/retrieval.d.ts +53 -0
- package/dist/metacognition/retrieval.d.ts.map +1 -0
- package/dist/metacognition/retrieval.js +170 -0
- package/dist/metacognition/retrieval.js.map +1 -0
- package/dist/metacognition/risk.d.ts +48 -0
- package/dist/metacognition/risk.d.ts.map +1 -0
- package/dist/metacognition/risk.js +165 -0
- package/dist/metacognition/risk.js.map +1 -0
- package/dist/metacognition/route-economics.d.ts +95 -0
- package/dist/metacognition/route-economics.d.ts.map +1 -0
- package/dist/metacognition/route-economics.js +110 -0
- package/dist/metacognition/route-economics.js.map +1 -0
- package/dist/metacognition/runtime-bridge.d.ts +54 -0
- package/dist/metacognition/runtime-bridge.d.ts.map +1 -0
- package/dist/metacognition/runtime-bridge.js +140 -0
- package/dist/metacognition/runtime-bridge.js.map +1 -0
- package/dist/metacognition/skills.d.ts +42 -0
- package/dist/metacognition/skills.d.ts.map +1 -0
- package/dist/metacognition/skills.js +220 -0
- package/dist/metacognition/skills.js.map +1 -0
- package/dist/metacognition/state.d.ts +110 -0
- package/dist/metacognition/state.d.ts.map +1 -0
- package/dist/metacognition/state.js +52 -0
- package/dist/metacognition/state.js.map +1 -0
- package/dist/metacognition/validation.d.ts +19 -0
- package/dist/metacognition/validation.d.ts.map +1 -0
- package/dist/metacognition/validation.js +58 -0
- package/dist/metacognition/validation.js.map +1 -0
- package/dist/metacognition/verification.d.ts +93 -0
- package/dist/metacognition/verification.d.ts.map +1 -0
- package/dist/metacognition/verification.js +132 -0
- package/dist/metacognition/verification.js.map +1 -0
- package/dist/metacognition/verifier.d.ts +49 -0
- package/dist/metacognition/verifier.d.ts.map +1 -0
- package/dist/metacognition/verifier.js +88 -0
- package/dist/metacognition/verifier.js.map +1 -0
- package/dist/modes/acp/acp-agent.d.ts +24 -0
- package/dist/modes/acp/acp-agent.d.ts.map +1 -0
- package/dist/modes/acp/acp-agent.js +133 -0
- package/dist/modes/acp/acp-agent.js.map +1 -0
- package/dist/modes/acp/acp-mode.d.ts +4 -0
- package/dist/modes/acp/acp-mode.d.ts.map +1 -0
- package/dist/modes/acp/acp-mode.js +34 -0
- package/dist/modes/acp/acp-mode.js.map +1 -0
- package/dist/modes/acp/acp-session.d.ts +4 -0
- package/dist/modes/acp/acp-session.d.ts.map +1 -0
- package/dist/modes/acp/acp-session.js +76 -0
- package/dist/modes/acp/acp-session.js.map +1 -0
- package/dist/modes/acp/acp-transport.d.ts +5 -0
- package/dist/modes/acp/acp-transport.d.ts.map +1 -0
- package/dist/modes/acp/acp-transport.js +90 -0
- package/dist/modes/acp/acp-transport.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +1 -0
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/observation/identity.d.ts +14 -0
- package/dist/observation/identity.d.ts.map +1 -0
- package/dist/observation/identity.js +29 -0
- package/dist/observation/identity.js.map +1 -0
- package/dist/observation/index.d.ts +13 -0
- package/dist/observation/index.d.ts.map +1 -0
- package/dist/observation/index.js +13 -0
- package/dist/observation/index.js.map +1 -0
- package/dist/observation/observe-mode.d.ts +46 -0
- package/dist/observation/observe-mode.d.ts.map +1 -0
- package/dist/observation/observe-mode.js +83 -0
- package/dist/observation/observe-mode.js.map +1 -0
- package/dist/observation/store.d.ts +53 -0
- package/dist/observation/store.d.ts.map +1 -0
- package/dist/observation/store.js +126 -0
- package/dist/observation/store.js.map +1 -0
- package/dist/observation/types.d.ts +72 -0
- package/dist/observation/types.d.ts.map +1 -0
- package/dist/observation/types.js +9 -0
- package/dist/observation/types.js.map +1 -0
- package/dist/observation/view.d.ts +39 -0
- package/dist/observation/view.d.ts.map +1 -0
- package/dist/observation/view.js +173 -0
- package/dist/observation/view.js.map +1 -0
- package/docs/audit-revalidation-2026-09-17.md +77 -0
- package/docs/devin-harness.md +33 -4
- package/docs/ecraf-normalization.md +83 -0
- package/docs/metacognition.md +51 -0
- package/docs/model-catalog-refresh.md +110 -1
- package/docs/models.md +1 -1
- package/docs/neo.md +134 -0
- package/docs/providers.md +125 -6
- package/docs/run-usage-ledger.md +56 -0
- package/docs/runtime-algorithms.md +151 -3
- package/docs/skills.md +1 -1
- package/docs/usage.md +2 -1
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/gondolin/package-lock.json +2 -2
- package/examples/extensions/gondolin/package.json +1 -1
- package/examples/extensions/sandbox/package-lock.json +2 -2
- package/examples/extensions/sandbox/package.json +1 -1
- package/examples/extensions/subagent/adaptive-agent-runtime.ts +14 -1
- package/examples/extensions/subagent/graph-result.ts +48 -0
- package/examples/extensions/subagent/index.ts +246 -111
- package/examples/extensions/subagent/managed-process-tree.ts +42 -0
- package/examples/extensions/subagent/managed-process.test.ts +24 -0
- package/examples/extensions/subagent/managed-process.ts +93 -112
- package/examples/extensions/subagent/subagent-runtime-types.ts +17 -1
- package/examples/extensions/subagent/subagent-stream.ts +161 -0
- package/examples/extensions/terminal-browser/README.md +54 -0
- package/examples/extensions/terminal-browser/bridge-protocol.ts +29 -0
- package/examples/extensions/terminal-browser/bridge.ts +219 -0
- package/examples/extensions/terminal-browser/browser-surface.ts +288 -0
- package/examples/extensions/terminal-browser/index.ts +215 -0
- package/examples/extensions/terminal-browser/placeholders.ts +49 -0
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/npm-shrinkwrap.json +18 -18
- package/package.json +8 -7
- package/resources/neo/skills/omk-browser/SKILL.md +32 -0
- package/resources/neo/skills/omk-code-review/SKILL.md +24 -0
- package/resources/neo/skills/omk-computeruse/SKILL.md +34 -0
- package/resources/neo/skills/omk-mcp-setup/SKILL.md +48 -0
- package/resources/neo/skills/omk-research/SKILL.md +24 -0
- package/resources/neo/skills/omk-site/SKILL.md +28 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stdio-transport.js","sourceRoot":"","sources":["../../../src/core/mcp/stdio-transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAGH,OAAO,KAAK,MAAM,aAAa,CAAC;AAChC,OAAO,EAAE,iBAAiB,EAAE,aAAa,EAAuB,MAAM,eAAe,CAAC;AAEtF,mEAAmE;AACnE,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAC1C,yDAAyD;AACzD,MAAM,CAAC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAqB1C,MAAM,OAAO,iBAAiB;IACrB,KAAK,CAA6C;IACzC,OAAO,GAAG,iBAAiB,EAAE,CAAC;IAC9B,WAAW,CAAS;IAC7B,UAAU,GAAG,EAAE,CAAC;IAChB,MAAM,GAAG,KAAK,CAAC;IACf,SAAS,CAA4C;IAC5C,OAAO,CAAwB;IAC/B,QAAQ,CAAyB;IAElD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;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAClC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAAA,CACvC;CACD","sourcesContent":["/**\n * Child-process stdio transport for MCP.\n *\n * Owns exactly one server process: writes newline-delimited JSON to stdin,\n * decodes stdout into messages, keeps a bounded tail of stderr for diagnostics,\n * and reports exit exactly once. It never interprets MCP semantics — that is\n * the client's job.\n *\n * Every configured OMK MCP server uses a `command`, so stdio is the whole\n * transport surface today. HTTP servers would get a sibling module rather than\n * a flag on this one.\n */\n\nimport type { ChildProcessWithoutNullStreams } from \"node:child_process\";\nimport spawn from \"cross-spawn\";\nimport { createLineDecoder, encodeMessage, type JsonRpcMessage } from \"./protocol.ts\";\n\n/** How much stderr tail to keep per server for error reporting. */\nexport const MAX_STDERR_TAIL_CHARS = 8192;\n/** Grace period between SIGTERM and SIGKILL on close. */\nexport const DEFAULT_KILL_GRACE_MS = 2000;\n\nexport interface StdioTransportOptions {\n\treadonly command: string;\n\treadonly args?: readonly string[];\n\treadonly env?: Readonly<Record<string, string>>;\n\treadonly cwd?: string;\n\t/** Grace period before SIGKILL. */\n\treadonly killGraceMs?: number;\n\t/** Inherit the parent environment. Default `true`. */\n\treadonly inheritEnv?: boolean;\n}\n\nexport interface StdioTransportHandlers {\n\treadonly onMessage: (message: JsonRpcMessage) => void;\n\t/** Malformed frames are surfaced, never silently dropped. */\n\treadonly onDecodeError?: (reason: string) => void;\n\t/** Called at most once, with the exit code or signal. */\n\treadonly onExit: (info: { readonly code: number | null; readonly signal: string | null }) => void;\n}\n\nexport class McpStdioTransport {\n\tprivate child: ChildProcessWithoutNullStreams | undefined;\n\tprivate readonly decoder = createLineDecoder();\n\tprivate readonly killGraceMs: number;\n\tprivate stderrTail = \"\";\n\tprivate exited = false;\n\tprivate killTimer: ReturnType<typeof setTimeout> | undefined;\n\tprivate readonly options: StdioTransportOptions;\n\tprivate readonly handlers: StdioTransportHandlers;\n\n\tconstructor(options: StdioTransportOptions, handlers: StdioTransportHandlers) {\n\t\tthis.options = options;\n\t\tthis.handlers = handlers;\n\t\tthis.killGraceMs = options.killGraceMs ?? DEFAULT_KILL_GRACE_MS;\n\t}\n\n\t/** Bounded tail of the server's stderr. Empty when the server has been quiet. */\n\tget stderr(): string {\n\t\treturn this.stderrTail;\n\t}\n\n\tget running(): boolean {\n\t\treturn this.child !== undefined && !this.exited;\n\t}\n\n\t/**\n\t * Spawn the server process. Throws synchronously only on an invalid\n\t * configuration; a spawn failure surfaces through `onExit`, so callers have\n\t * one failure path instead of two.\n\t */\n\tstart(): void {\n\t\tif (this.child) throw new Error(\"MCP stdio transport already started\");\n\t\tconst env = this.options.inheritEnv === false ? { ...this.options.env } : { ...process.env, ...this.options.env };\n\t\tconst child = spawn(this.options.command, [...(this.options.args ?? [])], {\n\t\t\tcwd: this.options.cwd,\n\t\t\tenv,\n\t\t\tstdio: [\"pipe\", \"pipe\", \"pipe\"],\n\t\t\twindowsHide: true,\n\t\t}) as ChildProcessWithoutNullStreams;\n\t\tthis.child = child;\n\n\t\tchild.stdout.setEncoding(\"utf8\");\n\t\tchild.stdout.on(\"data\", (chunk: string) => {\n\t\t\tfor (const decoded of this.decoder.push(chunk)) {\n\t\t\t\tif (decoded.message) this.handlers.onMessage(decoded.message);\n\t\t\t\telse if (decoded.error) this.handlers.onDecodeError?.(decoded.error);\n\t\t\t}\n\t\t});\n\n\t\tchild.stderr.setEncoding(\"utf8\");\n\t\tchild.stderr.on(\"data\", (chunk: string) => {\n\t\t\tthis.stderrTail = `${this.stderrTail}${chunk}`.slice(-MAX_STDERR_TAIL_CHARS);\n\t\t});\n\n\t\t// A stdin EPIPE after the server exits is expected, not an error worth throwing.\n\t\tchild.stdin.on(\"error\", () => {});\n\t\tchild.on(\"error\", (error: Error) => {\n\t\t\tthis.stderrTail = `${this.stderrTail}${error.message}\\n`.slice(-MAX_STDERR_TAIL_CHARS);\n\t\t\tthis.settleExit(null, null);\n\t\t});\n\t\tchild.on(\"exit\", (code, signal) => this.settleExit(code, signal));\n\t}\n\n\t/** Write one message. Returns `false` when the server is no longer writable. */\n\tsend(message: JsonRpcMessage): boolean {\n\t\tconst child = this.child;\n\t\tif (!child || this.exited || !child.stdin.writable) return false;\n\t\ttry {\n\t\t\tchild.stdin.write(encodeMessage(message));\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** Terminate the server: SIGTERM, then SIGKILL after the grace period. */\n\tclose(): void {\n\t\tconst child = this.child;\n\t\tif (!child || this.exited) return;\n\t\ttry {\n\t\t\tchild.stdin.end();\n\t\t} catch {\n\t\t\t// Already closed.\n\t\t}\n\t\ttry {\n\t\t\tchild.kill(\"SIGTERM\");\n\t\t} catch {\n\t\t\t// Already gone.\n\t\t}\n\t\tif (this.killTimer !== undefined) return;\n\t\tthis.killTimer = setTimeout(() => {\n\t\t\tthis.killTimer = undefined;\n\t\t\ttry {\n\t\t\t\tchild.kill(\"SIGKILL\");\n\t\t\t} catch {\n\t\t\t\t// Already gone.\n\t\t\t}\n\t\t}, this.killGraceMs);\n\t\tthis.killTimer.unref?.();\n\t}\n\n\tprivate settleExit(code: number | null, signal: string | null): void {\n\t\tif (this.exited) return;\n\t\tthis.exited = true;\n\t\tif (this.killTimer !== undefined) {\n\t\t\tclearTimeout(this.killTimer);\n\t\t\tthis.killTimer = undefined;\n\t\t}\n\t\tthis.decoder.reset();\n\t\tthis.handlers.onExit({ code, signal });\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"stdio-transport.js","sourceRoot":"","sources":["../../../src/core/mcp/stdio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CAAC;QACrB,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,EAAE,CAAC;IAAA,CACzB;IAEO,UAAU,CAAC,IAAmB,EAAE,MAAqB,EAAQ;QACpE,IAAI,IAAI,CAAC,MAAM;YAAE,OAAO;QACxB,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC;QACnB,IAAI,CAAC,iBAAiB,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;QAC7B,IAAI,IAAI,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAClC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC7B,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;QAC5B,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;QACrB,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;IAAA,CACvC;CACD","sourcesContent":["/**\n * Child-process stdio transport for MCP.\n *\n * Owns exactly one server process: writes newline-delimited JSON to stdin,\n * decodes stdout into messages, keeps a bounded tail of stderr for diagnostics,\n * and reports exit exactly once. It never interprets MCP semantics — that is\n * the client's job.\n *\n * Every configured OMK MCP server uses a `command`, so stdio is the whole\n * transport surface today. HTTP servers would get a sibling module rather than\n * a flag on this one.\n */\n\nimport type { ChildProcessWithoutNullStreams } from \"node:child_process\";\nimport spawn from \"cross-spawn\";\nimport { createLineDecoder, encodeMessage, type JsonRpcMessage } from \"./protocol.ts\";\n\n/** How much stderr tail to keep per server for error reporting. */\nexport const MAX_STDERR_TAIL_CHARS = 8192;\n/** Grace period between SIGTERM and SIGKILL on close. */\nexport const DEFAULT_KILL_GRACE_MS = 2000;\n/** Framed bytes allowed to sit in the child's stdin buffer before sends refuse. */\nexport const DEFAULT_MAX_PENDING_WRITE_BYTES = 16 * 1024 * 1024;\n\nexport interface StdioTransportOptions {\n\treadonly command: string;\n\treadonly args?: readonly string[];\n\treadonly env?: Readonly<Record<string, string>>;\n\treadonly cwd?: string;\n\t/** Grace period before SIGKILL. */\n\treadonly killGraceMs?: number;\n\t/** Inherit the parent environment. Default `true`. */\n\treadonly inheritEnv?: boolean;\n\t/** Framed bytes allowed to sit unwritten before `send` refuses. */\n\treadonly maxPendingWriteBytes?: number;\n}\n\nexport interface StdioTransportHandlers {\n\treadonly onMessage: (message: JsonRpcMessage) => void;\n\t/** Malformed frames are surfaced, never silently dropped. */\n\treadonly onDecodeError?: (reason: string) => void;\n\t/** Called at most once, with the exit code or signal. */\n\treadonly onExit: (info: { readonly code: number | null; readonly signal: string | null }) => void;\n}\n\nexport class McpStdioTransport {\n\tprivate child: ChildProcessWithoutNullStreams | undefined;\n\tprivate readonly decoder = createLineDecoder();\n\tprivate readonly killGraceMs: number;\n\tprivate stderrTail = \"\";\n\tprivate exited = false;\n\tprivate killTimer: ReturnType<typeof setTimeout> | undefined;\n\t/** Framed bytes written but not yet flushed to the child's stdin. */\n\tprivate pendingWriteBytes = 0;\n\tprivate waitingForDrain = false;\n\tprivate readonly options: StdioTransportOptions;\n\tprivate readonly handlers: StdioTransportHandlers;\n\n\tconstructor(options: StdioTransportOptions, handlers: StdioTransportHandlers) {\n\t\tthis.options = options;\n\t\tthis.handlers = handlers;\n\t\tthis.killGraceMs = options.killGraceMs ?? DEFAULT_KILL_GRACE_MS;\n\t}\n\n\t/** Bounded tail of the server's stderr. Empty when the server has been quiet. */\n\tget stderr(): string {\n\t\treturn this.stderrTail;\n\t}\n\n\tget running(): boolean {\n\t\treturn this.child !== undefined && !this.exited;\n\t}\n\n\t/**\n\t * Spawn the server process. Throws synchronously only on an invalid\n\t * configuration; a spawn failure surfaces through `onExit`, so callers have\n\t * one failure path instead of two.\n\t */\n\tstart(): void {\n\t\tif (this.child) throw new Error(\"MCP stdio transport already started\");\n\t\tconst env = this.options.inheritEnv === false ? { ...this.options.env } : { ...process.env, ...this.options.env };\n\t\tconst child = spawn(this.options.command, [...(this.options.args ?? [])], {\n\t\t\tcwd: this.options.cwd,\n\t\t\tenv,\n\t\t\tstdio: [\"pipe\", \"pipe\", \"pipe\"],\n\t\t\twindowsHide: true,\n\t\t}) as ChildProcessWithoutNullStreams;\n\t\tthis.child = child;\n\n\t\tchild.stdout.setEncoding(\"utf8\");\n\t\tchild.stdout.on(\"data\", (chunk: string) => {\n\t\t\tfor (const decoded of this.decoder.push(chunk)) {\n\t\t\t\tif (decoded.message) this.handlers.onMessage(decoded.message);\n\t\t\t\telse if (decoded.error) this.handlers.onDecodeError?.(decoded.error);\n\t\t\t}\n\t\t});\n\n\t\tchild.stderr.setEncoding(\"utf8\");\n\t\tchild.stderr.on(\"data\", (chunk: string) => {\n\t\t\tthis.stderrTail = `${this.stderrTail}${chunk}`.slice(-MAX_STDERR_TAIL_CHARS);\n\t\t});\n\n\t\t// A stdin EPIPE after the server exits is expected, not an error worth throwing.\n\t\tchild.stdin.on(\"error\", () => {});\n\t\tchild.on(\"error\", (error: Error) => {\n\t\t\tthis.stderrTail = `${this.stderrTail}${error.message}\\n`.slice(-MAX_STDERR_TAIL_CHARS);\n\t\t\tthis.settleExit(null, null);\n\t\t});\n\t\tchild.on(\"exit\", (code, signal) => this.settleExit(code, signal));\n\t}\n\n\t/**\n\t * Write one message. Returns `false` when the server is no longer writable\n\t * or the outbound buffer is already saturated — the client treats that as\n\t * a send failure rather than queueing unbounded frames.\n\t */\n\tsend(message: JsonRpcMessage): boolean {\n\t\tconst child = this.child;\n\t\tif (!child || this.exited || !child.stdin.writable) return false;\n\t\tconst frame = encodeMessage(message);\n\t\tconst frameBytes = Buffer.byteLength(frame, \"utf8\");\n\t\tconst cap = this.options.maxPendingWriteBytes ?? DEFAULT_MAX_PENDING_WRITE_BYTES;\n\t\tif (this.pendingWriteBytes + frameBytes > cap) return false;\n\t\ttry {\n\t\t\tconst flushed = child.stdin.write(frame);\n\t\t\tif (!flushed) {\n\t\t\t\t// Kernel/user buffer is saturated: account the frame and release it\n\t\t\t\t// on drain so the pending estimate tracks the real backlog.\n\t\t\t\tthis.pendingWriteBytes += frameBytes;\n\t\t\t\tif (!this.waitingForDrain) {\n\t\t\t\t\tthis.waitingForDrain = true;\n\t\t\t\t\tchild.stdin.once(\"drain\", () => {\n\t\t\t\t\t\tthis.waitingForDrain = false;\n\t\t\t\t\t\tthis.pendingWriteBytes = 0;\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t} catch {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/** Terminate the server: SIGTERM, then SIGKILL after the grace period. */\n\tclose(): void {\n\t\tconst child = this.child;\n\t\tif (!child || this.exited) return;\n\t\ttry {\n\t\t\tchild.stdin.end();\n\t\t} catch {\n\t\t\t// Already closed.\n\t\t}\n\t\ttry {\n\t\t\tchild.kill(\"SIGTERM\");\n\t\t} catch {\n\t\t\t// Already gone.\n\t\t}\n\t\tif (this.killTimer !== undefined) return;\n\t\tthis.killTimer = setTimeout(() => {\n\t\t\tthis.killTimer = undefined;\n\t\t\ttry {\n\t\t\t\tchild.kill(\"SIGKILL\");\n\t\t\t} catch {\n\t\t\t\t// Already gone.\n\t\t\t}\n\t\t}, this.killGraceMs);\n\t\tthis.killTimer.unref?.();\n\t}\n\n\tprivate settleExit(code: number | null, signal: string | null): void {\n\t\tif (this.exited) return;\n\t\tthis.exited = true;\n\t\tthis.pendingWriteBytes = 0;\n\t\tthis.waitingForDrain = false;\n\t\tif (this.killTimer !== undefined) {\n\t\t\tclearTimeout(this.killTimer);\n\t\t\tthis.killTimer = undefined;\n\t\t}\n\t\tthis.decoder.reset();\n\t\tthis.handlers.onExit({ code, signal });\n\t}\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP descriptor prompt-injection screen (audit §18). MCP tool descriptions
|
|
3
|
+
* are untrusted third-party input; this rule-based screen flags suspicious
|
|
4
|
+
* patterns at import time so the manager can quarantine the tool.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Result of {@link detectMcpDescriptorPromptInjection}. `patternSignal` is a
|
|
8
|
+
* rule score — the count of matched suspicious patterns squashed into
|
|
9
|
+
* [0.6, 1] — NOT a calibrated probability that the descriptor is an attack.
|
|
10
|
+
* Callers compare it against {@link MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD};
|
|
11
|
+
* `score` is kept as a compatibility alias for the same number.
|
|
12
|
+
*/
|
|
13
|
+
export interface McpDescriptorPromptInjectionSignal {
|
|
14
|
+
readonly patternSignal: number;
|
|
15
|
+
readonly patternHits: number;
|
|
16
|
+
/** @deprecated Compatibility alias of {@link patternSignal}. */
|
|
17
|
+
readonly score: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Any single suspicious-pattern hit crosses the quarantine line
|
|
21
|
+
* (0.6 + 1*0.25 = 0.85 > 0.7); two or more saturate at 1. The threshold is a
|
|
22
|
+
* policy boundary, not a probability cut.
|
|
23
|
+
*/
|
|
24
|
+
export declare const MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD = 0.7;
|
|
25
|
+
export declare function detectMcpDescriptorPromptInjection(description: string): McpDescriptorPromptInjectionSignal;
|
|
26
|
+
//# sourceMappingURL=mcp-descriptor-injection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-descriptor-injection.d.ts","sourceRoot":"","sources":["../../src/core/mcp-descriptor-injection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;GAMG;AACH,MAAM,WAAW,kCAAkC;IAClD,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACvB;AAED;;;;GAIG;AACH,eAAO,MAAM,uCAAuC,MAAM,CAAC;AAE3D,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,MAAM,GAAG,kCAAkC,CAa1G","sourcesContent":["/**\n * MCP descriptor prompt-injection screen (audit §18). MCP tool descriptions\n * are untrusted third-party input; this rule-based screen flags suspicious\n * patterns at import time so the manager can quarantine the tool.\n */\n\n/**\n * Result of {@link detectMcpDescriptorPromptInjection}. `patternSignal` is a\n * rule score — the count of matched suspicious patterns squashed into\n * [0.6, 1] — NOT a calibrated probability that the descriptor is an attack.\n * Callers compare it against {@link MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD};\n * `score` is kept as a compatibility alias for the same number.\n */\nexport interface McpDescriptorPromptInjectionSignal {\n\treadonly patternSignal: number;\n\treadonly patternHits: number;\n\t/** @deprecated Compatibility alias of {@link patternSignal}. */\n\treadonly score: number;\n}\n\n/**\n * Any single suspicious-pattern hit crosses the quarantine line\n * (0.6 + 1*0.25 = 0.85 > 0.7); two or more saturate at 1. The threshold is a\n * policy boundary, not a probability cut.\n */\nexport const MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD = 0.7;\n\nexport function detectMcpDescriptorPromptInjection(description: string): McpDescriptorPromptInjectionSignal {\n\tconst normalized = description.toLowerCase();\n\tconst suspiciousPatterns = [\n\t\t/ignore\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/disregard\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/exfiltrat/,\n\t\t/reveal\\s+(?:the\\s+)?(?:system\\s+)?prompt/,\n\t\t/send\\s+(?:me\\s+)?(?:all\\s+)?secrets/,\n\t];\n\tconst patternHits = suspiciousPatterns.filter((pattern) => pattern.test(normalized)).length;\n\tconst patternSignal = patternHits === 0 ? 0 : Math.min(1, 0.6 + patternHits * 0.25);\n\n\treturn { patternSignal, patternHits, score: patternSignal };\n}\n"]}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP descriptor prompt-injection screen (audit §18). MCP tool descriptions
|
|
3
|
+
* are untrusted third-party input; this rule-based screen flags suspicious
|
|
4
|
+
* patterns at import time so the manager can quarantine the tool.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Any single suspicious-pattern hit crosses the quarantine line
|
|
8
|
+
* (0.6 + 1*0.25 = 0.85 > 0.7); two or more saturate at 1. The threshold is a
|
|
9
|
+
* policy boundary, not a probability cut.
|
|
10
|
+
*/
|
|
11
|
+
export const MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD = 0.7;
|
|
12
|
+
export function detectMcpDescriptorPromptInjection(description) {
|
|
13
|
+
const normalized = description.toLowerCase();
|
|
14
|
+
const suspiciousPatterns = [
|
|
15
|
+
/ignore\s+(?:all\s+)?previous\s+instructions/,
|
|
16
|
+
/disregard\s+(?:all\s+)?previous\s+instructions/,
|
|
17
|
+
/exfiltrat/,
|
|
18
|
+
/reveal\s+(?:the\s+)?(?:system\s+)?prompt/,
|
|
19
|
+
/send\s+(?:me\s+)?(?:all\s+)?secrets/,
|
|
20
|
+
];
|
|
21
|
+
const patternHits = suspiciousPatterns.filter((pattern) => pattern.test(normalized)).length;
|
|
22
|
+
const patternSignal = patternHits === 0 ? 0 : Math.min(1, 0.6 + patternHits * 0.25);
|
|
23
|
+
return { patternSignal, patternHits, score: patternSignal };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=mcp-descriptor-injection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp-descriptor-injection.js","sourceRoot":"","sources":["../../src/core/mcp-descriptor-injection.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAgBH;;;;GAIG;AACH,MAAM,CAAC,MAAM,uCAAuC,GAAG,GAAG,CAAC;AAE3D,MAAM,UAAU,kCAAkC,CAAC,WAAmB,EAAsC;IAC3G,MAAM,UAAU,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;IAC7C,MAAM,kBAAkB,GAAG;QAC1B,6CAA6C;QAC7C,gDAAgD;QAChD,WAAW;QACX,0CAA0C;QAC1C,qCAAqC;KACrC,CAAC;IACF,MAAM,WAAW,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC;IAC5F,MAAM,aAAa,GAAG,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,GAAG,WAAW,GAAG,IAAI,CAAC,CAAC;IAEpF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa,EAAE,CAAC;AAAA,CAC5D","sourcesContent":["/**\n * MCP descriptor prompt-injection screen (audit §18). MCP tool descriptions\n * are untrusted third-party input; this rule-based screen flags suspicious\n * patterns at import time so the manager can quarantine the tool.\n */\n\n/**\n * Result of {@link detectMcpDescriptorPromptInjection}. `patternSignal` is a\n * rule score — the count of matched suspicious patterns squashed into\n * [0.6, 1] — NOT a calibrated probability that the descriptor is an attack.\n * Callers compare it against {@link MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD};\n * `score` is kept as a compatibility alias for the same number.\n */\nexport interface McpDescriptorPromptInjectionSignal {\n\treadonly patternSignal: number;\n\treadonly patternHits: number;\n\t/** @deprecated Compatibility alias of {@link patternSignal}. */\n\treadonly score: number;\n}\n\n/**\n * Any single suspicious-pattern hit crosses the quarantine line\n * (0.6 + 1*0.25 = 0.85 > 0.7); two or more saturate at 1. The threshold is a\n * policy boundary, not a probability cut.\n */\nexport const MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD = 0.7;\n\nexport function detectMcpDescriptorPromptInjection(description: string): McpDescriptorPromptInjectionSignal {\n\tconst normalized = description.toLowerCase();\n\tconst suspiciousPatterns = [\n\t\t/ignore\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/disregard\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/exfiltrat/,\n\t\t/reveal\\s+(?:the\\s+)?(?:system\\s+)?prompt/,\n\t\t/send\\s+(?:me\\s+)?(?:all\\s+)?secrets/,\n\t];\n\tconst patternHits = suspiciousPatterns.filter((pattern) => pattern.test(normalized)).length;\n\tconst patternSignal = patternHits === 0 ? 0 : Math.min(1, 0.6 + patternHits * 0.25);\n\n\treturn { patternSignal, patternHits, score: patternSignal };\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export { detectMcpDescriptorPromptInjection, MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD, type McpDescriptorPromptInjectionSignal, } from "./mcp-descriptor-injection.ts";
|
|
1
2
|
export type PublicMcpPresetKey = "context7" | "exa" | "githubReadOnly" | "astGrep" | "repomixCodeCompact" | "omkLlmlinguaCompress" | "doclingUnderstand" | "markitdownLite" | "firecrawlWebUnderstand" | "deepwikiRepoUnderstandCandidate" | "insaneSearchCandidate" | "playwrightSandboxed" | "microsoftLearn" | "officialReferenceSafePack";
|
|
2
3
|
export type PublicMcpRisk = "R1" | "R2" | "R3";
|
|
3
4
|
export type PublicMcpLicense = "Apache-2.0" | "Apache-2.0/MIT/CC-BY-4.0" | "MIT" | "Unspecified";
|
|
@@ -572,7 +573,4 @@ export declare function listPublicMcpPresets(): PublicMcpPreset[];
|
|
|
572
573
|
export declare function canonicalMcpPolicyHash(value: PublicMcpHashable): string;
|
|
573
574
|
export declare function canonicalPublicMcpServerIdentity(preset: PublicMcpPreset): string;
|
|
574
575
|
export declare function admitPublicMcpServer(preset: PublicMcpPreset, observed: PublicMcpObservedServer, approved: PublicMcpApprovedServer | undefined): PublicMcpAdmissionDecision;
|
|
575
|
-
export declare function detectMcpDescriptorPromptInjection(description: string): {
|
|
576
|
-
readonly score: number;
|
|
577
|
-
};
|
|
578
576
|
//# sourceMappingURL=mcp-public-presets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-public-presets.d.ts","sourceRoot":"","sources":["../../src/core/mcp-public-presets.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAC3B,UAAU,GACV,KA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoeiC,CAAC;AAEjE,eAAO,MAAM,6BAA6B;;;;;CAKhC,CAAC;AAEX,wBAAgB,oBAAoB,IAAI,eAAe,EAAE,CAExD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAEvE;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAMhF;AAED,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,uBAAuB,EACjC,QAAQ,EAAE,uBAAuB,GAAG,SAAS,GAC3C,0BAA0B,CA2C5B;AAED,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,MAAM,GAAG;IAAE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAclG","sourcesContent":["import { createHash } from \"node:crypto\";\n\nexport type PublicMcpPresetKey =\n\t| \"context7\"\n\t| \"exa\"\n\t| \"githubReadOnly\"\n\t| \"astGrep\"\n\t| \"repomixCodeCompact\"\n\t| \"omkLlmlinguaCompress\"\n\t| \"doclingUnderstand\"\n\t| \"markitdownLite\"\n\t| \"firecrawlWebUnderstand\"\n\t| \"deepwikiRepoUnderstandCandidate\"\n\t| \"insaneSearchCandidate\"\n\t| \"playwrightSandboxed\"\n\t| \"microsoftLearn\"\n\t| \"officialReferenceSafePack\";\n\nexport type PublicMcpRisk = \"R1\" | \"R2\" | \"R3\";\nexport type PublicMcpLicense = \"Apache-2.0\" | \"Apache-2.0/MIT/CC-BY-4.0\" | \"MIT\" | \"Unspecified\";\nexport type PublicMcpImplementation = \"candidate-wrapper\" | \"omk-owned\" | \"upstream-mcp\";\nexport type PublicMcpReadiness = \"candidate\" | \"stable\";\nexport type PublicMcpUriScheme = \"data\" | \"file\" | \"http\" | \"https\";\nexport type PublicMcpTransport =\n\t| {\n\t\t\treadonly type: \"http\";\n\t\t\treadonly url: string;\n\t }\n\t| {\n\t\t\treadonly type: \"embedded-python-or-sidecar\";\n\t\t\treadonly package: string;\n\t }\n\t| {\n\t\t\treadonly type: \"local-package\";\n\t\t\treadonly package: string;\n\t\t\treadonly args?: readonly string[];\n\t }\n\t| {\n\t\t\treadonly type: \"stdio\";\n\t\t\treadonly command: string;\n\t\t\treadonly args: readonly string[];\n\t };\n\nexport interface PublicMcpAuthPolicy {\n\treadonly kind: \"bearer\" | \"header\" | \"none\";\n\treadonly header?: string;\n\treadonly secretRef?: string;\n}\n\nexport interface PublicMcpSecretPolicy {\n\treadonly required?: readonly string[];\n\treadonly optional?: readonly string[];\n\treadonly headers?: Readonly<Record<string, string>>;\n}\n\nexport interface PublicMcpToolPolicy {\n\treadonly allow: readonly string[];\n\treadonly conditionalAllow?: readonly string[];\n\treadonly deny?: readonly string[];\n\treadonly denyByDefault: boolean;\n\treadonly denyMutations?: boolean;\n\treadonly disabledByDefault?: readonly string[];\n\treadonly gated?: readonly string[];\n\treadonly requirePostconditions?: readonly string[];\n}\n\nexport interface PublicMcpRuntimePolicy {\n\treadonly absolutePathMustBeUnderWorkspace?: boolean;\n\treadonly allowedUriSchemes?: readonly PublicMcpUriScheme[];\n\treadonly authenticationBoundaryRequired?: boolean;\n\treadonly blockMetadataIp?: boolean;\n\treadonly blockHttpByDefault?: boolean;\n\treadonly blockNetworkUrlsByDefault?: boolean;\n\treadonly blockPrivateNetwork?: boolean;\n\treadonly blockRemoteRepositoryByDefault?: boolean;\n\treadonly cacheDocuments?: boolean;\n\treadonly cacheable?: boolean;\n\treadonly cacheMaterializedOutputs?: boolean;\n\treadonly defaultCompressionRatio?: number;\n\treadonly descriptorHashPinned?: boolean;\n\treadonly distillBeforeMainContext?: boolean;\n\treadonly disableAutoInstall?: boolean;\n\treadonly domainAllowlistOptional?: boolean;\n\treadonly denyYoutubeByDefault?: boolean;\n\treadonly denyZipByDefault?: boolean;\n\treadonly evidenceLedger?: boolean;\n\treadonly filesystemRoot?: string;\n\treadonly fileRoot?: string;\n\treadonly forkContext?: boolean;\n\treadonly ledger?: boolean;\n\treadonly localFilesUnderWorkspaceOnly?: boolean;\n\treadonly localOnly?: boolean;\n\treadonly maxBrowserActions?: number;\n\treadonly maxCompressionRatio?: number;\n\treadonly maxInputBytes?: number;\n\treadonly maxInputTokens?: number;\n\treadonly maxOutputTokens?: number;\n\treadonly maxResults?: number;\n\treadonly maxUrlsPerTask?: number;\n\treadonly markdownFullPageRequiresExplicitNeed?: boolean;\n\treadonly mutationsRequireHumanGate?: boolean;\n\treadonly mutationsRequirePostconditions?: boolean;\n\treadonly noFilesystemReadExceptModelCache?: boolean;\n\treadonly noNetwork?: boolean;\n\treadonly noSecrets?: boolean;\n\treadonly noShell?: boolean;\n\treadonly outputGuard?: boolean;\n\treadonly preferGrepBeforeFullRead?: boolean;\n\treadonly preferIncrementalRead?: boolean;\n\treadonly preferJsonExtraction?: boolean;\n\treadonly privateRepoDeniedByDefault?: boolean;\n\treadonly promptTaint?: \"external-docs\" | \"external-web\" | \"browser\";\n\treadonly publicContentOnly?: boolean;\n\treadonly publicReposOnly?: boolean;\n\treadonly readOnly?: boolean;\n\treadonly recordEvidence?: boolean;\n\treadonly rejectIfCoverageBelow?: {\n\t\treadonly hard: number;\n\t\treadonly high: number;\n\t\treadonly low: number;\n\t\treadonly medium: number;\n\t};\n\treadonly requireCoverageVerification?: boolean;\n\treadonly requireOriginAllowlistForScrape?: boolean;\n\treadonly requiresExplicitPostconditions?: boolean;\n\treadonly requiresOriginAllowlist?: boolean;\n\treadonly requiresSandbox?: boolean;\n\treadonly secretBrokerOnly?: boolean;\n\treadonly secretScanRequired?: boolean;\n\treadonly ssrfGuard?: boolean;\n\treadonly workspaceReadOnly?: boolean;\n}\n\nexport interface PublicMcpPreset {\n\treadonly defaultEnabled?: boolean;\n\treadonly id: string;\n\treadonly key: PublicMcpPresetKey;\n\treadonly license: PublicMcpLicense;\n\treadonly notes: readonly string[];\n\treadonly policy: PublicMcpRuntimePolicy;\n\treadonly implementation?: PublicMcpImplementation;\n\treadonly readiness?: PublicMcpReadiness;\n\treadonly risk: PublicMcpRisk;\n\treadonly sourceUrls: readonly string[];\n\treadonly tools: PublicMcpToolPolicy;\n\treadonly auth?: PublicMcpAuthPolicy;\n\treadonly secrets?: PublicMcpSecretPolicy;\n\treadonly servers?: readonly string[];\n\treadonly transport?: PublicMcpTransport;\n}\n\nexport interface PublicMcpObservedTool {\n\treadonly name: string;\n\treadonly descriptorHash: string;\n\treadonly description: string;\n}\n\nexport interface PublicMcpObservedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: readonly PublicMcpObservedTool[];\n}\n\nexport interface PublicMcpApprovedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: Readonly<Record<string, string>>;\n}\n\nexport type PublicMcpAdmissionStatus = \"allow\" | \"quarantine\";\n\nexport interface PublicMcpAdmissionDecision {\n\treadonly status: PublicMcpAdmissionStatus;\n\treadonly reasons: readonly string[];\n}\n\nexport type PublicMcpHashable =\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| readonly PublicMcpHashable[]\n\t| {\n\t\t\treadonly [key: string]: PublicMcpHashable;\n\t };\n\nexport const PUBLIC_MCP_PRESETS = {\n\tcontext7: {\n\t\tid: \"context7\",\n\t\tkey: \"context7\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Documentation retrieval preset; optional API key only raises rate limits.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/upstash/context7\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.context7.com/mcp\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"CONTEXT7_API_KEY\"],\n\t\t\theaders: {\n\t\t\t\tCONTEXT7_API_KEY: \"secret-ref:context7\",\n\t\t\t},\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"resolve-library-id\", \"query-docs\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\texa: {\n\t\tid: \"exa\",\n\t\tkey: \"exa\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Run searches in forked context and return distilled output to the main task.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/exa-labs/exa-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.exa.ai/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"header\",\n\t\t\theader: \"Authorization\",\n\t\t\tsecretRef: \"secret-ref:exa_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"EXA_API_KEY\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"web_search_exa\", \"web_fetch_exa\"],\n\t\t\tconditionalAllow: [\"web_search_advanced_exa\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tdomainAllowlistOptional: true,\n\t\t\tforkContext: true,\n\t\t\tmaxOutputTokens: 5000,\n\t\t\tmaxResults: 10,\n\t\t\tssrfGuard: true,\n\t\t},\n\t},\n\tgithubReadOnly: {\n\t\tid: \"github-readonly\",\n\t\tkey: \"githubReadOnly\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Read-only GitHub MCP profile; mutation tools remain gated for future explicit workflows.\"],\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/github/github-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://api.githubcopilot.com/mcp/\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:github_pat\",\n\t\t},\n\t\tsecrets: {\n\t\t\trequired: [\"GITHUB_PERSONAL_ACCESS_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"actions_list\",\n\t\t\t\t\"get_file_contents\",\n\t\t\t\t\"issue_read\",\n\t\t\t\t\"list_issues\",\n\t\t\t\t\"list_pull_requests\",\n\t\t\t\t\"pull_request_read\",\n\t\t\t\t\"search_code\",\n\t\t\t\t\"search_issues\",\n\t\t\t\t\"search_pull_requests\",\n\t\t\t\t\"search_repositories\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t\trequirePostconditions: [\n\t\t\t\t\"add_comment_to_pending_review\",\n\t\t\t\t\"create_branch\",\n\t\t\t\t\"create_or_update_file\",\n\t\t\t\t\"create_pull_request\",\n\t\t\t\t\"delete_file\",\n\t\t\t\t\"issue_write\",\n\t\t\t\t\"merge_pull_request\",\n\t\t\t\t\"pull_request_review_write\",\n\t\t\t\t\"push_files\",\n\t\t\t\t\"update_pull_request\",\n\t\t\t\t\"update_pull_request_branch\",\n\t\t\t],\n\t\t},\n\t\tpolicy: {\n\t\t\tledger: true,\n\t\t\tmaxOutputTokens: 8000,\n\t\t\tmutationsRequireHumanGate: true,\n\t\t\treadOnly: true,\n\t\t\tsecretBrokerOnly: true,\n\t\t},\n\t},\n\tastGrep: {\n\t\tid: \"ast-grep\",\n\t\tkey: \"astGrep\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Experimental upstream; pin descriptor and wrap execution before broad enablement.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/ast-grep/ast-grep-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from\", \"git+https://github.com/ast-grep/ast-grep-mcp\", \"ast-grep-server\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"dump_syntax_tree\", \"find_code\", \"find_code_by_rule\", \"test_match_code_rule\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tmaxResults: 200,\n\t\t\tnoShell: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\trepomixCodeCompact: {\n\t\tdefaultEnabled: true,\n\t\tid: \"repomix-code-compact\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"repomixCodeCompact\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Codebase packing and compression preset; remote repository packing is disabled until a task explicitly opts in.\",\n\t\t\t\"Use grep/read against packed output before full-context attachment.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/yamadashy/repomix\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"npx\",\n\t\t\targs: [\"-y\", \"repomix\", \"--mcp\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"attach_packed_output\",\n\t\t\t\t\"file_system_read_directory\",\n\t\t\t\t\"grep_repomix_output\",\n\t\t\t\t\"pack_codebase\",\n\t\t\t\t\"read_repomix_output\",\n\t\t\t],\n\t\t\tdisabledByDefault: [\"pack_remote_repository\"],\n\t\t\tgated: [\"file_system_read_file\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tabsolutePathMustBeUnderWorkspace: true,\n\t\t\tblockRemoteRepositoryByDefault: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tmaxOutputTokens: 120_000,\n\t\t\toutputGuard: true,\n\t\t\tpreferGrepBeforeFullRead: true,\n\t\t\tpreferIncrementalRead: true,\n\t\t\tsecretScanRequired: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\tomkLlmlinguaCompress: {\n\t\tdefaultEnabled: true,\n\t\tid: \"omk-llmlingua-compress\",\n\t\timplementation: \"omk-owned\",\n\t\tkey: \"omkLlmlinguaCompress\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"First-party wrapper target for LLMLingua-style prompt and context compression.\",\n\t\t\t\"System prompts, latest user turns, and tool schemas must stay outside lossy compression.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/LLMLingua\", \"https://arxiv.org/abs/2403.12968\"],\n\t\ttransport: {\n\t\t\ttype: \"embedded-python-or-sidecar\",\n\t\t\tpackage: \"llmlingua\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"compress_context_items\",\n\t\t\t\t\"compress_messages\",\n\t\t\t\t\"compress_prompt\",\n\t\t\t\t\"compress_representation_candidate\",\n\t\t\t\t\"verify_compression_coverage\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheMaterializedOutputs: true,\n\t\t\tdefaultCompressionRatio: 3,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalOnly: true,\n\t\t\tmaxCompressionRatio: 8,\n\t\t\tmaxInputTokens: 200_000,\n\t\t\tnoFilesystemReadExceptModelCache: true,\n\t\t\tnoNetwork: true,\n\t\t\toutputGuard: true,\n\t\t\trejectIfCoverageBelow: {\n\t\t\t\thard: 0.95,\n\t\t\t\thigh: 0.8,\n\t\t\t\tmedium: 0.55,\n\t\t\t\tlow: 0.3,\n\t\t\t},\n\t\t\trequireCoverageVerification: true,\n\t\t},\n\t},\n\tdoclingUnderstand: {\n\t\tdefaultEnabled: true,\n\t\tid: \"docling-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"doclingUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Structured document understanding preset for PDFs, Office files, tables, OCR, and layout-sensitive conversions.\",\n\t\t\t\"Parser attack surface requires sandboxing and workspace-only local file access.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/docling-project/docling\", \"https://github.com/docling-project/docling-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from=docling-mcp\", \"docling-mcp-server\", \"--transport\", \"stdio\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_document\", \"export_docling_document_to_json\", \"export_docling_document_to_markdown\"],\n\t\t\tgated: [\"create_new_docling_document\", \"save_docling_document\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockNetworkUrlsByDefault: true,\n\t\t\tcacheDocuments: true,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalFilesUnderWorkspaceOnly: true,\n\t\t\tmaxInputBytes: 80_000_000,\n\t\t\tmaxOutputTokens: 80_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmarkitdownLite: {\n\t\tdefaultEnabled: true,\n\t\tid: \"markitdown-lite\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"markitdownLite\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Lightweight Markdown conversion fallback for local files and data URIs.\",\n\t\t\t\"HTTP, ZIP, and YouTube inputs stay blocked until a task explicitly needs them.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\n\t\t\t\"https://github.com/microsoft/markitdown\",\n\t\t\t\"https://github.com/microsoft/markitdown/tree/main/packages/markitdown-mcp\",\n\t\t],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"markitdown-mcp\",\n\t\t\targs: [],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_to_markdown\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tallowedUriSchemes: [\"file\", \"data\"],\n\t\t\tblockHttpByDefault: true,\n\t\t\tdenyYoutubeByDefault: true,\n\t\t\tdenyZipByDefault: true,\n\t\t\tevidenceLedger: true,\n\t\t\tfileRoot: \"workspaceRoot\",\n\t\t\tmaxInputBytes: 30_000_000,\n\t\t\tmaxOutputTokens: 50_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tfirecrawlWebUnderstand: {\n\t\tdefaultEnabled: false,\n\t\tid: \"firecrawl-web-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"firecrawlWebUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Opt-in live web understanding preset; search and scrape are the only default-admissible tools.\",\n\t\t\t\"Prefer JSON extraction over full-page Markdown to protect the context budget.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/firecrawl/firecrawl-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.firecrawl.dev/v2/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:firecrawl_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"FIRECRAWL_API_KEY\", \"FIRECRAWL_OAUTH_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"firecrawl_scrape\", \"firecrawl_search\"],\n\t\t\tdisabledByDefault: [\"firecrawl_agent\", \"firecrawl_crawl\", \"firecrawl_interact\", \"firecrawl_monitor\"],\n\t\t\tgated: [\"firecrawl_extract\", \"firecrawl_map\", \"firecrawl_research\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmarkdownFullPageRequiresExplicitNeed: true,\n\t\t\tmaxOutputTokens: 40_000,\n\t\t\tmaxUrlsPerTask: 10,\n\t\t\toutputGuard: true,\n\t\t\tpreferJsonExtraction: true,\n\t\t\trequireOriginAllowlistForScrape: true,\n\t\t},\n\t},\n\tdeepwikiRepoUnderstandCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"deepwiki-repo-understand\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"deepwikiRepoUnderstandCandidate\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\n\t\t\t\"Candidate only until an official MCP endpoint, tool schema, auth model, and retention boundary are verified.\",\n\t\t\t\"Remote repository indexing is public-repo-only by default.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://deepwiki.com/\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tnoSecrets: true,\n\t\t\toutputGuard: true,\n\t\t\tprivateRepoDeniedByDefault: true,\n\t\t\tpublicReposOnly: true,\n\t\t},\n\t},\n\tinsaneSearchCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"insane-search-public-reader\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"insaneSearchCandidate\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Candidate only: upstream is a Claude Code plugin, not a verified standalone MCP transport.\",\n\t\t\t\"Any OMK integration must be a sandboxed first-party wrapper around public-content reads, with auto-install disabled.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/fivetaku/insane-search\"],\n\t\ttools: {\n\t\t\tallow: [\"insane_search_public_read\"],\n\t\t\tdisabledByDefault: [\"insane_search_auto_install_dependencies\"],\n\t\t\tgated: [\"insane_search_browser_escalation\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tauthenticationBoundaryRequired: true,\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdisableAutoInstall: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmaxBrowserActions: 20,\n\t\t\tmaxOutputTokens: 30_000,\n\t\t\toutputGuard: true,\n\t\t\tpublicContentOnly: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tplaywrightSandboxed: {\n\t\tid: \"playwright-sandboxed\",\n\t\tkey: \"playwrightSandboxed\",\n\t\tlicense: \"Apache-2.0\",\n\t\tnotes: [\"Browser automation preset; enable only with sandbox and origin controls.\"],\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/microsoft/playwright-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"local-package\",\n\t\t\tpackage: \"@playwright/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"browser_close\",\n\t\t\t\t\"browser_click\",\n\t\t\t\t\"browser_navigate\",\n\t\t\t\t\"browser_snapshot\",\n\t\t\t\t\"browser_type\",\n\t\t\t\t\"browser_wait_for\",\n\t\t\t],\n\t\t\tdeny: [\"browser_console_messages\", \"browser_file_upload\", \"browser_pdf_save\", \"browser_press_key\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tledger: true,\n\t\t\tmaxBrowserActions: 40,\n\t\t\trecordEvidence: true,\n\t\t\trequiresExplicitPostconditions: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmicrosoftLearn: {\n\t\tid: \"microsoft-learn\",\n\t\tkey: \"microsoftLearn\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\"Microsoft official remote documentation endpoint from the Microsoft MCP catalog.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://learn.microsoft.com/api/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"*\"],\n\t\t\tdenyByDefault: true,\n\t\t\tdenyMutations: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\tofficialReferenceSafePack: {\n\t\tid: \"official-reference-safe-pack\",\n\t\tkey: \"officialReferenceSafePack\",\n\t\tlicense: \"Apache-2.0/MIT/CC-BY-4.0\",\n\t\tnotes: [\"Reference implementations only; wrap before production use.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/modelcontextprotocol/servers\"],\n\t\tservers: [\"time\", \"memory\", \"sequential-thinking\", \"git-readonly\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tfilesystemRoot: \"workspaceRoot\",\n\t\t\tmutationsRequirePostconditions: true,\n\t\t},\n\t},\n} as const satisfies Record<PublicMcpPresetKey, PublicMcpPreset>;\n\nexport const OMK_PUBLIC_CONTEXT_MCP_BUNDLE = {\n\tstableDefaults: [\"repomix-code-compact\", \"docling-understand\", \"markitdown-lite\", \"omk-llmlingua-compress\"],\n\toptInResearchWeb: [\"firecrawl-web-understand\"],\n\tcandidatesNeedVerification: [\"deepwiki-repo-understand\", \"insane-search-public-reader\"],\n\tinternalRouters: [\"mcp-tool-rag-router\"],\n} as const;\n\nexport function listPublicMcpPresets(): PublicMcpPreset[] {\n\treturn Object.values(PUBLIC_MCP_PRESETS).map((preset) => clonePublicMcpPreset(preset));\n}\n\nexport function canonicalMcpPolicyHash(value: PublicMcpHashable): string {\n\treturn createHash(\"sha256\").update(canonicalStringify(value)).digest(\"hex\");\n}\n\nexport function canonicalPublicMcpServerIdentity(preset: PublicMcpPreset): string {\n\treturn canonicalMcpPolicyHash({\n\t\tid: preset.id,\n\t\tservers: preset.servers ?? null,\n\t\ttransport: preset.transport ?? null,\n\t});\n}\n\nexport function admitPublicMcpServer(\n\tpreset: PublicMcpPreset,\n\tobserved: PublicMcpObservedServer,\n\tapproved: PublicMcpApprovedServer | undefined,\n): PublicMcpAdmissionDecision {\n\tif (!approved) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_not_approved\"],\n\t\t};\n\t}\n\n\tif (approved.serverIdentity !== observed.serverIdentity) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_identity_changed\"],\n\t\t};\n\t}\n\n\tconst reasons: string[] = [];\n\n\tfor (const tool of observed.tools) {\n\t\tconst approvedDescriptorHash = approved.tools[tool.name];\n\n\t\tif (!approvedDescriptorHash) {\n\t\t\treasons.push(`new_tool:${tool.name}`);\n\t\t} else if (approvedDescriptorHash !== tool.descriptorHash) {\n\t\t\treasons.push(`descriptor_changed:${tool.name}`);\n\t\t}\n\n\t\tif (!isToolAllowed(preset.tools, tool.name)) {\n\t\t\treasons.push(`tool_not_allowed:${tool.name}`);\n\t\t}\n\n\t\tif (shouldDenyMutationLikeTool(preset, tool.name)) {\n\t\t\treasons.push(`mutation_tool_denied:${tool.name}`);\n\t\t}\n\n\t\tif (detectMcpDescriptorPromptInjection(tool.description).score > 0.7) {\n\t\t\treasons.push(`descriptor_prompt_injection:${tool.name}`);\n\t\t}\n\t}\n\n\treturn {\n\t\tstatus: reasons.length === 0 ? \"allow\" : \"quarantine\",\n\t\treasons,\n\t};\n}\n\nexport function detectMcpDescriptorPromptInjection(description: string): { readonly score: number } {\n\tconst normalized = description.toLowerCase();\n\tconst suspiciousPatterns = [\n\t\t/ignore\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/disregard\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/exfiltrat/,\n\t\t/reveal\\s+(?:the\\s+)?(?:system\\s+)?prompt/,\n\t\t/send\\s+(?:me\\s+)?(?:all\\s+)?secrets/,\n\t];\n\tconst hits = suspiciousPatterns.filter((pattern) => pattern.test(normalized)).length;\n\n\treturn {\n\t\tscore: hits === 0 ? 0 : Math.min(1, 0.6 + hits * 0.25),\n\t};\n}\n\nfunction clonePublicMcpPreset(preset: PublicMcpPreset): PublicMcpPreset {\n\treturn {\n\t\t...preset,\n\t\tauth: preset.auth ? { ...preset.auth } : undefined,\n\t\tdefaultEnabled: preset.defaultEnabled,\n\t\timplementation: preset.implementation,\n\t\tnotes: [...preset.notes],\n\t\tpolicy: cloneRuntimePolicy(preset.policy),\n\t\treadiness: preset.readiness,\n\t\tsecrets: preset.secrets\n\t\t\t? {\n\t\t\t\t\theaders: preset.secrets.headers ? { ...preset.secrets.headers } : undefined,\n\t\t\t\t\toptional: preset.secrets.optional ? [...preset.secrets.optional] : undefined,\n\t\t\t\t\trequired: preset.secrets.required ? [...preset.secrets.required] : undefined,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tservers: preset.servers ? [...preset.servers] : undefined,\n\t\tsourceUrls: [...preset.sourceUrls],\n\t\ttools: {\n\t\t\tallow: [...preset.tools.allow],\n\t\t\tconditionalAllow: preset.tools.conditionalAllow ? [...preset.tools.conditionalAllow] : undefined,\n\t\t\tdeny: preset.tools.deny ? [...preset.tools.deny] : undefined,\n\t\t\tdenyByDefault: preset.tools.denyByDefault,\n\t\t\tdenyMutations: preset.tools.denyMutations,\n\t\t\tdisabledByDefault: preset.tools.disabledByDefault ? [...preset.tools.disabledByDefault] : undefined,\n\t\t\tgated: preset.tools.gated ? [...preset.tools.gated] : undefined,\n\t\t\trequirePostconditions: preset.tools.requirePostconditions\n\t\t\t\t? [...preset.tools.requirePostconditions]\n\t\t\t\t: undefined,\n\t\t},\n\t\ttransport: preset.transport ? cloneTransport(preset.transport) : undefined,\n\t};\n}\n\nfunction cloneTransport(transport: PublicMcpTransport): PublicMcpTransport {\n\tif (transport.type === \"stdio\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: [...transport.args],\n\t\t};\n\t}\n\n\tif (transport.type === \"local-package\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: transport.args ? [...transport.args] : undefined,\n\t\t};\n\t}\n\n\tif (transport.type === \"embedded-python-or-sidecar\") {\n\t\treturn { ...transport };\n\t}\n\n\treturn { ...transport };\n}\n\nfunction cloneRuntimePolicy(policy: PublicMcpRuntimePolicy): PublicMcpRuntimePolicy {\n\treturn {\n\t\t...policy,\n\t\tallowedUriSchemes: policy.allowedUriSchemes ? [...policy.allowedUriSchemes] : undefined,\n\t\trejectIfCoverageBelow: policy.rejectIfCoverageBelow ? { ...policy.rejectIfCoverageBelow } : undefined,\n\t};\n}\n\nfunction isToolAllowed(policy: PublicMcpToolPolicy, toolName: string): boolean {\n\tif (policy.deny?.includes(toolName)) {\n\t\treturn false;\n\t}\n\n\tif (policy.allow.includes(\"*\")) {\n\t\treturn true;\n\t}\n\n\treturn policy.allow.includes(toolName);\n}\n\nfunction shouldDenyMutationLikeTool(preset: PublicMcpPreset, toolName: string): boolean {\n\tif (!preset.tools.allow.includes(\"*\")) {\n\t\treturn false;\n\t}\n\n\tif (!preset.tools.denyMutations && !preset.policy.readOnly && !preset.policy.mutationsRequirePostconditions) {\n\t\treturn false;\n\t}\n\n\treturn isMutationLikeToolName(toolName);\n}\n\nfunction isMutationLikeToolName(toolName: string): boolean {\n\treturn /(?:^|[_-])(add|approve|archive|cancel|close|create|delete|dismiss|merge|post|push|remove|send|submit|update|upload|write)(?:$|[_-])/.test(\n\t\ttoolName.toLowerCase(),\n\t);\n}\n\nfunction canonicalStringify(value: PublicMcpHashable): string {\n\tif (value === null || typeof value === \"boolean\" || typeof value === \"number\" || typeof value === \"string\") {\n\t\treturn JSON.stringify(value);\n\t}\n\n\tif (Array.isArray(value)) {\n\t\treturn `[${value.map((item) => canonicalStringify(item)).join(\",\")}]`;\n\t}\n\n\tconst record = value as { readonly [key: string]: PublicMcpHashable };\n\tconst keys = Object.keys(record).sort();\n\treturn `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(\",\")}}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mcp-public-presets.d.ts","sourceRoot":"","sources":["../../src/core/mcp-public-presets.ts"],"names":[],"mappings":"AAMA,OAAO,EACN,kCAAkC,EAClC,uCAAuC,EACvC,KAAK,kCAAkC,GACvC,MAAM,+BAA+B,CAAC;AAEvC,MAAM,MAAM,kBAAkB,GAC3B,UAAU,GACV,KAAK,GACL,gBAAgB,GAChB,SAAS,GACT,oBAAoB,GACpB,sBAAsB,GACtB,mBAAmB,GACnB,gBAAgB,GAChB,wBAAwB,GACxB,iCAAiC,GACjC,uBAAuB,GACvB,qBAAqB,GACrB,gBAAgB,GAChB,2BAA2B,CAAC;AAE/B,MAAM,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAC/C,MAAM,MAAM,gBAAgB,GAAG,YAAY,GAAG,0BAA0B,GAAG,KAAK,GAAG,aAAa,CAAC;AACjG,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,GAAG,WAAW,GAAG,cAAc,CAAC;AACzF,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,QAAQ,CAAC;AACxD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACpE,MAAM,MAAM,kBAAkB,GAC3B;IACA,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACpB,GACD;IACA,QAAQ,CAAC,IAAI,EAAE,4BAA4B,CAAC;IAC5C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CACxB,GACD;IACA,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC,GACD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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoeiC,CAAC;AAEjE,eAAO,MAAM,6BAA6B;;;;;CAKhC,CAAC;AAEX,wBAAgB,oBAAoB,IAAI,eAAe,EAAE,CAExD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,iBAAiB,GAAG,MAAM,CAEvE;AAED,wBAAgB,gCAAgC,CAAC,MAAM,EAAE,eAAe,GAAG,MAAM,CAMhF;AAED,wBAAgB,oBAAoB,CACnC,MAAM,EAAE,eAAe,EACvB,QAAQ,EAAE,uBAAuB,EACjC,QAAQ,EAAE,uBAAuB,GAAG,SAAS,GAC3C,0BAA0B,CA6C5B","sourcesContent":["import { createHash } from \"node:crypto\";\nimport {\n\tdetectMcpDescriptorPromptInjection,\n\tMCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD,\n} from \"./mcp-descriptor-injection.ts\";\n\nexport {\n\tdetectMcpDescriptorPromptInjection,\n\tMCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD,\n\ttype McpDescriptorPromptInjectionSignal,\n} from \"./mcp-descriptor-injection.ts\";\n\nexport type PublicMcpPresetKey =\n\t| \"context7\"\n\t| \"exa\"\n\t| \"githubReadOnly\"\n\t| \"astGrep\"\n\t| \"repomixCodeCompact\"\n\t| \"omkLlmlinguaCompress\"\n\t| \"doclingUnderstand\"\n\t| \"markitdownLite\"\n\t| \"firecrawlWebUnderstand\"\n\t| \"deepwikiRepoUnderstandCandidate\"\n\t| \"insaneSearchCandidate\"\n\t| \"playwrightSandboxed\"\n\t| \"microsoftLearn\"\n\t| \"officialReferenceSafePack\";\n\nexport type PublicMcpRisk = \"R1\" | \"R2\" | \"R3\";\nexport type PublicMcpLicense = \"Apache-2.0\" | \"Apache-2.0/MIT/CC-BY-4.0\" | \"MIT\" | \"Unspecified\";\nexport type PublicMcpImplementation = \"candidate-wrapper\" | \"omk-owned\" | \"upstream-mcp\";\nexport type PublicMcpReadiness = \"candidate\" | \"stable\";\nexport type PublicMcpUriScheme = \"data\" | \"file\" | \"http\" | \"https\";\nexport type PublicMcpTransport =\n\t| {\n\t\t\treadonly type: \"http\";\n\t\t\treadonly url: string;\n\t }\n\t| {\n\t\t\treadonly type: \"embedded-python-or-sidecar\";\n\t\t\treadonly package: string;\n\t }\n\t| {\n\t\t\treadonly type: \"local-package\";\n\t\t\treadonly package: string;\n\t\t\treadonly args?: readonly string[];\n\t }\n\t| {\n\t\t\treadonly type: \"stdio\";\n\t\t\treadonly command: string;\n\t\t\treadonly args: readonly string[];\n\t };\n\nexport interface PublicMcpAuthPolicy {\n\treadonly kind: \"bearer\" | \"header\" | \"none\";\n\treadonly header?: string;\n\treadonly secretRef?: string;\n}\n\nexport interface PublicMcpSecretPolicy {\n\treadonly required?: readonly string[];\n\treadonly optional?: readonly string[];\n\treadonly headers?: Readonly<Record<string, string>>;\n}\n\nexport interface PublicMcpToolPolicy {\n\treadonly allow: readonly string[];\n\treadonly conditionalAllow?: readonly string[];\n\treadonly deny?: readonly string[];\n\treadonly denyByDefault: boolean;\n\treadonly denyMutations?: boolean;\n\treadonly disabledByDefault?: readonly string[];\n\treadonly gated?: readonly string[];\n\treadonly requirePostconditions?: readonly string[];\n}\n\nexport interface PublicMcpRuntimePolicy {\n\treadonly absolutePathMustBeUnderWorkspace?: boolean;\n\treadonly allowedUriSchemes?: readonly PublicMcpUriScheme[];\n\treadonly authenticationBoundaryRequired?: boolean;\n\treadonly blockMetadataIp?: boolean;\n\treadonly blockHttpByDefault?: boolean;\n\treadonly blockNetworkUrlsByDefault?: boolean;\n\treadonly blockPrivateNetwork?: boolean;\n\treadonly blockRemoteRepositoryByDefault?: boolean;\n\treadonly cacheDocuments?: boolean;\n\treadonly cacheable?: boolean;\n\treadonly cacheMaterializedOutputs?: boolean;\n\treadonly defaultCompressionRatio?: number;\n\treadonly descriptorHashPinned?: boolean;\n\treadonly distillBeforeMainContext?: boolean;\n\treadonly disableAutoInstall?: boolean;\n\treadonly domainAllowlistOptional?: boolean;\n\treadonly denyYoutubeByDefault?: boolean;\n\treadonly denyZipByDefault?: boolean;\n\treadonly evidenceLedger?: boolean;\n\treadonly filesystemRoot?: string;\n\treadonly fileRoot?: string;\n\treadonly forkContext?: boolean;\n\treadonly ledger?: boolean;\n\treadonly localFilesUnderWorkspaceOnly?: boolean;\n\treadonly localOnly?: boolean;\n\treadonly maxBrowserActions?: number;\n\treadonly maxCompressionRatio?: number;\n\treadonly maxInputBytes?: number;\n\treadonly maxInputTokens?: number;\n\treadonly maxOutputTokens?: number;\n\treadonly maxResults?: number;\n\treadonly maxUrlsPerTask?: number;\n\treadonly markdownFullPageRequiresExplicitNeed?: boolean;\n\treadonly mutationsRequireHumanGate?: boolean;\n\treadonly mutationsRequirePostconditions?: boolean;\n\treadonly noFilesystemReadExceptModelCache?: boolean;\n\treadonly noNetwork?: boolean;\n\treadonly noSecrets?: boolean;\n\treadonly noShell?: boolean;\n\treadonly outputGuard?: boolean;\n\treadonly preferGrepBeforeFullRead?: boolean;\n\treadonly preferIncrementalRead?: boolean;\n\treadonly preferJsonExtraction?: boolean;\n\treadonly privateRepoDeniedByDefault?: boolean;\n\treadonly promptTaint?: \"external-docs\" | \"external-web\" | \"browser\";\n\treadonly publicContentOnly?: boolean;\n\treadonly publicReposOnly?: boolean;\n\treadonly readOnly?: boolean;\n\treadonly recordEvidence?: boolean;\n\treadonly rejectIfCoverageBelow?: {\n\t\treadonly hard: number;\n\t\treadonly high: number;\n\t\treadonly low: number;\n\t\treadonly medium: number;\n\t};\n\treadonly requireCoverageVerification?: boolean;\n\treadonly requireOriginAllowlistForScrape?: boolean;\n\treadonly requiresExplicitPostconditions?: boolean;\n\treadonly requiresOriginAllowlist?: boolean;\n\treadonly requiresSandbox?: boolean;\n\treadonly secretBrokerOnly?: boolean;\n\treadonly secretScanRequired?: boolean;\n\treadonly ssrfGuard?: boolean;\n\treadonly workspaceReadOnly?: boolean;\n}\n\nexport interface PublicMcpPreset {\n\treadonly defaultEnabled?: boolean;\n\treadonly id: string;\n\treadonly key: PublicMcpPresetKey;\n\treadonly license: PublicMcpLicense;\n\treadonly notes: readonly string[];\n\treadonly policy: PublicMcpRuntimePolicy;\n\treadonly implementation?: PublicMcpImplementation;\n\treadonly readiness?: PublicMcpReadiness;\n\treadonly risk: PublicMcpRisk;\n\treadonly sourceUrls: readonly string[];\n\treadonly tools: PublicMcpToolPolicy;\n\treadonly auth?: PublicMcpAuthPolicy;\n\treadonly secrets?: PublicMcpSecretPolicy;\n\treadonly servers?: readonly string[];\n\treadonly transport?: PublicMcpTransport;\n}\n\nexport interface PublicMcpObservedTool {\n\treadonly name: string;\n\treadonly descriptorHash: string;\n\treadonly description: string;\n}\n\nexport interface PublicMcpObservedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: readonly PublicMcpObservedTool[];\n}\n\nexport interface PublicMcpApprovedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: Readonly<Record<string, string>>;\n}\n\nexport type PublicMcpAdmissionStatus = \"allow\" | \"quarantine\";\n\nexport interface PublicMcpAdmissionDecision {\n\treadonly status: PublicMcpAdmissionStatus;\n\treadonly reasons: readonly string[];\n}\n\nexport type PublicMcpHashable =\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| readonly PublicMcpHashable[]\n\t| {\n\t\t\treadonly [key: string]: PublicMcpHashable;\n\t };\n\nexport const PUBLIC_MCP_PRESETS = {\n\tcontext7: {\n\t\tid: \"context7\",\n\t\tkey: \"context7\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Documentation retrieval preset; optional API key only raises rate limits.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/upstash/context7\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.context7.com/mcp\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"CONTEXT7_API_KEY\"],\n\t\t\theaders: {\n\t\t\t\tCONTEXT7_API_KEY: \"secret-ref:context7\",\n\t\t\t},\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"resolve-library-id\", \"query-docs\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\texa: {\n\t\tid: \"exa\",\n\t\tkey: \"exa\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Run searches in forked context and return distilled output to the main task.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/exa-labs/exa-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.exa.ai/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"header\",\n\t\t\theader: \"Authorization\",\n\t\t\tsecretRef: \"secret-ref:exa_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"EXA_API_KEY\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"web_search_exa\", \"web_fetch_exa\"],\n\t\t\tconditionalAllow: [\"web_search_advanced_exa\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tdomainAllowlistOptional: true,\n\t\t\tforkContext: true,\n\t\t\tmaxOutputTokens: 5000,\n\t\t\tmaxResults: 10,\n\t\t\tssrfGuard: true,\n\t\t},\n\t},\n\tgithubReadOnly: {\n\t\tid: \"github-readonly\",\n\t\tkey: \"githubReadOnly\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Read-only GitHub MCP profile; mutation tools remain gated for future explicit workflows.\"],\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/github/github-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://api.githubcopilot.com/mcp/\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:github_pat\",\n\t\t},\n\t\tsecrets: {\n\t\t\trequired: [\"GITHUB_PERSONAL_ACCESS_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"actions_list\",\n\t\t\t\t\"get_file_contents\",\n\t\t\t\t\"issue_read\",\n\t\t\t\t\"list_issues\",\n\t\t\t\t\"list_pull_requests\",\n\t\t\t\t\"pull_request_read\",\n\t\t\t\t\"search_code\",\n\t\t\t\t\"search_issues\",\n\t\t\t\t\"search_pull_requests\",\n\t\t\t\t\"search_repositories\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t\trequirePostconditions: [\n\t\t\t\t\"add_comment_to_pending_review\",\n\t\t\t\t\"create_branch\",\n\t\t\t\t\"create_or_update_file\",\n\t\t\t\t\"create_pull_request\",\n\t\t\t\t\"delete_file\",\n\t\t\t\t\"issue_write\",\n\t\t\t\t\"merge_pull_request\",\n\t\t\t\t\"pull_request_review_write\",\n\t\t\t\t\"push_files\",\n\t\t\t\t\"update_pull_request\",\n\t\t\t\t\"update_pull_request_branch\",\n\t\t\t],\n\t\t},\n\t\tpolicy: {\n\t\t\tledger: true,\n\t\t\tmaxOutputTokens: 8000,\n\t\t\tmutationsRequireHumanGate: true,\n\t\t\treadOnly: true,\n\t\t\tsecretBrokerOnly: true,\n\t\t},\n\t},\n\tastGrep: {\n\t\tid: \"ast-grep\",\n\t\tkey: \"astGrep\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Experimental upstream; pin descriptor and wrap execution before broad enablement.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/ast-grep/ast-grep-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from\", \"git+https://github.com/ast-grep/ast-grep-mcp\", \"ast-grep-server\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"dump_syntax_tree\", \"find_code\", \"find_code_by_rule\", \"test_match_code_rule\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tmaxResults: 200,\n\t\t\tnoShell: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\trepomixCodeCompact: {\n\t\tdefaultEnabled: true,\n\t\tid: \"repomix-code-compact\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"repomixCodeCompact\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Codebase packing and compression preset; remote repository packing is disabled until a task explicitly opts in.\",\n\t\t\t\"Use grep/read against packed output before full-context attachment.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/yamadashy/repomix\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"npx\",\n\t\t\targs: [\"-y\", \"repomix\", \"--mcp\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"attach_packed_output\",\n\t\t\t\t\"file_system_read_directory\",\n\t\t\t\t\"grep_repomix_output\",\n\t\t\t\t\"pack_codebase\",\n\t\t\t\t\"read_repomix_output\",\n\t\t\t],\n\t\t\tdisabledByDefault: [\"pack_remote_repository\"],\n\t\t\tgated: [\"file_system_read_file\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tabsolutePathMustBeUnderWorkspace: true,\n\t\t\tblockRemoteRepositoryByDefault: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tmaxOutputTokens: 120_000,\n\t\t\toutputGuard: true,\n\t\t\tpreferGrepBeforeFullRead: true,\n\t\t\tpreferIncrementalRead: true,\n\t\t\tsecretScanRequired: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\tomkLlmlinguaCompress: {\n\t\tdefaultEnabled: true,\n\t\tid: \"omk-llmlingua-compress\",\n\t\timplementation: \"omk-owned\",\n\t\tkey: \"omkLlmlinguaCompress\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"First-party wrapper target for LLMLingua-style prompt and context compression.\",\n\t\t\t\"System prompts, latest user turns, and tool schemas must stay outside lossy compression.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/LLMLingua\", \"https://arxiv.org/abs/2403.12968\"],\n\t\ttransport: {\n\t\t\ttype: \"embedded-python-or-sidecar\",\n\t\t\tpackage: \"llmlingua\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"compress_context_items\",\n\t\t\t\t\"compress_messages\",\n\t\t\t\t\"compress_prompt\",\n\t\t\t\t\"compress_representation_candidate\",\n\t\t\t\t\"verify_compression_coverage\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheMaterializedOutputs: true,\n\t\t\tdefaultCompressionRatio: 3,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalOnly: true,\n\t\t\tmaxCompressionRatio: 8,\n\t\t\tmaxInputTokens: 200_000,\n\t\t\tnoFilesystemReadExceptModelCache: true,\n\t\t\tnoNetwork: true,\n\t\t\toutputGuard: true,\n\t\t\trejectIfCoverageBelow: {\n\t\t\t\thard: 0.95,\n\t\t\t\thigh: 0.8,\n\t\t\t\tmedium: 0.55,\n\t\t\t\tlow: 0.3,\n\t\t\t},\n\t\t\trequireCoverageVerification: true,\n\t\t},\n\t},\n\tdoclingUnderstand: {\n\t\tdefaultEnabled: true,\n\t\tid: \"docling-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"doclingUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Structured document understanding preset for PDFs, Office files, tables, OCR, and layout-sensitive conversions.\",\n\t\t\t\"Parser attack surface requires sandboxing and workspace-only local file access.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/docling-project/docling\", \"https://github.com/docling-project/docling-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from=docling-mcp\", \"docling-mcp-server\", \"--transport\", \"stdio\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_document\", \"export_docling_document_to_json\", \"export_docling_document_to_markdown\"],\n\t\t\tgated: [\"create_new_docling_document\", \"save_docling_document\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockNetworkUrlsByDefault: true,\n\t\t\tcacheDocuments: true,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalFilesUnderWorkspaceOnly: true,\n\t\t\tmaxInputBytes: 80_000_000,\n\t\t\tmaxOutputTokens: 80_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmarkitdownLite: {\n\t\tdefaultEnabled: true,\n\t\tid: \"markitdown-lite\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"markitdownLite\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Lightweight Markdown conversion fallback for local files and data URIs.\",\n\t\t\t\"HTTP, ZIP, and YouTube inputs stay blocked until a task explicitly needs them.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\n\t\t\t\"https://github.com/microsoft/markitdown\",\n\t\t\t\"https://github.com/microsoft/markitdown/tree/main/packages/markitdown-mcp\",\n\t\t],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"markitdown-mcp\",\n\t\t\targs: [],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_to_markdown\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tallowedUriSchemes: [\"file\", \"data\"],\n\t\t\tblockHttpByDefault: true,\n\t\t\tdenyYoutubeByDefault: true,\n\t\t\tdenyZipByDefault: true,\n\t\t\tevidenceLedger: true,\n\t\t\tfileRoot: \"workspaceRoot\",\n\t\t\tmaxInputBytes: 30_000_000,\n\t\t\tmaxOutputTokens: 50_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tfirecrawlWebUnderstand: {\n\t\tdefaultEnabled: false,\n\t\tid: \"firecrawl-web-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"firecrawlWebUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Opt-in live web understanding preset; search and scrape are the only default-admissible tools.\",\n\t\t\t\"Prefer JSON extraction over full-page Markdown to protect the context budget.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/firecrawl/firecrawl-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.firecrawl.dev/v2/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:firecrawl_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"FIRECRAWL_API_KEY\", \"FIRECRAWL_OAUTH_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"firecrawl_scrape\", \"firecrawl_search\"],\n\t\t\tdisabledByDefault: [\"firecrawl_agent\", \"firecrawl_crawl\", \"firecrawl_interact\", \"firecrawl_monitor\"],\n\t\t\tgated: [\"firecrawl_extract\", \"firecrawl_map\", \"firecrawl_research\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmarkdownFullPageRequiresExplicitNeed: true,\n\t\t\tmaxOutputTokens: 40_000,\n\t\t\tmaxUrlsPerTask: 10,\n\t\t\toutputGuard: true,\n\t\t\tpreferJsonExtraction: true,\n\t\t\trequireOriginAllowlistForScrape: true,\n\t\t},\n\t},\n\tdeepwikiRepoUnderstandCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"deepwiki-repo-understand\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"deepwikiRepoUnderstandCandidate\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\n\t\t\t\"Candidate only until an official MCP endpoint, tool schema, auth model, and retention boundary are verified.\",\n\t\t\t\"Remote repository indexing is public-repo-only by default.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://deepwiki.com/\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tnoSecrets: true,\n\t\t\toutputGuard: true,\n\t\t\tprivateRepoDeniedByDefault: true,\n\t\t\tpublicReposOnly: true,\n\t\t},\n\t},\n\tinsaneSearchCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"insane-search-public-reader\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"insaneSearchCandidate\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Candidate only: upstream is a Claude Code plugin, not a verified standalone MCP transport.\",\n\t\t\t\"Any OMK integration must be a sandboxed first-party wrapper around public-content reads, with auto-install disabled.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/fivetaku/insane-search\"],\n\t\ttools: {\n\t\t\tallow: [\"insane_search_public_read\"],\n\t\t\tdisabledByDefault: [\"insane_search_auto_install_dependencies\"],\n\t\t\tgated: [\"insane_search_browser_escalation\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tauthenticationBoundaryRequired: true,\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdisableAutoInstall: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmaxBrowserActions: 20,\n\t\t\tmaxOutputTokens: 30_000,\n\t\t\toutputGuard: true,\n\t\t\tpublicContentOnly: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tplaywrightSandboxed: {\n\t\tid: \"playwright-sandboxed\",\n\t\tkey: \"playwrightSandboxed\",\n\t\tlicense: \"Apache-2.0\",\n\t\tnotes: [\"Browser automation preset; enable only with sandbox and origin controls.\"],\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/microsoft/playwright-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"local-package\",\n\t\t\tpackage: \"@playwright/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"browser_close\",\n\t\t\t\t\"browser_click\",\n\t\t\t\t\"browser_navigate\",\n\t\t\t\t\"browser_snapshot\",\n\t\t\t\t\"browser_type\",\n\t\t\t\t\"browser_wait_for\",\n\t\t\t],\n\t\t\tdeny: [\"browser_console_messages\", \"browser_file_upload\", \"browser_pdf_save\", \"browser_press_key\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tledger: true,\n\t\t\tmaxBrowserActions: 40,\n\t\t\trecordEvidence: true,\n\t\t\trequiresExplicitPostconditions: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmicrosoftLearn: {\n\t\tid: \"microsoft-learn\",\n\t\tkey: \"microsoftLearn\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\"Microsoft official remote documentation endpoint from the Microsoft MCP catalog.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://learn.microsoft.com/api/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"*\"],\n\t\t\tdenyByDefault: true,\n\t\t\tdenyMutations: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\tofficialReferenceSafePack: {\n\t\tid: \"official-reference-safe-pack\",\n\t\tkey: \"officialReferenceSafePack\",\n\t\tlicense: \"Apache-2.0/MIT/CC-BY-4.0\",\n\t\tnotes: [\"Reference implementations only; wrap before production use.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/modelcontextprotocol/servers\"],\n\t\tservers: [\"time\", \"memory\", \"sequential-thinking\", \"git-readonly\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tfilesystemRoot: \"workspaceRoot\",\n\t\t\tmutationsRequirePostconditions: true,\n\t\t},\n\t},\n} as const satisfies Record<PublicMcpPresetKey, PublicMcpPreset>;\n\nexport const OMK_PUBLIC_CONTEXT_MCP_BUNDLE = {\n\tstableDefaults: [\"repomix-code-compact\", \"docling-understand\", \"markitdown-lite\", \"omk-llmlingua-compress\"],\n\toptInResearchWeb: [\"firecrawl-web-understand\"],\n\tcandidatesNeedVerification: [\"deepwiki-repo-understand\", \"insane-search-public-reader\"],\n\tinternalRouters: [\"mcp-tool-rag-router\"],\n} as const;\n\nexport function listPublicMcpPresets(): PublicMcpPreset[] {\n\treturn Object.values(PUBLIC_MCP_PRESETS).map((preset) => clonePublicMcpPreset(preset));\n}\n\nexport function canonicalMcpPolicyHash(value: PublicMcpHashable): string {\n\treturn createHash(\"sha256\").update(canonicalStringify(value)).digest(\"hex\");\n}\n\nexport function canonicalPublicMcpServerIdentity(preset: PublicMcpPreset): string {\n\treturn canonicalMcpPolicyHash({\n\t\tid: preset.id,\n\t\tservers: preset.servers ?? null,\n\t\ttransport: preset.transport ?? null,\n\t});\n}\n\nexport function admitPublicMcpServer(\n\tpreset: PublicMcpPreset,\n\tobserved: PublicMcpObservedServer,\n\tapproved: PublicMcpApprovedServer | undefined,\n): PublicMcpAdmissionDecision {\n\tif (!approved) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_not_approved\"],\n\t\t};\n\t}\n\n\tif (approved.serverIdentity !== observed.serverIdentity) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_identity_changed\"],\n\t\t};\n\t}\n\n\tconst reasons: string[] = [];\n\n\tfor (const tool of observed.tools) {\n\t\tconst approvedDescriptorHash = approved.tools[tool.name];\n\n\t\tif (!approvedDescriptorHash) {\n\t\t\treasons.push(`new_tool:${tool.name}`);\n\t\t} else if (approvedDescriptorHash !== tool.descriptorHash) {\n\t\t\treasons.push(`descriptor_changed:${tool.name}`);\n\t\t}\n\n\t\tif (!isToolAllowed(preset.tools, tool.name)) {\n\t\t\treasons.push(`tool_not_allowed:${tool.name}`);\n\t\t}\n\n\t\tif (shouldDenyMutationLikeTool(preset, tool.name)) {\n\t\t\treasons.push(`mutation_tool_denied:${tool.name}`);\n\t\t}\n\n\t\tif (\n\t\t\tdetectMcpDescriptorPromptInjection(tool.description).patternSignal > MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD\n\t\t) {\n\t\t\treasons.push(`descriptor_prompt_injection:${tool.name}`);\n\t\t}\n\t}\n\n\treturn {\n\t\tstatus: reasons.length === 0 ? \"allow\" : \"quarantine\",\n\t\treasons,\n\t};\n}\n\nfunction clonePublicMcpPreset(preset: PublicMcpPreset): PublicMcpPreset {\n\treturn {\n\t\t...preset,\n\t\tauth: preset.auth ? { ...preset.auth } : undefined,\n\t\tdefaultEnabled: preset.defaultEnabled,\n\t\timplementation: preset.implementation,\n\t\tnotes: [...preset.notes],\n\t\tpolicy: cloneRuntimePolicy(preset.policy),\n\t\treadiness: preset.readiness,\n\t\tsecrets: preset.secrets\n\t\t\t? {\n\t\t\t\t\theaders: preset.secrets.headers ? { ...preset.secrets.headers } : undefined,\n\t\t\t\t\toptional: preset.secrets.optional ? [...preset.secrets.optional] : undefined,\n\t\t\t\t\trequired: preset.secrets.required ? [...preset.secrets.required] : undefined,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tservers: preset.servers ? [...preset.servers] : undefined,\n\t\tsourceUrls: [...preset.sourceUrls],\n\t\ttools: {\n\t\t\tallow: [...preset.tools.allow],\n\t\t\tconditionalAllow: preset.tools.conditionalAllow ? [...preset.tools.conditionalAllow] : undefined,\n\t\t\tdeny: preset.tools.deny ? [...preset.tools.deny] : undefined,\n\t\t\tdenyByDefault: preset.tools.denyByDefault,\n\t\t\tdenyMutations: preset.tools.denyMutations,\n\t\t\tdisabledByDefault: preset.tools.disabledByDefault ? [...preset.tools.disabledByDefault] : undefined,\n\t\t\tgated: preset.tools.gated ? [...preset.tools.gated] : undefined,\n\t\t\trequirePostconditions: preset.tools.requirePostconditions\n\t\t\t\t? [...preset.tools.requirePostconditions]\n\t\t\t\t: undefined,\n\t\t},\n\t\ttransport: preset.transport ? cloneTransport(preset.transport) : undefined,\n\t};\n}\n\nfunction cloneTransport(transport: PublicMcpTransport): PublicMcpTransport {\n\tif (transport.type === \"stdio\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: [...transport.args],\n\t\t};\n\t}\n\n\tif (transport.type === \"local-package\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: transport.args ? [...transport.args] : undefined,\n\t\t};\n\t}\n\n\tif (transport.type === \"embedded-python-or-sidecar\") {\n\t\treturn { ...transport };\n\t}\n\n\treturn { ...transport };\n}\n\nfunction cloneRuntimePolicy(policy: PublicMcpRuntimePolicy): PublicMcpRuntimePolicy {\n\treturn {\n\t\t...policy,\n\t\tallowedUriSchemes: policy.allowedUriSchemes ? [...policy.allowedUriSchemes] : undefined,\n\t\trejectIfCoverageBelow: policy.rejectIfCoverageBelow ? { ...policy.rejectIfCoverageBelow } : undefined,\n\t};\n}\n\nfunction isToolAllowed(policy: PublicMcpToolPolicy, toolName: string): boolean {\n\tif (policy.deny?.includes(toolName)) {\n\t\treturn false;\n\t}\n\n\tif (policy.allow.includes(\"*\")) {\n\t\treturn true;\n\t}\n\n\treturn policy.allow.includes(toolName);\n}\n\nfunction shouldDenyMutationLikeTool(preset: PublicMcpPreset, toolName: string): boolean {\n\tif (!preset.tools.allow.includes(\"*\")) {\n\t\treturn false;\n\t}\n\n\tif (!preset.tools.denyMutations && !preset.policy.readOnly && !preset.policy.mutationsRequirePostconditions) {\n\t\treturn false;\n\t}\n\n\treturn isMutationLikeToolName(toolName);\n}\n\nfunction isMutationLikeToolName(toolName: string): boolean {\n\treturn /(?:^|[_-])(add|approve|archive|cancel|close|create|delete|dismiss|merge|post|push|remove|send|submit|update|upload|write)(?:$|[_-])/.test(\n\t\ttoolName.toLowerCase(),\n\t);\n}\n\nfunction canonicalStringify(value: PublicMcpHashable): string {\n\tif (value === null || typeof value === \"boolean\" || typeof value === \"number\" || typeof value === \"string\") {\n\t\treturn JSON.stringify(value);\n\t}\n\n\tif (Array.isArray(value)) {\n\t\treturn `[${value.map((item) => canonicalStringify(item)).join(\",\")}]`;\n\t}\n\n\tconst record = value as { readonly [key: string]: PublicMcpHashable };\n\tconst keys = Object.keys(record).sort();\n\treturn `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(\",\")}}`;\n}\n"]}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { detectMcpDescriptorPromptInjection, MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD, } from "./mcp-descriptor-injection.js";
|
|
3
|
+
export { detectMcpDescriptorPromptInjection, MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD, } from "./mcp-descriptor-injection.js";
|
|
2
4
|
export const PUBLIC_MCP_PRESETS = {
|
|
3
5
|
context7: {
|
|
4
6
|
id: "context7",
|
|
@@ -531,7 +533,7 @@ export function admitPublicMcpServer(preset, observed, approved) {
|
|
|
531
533
|
if (shouldDenyMutationLikeTool(preset, tool.name)) {
|
|
532
534
|
reasons.push(`mutation_tool_denied:${tool.name}`);
|
|
533
535
|
}
|
|
534
|
-
if (detectMcpDescriptorPromptInjection(tool.description).
|
|
536
|
+
if (detectMcpDescriptorPromptInjection(tool.description).patternSignal > MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD) {
|
|
535
537
|
reasons.push(`descriptor_prompt_injection:${tool.name}`);
|
|
536
538
|
}
|
|
537
539
|
}
|
|
@@ -540,20 +542,6 @@ export function admitPublicMcpServer(preset, observed, approved) {
|
|
|
540
542
|
reasons,
|
|
541
543
|
};
|
|
542
544
|
}
|
|
543
|
-
export function detectMcpDescriptorPromptInjection(description) {
|
|
544
|
-
const normalized = description.toLowerCase();
|
|
545
|
-
const suspiciousPatterns = [
|
|
546
|
-
/ignore\s+(?:all\s+)?previous\s+instructions/,
|
|
547
|
-
/disregard\s+(?:all\s+)?previous\s+instructions/,
|
|
548
|
-
/exfiltrat/,
|
|
549
|
-
/reveal\s+(?:the\s+)?(?:system\s+)?prompt/,
|
|
550
|
-
/send\s+(?:me\s+)?(?:all\s+)?secrets/,
|
|
551
|
-
];
|
|
552
|
-
const hits = suspiciousPatterns.filter((pattern) => pattern.test(normalized)).length;
|
|
553
|
-
return {
|
|
554
|
-
score: hits === 0 ? 0 : Math.min(1, 0.6 + hits * 0.25),
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
545
|
function clonePublicMcpPreset(preset) {
|
|
558
546
|
return {
|
|
559
547
|
...preset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-public-presets.js","sourceRoot":"","sources":["../../src/core/mcp-public-presets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAwLzC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,QAAQ,EAAE;QACT,EAAE,EAAE,UAAU;QACd,GAAG,EAAE,UAAU;QACf,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,CAAC,2EAA2E,CAAC;QACpF,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,CAAC,qCAAqC,CAAC;QACnD,SAAS,EAAE;YACV,IAAI,EAAE,MAAM;YACZ,GAAG,EAAE,8BAA8B;SACnC;QACD,OAAO,EAAE;YACR,QAAQ,EAAE,CAAC,kBAAkB,CAAC;YAC9B,OAAO,EAAE;gBACR,gBAAgB,EAAE,qBAAqB;aACvC;SACD;QACD,KAAK,EAAE;YACN,KAAK,EAAE,CAAC,oBAAoB,EAAE,YAAY,CAAC;YAC3C,aAAa,EAAE,IAAI;SACnB;QACD,MAAM,EAAE;YACP,SAAS,EAAE,IAAI;YACf,eAAe,EAAE,IAAI;YACrB,WAAW,EAAE,IAAI;YACjB,WAAW,EAAE,eAAe;YAC5B,QAAQ,EAAE,IAAI;SACd;KACD;IACD,GAAG,EAAE;QACJ,EAAE,EAAE,KAAK;QACT,GAAG,EAAE,KAAK;QACV,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,CAAC,8EAA8E,CAAC;QACvF,IAAI,EAA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AG,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAAA,CACvG","sourcesContent":["import { createHash } from \"node:crypto\";\n\nexport type PublicMcpPresetKey =\n\t| \"context7\"\n\t| \"exa\"\n\t| \"githubReadOnly\"\n\t| \"astGrep\"\n\t| \"repomixCodeCompact\"\n\t| \"omkLlmlinguaCompress\"\n\t| \"doclingUnderstand\"\n\t| \"markitdownLite\"\n\t| \"firecrawlWebUnderstand\"\n\t| \"deepwikiRepoUnderstandCandidate\"\n\t| \"insaneSearchCandidate\"\n\t| \"playwrightSandboxed\"\n\t| \"microsoftLearn\"\n\t| \"officialReferenceSafePack\";\n\nexport type PublicMcpRisk = \"R1\" | \"R2\" | \"R3\";\nexport type PublicMcpLicense = \"Apache-2.0\" | \"Apache-2.0/MIT/CC-BY-4.0\" | \"MIT\" | \"Unspecified\";\nexport type PublicMcpImplementation = \"candidate-wrapper\" | \"omk-owned\" | \"upstream-mcp\";\nexport type PublicMcpReadiness = \"candidate\" | \"stable\";\nexport type PublicMcpUriScheme = \"data\" | \"file\" | \"http\" | \"https\";\nexport type PublicMcpTransport =\n\t| {\n\t\t\treadonly type: \"http\";\n\t\t\treadonly url: string;\n\t }\n\t| {\n\t\t\treadonly type: \"embedded-python-or-sidecar\";\n\t\t\treadonly package: string;\n\t }\n\t| {\n\t\t\treadonly type: \"local-package\";\n\t\t\treadonly package: string;\n\t\t\treadonly args?: readonly string[];\n\t }\n\t| {\n\t\t\treadonly type: \"stdio\";\n\t\t\treadonly command: string;\n\t\t\treadonly args: readonly string[];\n\t };\n\nexport interface PublicMcpAuthPolicy {\n\treadonly kind: \"bearer\" | \"header\" | \"none\";\n\treadonly header?: string;\n\treadonly secretRef?: string;\n}\n\nexport interface PublicMcpSecretPolicy {\n\treadonly required?: readonly string[];\n\treadonly optional?: readonly string[];\n\treadonly headers?: Readonly<Record<string, string>>;\n}\n\nexport interface PublicMcpToolPolicy {\n\treadonly allow: readonly string[];\n\treadonly conditionalAllow?: readonly string[];\n\treadonly deny?: readonly string[];\n\treadonly denyByDefault: boolean;\n\treadonly denyMutations?: boolean;\n\treadonly disabledByDefault?: readonly string[];\n\treadonly gated?: readonly string[];\n\treadonly requirePostconditions?: readonly string[];\n}\n\nexport interface PublicMcpRuntimePolicy {\n\treadonly absolutePathMustBeUnderWorkspace?: boolean;\n\treadonly allowedUriSchemes?: readonly PublicMcpUriScheme[];\n\treadonly authenticationBoundaryRequired?: boolean;\n\treadonly blockMetadataIp?: boolean;\n\treadonly blockHttpByDefault?: boolean;\n\treadonly blockNetworkUrlsByDefault?: boolean;\n\treadonly blockPrivateNetwork?: boolean;\n\treadonly blockRemoteRepositoryByDefault?: boolean;\n\treadonly cacheDocuments?: boolean;\n\treadonly cacheable?: boolean;\n\treadonly cacheMaterializedOutputs?: boolean;\n\treadonly defaultCompressionRatio?: number;\n\treadonly descriptorHashPinned?: boolean;\n\treadonly distillBeforeMainContext?: boolean;\n\treadonly disableAutoInstall?: boolean;\n\treadonly domainAllowlistOptional?: boolean;\n\treadonly denyYoutubeByDefault?: boolean;\n\treadonly denyZipByDefault?: boolean;\n\treadonly evidenceLedger?: boolean;\n\treadonly filesystemRoot?: string;\n\treadonly fileRoot?: string;\n\treadonly forkContext?: boolean;\n\treadonly ledger?: boolean;\n\treadonly localFilesUnderWorkspaceOnly?: boolean;\n\treadonly localOnly?: boolean;\n\treadonly maxBrowserActions?: number;\n\treadonly maxCompressionRatio?: number;\n\treadonly maxInputBytes?: number;\n\treadonly maxInputTokens?: number;\n\treadonly maxOutputTokens?: number;\n\treadonly maxResults?: number;\n\treadonly maxUrlsPerTask?: number;\n\treadonly markdownFullPageRequiresExplicitNeed?: boolean;\n\treadonly mutationsRequireHumanGate?: boolean;\n\treadonly mutationsRequirePostconditions?: boolean;\n\treadonly noFilesystemReadExceptModelCache?: boolean;\n\treadonly noNetwork?: boolean;\n\treadonly noSecrets?: boolean;\n\treadonly noShell?: boolean;\n\treadonly outputGuard?: boolean;\n\treadonly preferGrepBeforeFullRead?: boolean;\n\treadonly preferIncrementalRead?: boolean;\n\treadonly preferJsonExtraction?: boolean;\n\treadonly privateRepoDeniedByDefault?: boolean;\n\treadonly promptTaint?: \"external-docs\" | \"external-web\" | \"browser\";\n\treadonly publicContentOnly?: boolean;\n\treadonly publicReposOnly?: boolean;\n\treadonly readOnly?: boolean;\n\treadonly recordEvidence?: boolean;\n\treadonly rejectIfCoverageBelow?: {\n\t\treadonly hard: number;\n\t\treadonly high: number;\n\t\treadonly low: number;\n\t\treadonly medium: number;\n\t};\n\treadonly requireCoverageVerification?: boolean;\n\treadonly requireOriginAllowlistForScrape?: boolean;\n\treadonly requiresExplicitPostconditions?: boolean;\n\treadonly requiresOriginAllowlist?: boolean;\n\treadonly requiresSandbox?: boolean;\n\treadonly secretBrokerOnly?: boolean;\n\treadonly secretScanRequired?: boolean;\n\treadonly ssrfGuard?: boolean;\n\treadonly workspaceReadOnly?: boolean;\n}\n\nexport interface PublicMcpPreset {\n\treadonly defaultEnabled?: boolean;\n\treadonly id: string;\n\treadonly key: PublicMcpPresetKey;\n\treadonly license: PublicMcpLicense;\n\treadonly notes: readonly string[];\n\treadonly policy: PublicMcpRuntimePolicy;\n\treadonly implementation?: PublicMcpImplementation;\n\treadonly readiness?: PublicMcpReadiness;\n\treadonly risk: PublicMcpRisk;\n\treadonly sourceUrls: readonly string[];\n\treadonly tools: PublicMcpToolPolicy;\n\treadonly auth?: PublicMcpAuthPolicy;\n\treadonly secrets?: PublicMcpSecretPolicy;\n\treadonly servers?: readonly string[];\n\treadonly transport?: PublicMcpTransport;\n}\n\nexport interface PublicMcpObservedTool {\n\treadonly name: string;\n\treadonly descriptorHash: string;\n\treadonly description: string;\n}\n\nexport interface PublicMcpObservedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: readonly PublicMcpObservedTool[];\n}\n\nexport interface PublicMcpApprovedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: Readonly<Record<string, string>>;\n}\n\nexport type PublicMcpAdmissionStatus = \"allow\" | \"quarantine\";\n\nexport interface PublicMcpAdmissionDecision {\n\treadonly status: PublicMcpAdmissionStatus;\n\treadonly reasons: readonly string[];\n}\n\nexport type PublicMcpHashable =\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| readonly PublicMcpHashable[]\n\t| {\n\t\t\treadonly [key: string]: PublicMcpHashable;\n\t };\n\nexport const PUBLIC_MCP_PRESETS = {\n\tcontext7: {\n\t\tid: \"context7\",\n\t\tkey: \"context7\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Documentation retrieval preset; optional API key only raises rate limits.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/upstash/context7\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.context7.com/mcp\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"CONTEXT7_API_KEY\"],\n\t\t\theaders: {\n\t\t\t\tCONTEXT7_API_KEY: \"secret-ref:context7\",\n\t\t\t},\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"resolve-library-id\", \"query-docs\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\texa: {\n\t\tid: \"exa\",\n\t\tkey: \"exa\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Run searches in forked context and return distilled output to the main task.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/exa-labs/exa-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.exa.ai/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"header\",\n\t\t\theader: \"Authorization\",\n\t\t\tsecretRef: \"secret-ref:exa_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"EXA_API_KEY\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"web_search_exa\", \"web_fetch_exa\"],\n\t\t\tconditionalAllow: [\"web_search_advanced_exa\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tdomainAllowlistOptional: true,\n\t\t\tforkContext: true,\n\t\t\tmaxOutputTokens: 5000,\n\t\t\tmaxResults: 10,\n\t\t\tssrfGuard: true,\n\t\t},\n\t},\n\tgithubReadOnly: {\n\t\tid: \"github-readonly\",\n\t\tkey: \"githubReadOnly\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Read-only GitHub MCP profile; mutation tools remain gated for future explicit workflows.\"],\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/github/github-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://api.githubcopilot.com/mcp/\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:github_pat\",\n\t\t},\n\t\tsecrets: {\n\t\t\trequired: [\"GITHUB_PERSONAL_ACCESS_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"actions_list\",\n\t\t\t\t\"get_file_contents\",\n\t\t\t\t\"issue_read\",\n\t\t\t\t\"list_issues\",\n\t\t\t\t\"list_pull_requests\",\n\t\t\t\t\"pull_request_read\",\n\t\t\t\t\"search_code\",\n\t\t\t\t\"search_issues\",\n\t\t\t\t\"search_pull_requests\",\n\t\t\t\t\"search_repositories\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t\trequirePostconditions: [\n\t\t\t\t\"add_comment_to_pending_review\",\n\t\t\t\t\"create_branch\",\n\t\t\t\t\"create_or_update_file\",\n\t\t\t\t\"create_pull_request\",\n\t\t\t\t\"delete_file\",\n\t\t\t\t\"issue_write\",\n\t\t\t\t\"merge_pull_request\",\n\t\t\t\t\"pull_request_review_write\",\n\t\t\t\t\"push_files\",\n\t\t\t\t\"update_pull_request\",\n\t\t\t\t\"update_pull_request_branch\",\n\t\t\t],\n\t\t},\n\t\tpolicy: {\n\t\t\tledger: true,\n\t\t\tmaxOutputTokens: 8000,\n\t\t\tmutationsRequireHumanGate: true,\n\t\t\treadOnly: true,\n\t\t\tsecretBrokerOnly: true,\n\t\t},\n\t},\n\tastGrep: {\n\t\tid: \"ast-grep\",\n\t\tkey: \"astGrep\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Experimental upstream; pin descriptor and wrap execution before broad enablement.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/ast-grep/ast-grep-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from\", \"git+https://github.com/ast-grep/ast-grep-mcp\", \"ast-grep-server\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"dump_syntax_tree\", \"find_code\", \"find_code_by_rule\", \"test_match_code_rule\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tmaxResults: 200,\n\t\t\tnoShell: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\trepomixCodeCompact: {\n\t\tdefaultEnabled: true,\n\t\tid: \"repomix-code-compact\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"repomixCodeCompact\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Codebase packing and compression preset; remote repository packing is disabled until a task explicitly opts in.\",\n\t\t\t\"Use grep/read against packed output before full-context attachment.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/yamadashy/repomix\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"npx\",\n\t\t\targs: [\"-y\", \"repomix\", \"--mcp\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"attach_packed_output\",\n\t\t\t\t\"file_system_read_directory\",\n\t\t\t\t\"grep_repomix_output\",\n\t\t\t\t\"pack_codebase\",\n\t\t\t\t\"read_repomix_output\",\n\t\t\t],\n\t\t\tdisabledByDefault: [\"pack_remote_repository\"],\n\t\t\tgated: [\"file_system_read_file\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tabsolutePathMustBeUnderWorkspace: true,\n\t\t\tblockRemoteRepositoryByDefault: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tmaxOutputTokens: 120_000,\n\t\t\toutputGuard: true,\n\t\t\tpreferGrepBeforeFullRead: true,\n\t\t\tpreferIncrementalRead: true,\n\t\t\tsecretScanRequired: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\tomkLlmlinguaCompress: {\n\t\tdefaultEnabled: true,\n\t\tid: \"omk-llmlingua-compress\",\n\t\timplementation: \"omk-owned\",\n\t\tkey: \"omkLlmlinguaCompress\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"First-party wrapper target for LLMLingua-style prompt and context compression.\",\n\t\t\t\"System prompts, latest user turns, and tool schemas must stay outside lossy compression.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/LLMLingua\", \"https://arxiv.org/abs/2403.12968\"],\n\t\ttransport: {\n\t\t\ttype: \"embedded-python-or-sidecar\",\n\t\t\tpackage: \"llmlingua\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"compress_context_items\",\n\t\t\t\t\"compress_messages\",\n\t\t\t\t\"compress_prompt\",\n\t\t\t\t\"compress_representation_candidate\",\n\t\t\t\t\"verify_compression_coverage\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheMaterializedOutputs: true,\n\t\t\tdefaultCompressionRatio: 3,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalOnly: true,\n\t\t\tmaxCompressionRatio: 8,\n\t\t\tmaxInputTokens: 200_000,\n\t\t\tnoFilesystemReadExceptModelCache: true,\n\t\t\tnoNetwork: true,\n\t\t\toutputGuard: true,\n\t\t\trejectIfCoverageBelow: {\n\t\t\t\thard: 0.95,\n\t\t\t\thigh: 0.8,\n\t\t\t\tmedium: 0.55,\n\t\t\t\tlow: 0.3,\n\t\t\t},\n\t\t\trequireCoverageVerification: true,\n\t\t},\n\t},\n\tdoclingUnderstand: {\n\t\tdefaultEnabled: true,\n\t\tid: \"docling-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"doclingUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Structured document understanding preset for PDFs, Office files, tables, OCR, and layout-sensitive conversions.\",\n\t\t\t\"Parser attack surface requires sandboxing and workspace-only local file access.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/docling-project/docling\", \"https://github.com/docling-project/docling-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from=docling-mcp\", \"docling-mcp-server\", \"--transport\", \"stdio\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_document\", \"export_docling_document_to_json\", \"export_docling_document_to_markdown\"],\n\t\t\tgated: [\"create_new_docling_document\", \"save_docling_document\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockNetworkUrlsByDefault: true,\n\t\t\tcacheDocuments: true,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalFilesUnderWorkspaceOnly: true,\n\t\t\tmaxInputBytes: 80_000_000,\n\t\t\tmaxOutputTokens: 80_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmarkitdownLite: {\n\t\tdefaultEnabled: true,\n\t\tid: \"markitdown-lite\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"markitdownLite\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Lightweight Markdown conversion fallback for local files and data URIs.\",\n\t\t\t\"HTTP, ZIP, and YouTube inputs stay blocked until a task explicitly needs them.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\n\t\t\t\"https://github.com/microsoft/markitdown\",\n\t\t\t\"https://github.com/microsoft/markitdown/tree/main/packages/markitdown-mcp\",\n\t\t],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"markitdown-mcp\",\n\t\t\targs: [],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_to_markdown\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tallowedUriSchemes: [\"file\", \"data\"],\n\t\t\tblockHttpByDefault: true,\n\t\t\tdenyYoutubeByDefault: true,\n\t\t\tdenyZipByDefault: true,\n\t\t\tevidenceLedger: true,\n\t\t\tfileRoot: \"workspaceRoot\",\n\t\t\tmaxInputBytes: 30_000_000,\n\t\t\tmaxOutputTokens: 50_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tfirecrawlWebUnderstand: {\n\t\tdefaultEnabled: false,\n\t\tid: \"firecrawl-web-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"firecrawlWebUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Opt-in live web understanding preset; search and scrape are the only default-admissible tools.\",\n\t\t\t\"Prefer JSON extraction over full-page Markdown to protect the context budget.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/firecrawl/firecrawl-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.firecrawl.dev/v2/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:firecrawl_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"FIRECRAWL_API_KEY\", \"FIRECRAWL_OAUTH_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"firecrawl_scrape\", \"firecrawl_search\"],\n\t\t\tdisabledByDefault: [\"firecrawl_agent\", \"firecrawl_crawl\", \"firecrawl_interact\", \"firecrawl_monitor\"],\n\t\t\tgated: [\"firecrawl_extract\", \"firecrawl_map\", \"firecrawl_research\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmarkdownFullPageRequiresExplicitNeed: true,\n\t\t\tmaxOutputTokens: 40_000,\n\t\t\tmaxUrlsPerTask: 10,\n\t\t\toutputGuard: true,\n\t\t\tpreferJsonExtraction: true,\n\t\t\trequireOriginAllowlistForScrape: true,\n\t\t},\n\t},\n\tdeepwikiRepoUnderstandCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"deepwiki-repo-understand\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"deepwikiRepoUnderstandCandidate\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\n\t\t\t\"Candidate only until an official MCP endpoint, tool schema, auth model, and retention boundary are verified.\",\n\t\t\t\"Remote repository indexing is public-repo-only by default.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://deepwiki.com/\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tnoSecrets: true,\n\t\t\toutputGuard: true,\n\t\t\tprivateRepoDeniedByDefault: true,\n\t\t\tpublicReposOnly: true,\n\t\t},\n\t},\n\tinsaneSearchCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"insane-search-public-reader\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"insaneSearchCandidate\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Candidate only: upstream is a Claude Code plugin, not a verified standalone MCP transport.\",\n\t\t\t\"Any OMK integration must be a sandboxed first-party wrapper around public-content reads, with auto-install disabled.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/fivetaku/insane-search\"],\n\t\ttools: {\n\t\t\tallow: [\"insane_search_public_read\"],\n\t\t\tdisabledByDefault: [\"insane_search_auto_install_dependencies\"],\n\t\t\tgated: [\"insane_search_browser_escalation\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tauthenticationBoundaryRequired: true,\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdisableAutoInstall: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmaxBrowserActions: 20,\n\t\t\tmaxOutputTokens: 30_000,\n\t\t\toutputGuard: true,\n\t\t\tpublicContentOnly: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tplaywrightSandboxed: {\n\t\tid: \"playwright-sandboxed\",\n\t\tkey: \"playwrightSandboxed\",\n\t\tlicense: \"Apache-2.0\",\n\t\tnotes: [\"Browser automation preset; enable only with sandbox and origin controls.\"],\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/microsoft/playwright-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"local-package\",\n\t\t\tpackage: \"@playwright/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"browser_close\",\n\t\t\t\t\"browser_click\",\n\t\t\t\t\"browser_navigate\",\n\t\t\t\t\"browser_snapshot\",\n\t\t\t\t\"browser_type\",\n\t\t\t\t\"browser_wait_for\",\n\t\t\t],\n\t\t\tdeny: [\"browser_console_messages\", \"browser_file_upload\", \"browser_pdf_save\", \"browser_press_key\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tledger: true,\n\t\t\tmaxBrowserActions: 40,\n\t\t\trecordEvidence: true,\n\t\t\trequiresExplicitPostconditions: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmicrosoftLearn: {\n\t\tid: \"microsoft-learn\",\n\t\tkey: \"microsoftLearn\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\"Microsoft official remote documentation endpoint from the Microsoft MCP catalog.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://learn.microsoft.com/api/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"*\"],\n\t\t\tdenyByDefault: true,\n\t\t\tdenyMutations: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\tofficialReferenceSafePack: {\n\t\tid: \"official-reference-safe-pack\",\n\t\tkey: \"officialReferenceSafePack\",\n\t\tlicense: \"Apache-2.0/MIT/CC-BY-4.0\",\n\t\tnotes: [\"Reference implementations only; wrap before production use.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/modelcontextprotocol/servers\"],\n\t\tservers: [\"time\", \"memory\", \"sequential-thinking\", \"git-readonly\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tfilesystemRoot: \"workspaceRoot\",\n\t\t\tmutationsRequirePostconditions: true,\n\t\t},\n\t},\n} as const satisfies Record<PublicMcpPresetKey, PublicMcpPreset>;\n\nexport const OMK_PUBLIC_CONTEXT_MCP_BUNDLE = {\n\tstableDefaults: [\"repomix-code-compact\", \"docling-understand\", \"markitdown-lite\", \"omk-llmlingua-compress\"],\n\toptInResearchWeb: [\"firecrawl-web-understand\"],\n\tcandidatesNeedVerification: [\"deepwiki-repo-understand\", \"insane-search-public-reader\"],\n\tinternalRouters: [\"mcp-tool-rag-router\"],\n} as const;\n\nexport function listPublicMcpPresets(): PublicMcpPreset[] {\n\treturn Object.values(PUBLIC_MCP_PRESETS).map((preset) => clonePublicMcpPreset(preset));\n}\n\nexport function canonicalMcpPolicyHash(value: PublicMcpHashable): string {\n\treturn createHash(\"sha256\").update(canonicalStringify(value)).digest(\"hex\");\n}\n\nexport function canonicalPublicMcpServerIdentity(preset: PublicMcpPreset): string {\n\treturn canonicalMcpPolicyHash({\n\t\tid: preset.id,\n\t\tservers: preset.servers ?? null,\n\t\ttransport: preset.transport ?? null,\n\t});\n}\n\nexport function admitPublicMcpServer(\n\tpreset: PublicMcpPreset,\n\tobserved: PublicMcpObservedServer,\n\tapproved: PublicMcpApprovedServer | undefined,\n): PublicMcpAdmissionDecision {\n\tif (!approved) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_not_approved\"],\n\t\t};\n\t}\n\n\tif (approved.serverIdentity !== observed.serverIdentity) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_identity_changed\"],\n\t\t};\n\t}\n\n\tconst reasons: string[] = [];\n\n\tfor (const tool of observed.tools) {\n\t\tconst approvedDescriptorHash = approved.tools[tool.name];\n\n\t\tif (!approvedDescriptorHash) {\n\t\t\treasons.push(`new_tool:${tool.name}`);\n\t\t} else if (approvedDescriptorHash !== tool.descriptorHash) {\n\t\t\treasons.push(`descriptor_changed:${tool.name}`);\n\t\t}\n\n\t\tif (!isToolAllowed(preset.tools, tool.name)) {\n\t\t\treasons.push(`tool_not_allowed:${tool.name}`);\n\t\t}\n\n\t\tif (shouldDenyMutationLikeTool(preset, tool.name)) {\n\t\t\treasons.push(`mutation_tool_denied:${tool.name}`);\n\t\t}\n\n\t\tif (detectMcpDescriptorPromptInjection(tool.description).score > 0.7) {\n\t\t\treasons.push(`descriptor_prompt_injection:${tool.name}`);\n\t\t}\n\t}\n\n\treturn {\n\t\tstatus: reasons.length === 0 ? \"allow\" : \"quarantine\",\n\t\treasons,\n\t};\n}\n\nexport function detectMcpDescriptorPromptInjection(description: string): { readonly score: number } {\n\tconst normalized = description.toLowerCase();\n\tconst suspiciousPatterns = [\n\t\t/ignore\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/disregard\\s+(?:all\\s+)?previous\\s+instructions/,\n\t\t/exfiltrat/,\n\t\t/reveal\\s+(?:the\\s+)?(?:system\\s+)?prompt/,\n\t\t/send\\s+(?:me\\s+)?(?:all\\s+)?secrets/,\n\t];\n\tconst hits = suspiciousPatterns.filter((pattern) => pattern.test(normalized)).length;\n\n\treturn {\n\t\tscore: hits === 0 ? 0 : Math.min(1, 0.6 + hits * 0.25),\n\t};\n}\n\nfunction clonePublicMcpPreset(preset: PublicMcpPreset): PublicMcpPreset {\n\treturn {\n\t\t...preset,\n\t\tauth: preset.auth ? { ...preset.auth } : undefined,\n\t\tdefaultEnabled: preset.defaultEnabled,\n\t\timplementation: preset.implementation,\n\t\tnotes: [...preset.notes],\n\t\tpolicy: cloneRuntimePolicy(preset.policy),\n\t\treadiness: preset.readiness,\n\t\tsecrets: preset.secrets\n\t\t\t? {\n\t\t\t\t\theaders: preset.secrets.headers ? { ...preset.secrets.headers } : undefined,\n\t\t\t\t\toptional: preset.secrets.optional ? [...preset.secrets.optional] : undefined,\n\t\t\t\t\trequired: preset.secrets.required ? [...preset.secrets.required] : undefined,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tservers: preset.servers ? [...preset.servers] : undefined,\n\t\tsourceUrls: [...preset.sourceUrls],\n\t\ttools: {\n\t\t\tallow: [...preset.tools.allow],\n\t\t\tconditionalAllow: preset.tools.conditionalAllow ? [...preset.tools.conditionalAllow] : undefined,\n\t\t\tdeny: preset.tools.deny ? [...preset.tools.deny] : undefined,\n\t\t\tdenyByDefault: preset.tools.denyByDefault,\n\t\t\tdenyMutations: preset.tools.denyMutations,\n\t\t\tdisabledByDefault: preset.tools.disabledByDefault ? [...preset.tools.disabledByDefault] : undefined,\n\t\t\tgated: preset.tools.gated ? [...preset.tools.gated] : undefined,\n\t\t\trequirePostconditions: preset.tools.requirePostconditions\n\t\t\t\t? [...preset.tools.requirePostconditions]\n\t\t\t\t: undefined,\n\t\t},\n\t\ttransport: preset.transport ? cloneTransport(preset.transport) : undefined,\n\t};\n}\n\nfunction cloneTransport(transport: PublicMcpTransport): PublicMcpTransport {\n\tif (transport.type === \"stdio\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: [...transport.args],\n\t\t};\n\t}\n\n\tif (transport.type === \"local-package\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: transport.args ? [...transport.args] : undefined,\n\t\t};\n\t}\n\n\tif (transport.type === \"embedded-python-or-sidecar\") {\n\t\treturn { ...transport };\n\t}\n\n\treturn { ...transport };\n}\n\nfunction cloneRuntimePolicy(policy: PublicMcpRuntimePolicy): PublicMcpRuntimePolicy {\n\treturn {\n\t\t...policy,\n\t\tallowedUriSchemes: policy.allowedUriSchemes ? [...policy.allowedUriSchemes] : undefined,\n\t\trejectIfCoverageBelow: policy.rejectIfCoverageBelow ? { ...policy.rejectIfCoverageBelow } : undefined,\n\t};\n}\n\nfunction isToolAllowed(policy: PublicMcpToolPolicy, toolName: string): boolean {\n\tif (policy.deny?.includes(toolName)) {\n\t\treturn false;\n\t}\n\n\tif (policy.allow.includes(\"*\")) {\n\t\treturn true;\n\t}\n\n\treturn policy.allow.includes(toolName);\n}\n\nfunction shouldDenyMutationLikeTool(preset: PublicMcpPreset, toolName: string): boolean {\n\tif (!preset.tools.allow.includes(\"*\")) {\n\t\treturn false;\n\t}\n\n\tif (!preset.tools.denyMutations && !preset.policy.readOnly && !preset.policy.mutationsRequirePostconditions) {\n\t\treturn false;\n\t}\n\n\treturn isMutationLikeToolName(toolName);\n}\n\nfunction isMutationLikeToolName(toolName: string): boolean {\n\treturn /(?:^|[_-])(add|approve|archive|cancel|close|create|delete|dismiss|merge|post|push|remove|send|submit|update|upload|write)(?:$|[_-])/.test(\n\t\ttoolName.toLowerCase(),\n\t);\n}\n\nfunction canonicalStringify(value: PublicMcpHashable): string {\n\tif (value === null || typeof value === \"boolean\" || typeof value === \"number\" || typeof value === \"string\") {\n\t\treturn JSON.stringify(value);\n\t}\n\n\tif (Array.isArray(value)) {\n\t\treturn `[${value.map((item) => canonicalStringify(item)).join(\",\")}]`;\n\t}\n\n\tconst record = value as { readonly [key: string]: PublicMcpHashable };\n\tconst keys = Object.keys(record).sort();\n\treturn `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(\",\")}}`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mcp-public-presets.js","sourceRoot":"","sources":["../../src/core/mcp-public-presets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EACN,kCAAkC,EAClC,uCAAuC,GACvC,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACN,kCAAkC,EAClC,uCAAuC,GAEvC,MAAM,+BAA+B,CAAC;AAwLvC,MAAM,CAAC,MAAM,kBAAkB,GAAG;IACjC,QAAQ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AM,GAAG,KAAsD,CAAC;IACtE,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;IACxC,OAAO,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAAA,CACvG","sourcesContent":["import { createHash } from \"node:crypto\";\nimport {\n\tdetectMcpDescriptorPromptInjection,\n\tMCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD,\n} from \"./mcp-descriptor-injection.ts\";\n\nexport {\n\tdetectMcpDescriptorPromptInjection,\n\tMCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD,\n\ttype McpDescriptorPromptInjectionSignal,\n} from \"./mcp-descriptor-injection.ts\";\n\nexport type PublicMcpPresetKey =\n\t| \"context7\"\n\t| \"exa\"\n\t| \"githubReadOnly\"\n\t| \"astGrep\"\n\t| \"repomixCodeCompact\"\n\t| \"omkLlmlinguaCompress\"\n\t| \"doclingUnderstand\"\n\t| \"markitdownLite\"\n\t| \"firecrawlWebUnderstand\"\n\t| \"deepwikiRepoUnderstandCandidate\"\n\t| \"insaneSearchCandidate\"\n\t| \"playwrightSandboxed\"\n\t| \"microsoftLearn\"\n\t| \"officialReferenceSafePack\";\n\nexport type PublicMcpRisk = \"R1\" | \"R2\" | \"R3\";\nexport type PublicMcpLicense = \"Apache-2.0\" | \"Apache-2.0/MIT/CC-BY-4.0\" | \"MIT\" | \"Unspecified\";\nexport type PublicMcpImplementation = \"candidate-wrapper\" | \"omk-owned\" | \"upstream-mcp\";\nexport type PublicMcpReadiness = \"candidate\" | \"stable\";\nexport type PublicMcpUriScheme = \"data\" | \"file\" | \"http\" | \"https\";\nexport type PublicMcpTransport =\n\t| {\n\t\t\treadonly type: \"http\";\n\t\t\treadonly url: string;\n\t }\n\t| {\n\t\t\treadonly type: \"embedded-python-or-sidecar\";\n\t\t\treadonly package: string;\n\t }\n\t| {\n\t\t\treadonly type: \"local-package\";\n\t\t\treadonly package: string;\n\t\t\treadonly args?: readonly string[];\n\t }\n\t| {\n\t\t\treadonly type: \"stdio\";\n\t\t\treadonly command: string;\n\t\t\treadonly args: readonly string[];\n\t };\n\nexport interface PublicMcpAuthPolicy {\n\treadonly kind: \"bearer\" | \"header\" | \"none\";\n\treadonly header?: string;\n\treadonly secretRef?: string;\n}\n\nexport interface PublicMcpSecretPolicy {\n\treadonly required?: readonly string[];\n\treadonly optional?: readonly string[];\n\treadonly headers?: Readonly<Record<string, string>>;\n}\n\nexport interface PublicMcpToolPolicy {\n\treadonly allow: readonly string[];\n\treadonly conditionalAllow?: readonly string[];\n\treadonly deny?: readonly string[];\n\treadonly denyByDefault: boolean;\n\treadonly denyMutations?: boolean;\n\treadonly disabledByDefault?: readonly string[];\n\treadonly gated?: readonly string[];\n\treadonly requirePostconditions?: readonly string[];\n}\n\nexport interface PublicMcpRuntimePolicy {\n\treadonly absolutePathMustBeUnderWorkspace?: boolean;\n\treadonly allowedUriSchemes?: readonly PublicMcpUriScheme[];\n\treadonly authenticationBoundaryRequired?: boolean;\n\treadonly blockMetadataIp?: boolean;\n\treadonly blockHttpByDefault?: boolean;\n\treadonly blockNetworkUrlsByDefault?: boolean;\n\treadonly blockPrivateNetwork?: boolean;\n\treadonly blockRemoteRepositoryByDefault?: boolean;\n\treadonly cacheDocuments?: boolean;\n\treadonly cacheable?: boolean;\n\treadonly cacheMaterializedOutputs?: boolean;\n\treadonly defaultCompressionRatio?: number;\n\treadonly descriptorHashPinned?: boolean;\n\treadonly distillBeforeMainContext?: boolean;\n\treadonly disableAutoInstall?: boolean;\n\treadonly domainAllowlistOptional?: boolean;\n\treadonly denyYoutubeByDefault?: boolean;\n\treadonly denyZipByDefault?: boolean;\n\treadonly evidenceLedger?: boolean;\n\treadonly filesystemRoot?: string;\n\treadonly fileRoot?: string;\n\treadonly forkContext?: boolean;\n\treadonly ledger?: boolean;\n\treadonly localFilesUnderWorkspaceOnly?: boolean;\n\treadonly localOnly?: boolean;\n\treadonly maxBrowserActions?: number;\n\treadonly maxCompressionRatio?: number;\n\treadonly maxInputBytes?: number;\n\treadonly maxInputTokens?: number;\n\treadonly maxOutputTokens?: number;\n\treadonly maxResults?: number;\n\treadonly maxUrlsPerTask?: number;\n\treadonly markdownFullPageRequiresExplicitNeed?: boolean;\n\treadonly mutationsRequireHumanGate?: boolean;\n\treadonly mutationsRequirePostconditions?: boolean;\n\treadonly noFilesystemReadExceptModelCache?: boolean;\n\treadonly noNetwork?: boolean;\n\treadonly noSecrets?: boolean;\n\treadonly noShell?: boolean;\n\treadonly outputGuard?: boolean;\n\treadonly preferGrepBeforeFullRead?: boolean;\n\treadonly preferIncrementalRead?: boolean;\n\treadonly preferJsonExtraction?: boolean;\n\treadonly privateRepoDeniedByDefault?: boolean;\n\treadonly promptTaint?: \"external-docs\" | \"external-web\" | \"browser\";\n\treadonly publicContentOnly?: boolean;\n\treadonly publicReposOnly?: boolean;\n\treadonly readOnly?: boolean;\n\treadonly recordEvidence?: boolean;\n\treadonly rejectIfCoverageBelow?: {\n\t\treadonly hard: number;\n\t\treadonly high: number;\n\t\treadonly low: number;\n\t\treadonly medium: number;\n\t};\n\treadonly requireCoverageVerification?: boolean;\n\treadonly requireOriginAllowlistForScrape?: boolean;\n\treadonly requiresExplicitPostconditions?: boolean;\n\treadonly requiresOriginAllowlist?: boolean;\n\treadonly requiresSandbox?: boolean;\n\treadonly secretBrokerOnly?: boolean;\n\treadonly secretScanRequired?: boolean;\n\treadonly ssrfGuard?: boolean;\n\treadonly workspaceReadOnly?: boolean;\n}\n\nexport interface PublicMcpPreset {\n\treadonly defaultEnabled?: boolean;\n\treadonly id: string;\n\treadonly key: PublicMcpPresetKey;\n\treadonly license: PublicMcpLicense;\n\treadonly notes: readonly string[];\n\treadonly policy: PublicMcpRuntimePolicy;\n\treadonly implementation?: PublicMcpImplementation;\n\treadonly readiness?: PublicMcpReadiness;\n\treadonly risk: PublicMcpRisk;\n\treadonly sourceUrls: readonly string[];\n\treadonly tools: PublicMcpToolPolicy;\n\treadonly auth?: PublicMcpAuthPolicy;\n\treadonly secrets?: PublicMcpSecretPolicy;\n\treadonly servers?: readonly string[];\n\treadonly transport?: PublicMcpTransport;\n}\n\nexport interface PublicMcpObservedTool {\n\treadonly name: string;\n\treadonly descriptorHash: string;\n\treadonly description: string;\n}\n\nexport interface PublicMcpObservedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: readonly PublicMcpObservedTool[];\n}\n\nexport interface PublicMcpApprovedServer {\n\treadonly serverIdentity: string;\n\treadonly tools: Readonly<Record<string, string>>;\n}\n\nexport type PublicMcpAdmissionStatus = \"allow\" | \"quarantine\";\n\nexport interface PublicMcpAdmissionDecision {\n\treadonly status: PublicMcpAdmissionStatus;\n\treadonly reasons: readonly string[];\n}\n\nexport type PublicMcpHashable =\n\t| null\n\t| boolean\n\t| number\n\t| string\n\t| readonly PublicMcpHashable[]\n\t| {\n\t\t\treadonly [key: string]: PublicMcpHashable;\n\t };\n\nexport const PUBLIC_MCP_PRESETS = {\n\tcontext7: {\n\t\tid: \"context7\",\n\t\tkey: \"context7\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Documentation retrieval preset; optional API key only raises rate limits.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/upstash/context7\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.context7.com/mcp\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"CONTEXT7_API_KEY\"],\n\t\t\theaders: {\n\t\t\t\tCONTEXT7_API_KEY: \"secret-ref:context7\",\n\t\t\t},\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"resolve-library-id\", \"query-docs\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\texa: {\n\t\tid: \"exa\",\n\t\tkey: \"exa\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Run searches in forked context and return distilled output to the main task.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/exa-labs/exa-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.exa.ai/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"header\",\n\t\t\theader: \"Authorization\",\n\t\t\tsecretRef: \"secret-ref:exa_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"EXA_API_KEY\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"web_search_exa\", \"web_fetch_exa\"],\n\t\t\tconditionalAllow: [\"web_search_advanced_exa\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tdomainAllowlistOptional: true,\n\t\t\tforkContext: true,\n\t\t\tmaxOutputTokens: 5000,\n\t\t\tmaxResults: 10,\n\t\t\tssrfGuard: true,\n\t\t},\n\t},\n\tgithubReadOnly: {\n\t\tid: \"github-readonly\",\n\t\tkey: \"githubReadOnly\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Read-only GitHub MCP profile; mutation tools remain gated for future explicit workflows.\"],\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/github/github-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://api.githubcopilot.com/mcp/\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:github_pat\",\n\t\t},\n\t\tsecrets: {\n\t\t\trequired: [\"GITHUB_PERSONAL_ACCESS_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"actions_list\",\n\t\t\t\t\"get_file_contents\",\n\t\t\t\t\"issue_read\",\n\t\t\t\t\"list_issues\",\n\t\t\t\t\"list_pull_requests\",\n\t\t\t\t\"pull_request_read\",\n\t\t\t\t\"search_code\",\n\t\t\t\t\"search_issues\",\n\t\t\t\t\"search_pull_requests\",\n\t\t\t\t\"search_repositories\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t\trequirePostconditions: [\n\t\t\t\t\"add_comment_to_pending_review\",\n\t\t\t\t\"create_branch\",\n\t\t\t\t\"create_or_update_file\",\n\t\t\t\t\"create_pull_request\",\n\t\t\t\t\"delete_file\",\n\t\t\t\t\"issue_write\",\n\t\t\t\t\"merge_pull_request\",\n\t\t\t\t\"pull_request_review_write\",\n\t\t\t\t\"push_files\",\n\t\t\t\t\"update_pull_request\",\n\t\t\t\t\"update_pull_request_branch\",\n\t\t\t],\n\t\t},\n\t\tpolicy: {\n\t\t\tledger: true,\n\t\t\tmaxOutputTokens: 8000,\n\t\t\tmutationsRequireHumanGate: true,\n\t\t\treadOnly: true,\n\t\t\tsecretBrokerOnly: true,\n\t\t},\n\t},\n\tastGrep: {\n\t\tid: \"ast-grep\",\n\t\tkey: \"astGrep\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\"Experimental upstream; pin descriptor and wrap execution before broad enablement.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/ast-grep/ast-grep-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from\", \"git+https://github.com/ast-grep/ast-grep-mcp\", \"ast-grep-server\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"dump_syntax_tree\", \"find_code\", \"find_code_by_rule\", \"test_match_code_rule\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tmaxResults: 200,\n\t\t\tnoShell: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\trepomixCodeCompact: {\n\t\tdefaultEnabled: true,\n\t\tid: \"repomix-code-compact\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"repomixCodeCompact\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Codebase packing and compression preset; remote repository packing is disabled until a task explicitly opts in.\",\n\t\t\t\"Use grep/read against packed output before full-context attachment.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/yamadashy/repomix\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"npx\",\n\t\t\targs: [\"-y\", \"repomix\", \"--mcp\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"attach_packed_output\",\n\t\t\t\t\"file_system_read_directory\",\n\t\t\t\t\"grep_repomix_output\",\n\t\t\t\t\"pack_codebase\",\n\t\t\t\t\"read_repomix_output\",\n\t\t\t],\n\t\t\tdisabledByDefault: [\"pack_remote_repository\"],\n\t\t\tgated: [\"file_system_read_file\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tabsolutePathMustBeUnderWorkspace: true,\n\t\t\tblockRemoteRepositoryByDefault: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tmaxOutputTokens: 120_000,\n\t\t\toutputGuard: true,\n\t\t\tpreferGrepBeforeFullRead: true,\n\t\t\tpreferIncrementalRead: true,\n\t\t\tsecretScanRequired: true,\n\t\t\tworkspaceReadOnly: true,\n\t\t},\n\t},\n\tomkLlmlinguaCompress: {\n\t\tdefaultEnabled: true,\n\t\tid: \"omk-llmlingua-compress\",\n\t\timplementation: \"omk-owned\",\n\t\tkey: \"omkLlmlinguaCompress\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"First-party wrapper target for LLMLingua-style prompt and context compression.\",\n\t\t\t\"System prompts, latest user turns, and tool schemas must stay outside lossy compression.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/LLMLingua\", \"https://arxiv.org/abs/2403.12968\"],\n\t\ttransport: {\n\t\t\ttype: \"embedded-python-or-sidecar\",\n\t\t\tpackage: \"llmlingua\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"compress_context_items\",\n\t\t\t\t\"compress_messages\",\n\t\t\t\t\"compress_prompt\",\n\t\t\t\t\"compress_representation_candidate\",\n\t\t\t\t\"verify_compression_coverage\",\n\t\t\t],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheMaterializedOutputs: true,\n\t\t\tdefaultCompressionRatio: 3,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalOnly: true,\n\t\t\tmaxCompressionRatio: 8,\n\t\t\tmaxInputTokens: 200_000,\n\t\t\tnoFilesystemReadExceptModelCache: true,\n\t\t\tnoNetwork: true,\n\t\t\toutputGuard: true,\n\t\t\trejectIfCoverageBelow: {\n\t\t\t\thard: 0.95,\n\t\t\t\thigh: 0.8,\n\t\t\t\tmedium: 0.55,\n\t\t\t\tlow: 0.3,\n\t\t\t},\n\t\t\trequireCoverageVerification: true,\n\t\t},\n\t},\n\tdoclingUnderstand: {\n\t\tdefaultEnabled: true,\n\t\tid: \"docling-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"doclingUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Structured document understanding preset for PDFs, Office files, tables, OCR, and layout-sensitive conversions.\",\n\t\t\t\"Parser attack surface requires sandboxing and workspace-only local file access.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/docling-project/docling\", \"https://github.com/docling-project/docling-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"uvx\",\n\t\t\targs: [\"--from=docling-mcp\", \"docling-mcp-server\", \"--transport\", \"stdio\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_document\", \"export_docling_document_to_json\", \"export_docling_document_to_markdown\"],\n\t\t\tgated: [\"create_new_docling_document\", \"save_docling_document\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockNetworkUrlsByDefault: true,\n\t\t\tcacheDocuments: true,\n\t\t\tevidenceLedger: true,\n\t\t\tlocalFilesUnderWorkspaceOnly: true,\n\t\t\tmaxInputBytes: 80_000_000,\n\t\t\tmaxOutputTokens: 80_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmarkitdownLite: {\n\t\tdefaultEnabled: true,\n\t\tid: \"markitdown-lite\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"markitdownLite\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Lightweight Markdown conversion fallback for local files and data URIs.\",\n\t\t\t\"HTTP, ZIP, and YouTube inputs stay blocked until a task explicitly needs them.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\n\t\t\t\"https://github.com/microsoft/markitdown\",\n\t\t\t\"https://github.com/microsoft/markitdown/tree/main/packages/markitdown-mcp\",\n\t\t],\n\t\ttransport: {\n\t\t\ttype: \"stdio\",\n\t\t\tcommand: \"markitdown-mcp\",\n\t\t\targs: [],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"convert_to_markdown\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tallowedUriSchemes: [\"file\", \"data\"],\n\t\t\tblockHttpByDefault: true,\n\t\t\tdenyYoutubeByDefault: true,\n\t\t\tdenyZipByDefault: true,\n\t\t\tevidenceLedger: true,\n\t\t\tfileRoot: \"workspaceRoot\",\n\t\t\tmaxInputBytes: 30_000_000,\n\t\t\tmaxOutputTokens: 50_000,\n\t\t\toutputGuard: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tfirecrawlWebUnderstand: {\n\t\tdefaultEnabled: false,\n\t\tid: \"firecrawl-web-understand\",\n\t\timplementation: \"upstream-mcp\",\n\t\tkey: \"firecrawlWebUnderstand\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Opt-in live web understanding preset; search and scrape are the only default-admissible tools.\",\n\t\t\t\"Prefer JSON extraction over full-page Markdown to protect the context budget.\",\n\t\t],\n\t\treadiness: \"stable\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://github.com/firecrawl/firecrawl-mcp-server\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://mcp.firecrawl.dev/v2/mcp\",\n\t\t},\n\t\tauth: {\n\t\t\tkind: \"bearer\",\n\t\t\tsecretRef: \"secret-ref:firecrawl_api_key\",\n\t\t},\n\t\tsecrets: {\n\t\t\toptional: [\"FIRECRAWL_API_KEY\", \"FIRECRAWL_OAUTH_TOKEN\"],\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"firecrawl_scrape\", \"firecrawl_search\"],\n\t\t\tdisabledByDefault: [\"firecrawl_agent\", \"firecrawl_crawl\", \"firecrawl_interact\", \"firecrawl_monitor\"],\n\t\t\tgated: [\"firecrawl_extract\", \"firecrawl_map\", \"firecrawl_research\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmarkdownFullPageRequiresExplicitNeed: true,\n\t\t\tmaxOutputTokens: 40_000,\n\t\t\tmaxUrlsPerTask: 10,\n\t\t\toutputGuard: true,\n\t\t\tpreferJsonExtraction: true,\n\t\t\trequireOriginAllowlistForScrape: true,\n\t\t},\n\t},\n\tdeepwikiRepoUnderstandCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"deepwiki-repo-understand\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"deepwikiRepoUnderstandCandidate\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\n\t\t\t\"Candidate only until an official MCP endpoint, tool schema, auth model, and retention boundary are verified.\",\n\t\t\t\"Remote repository indexing is public-repo-only by default.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R2\",\n\t\tsourceUrls: [\"https://deepwiki.com/\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tdescriptorHashPinned: true,\n\t\t\tevidenceLedger: true,\n\t\t\tnoSecrets: true,\n\t\t\toutputGuard: true,\n\t\t\tprivateRepoDeniedByDefault: true,\n\t\t\tpublicReposOnly: true,\n\t\t},\n\t},\n\tinsaneSearchCandidate: {\n\t\tdefaultEnabled: false,\n\t\tid: \"insane-search-public-reader\",\n\t\timplementation: \"candidate-wrapper\",\n\t\tkey: \"insaneSearchCandidate\",\n\t\tlicense: \"MIT\",\n\t\tnotes: [\n\t\t\t\"Candidate only: upstream is a Claude Code plugin, not a verified standalone MCP transport.\",\n\t\t\t\"Any OMK integration must be a sandboxed first-party wrapper around public-content reads, with auto-install disabled.\",\n\t\t],\n\t\treadiness: \"candidate\",\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/fivetaku/insane-search\"],\n\t\ttools: {\n\t\t\tallow: [\"insane_search_public_read\"],\n\t\t\tdisabledByDefault: [\"insane_search_auto_install_dependencies\"],\n\t\t\tgated: [\"insane_search_browser_escalation\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tauthenticationBoundaryRequired: true,\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdisableAutoInstall: true,\n\t\t\tdistillBeforeMainContext: true,\n\t\t\tevidenceLedger: true,\n\t\t\tforkContext: true,\n\t\t\tmaxBrowserActions: 20,\n\t\t\tmaxOutputTokens: 30_000,\n\t\t\toutputGuard: true,\n\t\t\tpublicContentOnly: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tplaywrightSandboxed: {\n\t\tid: \"playwright-sandboxed\",\n\t\tkey: \"playwrightSandboxed\",\n\t\tlicense: \"Apache-2.0\",\n\t\tnotes: [\"Browser automation preset; enable only with sandbox and origin controls.\"],\n\t\trisk: \"R3\",\n\t\tsourceUrls: [\"https://github.com/microsoft/playwright-mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"local-package\",\n\t\t\tpackage: \"@playwright/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\n\t\t\t\t\"browser_close\",\n\t\t\t\t\"browser_click\",\n\t\t\t\t\"browser_navigate\",\n\t\t\t\t\"browser_snapshot\",\n\t\t\t\t\"browser_type\",\n\t\t\t\t\"browser_wait_for\",\n\t\t\t],\n\t\t\tdeny: [\"browser_console_messages\", \"browser_file_upload\", \"browser_pdf_save\", \"browser_press_key\"],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockMetadataIp: true,\n\t\t\tblockPrivateNetwork: true,\n\t\t\tledger: true,\n\t\t\tmaxBrowserActions: 40,\n\t\t\trecordEvidence: true,\n\t\t\trequiresExplicitPostconditions: true,\n\t\t\trequiresOriginAllowlist: true,\n\t\t\trequiresSandbox: true,\n\t\t},\n\t},\n\tmicrosoftLearn: {\n\t\tid: \"microsoft-learn\",\n\t\tkey: \"microsoftLearn\",\n\t\tlicense: \"Unspecified\",\n\t\tnotes: [\"Microsoft official remote documentation endpoint from the Microsoft MCP catalog.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/microsoft/mcp\"],\n\t\ttransport: {\n\t\t\ttype: \"http\",\n\t\t\turl: \"https://learn.microsoft.com/api/mcp\",\n\t\t},\n\t\ttools: {\n\t\t\tallow: [\"*\"],\n\t\t\tdenyByDefault: true,\n\t\t\tdenyMutations: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tcacheable: true,\n\t\t\tmaxOutputTokens: 6000,\n\t\t\toutputGuard: true,\n\t\t\tpromptTaint: \"external-docs\",\n\t\t\treadOnly: true,\n\t\t},\n\t},\n\tofficialReferenceSafePack: {\n\t\tid: \"official-reference-safe-pack\",\n\t\tkey: \"officialReferenceSafePack\",\n\t\tlicense: \"Apache-2.0/MIT/CC-BY-4.0\",\n\t\tnotes: [\"Reference implementations only; wrap before production use.\"],\n\t\trisk: \"R1\",\n\t\tsourceUrls: [\"https://github.com/modelcontextprotocol/servers\"],\n\t\tservers: [\"time\", \"memory\", \"sequential-thinking\", \"git-readonly\"],\n\t\ttools: {\n\t\t\tallow: [],\n\t\t\tdenyByDefault: true,\n\t\t},\n\t\tpolicy: {\n\t\t\tblockPrivateNetwork: true,\n\t\t\tdescriptorHashPinned: true,\n\t\t\tfilesystemRoot: \"workspaceRoot\",\n\t\t\tmutationsRequirePostconditions: true,\n\t\t},\n\t},\n} as const satisfies Record<PublicMcpPresetKey, PublicMcpPreset>;\n\nexport const OMK_PUBLIC_CONTEXT_MCP_BUNDLE = {\n\tstableDefaults: [\"repomix-code-compact\", \"docling-understand\", \"markitdown-lite\", \"omk-llmlingua-compress\"],\n\toptInResearchWeb: [\"firecrawl-web-understand\"],\n\tcandidatesNeedVerification: [\"deepwiki-repo-understand\", \"insane-search-public-reader\"],\n\tinternalRouters: [\"mcp-tool-rag-router\"],\n} as const;\n\nexport function listPublicMcpPresets(): PublicMcpPreset[] {\n\treturn Object.values(PUBLIC_MCP_PRESETS).map((preset) => clonePublicMcpPreset(preset));\n}\n\nexport function canonicalMcpPolicyHash(value: PublicMcpHashable): string {\n\treturn createHash(\"sha256\").update(canonicalStringify(value)).digest(\"hex\");\n}\n\nexport function canonicalPublicMcpServerIdentity(preset: PublicMcpPreset): string {\n\treturn canonicalMcpPolicyHash({\n\t\tid: preset.id,\n\t\tservers: preset.servers ?? null,\n\t\ttransport: preset.transport ?? null,\n\t});\n}\n\nexport function admitPublicMcpServer(\n\tpreset: PublicMcpPreset,\n\tobserved: PublicMcpObservedServer,\n\tapproved: PublicMcpApprovedServer | undefined,\n): PublicMcpAdmissionDecision {\n\tif (!approved) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_not_approved\"],\n\t\t};\n\t}\n\n\tif (approved.serverIdentity !== observed.serverIdentity) {\n\t\treturn {\n\t\t\tstatus: \"quarantine\",\n\t\t\treasons: [\"server_identity_changed\"],\n\t\t};\n\t}\n\n\tconst reasons: string[] = [];\n\n\tfor (const tool of observed.tools) {\n\t\tconst approvedDescriptorHash = approved.tools[tool.name];\n\n\t\tif (!approvedDescriptorHash) {\n\t\t\treasons.push(`new_tool:${tool.name}`);\n\t\t} else if (approvedDescriptorHash !== tool.descriptorHash) {\n\t\t\treasons.push(`descriptor_changed:${tool.name}`);\n\t\t}\n\n\t\tif (!isToolAllowed(preset.tools, tool.name)) {\n\t\t\treasons.push(`tool_not_allowed:${tool.name}`);\n\t\t}\n\n\t\tif (shouldDenyMutationLikeTool(preset, tool.name)) {\n\t\t\treasons.push(`mutation_tool_denied:${tool.name}`);\n\t\t}\n\n\t\tif (\n\t\t\tdetectMcpDescriptorPromptInjection(tool.description).patternSignal > MCP_QUARANTINE_PATTERN_SIGNAL_THRESHOLD\n\t\t) {\n\t\t\treasons.push(`descriptor_prompt_injection:${tool.name}`);\n\t\t}\n\t}\n\n\treturn {\n\t\tstatus: reasons.length === 0 ? \"allow\" : \"quarantine\",\n\t\treasons,\n\t};\n}\n\nfunction clonePublicMcpPreset(preset: PublicMcpPreset): PublicMcpPreset {\n\treturn {\n\t\t...preset,\n\t\tauth: preset.auth ? { ...preset.auth } : undefined,\n\t\tdefaultEnabled: preset.defaultEnabled,\n\t\timplementation: preset.implementation,\n\t\tnotes: [...preset.notes],\n\t\tpolicy: cloneRuntimePolicy(preset.policy),\n\t\treadiness: preset.readiness,\n\t\tsecrets: preset.secrets\n\t\t\t? {\n\t\t\t\t\theaders: preset.secrets.headers ? { ...preset.secrets.headers } : undefined,\n\t\t\t\t\toptional: preset.secrets.optional ? [...preset.secrets.optional] : undefined,\n\t\t\t\t\trequired: preset.secrets.required ? [...preset.secrets.required] : undefined,\n\t\t\t\t}\n\t\t\t: undefined,\n\t\tservers: preset.servers ? [...preset.servers] : undefined,\n\t\tsourceUrls: [...preset.sourceUrls],\n\t\ttools: {\n\t\t\tallow: [...preset.tools.allow],\n\t\t\tconditionalAllow: preset.tools.conditionalAllow ? [...preset.tools.conditionalAllow] : undefined,\n\t\t\tdeny: preset.tools.deny ? [...preset.tools.deny] : undefined,\n\t\t\tdenyByDefault: preset.tools.denyByDefault,\n\t\t\tdenyMutations: preset.tools.denyMutations,\n\t\t\tdisabledByDefault: preset.tools.disabledByDefault ? [...preset.tools.disabledByDefault] : undefined,\n\t\t\tgated: preset.tools.gated ? [...preset.tools.gated] : undefined,\n\t\t\trequirePostconditions: preset.tools.requirePostconditions\n\t\t\t\t? [...preset.tools.requirePostconditions]\n\t\t\t\t: undefined,\n\t\t},\n\t\ttransport: preset.transport ? cloneTransport(preset.transport) : undefined,\n\t};\n}\n\nfunction cloneTransport(transport: PublicMcpTransport): PublicMcpTransport {\n\tif (transport.type === \"stdio\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: [...transport.args],\n\t\t};\n\t}\n\n\tif (transport.type === \"local-package\") {\n\t\treturn {\n\t\t\t...transport,\n\t\t\targs: transport.args ? [...transport.args] : undefined,\n\t\t};\n\t}\n\n\tif (transport.type === \"embedded-python-or-sidecar\") {\n\t\treturn { ...transport };\n\t}\n\n\treturn { ...transport };\n}\n\nfunction cloneRuntimePolicy(policy: PublicMcpRuntimePolicy): PublicMcpRuntimePolicy {\n\treturn {\n\t\t...policy,\n\t\tallowedUriSchemes: policy.allowedUriSchemes ? [...policy.allowedUriSchemes] : undefined,\n\t\trejectIfCoverageBelow: policy.rejectIfCoverageBelow ? { ...policy.rejectIfCoverageBelow } : undefined,\n\t};\n}\n\nfunction isToolAllowed(policy: PublicMcpToolPolicy, toolName: string): boolean {\n\tif (policy.deny?.includes(toolName)) {\n\t\treturn false;\n\t}\n\n\tif (policy.allow.includes(\"*\")) {\n\t\treturn true;\n\t}\n\n\treturn policy.allow.includes(toolName);\n}\n\nfunction shouldDenyMutationLikeTool(preset: PublicMcpPreset, toolName: string): boolean {\n\tif (!preset.tools.allow.includes(\"*\")) {\n\t\treturn false;\n\t}\n\n\tif (!preset.tools.denyMutations && !preset.policy.readOnly && !preset.policy.mutationsRequirePostconditions) {\n\t\treturn false;\n\t}\n\n\treturn isMutationLikeToolName(toolName);\n}\n\nfunction isMutationLikeToolName(toolName: string): boolean {\n\treturn /(?:^|[_-])(add|approve|archive|cancel|close|create|delete|dismiss|merge|post|push|remove|send|submit|update|upload|write)(?:$|[_-])/.test(\n\t\ttoolName.toLowerCase(),\n\t);\n}\n\nfunction canonicalStringify(value: PublicMcpHashable): string {\n\tif (value === null || typeof value === \"boolean\" || typeof value === \"number\" || typeof value === \"string\") {\n\t\treturn JSON.stringify(value);\n\t}\n\n\tif (Array.isArray(value)) {\n\t\treturn `[${value.map((item) => canonicalStringify(item)).join(\",\")}]`;\n\t}\n\n\tconst record = value as { readonly [key: string]: PublicMcpHashable };\n\tconst keys = Object.keys(record).sort();\n\treturn `{${keys.map((key) => `${JSON.stringify(key)}:${canonicalStringify(record[key])}`).join(\",\")}}`;\n}\n"]}
|