opkg 0.6.1 → 0.7.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/README.md +109 -186
- package/assets/openpackage_ascii_dark.png +0 -0
- package/assets/openpackage_ascii_light.png +0 -0
- package/dist/commands/add.js +34 -10
- package/dist/commands/add.js.map +1 -1
- package/dist/commands/apply.js +16 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/delete.js +1 -1
- package/dist/commands/delete.js.map +1 -1
- package/dist/commands/install.js +177 -8
- package/dist/commands/install.js.map +1 -1
- package/dist/commands/list.js +2 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/login.js +1 -1
- package/dist/commands/login.js.map +1 -1
- package/dist/commands/logout.js +1 -1
- package/dist/commands/logout.js.map +1 -1
- package/dist/commands/new.js +125 -0
- package/dist/commands/new.js.map +1 -0
- package/dist/commands/pack.js +7 -13
- package/dist/commands/pack.js.map +1 -1
- package/dist/commands/pull.js +1 -1
- package/dist/commands/pull.js.map +1 -1
- package/dist/commands/push.js +1 -1
- package/dist/commands/push.js.map +1 -1
- package/dist/commands/remove.js +63 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/commands/save.js +11 -17
- package/dist/commands/save.js.map +1 -1
- package/dist/commands/set.js +33 -0
- package/dist/commands/set.js.map +1 -0
- package/dist/commands/show.js +16 -94
- package/dist/commands/show.js.map +1 -1
- package/dist/commands/status.js +26 -701
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/uninstall.js +14 -427
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/constants/index.js +72 -16
- package/dist/constants/index.js.map +1 -1
- package/dist/core/add/add-conflict-handler.js +1 -8
- package/dist/core/add/add-conflict-handler.js.map +1 -1
- package/dist/core/add/add-pipeline.js +12 -10
- package/dist/core/add/add-pipeline.js.map +1 -1
- package/dist/core/add/add-to-source-pipeline.js +123 -0
- package/dist/core/add/add-to-source-pipeline.js.map +1 -0
- package/dist/core/add/package-index-updater.js +77 -78
- package/dist/core/add/package-index-updater.js.map +1 -1
- package/dist/core/add/platform-path-transformer.js +6 -4
- package/dist/core/add/platform-path-transformer.js.map +1 -1
- package/dist/core/add/source-collector.js +2 -3
- package/dist/core/add/source-collector.js.map +1 -1
- package/dist/core/apply/apply-pipeline.js +110 -0
- package/dist/core/apply/apply-pipeline.js.map +1 -0
- package/dist/core/dependency-resolver.js +263 -21
- package/dist/core/dependency-resolver.js.map +1 -1
- package/dist/core/discovery/file-discovery.js +1 -2
- package/dist/core/discovery/file-discovery.js.map +1 -1
- package/dist/core/discovery/platform-files-discovery.js +33 -18
- package/dist/core/discovery/platform-files-discovery.js.map +1 -1
- package/dist/core/flows/flow-executor.js +974 -0
- package/dist/core/flows/flow-executor.js.map +1 -0
- package/dist/core/flows/flow-inverter.js +442 -0
- package/dist/core/flows/flow-inverter.js.map +1 -0
- package/dist/core/flows/flow-key-extractor.js +101 -0
- package/dist/core/flows/flow-key-extractor.js.map +1 -0
- package/dist/core/flows/flow-key-mapper.js +382 -0
- package/dist/core/flows/flow-key-mapper.js.map +1 -0
- package/dist/core/flows/flow-transforms.js +632 -0
- package/dist/core/flows/flow-transforms.js.map +1 -0
- package/dist/core/flows/map-pipeline/context.js +73 -0
- package/dist/core/flows/map-pipeline/context.js.map +1 -0
- package/dist/core/flows/map-pipeline/index.js +156 -0
- package/dist/core/flows/map-pipeline/index.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/copy.js +104 -0
- package/dist/core/flows/map-pipeline/operations/copy.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/pipe.js +70 -0
- package/dist/core/flows/map-pipeline/operations/pipe.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/rename.js +102 -0
- package/dist/core/flows/map-pipeline/operations/rename.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/set.js +50 -0
- package/dist/core/flows/map-pipeline/operations/set.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/switch.js +79 -0
- package/dist/core/flows/map-pipeline/operations/switch.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/transform.js +543 -0
- package/dist/core/flows/map-pipeline/operations/transform.js.map +1 -0
- package/dist/core/flows/map-pipeline/operations/unset.js +65 -0
- package/dist/core/flows/map-pipeline/operations/unset.js.map +1 -0
- package/dist/core/flows/map-pipeline/types.js +8 -0
- package/dist/core/flows/map-pipeline/types.js.map +1 -0
- package/dist/core/flows/map-pipeline/utils.js +278 -0
- package/dist/core/flows/map-pipeline/utils.js.map +1 -0
- package/dist/core/flows/platform-converter.js +328 -0
- package/dist/core/flows/platform-converter.js.map +1 -0
- package/dist/core/flows/source-resolver.js +192 -0
- package/dist/core/flows/source-resolver.js.map +1 -0
- package/dist/core/flows/toml-domain-transforms.js +23 -0
- package/dist/core/flows/toml-domain-transforms.js.map +1 -0
- package/dist/core/install/bulk-install-pipeline.js +68 -7
- package/dist/core/install/bulk-install-pipeline.js.map +1 -1
- package/dist/core/install/canonical-plan.js +3 -3
- package/dist/core/install/canonical-plan.js.map +1 -1
- package/dist/core/install/dry-run.js +3 -3
- package/dist/core/install/dry-run.js.map +1 -1
- package/dist/core/install/flow-based-installer.js +1158 -0
- package/dist/core/install/flow-based-installer.js.map +1 -0
- package/dist/core/install/flow-workspace-tracker.js +111 -0
- package/dist/core/install/flow-workspace-tracker.js.map +1 -0
- package/dist/core/install/format-detector.js +228 -0
- package/dist/core/install/format-detector.js.map +1 -0
- package/dist/core/install/git-package-loader.js +20 -0
- package/dist/core/install/git-package-loader.js.map +1 -0
- package/dist/core/install/install-errors.js +1 -1
- package/dist/core/install/install-errors.js.map +1 -1
- package/dist/core/install/install-flow.js +34 -14
- package/dist/core/install/install-flow.js.map +1 -1
- package/dist/core/install/install-pipeline.js +52 -17
- package/dist/core/install/install-pipeline.js.map +1 -1
- package/dist/core/install/install-reporting.js +26 -8
- package/dist/core/install/install-reporting.js.map +1 -1
- package/dist/core/install/local-source-resolution.js +103 -0
- package/dist/core/install/local-source-resolution.js.map +1 -0
- package/dist/core/install/marketplace-handler.js +221 -0
- package/dist/core/install/marketplace-handler.js.map +1 -0
- package/dist/core/install/path-install-pipeline.js +241 -0
- package/dist/core/install/path-install-pipeline.js.map +1 -0
- package/dist/core/install/path-package-loader.js +116 -0
- package/dist/core/install/path-package-loader.js.map +1 -0
- package/dist/core/install/plugin-detector.js +72 -0
- package/dist/core/install/plugin-detector.js.map +1 -0
- package/dist/core/install/plugin-to-universal-converter.js +218 -0
- package/dist/core/install/plugin-to-universal-converter.js.map +1 -0
- package/dist/core/install/plugin-transformer.js +191 -0
- package/dist/core/install/plugin-transformer.js.map +1 -0
- package/dist/core/install/version-selection.js +1 -1
- package/dist/core/install/version-selection.js.map +1 -1
- package/dist/core/openpackage.js +40 -22
- package/dist/core/openpackage.js.map +1 -1
- package/dist/core/pack/pack-output.js +62 -0
- package/dist/core/pack/pack-output.js.map +1 -0
- package/dist/core/pack/pack-pipeline.js +186 -0
- package/dist/core/pack/pack-pipeline.js.map +1 -0
- package/dist/core/package-context.js +45 -70
- package/dist/core/package-context.js.map +1 -1
- package/dist/core/package-creation.js +203 -0
- package/dist/core/package-creation.js.map +1 -0
- package/dist/core/package.js +20 -6
- package/dist/core/package.js.map +1 -1
- package/dist/core/platforms.js +665 -209
- package/dist/core/platforms.js.map +1 -1
- package/dist/core/push/push-context.js +1 -1
- package/dist/core/push/push-context.js.map +1 -1
- package/dist/core/push/push-upload.js +2 -2
- package/dist/core/push/push-upload.js.map +1 -1
- package/dist/core/registry.js +6 -6
- package/dist/core/registry.js.map +1 -1
- package/dist/core/remote-pull.js +2 -2
- package/dist/core/remote-pull.js.map +1 -1
- package/dist/core/remove/removal-collector.js +52 -0
- package/dist/core/remove/removal-collector.js.map +1 -0
- package/dist/core/remove/removal-confirmation.js +39 -0
- package/dist/core/remove/removal-confirmation.js.map +1 -0
- package/dist/core/remove/remove-from-source-pipeline.js +173 -0
- package/dist/core/remove/remove-from-source-pipeline.js.map +1 -0
- package/dist/core/save/constants.js +3 -3
- package/dist/core/save/constants.js.map +1 -1
- package/dist/core/save/flow-based-saver.js +270 -0
- package/dist/core/save/flow-based-saver.js.map +1 -0
- package/dist/core/save/name-resolution.js +1 -1
- package/dist/core/save/name-resolution.js.map +1 -1
- package/dist/core/save/package-yml-generator.js +4 -5
- package/dist/core/save/package-yml-generator.js.map +1 -1
- package/dist/core/save/save-candidate-builder.js +215 -0
- package/dist/core/save/save-candidate-builder.js.map +1 -0
- package/dist/core/save/save-candidate-loader.js +12 -11
- package/dist/core/save/save-candidate-loader.js.map +1 -1
- package/dist/core/save/save-conflict-analyzer.js +150 -0
- package/dist/core/save/save-conflict-analyzer.js.map +1 -0
- package/dist/core/save/save-conflict-resolution.js +28 -14
- package/dist/core/save/save-conflict-resolution.js.map +1 -1
- package/dist/core/save/save-conflict-resolver.js +31 -275
- package/dist/core/save/save-conflict-resolver.js.map +1 -1
- package/dist/core/save/save-group-builder.js +52 -0
- package/dist/core/save/save-group-builder.js.map +1 -0
- package/dist/core/save/save-interactive-resolver.js +190 -0
- package/dist/core/save/save-interactive-resolver.js.map +1 -0
- package/dist/core/save/save-pipeline.js +58 -34
- package/dist/core/save/save-pipeline.js.map +1 -1
- package/dist/core/save/save-platform-handler.js +53 -0
- package/dist/core/save/save-platform-handler.js.map +1 -0
- package/dist/core/save/save-resolution-executor.js +145 -0
- package/dist/core/save/save-resolution-executor.js.map +1 -0
- package/dist/core/save/save-result-reporter.js +167 -0
- package/dist/core/save/save-result-reporter.js.map +1 -0
- package/dist/core/save/save-to-source-pipeline.js +154 -0
- package/dist/core/save/save-to-source-pipeline.js.map +1 -0
- package/dist/core/save/save-versioning.js +4 -4
- package/dist/core/save/save-versioning.js.map +1 -1
- package/dist/core/save/save-write-coordinator.js +204 -0
- package/dist/core/save/save-write-coordinator.js.map +1 -0
- package/dist/core/save/save-yml-resolution.js +28 -216
- package/dist/core/save/save-yml-resolution.js.map +1 -1
- package/dist/core/save/workspace-rename.js +7 -8
- package/dist/core/save/workspace-rename.js.map +1 -1
- package/dist/core/set/set-output.js +72 -0
- package/dist/core/set/set-output.js.map +1 -0
- package/dist/core/set/set-pipeline.js +361 -0
- package/dist/core/set/set-pipeline.js.map +1 -0
- package/dist/core/set/set-types.js +5 -0
- package/dist/core/set/set-types.js.map +1 -0
- package/dist/core/show/package-resolver.js +257 -0
- package/dist/core/show/package-resolver.js.map +1 -0
- package/dist/core/show/scope-discovery.js +165 -0
- package/dist/core/show/scope-discovery.js.map +1 -0
- package/dist/core/show/show-output.js +168 -0
- package/dist/core/show/show-output.js.map +1 -0
- package/dist/core/show/show-pipeline.js +113 -0
- package/dist/core/show/show-pipeline.js.map +1 -0
- package/dist/core/show/show-types.js +5 -0
- package/dist/core/show/show-types.js.map +1 -0
- package/dist/core/source-resolution/dependency-graph.js +104 -0
- package/dist/core/source-resolution/dependency-graph.js.map +1 -0
- package/dist/core/source-resolution/resolve-mutable-source.js +109 -0
- package/dist/core/source-resolution/resolve-mutable-source.js.map +1 -0
- package/dist/core/source-resolution/resolve-package-source.js +29 -0
- package/dist/core/source-resolution/resolve-package-source.js.map +1 -0
- package/dist/core/source-resolution/resolve-registry-version.js +35 -0
- package/dist/core/source-resolution/resolve-registry-version.js.map +1 -0
- package/dist/core/source-resolution/types.js.map +1 -0
- package/dist/core/status/status-file-discovery.js +23 -12
- package/dist/core/status/status-file-discovery.js.map +1 -1
- package/dist/core/status/status-pipeline.js +134 -0
- package/dist/core/status/status-pipeline.js.map +1 -0
- package/dist/core/sync/platform-sync-summary.js +27 -0
- package/dist/core/sync/platform-sync-summary.js.map +1 -0
- package/dist/core/uninstall/flow-aware-uninstaller.js +189 -0
- package/dist/core/uninstall/flow-aware-uninstaller.js.map +1 -0
- package/dist/core/uninstall/uninstall-file-discovery.js +11 -6
- package/dist/core/uninstall/uninstall-file-discovery.js.map +1 -1
- package/dist/core/uninstall/uninstall-pipeline.js +141 -0
- package/dist/core/uninstall/uninstall-pipeline.js.map +1 -0
- package/dist/core/universal-patterns.js +64 -0
- package/dist/core/universal-patterns.js.map +1 -0
- package/dist/index.js +99 -6
- package/dist/index.js.map +1 -1
- package/dist/types/flows.js +8 -0
- package/dist/types/flows.js.map +1 -0
- package/dist/types/index.js +3 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/platform-flows.js +8 -0
- package/dist/types/platform-flows.js.map +1 -0
- package/dist/types/workspace-index.js +6 -0
- package/dist/types/workspace-index.js.map +1 -0
- package/dist/utils/custom-path-resolution.js +160 -0
- package/dist/utils/custom-path-resolution.js.map +1 -0
- package/dist/utils/dependency-coverage.js +1 -1
- package/dist/utils/dependency-coverage.js.map +1 -1
- package/dist/utils/file-processing.js +1 -1
- package/dist/utils/flow-index-installer.js +209 -0
- package/dist/utils/flow-index-installer.js.map +1 -0
- package/dist/utils/formatters.js +47 -1
- package/dist/utils/formatters.js.map +1 -1
- package/dist/utils/fs.js +17 -0
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/git-clone-registry.js +88 -0
- package/dist/utils/git-clone-registry.js.map +1 -0
- package/dist/utils/git-clone.js +69 -0
- package/dist/utils/git-clone.js.map +1 -0
- package/dist/utils/git-spec.js +96 -0
- package/dist/utils/git-spec.js.map +1 -0
- package/dist/utils/http-client.js +7 -0
- package/dist/utils/http-client.js.map +1 -1
- package/dist/utils/index-based-installer.js +356 -163
- package/dist/utils/index-based-installer.js.map +1 -1
- package/dist/utils/install-conflict-handler.js +2 -2
- package/dist/utils/install-conflict-handler.js.map +1 -1
- package/dist/utils/install-file-discovery.js +18 -13
- package/dist/utils/install-file-discovery.js.map +1 -1
- package/dist/utils/install-helpers.js +43 -20
- package/dist/utils/install-helpers.js.map +1 -1
- package/dist/utils/jsonc.js +23 -1
- package/dist/utils/jsonc.js.map +1 -1
- package/dist/utils/manifest-paths.js +1 -1
- package/dist/utils/manifest-paths.js.map +1 -1
- package/dist/utils/markdown-frontmatter.js +46 -0
- package/dist/utils/markdown-frontmatter.js.map +1 -1
- package/dist/utils/package-copy.js +5 -103
- package/dist/utils/package-copy.js.map +1 -1
- package/dist/utils/package-filters.js +9 -105
- package/dist/utils/package-filters.js.map +1 -1
- package/dist/utils/package-index-yml.js +27 -6
- package/dist/utils/package-index-yml.js.map +1 -1
- package/dist/utils/package-input.js +98 -0
- package/dist/utils/package-input.js.map +1 -0
- package/dist/utils/package-management.js +80 -28
- package/dist/utils/package-management.js.map +1 -1
- package/dist/utils/package-name-resolution.js +327 -0
- package/dist/utils/package-name-resolution.js.map +1 -0
- package/dist/utils/package-name.js +18 -16
- package/dist/utils/package-name.js.map +1 -1
- package/dist/utils/package-versioning.js +2 -33
- package/dist/utils/package-versioning.js.map +1 -1
- package/dist/utils/package-yml.js +19 -28
- package/dist/utils/package-yml.js.map +1 -1
- package/dist/utils/path-resolution.js +102 -0
- package/dist/utils/path-resolution.js.map +1 -0
- package/dist/utils/paths.js +6 -6
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/platform-file.js +36 -24
- package/dist/utils/platform-file.js.map +1 -1
- package/dist/utils/platform-mapper.js +222 -68
- package/dist/utils/platform-mapper.js.map +1 -1
- package/dist/utils/platform-root-files.js +44 -0
- package/dist/utils/platform-root-files.js.map +1 -0
- package/dist/utils/platform-utils.js +35 -54
- package/dist/utils/platform-utils.js.map +1 -1
- package/dist/utils/platform-yaml-merge.js +20 -140
- package/dist/utils/platform-yaml-merge.js.map +1 -1
- package/dist/utils/prompts.js +92 -7
- package/dist/utils/prompts.js.map +1 -1
- package/dist/utils/registry-entry-filter.js +50 -27
- package/dist/utils/registry-entry-filter.js.map +1 -1
- package/dist/utils/registry-paths.js +5 -4
- package/dist/utils/registry-paths.js.map +1 -1
- package/dist/utils/scope-resolution.js +156 -0
- package/dist/utils/scope-resolution.js.map +1 -0
- package/dist/utils/source-mutability.js +15 -0
- package/dist/utils/source-mutability.js.map +1 -0
- package/dist/utils/tarball.js +29 -4
- package/dist/utils/tarball.js.map +1 -1
- package/dist/utils/version-ranges.js +1 -32
- package/dist/utils/version-ranges.js.map +1 -1
- package/dist/utils/workspace-index-helpers.js +28 -0
- package/dist/utils/workspace-index-helpers.js.map +1 -0
- package/dist/utils/workspace-index-ownership.js +100 -0
- package/dist/utils/workspace-index-ownership.js.map +1 -0
- package/dist/utils/workspace-index-yml.js +173 -0
- package/dist/utils/workspace-index-yml.js.map +1 -0
- package/examples/custom-subdirs-platform.jsonc +157 -0
- package/package.json +7 -2
- package/platforms.jsonc +531 -84
- package/schemas/map-pipeline-v1.json +256 -0
- package/schemas/platforms-v1.json +400 -0
- package/specs/README.md +88 -0
- package/specs/add/README.md +166 -0
- package/specs/agents-claude.md +570 -0
- package/specs/agents-opencode.md +622 -0
- package/specs/apply/README.md +21 -0
- package/specs/apply/apply-behavior.md +58 -0
- package/specs/apply/apply-command.md +51 -0
- package/specs/apply/conflicts.md +41 -0
- package/specs/apply/index-effects.md +81 -0
- package/specs/architecture.md +107 -0
- package/specs/auth/README.md +17 -0
- package/specs/auth/auth-http-contract.md +25 -0
- package/specs/auth/cli/credentials.md +39 -0
- package/specs/auth/cli/login.md +32 -0
- package/specs/auth/cli/logout.md +16 -0
- package/specs/claude-mcp.md +1065 -0
- package/specs/claude-plugins-marketplace.md +363 -0
- package/specs/claude-plugins.md +413 -0
- package/specs/cli-options.md +52 -0
- package/specs/codex-mcp.md +114 -0
- package/specs/commands-overview.md +175 -0
- package/specs/directory-layout.md +95 -0
- package/specs/install/README.md +12 -4
- package/specs/install/git-sources.md +230 -0
- package/specs/install/install-behavior.md +483 -73
- package/specs/install/package-yml-canonical.md +67 -35
- package/specs/install/version-resolution.md +69 -115
- package/specs/new/README.md +769 -0
- package/specs/new/SUMMARY.md +310 -0
- package/specs/new/scope-behavior.md +793 -0
- package/specs/pack/README.md +77 -0
- package/specs/pack/package-name-resolution.md +330 -0
- package/specs/package/README.md +18 -17
- package/specs/package/nested-packages-and-parent-packages.md +32 -31
- package/specs/package/package-index-yml.md +95 -101
- package/specs/package/package-root-layout.md +64 -46
- package/specs/package/registry-payload-and-copy.md +50 -44
- package/specs/package/universal-content.md +33 -56
- package/specs/package-sources.md +248 -0
- package/specs/platforms/README.md +52 -0
- package/specs/platforms/configuration.md +571 -0
- package/specs/platforms/detection.md +552 -0
- package/specs/platforms/directory-layout.md +599 -0
- package/specs/platforms/examples.md +1146 -0
- package/specs/platforms/flow-reference.md +1240 -0
- package/specs/platforms/flows.md +1488 -0
- package/specs/platforms/map-pipeline.md +801 -0
- package/specs/platforms/overview.md +349 -0
- package/specs/platforms/specification.md +700 -0
- package/specs/platforms/troubleshooting.md +697 -0
- package/specs/platforms/universal-converter.md +520 -0
- package/specs/push/README.md +1 -0
- package/specs/push/push-behavior.md +11 -3
- package/specs/push/push-remote-upload.md +1 -1
- package/specs/push/push-scoping.md +1 -1
- package/specs/push/push-version-selection.md +1 -1
- package/specs/registry.md +111 -0
- package/specs/remove/README.md +257 -0
- package/specs/save/README.md +21 -17
- package/specs/save/save-conflict-resolution.md +205 -83
- package/specs/save/save-file-discovery.md +6 -4
- package/specs/save/save-frontmatter-overrides.md +11 -15
- package/specs/save/save-modes-inputs.md +9 -39
- package/specs/save/save-naming-scoping.md +4 -4
- package/specs/save/save-package-detection.md +13 -13
- package/specs/save/save-registry-sync.md +16 -106
- package/specs/save/save-versioning.md +80 -0
- package/specs/scope-management.md +92 -0
- package/specs/set/README.md +520 -0
- package/specs/set/set-behavior.md +563 -0
- package/specs/show/README.md +483 -0
- package/specs/show/show-remote.md +494 -0
- package/specs/status/README.md +38 -0
- package/specs/uninstall/README.md +231 -0
- package/dist/commands/duplicate.js +0 -69
- package/dist/commands/duplicate.js.map +0 -1
- package/dist/commands/init.js +0 -117
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/prune.js +0 -357
- package/dist/commands/prune.js.map +0 -1
- package/dist/commands/tui.js +0 -61
- package/dist/commands/tui.js.map +0 -1
- package/dist/core/install/index.js +0 -3
- package/dist/core/install/index.js.map +0 -1
- package/dist/core/push/push-single-file.js +0 -56
- package/dist/core/push/push-single-file.js.map +0 -1
- package/dist/core/save/package-detection.js +0 -147
- package/dist/core/save/package-detection.js.map +0 -1
- package/dist/core/save/save-single-file.js +0 -124
- package/dist/core/save/save-single-file.js.map +0 -1
- package/dist/core/token-store.js +0 -73
- package/dist/core/token-store.js.map +0 -1
- package/dist/tui/app.js +0 -95
- package/dist/tui/app.js.map +0 -1
- package/dist/tui/components/package-list.js +0 -73
- package/dist/tui/components/package-list.js.map +0 -1
- package/dist/tui/controller.js +0 -365
- package/dist/tui/controller.js.map +0 -1
- package/dist/tui/index.js +0 -12
- package/dist/tui/index.js.map +0 -1
- package/dist/tui/services/file-index.js +0 -64
- package/dist/tui/services/file-index.js.map +0 -1
- package/dist/tui/services/packages.js +0 -18
- package/dist/tui/services/packages.js.map +0 -1
- package/dist/tui/services/save.js +0 -21
- package/dist/tui/services/save.js.map +0 -1
- package/dist/tui/state/app-state.js +0 -15
- package/dist/tui/state/app-state.js.map +0 -1
- package/dist/tui/state.js +0 -17
- package/dist/tui/state.js.map +0 -1
- package/dist/tui/types.js.map +0 -1
- package/dist/tui/views/add-file-modal.js +0 -129
- package/dist/tui/views/add-file-modal.js.map +0 -1
- package/dist/tui/views/file-preview.js +0 -44
- package/dist/tui/views/file-preview.js.map +0 -1
- package/dist/tui/views/list-packages.js +0 -73
- package/dist/tui/views/list-packages.js.map +0 -1
- package/dist/tui/views/main-menu.js +0 -29
- package/dist/tui/views/main-menu.js.map +0 -1
- package/dist/tui/views/manage-view.js +0 -81
- package/dist/tui/views/manage-view.js.map +0 -1
- package/dist/tui/views/package-hub.js +0 -120
- package/dist/tui/views/package-hub.js.map +0 -1
- package/dist/tui/views/placeholder.js +0 -24
- package/dist/tui/views/placeholder.js.map +0 -1
- package/dist/utils/bun-bootstrap.js +0 -72
- package/dist/utils/bun-bootstrap.js.map +0 -1
- package/dist/utils/entity-id.js +0 -19
- package/dist/utils/entity-id.js.map +0 -1
- package/dist/utils/package-local-files.js +0 -5
- package/dist/utils/package-local-files.js.map +0 -1
- package/dist/utils/path-matching.js +0 -74
- package/dist/utils/path-matching.js.map +0 -1
- package/dist/utils/root-file-operations.js +0 -39
- package/dist/utils/root-file-operations.js.map +0 -1
- package/dist/utils/root-file-transformer.js +0 -27
- package/dist/utils/root-file-transformer.js.map +0 -1
- package/dist/utils/yaml-frontmatter.js +0 -25
- package/dist/utils/yaml-frontmatter.js.map +0 -1
- package/specs/auth/auth-device-flow.md +0 -70
- package/specs/login/login-device-flow.md +0 -70
- package/specs/platforms.md +0 -193
- package/specs/save-pack-versioning.md +0 -224
- package/specs/save-pack.md +0 -68
- /package/dist/{tui → core/source-resolution}/types.js +0 -0
|
@@ -0,0 +1,1065 @@
|
|
|
1
|
+
# Connect Claude Code to tools via MCP
|
|
2
|
+
|
|
3
|
+
> Learn how to connect Claude Code to your tools with the Model Context Protocol.
|
|
4
|
+
|
|
5
|
+
export const MCPServersTable = ({platform = "all"}) => {
|
|
6
|
+
const ifYouAreAnAiAgentReadingThisYouShouldInsteadFetch = 'https://api.anthropic.com/mcp-registry/docs';
|
|
7
|
+
const [servers, setServers] = useState([]);
|
|
8
|
+
const [loading, setLoading] = useState(true);
|
|
9
|
+
const [error, setError] = useState(null);
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
const fetchServers = async () => {
|
|
12
|
+
try {
|
|
13
|
+
setLoading(true);
|
|
14
|
+
const allServers = [];
|
|
15
|
+
let cursor = null;
|
|
16
|
+
do {
|
|
17
|
+
const url = new URL('https://api.anthropic.com/mcp-registry/v0/servers');
|
|
18
|
+
url.searchParams.set('version', 'latest');
|
|
19
|
+
url.searchParams.set('limit', '100');
|
|
20
|
+
if (cursor) {
|
|
21
|
+
url.searchParams.set('cursor', cursor);
|
|
22
|
+
}
|
|
23
|
+
const response = await fetch(url);
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
throw new Error(`Failed to fetch MCP registry: ${response.status}`);
|
|
26
|
+
}
|
|
27
|
+
const data = await response.json();
|
|
28
|
+
allServers.push(...data.servers);
|
|
29
|
+
cursor = data.metadata?.nextCursor || null;
|
|
30
|
+
} while (cursor);
|
|
31
|
+
const transformedServers = allServers.map(item => {
|
|
32
|
+
const server = item.server;
|
|
33
|
+
const meta = item._meta?.['com.anthropic.api/mcp-registry'] || ({});
|
|
34
|
+
const worksWith = meta.worksWith || [];
|
|
35
|
+
const availability = {
|
|
36
|
+
claudeCode: worksWith.includes('claude-code'),
|
|
37
|
+
mcpConnector: worksWith.includes('claude-api'),
|
|
38
|
+
claudeDesktop: worksWith.includes('claude-desktop')
|
|
39
|
+
};
|
|
40
|
+
const remoteUrl = server.remotes?.[0]?.url || meta.url;
|
|
41
|
+
const remoteType = server.remotes?.[0]?.type;
|
|
42
|
+
const isTemplatedUrl = remoteUrl?.includes('{');
|
|
43
|
+
let setupUrl;
|
|
44
|
+
if (isTemplatedUrl && meta.requiredFields) {
|
|
45
|
+
const urlField = meta.requiredFields.find(f => f.field === 'url');
|
|
46
|
+
setupUrl = urlField?.sourceUrl || meta.documentation;
|
|
47
|
+
}
|
|
48
|
+
const urls = {};
|
|
49
|
+
if (!isTemplatedUrl) {
|
|
50
|
+
if (remoteType === 'streamable-http') {
|
|
51
|
+
urls.http = remoteUrl;
|
|
52
|
+
} else if (remoteType === 'sse') {
|
|
53
|
+
urls.sse = remoteUrl;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
let envVars = [];
|
|
57
|
+
if (server.packages && server.packages.length > 0) {
|
|
58
|
+
const npmPackage = server.packages.find(p => p.registryType === 'npm');
|
|
59
|
+
if (npmPackage) {
|
|
60
|
+
urls.stdio = `npx -y ${npmPackage.identifier}`;
|
|
61
|
+
if (npmPackage.environmentVariables) {
|
|
62
|
+
envVars = npmPackage.environmentVariables;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return {
|
|
67
|
+
name: meta.displayName || server.title || server.name,
|
|
68
|
+
description: meta.oneLiner || server.description,
|
|
69
|
+
documentation: meta.documentation,
|
|
70
|
+
urls: urls,
|
|
71
|
+
envVars: envVars,
|
|
72
|
+
availability: availability,
|
|
73
|
+
customCommands: meta.claudeCodeCopyText ? {
|
|
74
|
+
claudeCode: meta.claudeCodeCopyText
|
|
75
|
+
} : undefined,
|
|
76
|
+
setupUrl: setupUrl
|
|
77
|
+
};
|
|
78
|
+
});
|
|
79
|
+
setServers(transformedServers);
|
|
80
|
+
setError(null);
|
|
81
|
+
} catch (err) {
|
|
82
|
+
setError(err.message);
|
|
83
|
+
console.error('Error fetching MCP registry:', err);
|
|
84
|
+
} finally {
|
|
85
|
+
setLoading(false);
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
fetchServers();
|
|
89
|
+
}, []);
|
|
90
|
+
const generateClaudeCodeCommand = server => {
|
|
91
|
+
if (server.customCommands && server.customCommands.claudeCode) {
|
|
92
|
+
return server.customCommands.claudeCode;
|
|
93
|
+
}
|
|
94
|
+
const serverSlug = server.name.toLowerCase().replace(/[^a-z0-9]/g, '-');
|
|
95
|
+
if (server.urls.http) {
|
|
96
|
+
return `claude mcp add ${serverSlug} --transport http ${server.urls.http}`;
|
|
97
|
+
}
|
|
98
|
+
if (server.urls.sse) {
|
|
99
|
+
return `claude mcp add ${serverSlug} --transport sse ${server.urls.sse}`;
|
|
100
|
+
}
|
|
101
|
+
if (server.urls.stdio) {
|
|
102
|
+
const envFlags = server.envVars && server.envVars.length > 0 ? server.envVars.map(v => `--env ${v.name}=YOUR_${v.name}`).join(' ') : '';
|
|
103
|
+
const baseCommand = `claude mcp add ${serverSlug} --transport stdio`;
|
|
104
|
+
return envFlags ? `${baseCommand} ${envFlags} -- ${server.urls.stdio}` : `${baseCommand} -- ${server.urls.stdio}`;
|
|
105
|
+
}
|
|
106
|
+
return null;
|
|
107
|
+
};
|
|
108
|
+
if (loading) {
|
|
109
|
+
return <div>Loading MCP servers...</div>;
|
|
110
|
+
}
|
|
111
|
+
if (error) {
|
|
112
|
+
return <div>Error loading MCP servers: {error}</div>;
|
|
113
|
+
}
|
|
114
|
+
const filteredServers = servers.filter(server => {
|
|
115
|
+
if (platform === "claudeCode") {
|
|
116
|
+
return server.availability.claudeCode;
|
|
117
|
+
} else if (platform === "mcpConnector") {
|
|
118
|
+
return server.availability.mcpConnector;
|
|
119
|
+
} else if (platform === "claudeDesktop") {
|
|
120
|
+
return server.availability.claudeDesktop;
|
|
121
|
+
} else if (platform === "all") {
|
|
122
|
+
return true;
|
|
123
|
+
} else {
|
|
124
|
+
throw new Error(`Unknown platform: ${platform}`);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
127
|
+
return <>
|
|
128
|
+
<style jsx>{`
|
|
129
|
+
.cards-container {
|
|
130
|
+
display: grid;
|
|
131
|
+
gap: 1rem;
|
|
132
|
+
margin-bottom: 2rem;
|
|
133
|
+
}
|
|
134
|
+
.server-card {
|
|
135
|
+
border: 1px solid var(--border-color, #e5e7eb);
|
|
136
|
+
border-radius: 6px;
|
|
137
|
+
padding: 1rem;
|
|
138
|
+
}
|
|
139
|
+
.command-row {
|
|
140
|
+
display: flex;
|
|
141
|
+
align-items: center;
|
|
142
|
+
gap: 0.25rem;
|
|
143
|
+
}
|
|
144
|
+
.command-row code {
|
|
145
|
+
font-size: 0.75rem;
|
|
146
|
+
overflow-x: auto;
|
|
147
|
+
}
|
|
148
|
+
`}</style>
|
|
149
|
+
|
|
150
|
+
<div className="cards-container">
|
|
151
|
+
{filteredServers.map(server => {
|
|
152
|
+
const claudeCodeCommand = generateClaudeCodeCommand(server);
|
|
153
|
+
const mcpUrl = server.urls.http || server.urls.sse;
|
|
154
|
+
const commandToShow = platform === "claudeCode" ? claudeCodeCommand : mcpUrl;
|
|
155
|
+
return <div key={server.name} className="server-card">
|
|
156
|
+
<div>
|
|
157
|
+
{server.documentation ? <a href={server.documentation}>
|
|
158
|
+
<strong>{server.name}</strong>
|
|
159
|
+
</a> : <strong>{server.name}</strong>}
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<p style={{
|
|
163
|
+
margin: '0.5rem 0',
|
|
164
|
+
fontSize: '0.9rem'
|
|
165
|
+
}}>
|
|
166
|
+
{server.description}
|
|
167
|
+
</p>
|
|
168
|
+
|
|
169
|
+
{server.setupUrl && <p style={{
|
|
170
|
+
margin: '0.25rem 0',
|
|
171
|
+
fontSize: '0.8rem',
|
|
172
|
+
fontStyle: 'italic',
|
|
173
|
+
opacity: 0.7
|
|
174
|
+
}}>
|
|
175
|
+
Requires user-specific URL.{' '}
|
|
176
|
+
<a href={server.setupUrl} style={{
|
|
177
|
+
textDecoration: 'underline'
|
|
178
|
+
}}>
|
|
179
|
+
Get your URL here
|
|
180
|
+
</a>.
|
|
181
|
+
</p>}
|
|
182
|
+
|
|
183
|
+
{commandToShow && !server.setupUrl && <>
|
|
184
|
+
<p style={{
|
|
185
|
+
display: 'block',
|
|
186
|
+
fontSize: '0.75rem',
|
|
187
|
+
fontWeight: 500,
|
|
188
|
+
minWidth: 'fit-content',
|
|
189
|
+
marginTop: '0.5rem',
|
|
190
|
+
marginBottom: 0
|
|
191
|
+
}}>
|
|
192
|
+
{platform === "claudeCode" ? "Command" : "URL"}
|
|
193
|
+
</p>
|
|
194
|
+
<div className="command-row">
|
|
195
|
+
<code>
|
|
196
|
+
{commandToShow}
|
|
197
|
+
</code>
|
|
198
|
+
</div>
|
|
199
|
+
</>}
|
|
200
|
+
</div>;
|
|
201
|
+
})}
|
|
202
|
+
</div>
|
|
203
|
+
</>;
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
Claude Code can connect to hundreds of external tools and data sources through the [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction), an open source standard for AI-tool integrations. MCP servers give Claude Code access to your tools, databases, and APIs.
|
|
207
|
+
|
|
208
|
+
## What you can do with MCP
|
|
209
|
+
|
|
210
|
+
With MCP servers connected, you can ask Claude Code to:
|
|
211
|
+
|
|
212
|
+
* **Implement features from issue trackers**: "Add the feature described in JIRA issue ENG-4521 and create a PR on GitHub."
|
|
213
|
+
* **Analyze monitoring data**: "Check Sentry and Statsig to check the usage of the feature described in ENG-4521."
|
|
214
|
+
* **Query databases**: "Find emails of 10 random users who used feature ENG-4521, based on our PostgreSQL database."
|
|
215
|
+
* **Integrate designs**: "Update our standard email template based on the new Figma designs that were posted in Slack"
|
|
216
|
+
* **Automate workflows**: "Create Gmail drafts inviting these 10 users to a feedback session about the new feature."
|
|
217
|
+
|
|
218
|
+
## Popular MCP servers
|
|
219
|
+
|
|
220
|
+
Here are some commonly used MCP servers you can connect to Claude Code:
|
|
221
|
+
|
|
222
|
+
<Warning>
|
|
223
|
+
Use third party MCP servers at your own risk - Anthropic has not verified
|
|
224
|
+
the correctness or security of all these servers.
|
|
225
|
+
Make sure you trust MCP servers you are installing.
|
|
226
|
+
Be especially careful when using MCP servers that could fetch untrusted
|
|
227
|
+
content, as these can expose you to prompt injection risk.
|
|
228
|
+
</Warning>
|
|
229
|
+
|
|
230
|
+
<MCPServersTable platform="claudeCode" />
|
|
231
|
+
|
|
232
|
+
<Note>
|
|
233
|
+
**Need a specific integration?** [Find hundreds more MCP servers on GitHub](https://github.com/modelcontextprotocol/servers), or build your own using the [MCP SDK](https://modelcontextprotocol.io/quickstart/server).
|
|
234
|
+
</Note>
|
|
235
|
+
|
|
236
|
+
## Installing MCP servers
|
|
237
|
+
|
|
238
|
+
MCP servers can be configured in three different ways depending on your needs:
|
|
239
|
+
|
|
240
|
+
### Option 1: Add a remote HTTP server
|
|
241
|
+
|
|
242
|
+
HTTP servers are the recommended option for connecting to remote MCP servers. This is the most widely supported transport for cloud-based services.
|
|
243
|
+
|
|
244
|
+
```bash theme={null}
|
|
245
|
+
# Basic syntax
|
|
246
|
+
claude mcp add --transport http <name> <url>
|
|
247
|
+
|
|
248
|
+
# Real example: Connect to Notion
|
|
249
|
+
claude mcp add --transport http notion https://mcp.notion.com/mcp
|
|
250
|
+
|
|
251
|
+
# Example with Bearer token
|
|
252
|
+
claude mcp add --transport http secure-api https://api.example.com/mcp \
|
|
253
|
+
--header "Authorization: Bearer your-token"
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Option 2: Add a remote SSE server
|
|
257
|
+
|
|
258
|
+
<Warning>
|
|
259
|
+
The SSE (Server-Sent Events) transport is deprecated. Use HTTP servers instead, where available.
|
|
260
|
+
</Warning>
|
|
261
|
+
|
|
262
|
+
```bash theme={null}
|
|
263
|
+
# Basic syntax
|
|
264
|
+
claude mcp add --transport sse <name> <url>
|
|
265
|
+
|
|
266
|
+
# Real example: Connect to Asana
|
|
267
|
+
claude mcp add --transport sse asana https://mcp.asana.com/sse
|
|
268
|
+
|
|
269
|
+
# Example with authentication header
|
|
270
|
+
claude mcp add --transport sse private-api https://api.company.com/sse \
|
|
271
|
+
--header "X-API-Key: your-key-here"
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### Option 3: Add a local stdio server
|
|
275
|
+
|
|
276
|
+
Stdio servers run as local processes on your machine. They're ideal for tools that need direct system access or custom scripts.
|
|
277
|
+
|
|
278
|
+
```bash theme={null}
|
|
279
|
+
# Basic syntax
|
|
280
|
+
claude mcp add --transport stdio <name> <command> [args...]
|
|
281
|
+
|
|
282
|
+
# Real example: Add Airtable server
|
|
283
|
+
claude mcp add --transport stdio airtable --env AIRTABLE_API_KEY=YOUR_KEY \
|
|
284
|
+
-- npx -y airtable-mcp-server
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
<Note>
|
|
288
|
+
**Understanding the "--" parameter:**
|
|
289
|
+
The `--` (double dash) separates Claude's own CLI flags from the command and arguments that get passed to the MCP server. Everything before `--` are options for Claude (like `--env`, `--scope`), and everything after `--` is the actual command to run the MCP server.
|
|
290
|
+
|
|
291
|
+
For example:
|
|
292
|
+
|
|
293
|
+
* `claude mcp add --transport stdio myserver -- npx server` → runs `npx server`
|
|
294
|
+
* `claude mcp add --transport stdio myserver --env KEY=value -- python server.py --port 8080` → runs `python server.py --port 8080` with `KEY=value` in environment
|
|
295
|
+
|
|
296
|
+
This prevents conflicts between Claude's flags and the server's flags.
|
|
297
|
+
</Note>
|
|
298
|
+
|
|
299
|
+
### Managing your servers
|
|
300
|
+
|
|
301
|
+
Once configured, you can manage your MCP servers with these commands:
|
|
302
|
+
|
|
303
|
+
```bash theme={null}
|
|
304
|
+
# List all configured servers
|
|
305
|
+
claude mcp list
|
|
306
|
+
|
|
307
|
+
# Get details for a specific server
|
|
308
|
+
claude mcp get github
|
|
309
|
+
|
|
310
|
+
# Remove a server
|
|
311
|
+
claude mcp remove github
|
|
312
|
+
|
|
313
|
+
# (within Claude Code) Check server status
|
|
314
|
+
/mcp
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
<Tip>
|
|
318
|
+
Tips:
|
|
319
|
+
|
|
320
|
+
* Use the `--scope` flag to specify where the configuration is stored:
|
|
321
|
+
* `local` (default): Available only to you in the current project (was called `project` in older versions)
|
|
322
|
+
* `project`: Shared with everyone in the project via `.mcp.json` file
|
|
323
|
+
* `user`: Available to you across all projects (was called `global` in older versions)
|
|
324
|
+
* Set environment variables with `--env` flags (for example, `--env KEY=value`)
|
|
325
|
+
* Configure MCP server startup timeout using the MCP\_TIMEOUT environment variable (for example, `MCP_TIMEOUT=10000 claude` sets a 10-second timeout)
|
|
326
|
+
* Claude Code will display a warning when MCP tool output exceeds 10,000 tokens. To increase this limit, set the `MAX_MCP_OUTPUT_TOKENS` environment variable (for example, `MAX_MCP_OUTPUT_TOKENS=50000`)
|
|
327
|
+
* Use `/mcp` to authenticate with remote servers that require OAuth 2.0 authentication
|
|
328
|
+
</Tip>
|
|
329
|
+
|
|
330
|
+
<Warning>
|
|
331
|
+
**Windows Users**: On native Windows (not WSL), local MCP servers that use `npx` require the `cmd /c` wrapper to ensure proper execution.
|
|
332
|
+
|
|
333
|
+
```bash theme={null}
|
|
334
|
+
# This creates command="cmd" which Windows can execute
|
|
335
|
+
claude mcp add --transport stdio my-server -- cmd /c npx -y @some/package
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
Without the `cmd /c` wrapper, you'll encounter "Connection closed" errors because Windows cannot directly execute `npx`. (See the note above for an explanation of the `--` parameter.)
|
|
339
|
+
</Warning>
|
|
340
|
+
|
|
341
|
+
### Plugin-provided MCP servers
|
|
342
|
+
|
|
343
|
+
[Plugins](/en/plugins) can bundle MCP servers, automatically providing tools and integrations when the plugin is enabled. Plugin MCP servers work identically to user-configured servers.
|
|
344
|
+
|
|
345
|
+
**How plugin MCP servers work**:
|
|
346
|
+
|
|
347
|
+
* Plugins define MCP servers in `.mcp.json` at the plugin root or inline in `plugin.json`
|
|
348
|
+
* When a plugin is enabled, its MCP servers start automatically
|
|
349
|
+
* Plugin MCP tools appear alongside manually configured MCP tools
|
|
350
|
+
* Plugin servers are managed through plugin installation (not `/mcp` commands)
|
|
351
|
+
|
|
352
|
+
**Example plugin MCP configuration**:
|
|
353
|
+
|
|
354
|
+
In `.mcp.json` at plugin root:
|
|
355
|
+
|
|
356
|
+
```json theme={null}
|
|
357
|
+
{
|
|
358
|
+
"database-tools": {
|
|
359
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/servers/db-server",
|
|
360
|
+
"args": ["--config", "${CLAUDE_PLUGIN_ROOT}/config.json"],
|
|
361
|
+
"env": {
|
|
362
|
+
"DB_URL": "${DB_URL}"
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
Or inline in `plugin.json`:
|
|
369
|
+
|
|
370
|
+
```json theme={null}
|
|
371
|
+
{
|
|
372
|
+
"name": "my-plugin",
|
|
373
|
+
"mcpServers": {
|
|
374
|
+
"plugin-api": {
|
|
375
|
+
"command": "${CLAUDE_PLUGIN_ROOT}/servers/api-server",
|
|
376
|
+
"args": ["--port", "8080"]
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
**Plugin MCP features**:
|
|
383
|
+
|
|
384
|
+
* **Automatic lifecycle**: Servers start when plugin enables, but you must restart Claude Code to apply MCP server changes (enabling or disabling)
|
|
385
|
+
* **Environment variables**: Use `${CLAUDE_PLUGIN_ROOT}` for plugin-relative paths
|
|
386
|
+
* **User environment access**: Access to same environment variables as manually configured servers
|
|
387
|
+
* **Multiple transport types**: Support stdio, SSE, and HTTP transports (transport support may vary by server)
|
|
388
|
+
|
|
389
|
+
**Viewing plugin MCP servers**:
|
|
390
|
+
|
|
391
|
+
```bash theme={null}
|
|
392
|
+
# Within Claude Code, see all MCP servers including plugin ones
|
|
393
|
+
/mcp
|
|
394
|
+
```
|
|
395
|
+
|
|
396
|
+
Plugin servers appear in the list with indicators showing they come from plugins.
|
|
397
|
+
|
|
398
|
+
**Benefits of plugin MCP servers**:
|
|
399
|
+
|
|
400
|
+
* **Bundled distribution**: Tools and servers packaged together
|
|
401
|
+
* **Automatic setup**: No manual MCP configuration needed
|
|
402
|
+
* **Team consistency**: Everyone gets the same tools when plugin is installed
|
|
403
|
+
|
|
404
|
+
See the [plugin components reference](/en/plugins-reference#mcp-servers) for details on bundling MCP servers with plugins.
|
|
405
|
+
|
|
406
|
+
## MCP installation scopes
|
|
407
|
+
|
|
408
|
+
MCP servers can be configured at three different scope levels, each serving distinct purposes for managing server accessibility and sharing. Understanding these scopes helps you determine the best way to configure servers for your specific needs.
|
|
409
|
+
|
|
410
|
+
### Local scope
|
|
411
|
+
|
|
412
|
+
Local-scoped servers represent the default configuration level and are stored in `~/.claude.json` under your project's path. These servers remain private to you and are only accessible when working within the current project directory. This scope is ideal for personal development servers, experimental configurations, or servers containing sensitive credentials that shouldn't be shared.
|
|
413
|
+
|
|
414
|
+
```bash theme={null}
|
|
415
|
+
# Add a local-scoped server (default)
|
|
416
|
+
claude mcp add --transport http stripe https://mcp.stripe.com
|
|
417
|
+
|
|
418
|
+
# Explicitly specify local scope
|
|
419
|
+
claude mcp add --transport http stripe --scope local https://mcp.stripe.com
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
### Project scope
|
|
423
|
+
|
|
424
|
+
Project-scoped servers enable team collaboration by storing configurations in a `.mcp.json` file at your project's root directory. This file is designed to be checked into version control, ensuring all team members have access to the same MCP tools and services. When you add a project-scoped server, Claude Code automatically creates or updates this file with the appropriate configuration structure.
|
|
425
|
+
|
|
426
|
+
```bash theme={null}
|
|
427
|
+
# Add a project-scoped server
|
|
428
|
+
claude mcp add --transport http paypal --scope project https://mcp.paypal.com/mcp
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
The resulting `.mcp.json` file follows a standardized format:
|
|
432
|
+
|
|
433
|
+
```json theme={null}
|
|
434
|
+
{
|
|
435
|
+
"mcpServers": {
|
|
436
|
+
"shared-server": {
|
|
437
|
+
"command": "/path/to/server",
|
|
438
|
+
"args": [],
|
|
439
|
+
"env": {}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
For security reasons, Claude Code prompts for approval before using project-scoped servers from `.mcp.json` files. If you need to reset these approval choices, use the `claude mcp reset-project-choices` command.
|
|
446
|
+
|
|
447
|
+
### User scope
|
|
448
|
+
|
|
449
|
+
User-scoped servers are stored in `~/.claude.json` and provide cross-project accessibility, making them available across all projects on your machine while remaining private to your user account. This scope works well for personal utility servers, development tools, or services you frequently use across different projects.
|
|
450
|
+
|
|
451
|
+
```bash theme={null}
|
|
452
|
+
# Add a user server
|
|
453
|
+
claude mcp add --transport http hubspot --scope user https://mcp.hubspot.com/anthropic
|
|
454
|
+
```
|
|
455
|
+
|
|
456
|
+
### Choosing the right scope
|
|
457
|
+
|
|
458
|
+
Select your scope based on:
|
|
459
|
+
|
|
460
|
+
* **Local scope**: Personal servers, experimental configurations, or sensitive credentials specific to one project
|
|
461
|
+
* **Project scope**: Team-shared servers, project-specific tools, or services required for collaboration
|
|
462
|
+
* **User scope**: Personal utilities needed across multiple projects, development tools, or frequently used services
|
|
463
|
+
|
|
464
|
+
<Note>
|
|
465
|
+
**Where are MCP servers stored?**
|
|
466
|
+
|
|
467
|
+
* **User and local scope**: `~/.claude.json` (in the `mcpServers` field or under project paths)
|
|
468
|
+
* **Project scope**: `.mcp.json` in your project root (checked into source control)
|
|
469
|
+
* **Enterprise managed**: `managed-mcp.json` in system directories (see [Enterprise MCP configuration](#enterprise-mcp-configuration))
|
|
470
|
+
</Note>
|
|
471
|
+
|
|
472
|
+
### Scope hierarchy and precedence
|
|
473
|
+
|
|
474
|
+
MCP server configurations follow a clear precedence hierarchy. When servers with the same name exist at multiple scopes, the system resolves conflicts by prioritizing local-scoped servers first, followed by project-scoped servers, and finally user-scoped servers. This design ensures that personal configurations can override shared ones when needed.
|
|
475
|
+
|
|
476
|
+
### Environment variable expansion in `.mcp.json`
|
|
477
|
+
|
|
478
|
+
Claude Code supports environment variable expansion in `.mcp.json` files, allowing teams to share configurations while maintaining flexibility for machine-specific paths and sensitive values like API keys.
|
|
479
|
+
|
|
480
|
+
**Supported syntax:**
|
|
481
|
+
|
|
482
|
+
* `${VAR}` - Expands to the value of environment variable `VAR`
|
|
483
|
+
* `${VAR:-default}` - Expands to `VAR` if set, otherwise uses `default`
|
|
484
|
+
|
|
485
|
+
**Expansion locations:**
|
|
486
|
+
Environment variables can be expanded in:
|
|
487
|
+
|
|
488
|
+
* `command` - The server executable path
|
|
489
|
+
* `args` - Command-line arguments
|
|
490
|
+
* `env` - Environment variables passed to the server
|
|
491
|
+
* `url` - For HTTP server types
|
|
492
|
+
* `headers` - For HTTP server authentication
|
|
493
|
+
|
|
494
|
+
**Example with variable expansion:**
|
|
495
|
+
|
|
496
|
+
```json theme={null}
|
|
497
|
+
{
|
|
498
|
+
"mcpServers": {
|
|
499
|
+
"api-server": {
|
|
500
|
+
"type": "http",
|
|
501
|
+
"url": "${API_BASE_URL:-https://api.example.com}/mcp",
|
|
502
|
+
"headers": {
|
|
503
|
+
"Authorization": "Bearer ${API_KEY}"
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
```
|
|
509
|
+
|
|
510
|
+
If a required environment variable is not set and has no default value, Claude Code will fail to parse the config.
|
|
511
|
+
|
|
512
|
+
## Practical examples
|
|
513
|
+
|
|
514
|
+
{/* ### Example: Automate browser testing with Playwright
|
|
515
|
+
|
|
516
|
+
```bash
|
|
517
|
+
# 1. Add the Playwright MCP server
|
|
518
|
+
claude mcp add --transport stdio playwright -- npx -y @playwright/mcp@latest
|
|
519
|
+
|
|
520
|
+
# 2. Write and run browser tests
|
|
521
|
+
> "Test if the login flow works with test@example.com"
|
|
522
|
+
> "Take a screenshot of the checkout page on mobile"
|
|
523
|
+
> "Verify that the search feature returns results"
|
|
524
|
+
``` */}
|
|
525
|
+
|
|
526
|
+
### Example: Monitor errors with Sentry
|
|
527
|
+
|
|
528
|
+
```bash theme={null}
|
|
529
|
+
# 1. Add the Sentry MCP server
|
|
530
|
+
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
|
|
531
|
+
|
|
532
|
+
# 2. Use /mcp to authenticate with your Sentry account
|
|
533
|
+
> /mcp
|
|
534
|
+
|
|
535
|
+
# 3. Debug production issues
|
|
536
|
+
> "What are the most common errors in the last 24 hours?"
|
|
537
|
+
> "Show me the stack trace for error ID abc123"
|
|
538
|
+
> "Which deployment introduced these new errors?"
|
|
539
|
+
```
|
|
540
|
+
|
|
541
|
+
### Example: Connect to GitHub for code reviews
|
|
542
|
+
|
|
543
|
+
```bash theme={null}
|
|
544
|
+
# 1. Add the GitHub MCP server
|
|
545
|
+
claude mcp add --transport http github https://api.githubcopilot.com/mcp/
|
|
546
|
+
|
|
547
|
+
# 2. In Claude Code, authenticate if needed
|
|
548
|
+
> /mcp
|
|
549
|
+
# Select "Authenticate" for GitHub
|
|
550
|
+
|
|
551
|
+
# 3. Now you can ask Claude to work with GitHub
|
|
552
|
+
> "Review PR #456 and suggest improvements"
|
|
553
|
+
> "Create a new issue for the bug we just found"
|
|
554
|
+
> "Show me all open PRs assigned to me"
|
|
555
|
+
```
|
|
556
|
+
|
|
557
|
+
### Example: Query your PostgreSQL database
|
|
558
|
+
|
|
559
|
+
```bash theme={null}
|
|
560
|
+
# 1. Add the database server with your connection string
|
|
561
|
+
claude mcp add --transport stdio db -- npx -y @bytebase/dbhub \
|
|
562
|
+
--dsn "postgresql://readonly:pass@prod.db.com:5432/analytics"
|
|
563
|
+
|
|
564
|
+
# 2. Query your database naturally
|
|
565
|
+
> "What's our total revenue this month?"
|
|
566
|
+
> "Show me the schema for the orders table"
|
|
567
|
+
> "Find customers who haven't made a purchase in 90 days"
|
|
568
|
+
```
|
|
569
|
+
|
|
570
|
+
## Authenticate with remote MCP servers
|
|
571
|
+
|
|
572
|
+
Many cloud-based MCP servers require authentication. Claude Code supports OAuth 2.0 for secure connections.
|
|
573
|
+
|
|
574
|
+
<Steps>
|
|
575
|
+
<Step title="Add the server that requires authentication">
|
|
576
|
+
For example:
|
|
577
|
+
|
|
578
|
+
```bash theme={null}
|
|
579
|
+
claude mcp add --transport http sentry https://mcp.sentry.dev/mcp
|
|
580
|
+
```
|
|
581
|
+
</Step>
|
|
582
|
+
|
|
583
|
+
<Step title="Use the /mcp command within Claude Code">
|
|
584
|
+
In Claude code, use the command:
|
|
585
|
+
|
|
586
|
+
```
|
|
587
|
+
> /mcp
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
Then follow the steps in your browser to login.
|
|
591
|
+
</Step>
|
|
592
|
+
</Steps>
|
|
593
|
+
|
|
594
|
+
<Tip>
|
|
595
|
+
Tips:
|
|
596
|
+
|
|
597
|
+
* Authentication tokens are stored securely and refreshed automatically
|
|
598
|
+
* Use "Clear authentication" in the `/mcp` menu to revoke access
|
|
599
|
+
* If your browser doesn't open automatically, copy the provided URL
|
|
600
|
+
* OAuth authentication works with HTTP servers
|
|
601
|
+
</Tip>
|
|
602
|
+
|
|
603
|
+
## Add MCP servers from JSON configuration
|
|
604
|
+
|
|
605
|
+
If you have a JSON configuration for an MCP server, you can add it directly:
|
|
606
|
+
|
|
607
|
+
<Steps>
|
|
608
|
+
<Step title="Add an MCP server from JSON">
|
|
609
|
+
```bash theme={null}
|
|
610
|
+
# Basic syntax
|
|
611
|
+
claude mcp add-json <name> '<json>'
|
|
612
|
+
|
|
613
|
+
# Example: Adding an HTTP server with JSON configuration
|
|
614
|
+
claude mcp add-json weather-api '{"type":"http","url":"https://api.weather.com/mcp","headers":{"Authorization":"Bearer token"}}'
|
|
615
|
+
|
|
616
|
+
# Example: Adding a stdio server with JSON configuration
|
|
617
|
+
claude mcp add-json local-weather '{"type":"stdio","command":"/path/to/weather-cli","args":["--api-key","abc123"],"env":{"CACHE_DIR":"/tmp"}}'
|
|
618
|
+
```
|
|
619
|
+
</Step>
|
|
620
|
+
|
|
621
|
+
<Step title="Verify the server was added">
|
|
622
|
+
```bash theme={null}
|
|
623
|
+
claude mcp get weather-api
|
|
624
|
+
```
|
|
625
|
+
</Step>
|
|
626
|
+
</Steps>
|
|
627
|
+
|
|
628
|
+
<Tip>
|
|
629
|
+
Tips:
|
|
630
|
+
|
|
631
|
+
* Make sure the JSON is properly escaped in your shell
|
|
632
|
+
* The JSON must conform to the MCP server configuration schema
|
|
633
|
+
* You can use `--scope user` to add the server to your user configuration instead of the project-specific one
|
|
634
|
+
</Tip>
|
|
635
|
+
|
|
636
|
+
## Import MCP servers from Claude Desktop
|
|
637
|
+
|
|
638
|
+
If you've already configured MCP servers in Claude Desktop, you can import them:
|
|
639
|
+
|
|
640
|
+
<Steps>
|
|
641
|
+
<Step title="Import servers from Claude Desktop">
|
|
642
|
+
```bash theme={null}
|
|
643
|
+
# Basic syntax
|
|
644
|
+
claude mcp add-from-claude-desktop
|
|
645
|
+
```
|
|
646
|
+
</Step>
|
|
647
|
+
|
|
648
|
+
<Step title="Select which servers to import">
|
|
649
|
+
After running the command, you'll see an interactive dialog that allows you to select which servers you want to import.
|
|
650
|
+
</Step>
|
|
651
|
+
|
|
652
|
+
<Step title="Verify the servers were imported">
|
|
653
|
+
```bash theme={null}
|
|
654
|
+
claude mcp list
|
|
655
|
+
```
|
|
656
|
+
</Step>
|
|
657
|
+
</Steps>
|
|
658
|
+
|
|
659
|
+
<Tip>
|
|
660
|
+
Tips:
|
|
661
|
+
|
|
662
|
+
* This feature only works on macOS and Windows Subsystem for Linux (WSL)
|
|
663
|
+
* It reads the Claude Desktop configuration file from its standard location on those platforms
|
|
664
|
+
* Use the `--scope user` flag to add servers to your user configuration
|
|
665
|
+
* Imported servers will have the same names as in Claude Desktop
|
|
666
|
+
* If servers with the same names already exist, they will get a numerical suffix (for example, `server_1`)
|
|
667
|
+
</Tip>
|
|
668
|
+
|
|
669
|
+
## Use Claude Code as an MCP server
|
|
670
|
+
|
|
671
|
+
You can use Claude Code itself as an MCP server that other applications can connect to:
|
|
672
|
+
|
|
673
|
+
```bash theme={null}
|
|
674
|
+
# Start Claude as a stdio MCP server
|
|
675
|
+
claude mcp serve
|
|
676
|
+
```
|
|
677
|
+
|
|
678
|
+
You can use this in Claude Desktop by adding this configuration to claude\_desktop\_config.json:
|
|
679
|
+
|
|
680
|
+
```json theme={null}
|
|
681
|
+
{
|
|
682
|
+
"mcpServers": {
|
|
683
|
+
"claude-code": {
|
|
684
|
+
"type": "stdio",
|
|
685
|
+
"command": "claude",
|
|
686
|
+
"args": ["mcp", "serve"],
|
|
687
|
+
"env": {}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
<Warning>
|
|
694
|
+
**Configuring the executable path**: The `command` field must reference the Claude Code executable. If the `claude` command is not in your system's PATH, you'll need to specify the full path to the executable.
|
|
695
|
+
|
|
696
|
+
To find the full path:
|
|
697
|
+
|
|
698
|
+
```bash theme={null}
|
|
699
|
+
which claude
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
Then use the full path in your configuration:
|
|
703
|
+
|
|
704
|
+
```json theme={null}
|
|
705
|
+
{
|
|
706
|
+
"mcpServers": {
|
|
707
|
+
"claude-code": {
|
|
708
|
+
"type": "stdio",
|
|
709
|
+
"command": "/full/path/to/claude",
|
|
710
|
+
"args": ["mcp", "serve"],
|
|
711
|
+
"env": {}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
Without the correct executable path, you'll encounter errors like `spawn claude ENOENT`.
|
|
718
|
+
</Warning>
|
|
719
|
+
|
|
720
|
+
<Tip>
|
|
721
|
+
Tips:
|
|
722
|
+
|
|
723
|
+
* The server provides access to Claude's tools like View, Edit, LS, etc.
|
|
724
|
+
* In Claude Desktop, try asking Claude to read files in a directory, make edits, and more.
|
|
725
|
+
* Note that this MCP server is only exposing Claude Code's tools to your MCP client, so your own client is responsible for implementing user confirmation for individual tool calls.
|
|
726
|
+
</Tip>
|
|
727
|
+
|
|
728
|
+
## MCP output limits and warnings
|
|
729
|
+
|
|
730
|
+
When MCP tools produce large outputs, Claude Code helps manage the token usage to prevent overwhelming your conversation context:
|
|
731
|
+
|
|
732
|
+
* **Output warning threshold**: Claude Code displays a warning when any MCP tool output exceeds 10,000 tokens
|
|
733
|
+
* **Configurable limit**: You can adjust the maximum allowed MCP output tokens using the `MAX_MCP_OUTPUT_TOKENS` environment variable
|
|
734
|
+
* **Default limit**: The default maximum is 25,000 tokens
|
|
735
|
+
|
|
736
|
+
To increase the limit for tools that produce large outputs:
|
|
737
|
+
|
|
738
|
+
```bash theme={null}
|
|
739
|
+
# Set a higher limit for MCP tool outputs
|
|
740
|
+
export MAX_MCP_OUTPUT_TOKENS=50000
|
|
741
|
+
claude
|
|
742
|
+
```
|
|
743
|
+
|
|
744
|
+
This is particularly useful when working with MCP servers that:
|
|
745
|
+
|
|
746
|
+
* Query large datasets or databases
|
|
747
|
+
* Generate detailed reports or documentation
|
|
748
|
+
* Process extensive log files or debugging information
|
|
749
|
+
|
|
750
|
+
<Warning>
|
|
751
|
+
If you frequently encounter output warnings with specific MCP servers, consider increasing the limit or configuring the server to paginate or filter its responses.
|
|
752
|
+
</Warning>
|
|
753
|
+
|
|
754
|
+
## Use MCP resources
|
|
755
|
+
|
|
756
|
+
MCP servers can expose resources that you can reference using @ mentions, similar to how you reference files.
|
|
757
|
+
|
|
758
|
+
### Reference MCP resources
|
|
759
|
+
|
|
760
|
+
<Steps>
|
|
761
|
+
<Step title="List available resources">
|
|
762
|
+
Type `@` in your prompt to see available resources from all connected MCP servers. Resources appear alongside files in the autocomplete menu.
|
|
763
|
+
</Step>
|
|
764
|
+
|
|
765
|
+
<Step title="Reference a specific resource">
|
|
766
|
+
Use the format `@server:protocol://resource/path` to reference a resource:
|
|
767
|
+
|
|
768
|
+
```
|
|
769
|
+
> Can you analyze @github:issue://123 and suggest a fix?
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
```
|
|
773
|
+
> Please review the API documentation at @docs:file://api/authentication
|
|
774
|
+
```
|
|
775
|
+
</Step>
|
|
776
|
+
|
|
777
|
+
<Step title="Multiple resource references">
|
|
778
|
+
You can reference multiple resources in a single prompt:
|
|
779
|
+
|
|
780
|
+
```
|
|
781
|
+
> Compare @postgres:schema://users with @docs:file://database/user-model
|
|
782
|
+
```
|
|
783
|
+
</Step>
|
|
784
|
+
</Steps>
|
|
785
|
+
|
|
786
|
+
<Tip>
|
|
787
|
+
Tips:
|
|
788
|
+
|
|
789
|
+
* Resources are automatically fetched and included as attachments when referenced
|
|
790
|
+
* Resource paths are fuzzy-searchable in the @ mention autocomplete
|
|
791
|
+
* Claude Code automatically provides tools to list and read MCP resources when servers support them
|
|
792
|
+
* Resources can contain any type of content that the MCP server provides (text, JSON, structured data, etc.)
|
|
793
|
+
</Tip>
|
|
794
|
+
|
|
795
|
+
## Use MCP prompts as slash commands
|
|
796
|
+
|
|
797
|
+
MCP servers can expose prompts that become available as slash commands in Claude Code.
|
|
798
|
+
|
|
799
|
+
### Execute MCP prompts
|
|
800
|
+
|
|
801
|
+
<Steps>
|
|
802
|
+
<Step title="Discover available prompts">
|
|
803
|
+
Type `/` to see all available commands, including those from MCP servers. MCP prompts appear with the format `/mcp__servername__promptname`.
|
|
804
|
+
</Step>
|
|
805
|
+
|
|
806
|
+
<Step title="Execute a prompt without arguments">
|
|
807
|
+
```
|
|
808
|
+
> /mcp__github__list_prs
|
|
809
|
+
```
|
|
810
|
+
</Step>
|
|
811
|
+
|
|
812
|
+
<Step title="Execute a prompt with arguments">
|
|
813
|
+
Many prompts accept arguments. Pass them space-separated after the command:
|
|
814
|
+
|
|
815
|
+
```
|
|
816
|
+
> /mcp__github__pr_review 456
|
|
817
|
+
```
|
|
818
|
+
|
|
819
|
+
```
|
|
820
|
+
> /mcp__jira__create_issue "Bug in login flow" high
|
|
821
|
+
```
|
|
822
|
+
</Step>
|
|
823
|
+
</Steps>
|
|
824
|
+
|
|
825
|
+
<Tip>
|
|
826
|
+
Tips:
|
|
827
|
+
|
|
828
|
+
* MCP prompts are dynamically discovered from connected servers
|
|
829
|
+
* Arguments are parsed based on the prompt's defined parameters
|
|
830
|
+
* Prompt results are injected directly into the conversation
|
|
831
|
+
* Server and prompt names are normalized (spaces become underscores)
|
|
832
|
+
</Tip>
|
|
833
|
+
|
|
834
|
+
## Enterprise MCP configuration
|
|
835
|
+
|
|
836
|
+
For organizations that need centralized control over MCP servers, Claude Code supports two enterprise configuration options:
|
|
837
|
+
|
|
838
|
+
1. **Exclusive control with `managed-mcp.json`**: Deploy a fixed set of MCP servers that users cannot modify or extend
|
|
839
|
+
2. **Policy-based control with allowlists/denylists**: Allow users to add their own servers, but restrict which ones are permitted
|
|
840
|
+
|
|
841
|
+
These options allow IT administrators to:
|
|
842
|
+
|
|
843
|
+
* **Control which MCP servers employees can access**: Deploy a standardized set of approved MCP servers across the organization
|
|
844
|
+
* **Prevent unauthorized MCP servers**: Restrict users from adding unapproved MCP servers
|
|
845
|
+
* **Disable MCP entirely**: Remove MCP functionality completely if needed
|
|
846
|
+
|
|
847
|
+
### Option 1: Exclusive control with managed-mcp.json
|
|
848
|
+
|
|
849
|
+
When you deploy a `managed-mcp.json` file, it takes **exclusive control** over all MCP servers. Users cannot add, modify, or use any MCP servers other than those defined in this file. This is the simplest approach for organizations that want complete control.
|
|
850
|
+
|
|
851
|
+
System administrators deploy the configuration file to a system-wide directory:
|
|
852
|
+
|
|
853
|
+
* macOS: `/Library/Application Support/ClaudeCode/managed-mcp.json`
|
|
854
|
+
* Linux and WSL: `/etc/claude-code/managed-mcp.json`
|
|
855
|
+
* Windows: `C:\Program Files\ClaudeCode\managed-mcp.json`
|
|
856
|
+
|
|
857
|
+
<Note>
|
|
858
|
+
These are system-wide paths (not user home directories like `~/Library/...`) that require administrator privileges. They are designed to be deployed by IT administrators.
|
|
859
|
+
</Note>
|
|
860
|
+
|
|
861
|
+
The `managed-mcp.json` file uses the same format as a standard `.mcp.json` file:
|
|
862
|
+
|
|
863
|
+
```json theme={null}
|
|
864
|
+
{
|
|
865
|
+
"mcpServers": {
|
|
866
|
+
"github": {
|
|
867
|
+
"type": "http",
|
|
868
|
+
"url": "https://api.githubcopilot.com/mcp/"
|
|
869
|
+
},
|
|
870
|
+
"sentry": {
|
|
871
|
+
"type": "http",
|
|
872
|
+
"url": "https://mcp.sentry.dev/mcp"
|
|
873
|
+
},
|
|
874
|
+
"company-internal": {
|
|
875
|
+
"type": "stdio",
|
|
876
|
+
"command": "/usr/local/bin/company-mcp-server",
|
|
877
|
+
"args": ["--config", "/etc/company/mcp-config.json"],
|
|
878
|
+
"env": {
|
|
879
|
+
"COMPANY_API_URL": "https://internal.company.com"
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
```
|
|
885
|
+
|
|
886
|
+
### Option 2: Policy-based control with allowlists and denylists
|
|
887
|
+
|
|
888
|
+
Instead of taking exclusive control, administrators can allow users to configure their own MCP servers while enforcing restrictions on which servers are permitted. This approach uses `allowedMcpServers` and `deniedMcpServers` in the [managed settings file](/en/settings#settings-files).
|
|
889
|
+
|
|
890
|
+
<Note>
|
|
891
|
+
**Choosing between options**: Use Option 1 (`managed-mcp.json`) when you want to deploy a fixed set of servers with no user customization. Use Option 2 (allowlists/denylists) when you want to allow users to add their own servers within policy constraints.
|
|
892
|
+
</Note>
|
|
893
|
+
|
|
894
|
+
#### Restriction options
|
|
895
|
+
|
|
896
|
+
Each entry in the allowlist or denylist can restrict servers in three ways:
|
|
897
|
+
|
|
898
|
+
1. **By server name** (`serverName`): Matches the configured name of the server
|
|
899
|
+
2. **By command** (`serverCommand`): Matches the exact command and arguments used to start stdio servers
|
|
900
|
+
3. **By URL pattern** (`serverUrl`): Matches remote server URLs with wildcard support
|
|
901
|
+
|
|
902
|
+
**Important**: Each entry must have exactly one of `serverName`, `serverCommand`, or `serverUrl`.
|
|
903
|
+
|
|
904
|
+
#### Example configuration
|
|
905
|
+
|
|
906
|
+
```json theme={null}
|
|
907
|
+
{
|
|
908
|
+
"allowedMcpServers": [
|
|
909
|
+
// Allow by server name
|
|
910
|
+
{ "serverName": "github" },
|
|
911
|
+
{ "serverName": "sentry" },
|
|
912
|
+
|
|
913
|
+
// Allow by exact command (for stdio servers)
|
|
914
|
+
{ "serverCommand": ["npx", "-y", "@modelcontextprotocol/server-filesystem"] },
|
|
915
|
+
{ "serverCommand": ["python", "/usr/local/bin/approved-server.py"] },
|
|
916
|
+
|
|
917
|
+
// Allow by URL pattern (for remote servers)
|
|
918
|
+
{ "serverUrl": "https://mcp.company.com/*" },
|
|
919
|
+
{ "serverUrl": "https://*.internal.corp/*" }
|
|
920
|
+
],
|
|
921
|
+
"deniedMcpServers": [
|
|
922
|
+
// Block by server name
|
|
923
|
+
{ "serverName": "dangerous-server" },
|
|
924
|
+
|
|
925
|
+
// Block by exact command (for stdio servers)
|
|
926
|
+
{ "serverCommand": ["npx", "-y", "unapproved-package"] },
|
|
927
|
+
|
|
928
|
+
// Block by URL pattern (for remote servers)
|
|
929
|
+
{ "serverUrl": "https://*.untrusted.com/*" }
|
|
930
|
+
]
|
|
931
|
+
}
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
#### How command-based restrictions work
|
|
935
|
+
|
|
936
|
+
**Exact matching**:
|
|
937
|
+
|
|
938
|
+
* Command arrays must match **exactly** - both the command and all arguments in the correct order
|
|
939
|
+
* Example: `["npx", "-y", "server"]` will NOT match `["npx", "server"]` or `["npx", "-y", "server", "--flag"]`
|
|
940
|
+
|
|
941
|
+
**Stdio server behavior**:
|
|
942
|
+
|
|
943
|
+
* When the allowlist contains **any** `serverCommand` entries, stdio servers **must** match one of those commands
|
|
944
|
+
* Stdio servers cannot pass by name alone when command restrictions are present
|
|
945
|
+
* This ensures administrators can enforce which commands are allowed to run
|
|
946
|
+
|
|
947
|
+
**Non-stdio server behavior**:
|
|
948
|
+
|
|
949
|
+
* Remote servers (HTTP, SSE, WebSocket) use URL-based matching when `serverUrl` entries exist in the allowlist
|
|
950
|
+
* If no URL entries exist, remote servers fall back to name-based matching
|
|
951
|
+
* Command restrictions do not apply to remote servers
|
|
952
|
+
|
|
953
|
+
#### How URL-based restrictions work
|
|
954
|
+
|
|
955
|
+
URL patterns support wildcards using `*` to match any sequence of characters. This is useful for allowing entire domains or subdomains.
|
|
956
|
+
|
|
957
|
+
**Wildcard examples**:
|
|
958
|
+
|
|
959
|
+
* `https://mcp.company.com/*` - Allow all paths on a specific domain
|
|
960
|
+
* `https://*.example.com/*` - Allow any subdomain of example.com
|
|
961
|
+
* `http://localhost:*/*` - Allow any port on localhost
|
|
962
|
+
|
|
963
|
+
**Remote server behavior**:
|
|
964
|
+
|
|
965
|
+
* When the allowlist contains **any** `serverUrl` entries, remote servers **must** match one of those URL patterns
|
|
966
|
+
* Remote servers cannot pass by name alone when URL restrictions are present
|
|
967
|
+
* This ensures administrators can enforce which remote endpoints are allowed
|
|
968
|
+
|
|
969
|
+
<Accordion title="Example: URL-only allowlist">
|
|
970
|
+
```json theme={null}
|
|
971
|
+
{
|
|
972
|
+
"allowedMcpServers": [
|
|
973
|
+
{ "serverUrl": "https://mcp.company.com/*" },
|
|
974
|
+
{ "serverUrl": "https://*.internal.corp/*" }
|
|
975
|
+
]
|
|
976
|
+
}
|
|
977
|
+
```
|
|
978
|
+
|
|
979
|
+
**Result**:
|
|
980
|
+
|
|
981
|
+
* HTTP server at `https://mcp.company.com/api`: ✅ Allowed (matches URL pattern)
|
|
982
|
+
* HTTP server at `https://api.internal.corp/mcp`: ✅ Allowed (matches wildcard subdomain)
|
|
983
|
+
* HTTP server at `https://external.com/mcp`: ❌ Blocked (doesn't match any URL pattern)
|
|
984
|
+
* Stdio server with any command: ❌ Blocked (no name or command entries to match)
|
|
985
|
+
</Accordion>
|
|
986
|
+
|
|
987
|
+
<Accordion title="Example: Command-only allowlist">
|
|
988
|
+
```json theme={null}
|
|
989
|
+
{
|
|
990
|
+
"allowedMcpServers": [
|
|
991
|
+
{ "serverCommand": ["npx", "-y", "approved-package"] }
|
|
992
|
+
]
|
|
993
|
+
}
|
|
994
|
+
```
|
|
995
|
+
|
|
996
|
+
**Result**:
|
|
997
|
+
|
|
998
|
+
* Stdio server with `["npx", "-y", "approved-package"]`: ✅ Allowed (matches command)
|
|
999
|
+
* Stdio server with `["node", "server.js"]`: ❌ Blocked (doesn't match command)
|
|
1000
|
+
* HTTP server named "my-api": ❌ Blocked (no name entries to match)
|
|
1001
|
+
</Accordion>
|
|
1002
|
+
|
|
1003
|
+
<Accordion title="Example: Mixed name and command allowlist">
|
|
1004
|
+
```json theme={null}
|
|
1005
|
+
{
|
|
1006
|
+
"allowedMcpServers": [
|
|
1007
|
+
{ "serverName": "github" },
|
|
1008
|
+
{ "serverCommand": ["npx", "-y", "approved-package"] }
|
|
1009
|
+
]
|
|
1010
|
+
}
|
|
1011
|
+
```
|
|
1012
|
+
|
|
1013
|
+
**Result**:
|
|
1014
|
+
|
|
1015
|
+
* Stdio server named "local-tool" with `["npx", "-y", "approved-package"]`: ✅ Allowed (matches command)
|
|
1016
|
+
* Stdio server named "local-tool" with `["node", "server.js"]`: ❌ Blocked (command entries exist but doesn't match)
|
|
1017
|
+
* Stdio server named "github" with `["node", "server.js"]`: ❌ Blocked (stdio servers must match commands when command entries exist)
|
|
1018
|
+
* HTTP server named "github": ✅ Allowed (matches name)
|
|
1019
|
+
* HTTP server named "other-api": ❌ Blocked (name doesn't match)
|
|
1020
|
+
</Accordion>
|
|
1021
|
+
|
|
1022
|
+
<Accordion title="Example: Name-only allowlist">
|
|
1023
|
+
```json theme={null}
|
|
1024
|
+
{
|
|
1025
|
+
"allowedMcpServers": [
|
|
1026
|
+
{ "serverName": "github" },
|
|
1027
|
+
{ "serverName": "internal-tool" }
|
|
1028
|
+
]
|
|
1029
|
+
}
|
|
1030
|
+
```
|
|
1031
|
+
|
|
1032
|
+
**Result**:
|
|
1033
|
+
|
|
1034
|
+
* Stdio server named "github" with any command: ✅ Allowed (no command restrictions)
|
|
1035
|
+
* Stdio server named "internal-tool" with any command: ✅ Allowed (no command restrictions)
|
|
1036
|
+
* HTTP server named "github": ✅ Allowed (matches name)
|
|
1037
|
+
* Any server named "other": ❌ Blocked (name doesn't match)
|
|
1038
|
+
</Accordion>
|
|
1039
|
+
|
|
1040
|
+
#### Allowlist behavior (`allowedMcpServers`)
|
|
1041
|
+
|
|
1042
|
+
* `undefined` (default): No restrictions - users can configure any MCP server
|
|
1043
|
+
* Empty array `[]`: Complete lockdown - users cannot configure any MCP servers
|
|
1044
|
+
* List of entries: Users can only configure servers that match by name, command, or URL pattern
|
|
1045
|
+
|
|
1046
|
+
#### Denylist behavior (`deniedMcpServers`)
|
|
1047
|
+
|
|
1048
|
+
* `undefined` (default): No servers are blocked
|
|
1049
|
+
* Empty array `[]`: No servers are blocked
|
|
1050
|
+
* List of entries: Specified servers are explicitly blocked across all scopes
|
|
1051
|
+
|
|
1052
|
+
#### Important notes
|
|
1053
|
+
|
|
1054
|
+
* **Option 1 and Option 2 can be combined**: If `managed-mcp.json` exists, it has exclusive control and users cannot add servers. Allowlists/denylists still apply to the enterprise servers themselves.
|
|
1055
|
+
* **Denylist takes absolute precedence**: If a server matches a denylist entry (by name, command, or URL), it will be blocked even if it's on the allowlist
|
|
1056
|
+
* Name-based, command-based, and URL-based restrictions work together: a server passes if it matches **either** a name entry, a command entry, or a URL pattern (unless blocked by denylist)
|
|
1057
|
+
|
|
1058
|
+
<Note>
|
|
1059
|
+
**When using `managed-mcp.json`**: Users cannot add MCP servers through `claude mcp add` or configuration files. The `allowedMcpServers` and `deniedMcpServers` settings still apply to filter which enterprise servers are actually loaded.
|
|
1060
|
+
</Note>
|
|
1061
|
+
|
|
1062
|
+
|
|
1063
|
+
---
|
|
1064
|
+
|
|
1065
|
+
> To find navigation and other pages in this documentation, fetch the llms.txt file at: https://code.claude.com/docs/llms.txt
|