@tencent-ai/codebuddy-code 2.67.0 → 2.68.0-next.19b562c.20260330
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 +26 -0
- package/dist/codebuddy-headless.js +58 -58
- package/dist/codebuddy.js +120 -79
- package/dist/web-ui/assets/{index-BPT-qRRx.js → index-Cl0stqCM.js} +145 -116
- package/dist/web-ui/assets/index-Dt1puyHn.css +32 -0
- package/dist/web-ui/docs/cn/cli/acp.md +152 -0
- package/dist/web-ui/docs/cn/cli/agent-teams.md +327 -0
- package/dist/web-ui/docs/cn/cli/bash-sandboxing.md +290 -0
- package/dist/web-ui/docs/cn/cli/best-practices.md +554 -0
- package/dist/web-ui/docs/cn/cli/channels-reference.md +293 -0
- package/dist/web-ui/docs/cn/cli/channels.md +215 -0
- package/dist/web-ui/docs/cn/cli/checkpointing.md +51 -0
- package/dist/web-ui/docs/cn/cli/cli-reference.md +187 -0
- package/dist/web-ui/docs/cn/cli/common-workflows.md +1013 -0
- package/dist/web-ui/docs/cn/cli/costs.md +174 -0
- package/dist/web-ui/docs/cn/cli/devcontainer.md +553 -0
- package/dist/web-ui/docs/cn/cli/env-vars.md +326 -0
- package/dist/web-ui/docs/cn/cli/gitlab-ci-cd.md +357 -0
- package/dist/web-ui/docs/cn/cli/headless.md +258 -0
- package/dist/web-ui/docs/cn/cli/hooks-guide.md +9 -0
- package/dist/web-ui/docs/cn/cli/hooks.md +805 -0
- package/dist/web-ui/docs/cn/cli/iam.md +530 -0
- package/dist/web-ui/docs/cn/cli/ide-integrations.md +92 -0
- package/dist/web-ui/docs/cn/cli/installation.md +291 -0
- package/dist/web-ui/docs/cn/cli/interactive-mode.md +233 -0
- package/dist/web-ui/docs/cn/cli/mcp.md +739 -0
- package/dist/web-ui/docs/cn/cli/memory.md +436 -0
- package/dist/web-ui/docs/cn/cli/models.md +356 -0
- package/dist/web-ui/docs/cn/cli/overview.md +100 -0
- package/dist/web-ui/docs/cn/cli/plugin-marketplaces.md +533 -0
- package/dist/web-ui/docs/cn/cli/plugins-reference.md +774 -0
- package/dist/web-ui/docs/cn/cli/plugins.md +689 -0
- package/dist/web-ui/docs/cn/cli/quickstart.md +249 -0
- package/dist/web-ui/docs/cn/cli/release-notes/README.md +199 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.10.0.md +23 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.10.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.11.0.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.12.0.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.13.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.14.0.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.14.1.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.15.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.15.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.16.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.17.0.md +29 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.18.0.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.19.0.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.19.1.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.19.2.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.20.0.md +23 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.20.1.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.21.0.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.22.0.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.3.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.4.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.23.5.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.24.0.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.25.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.25.1.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.26.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.0.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.1.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.2.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.27.3.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.28.0.md +26 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.28.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.29.0.md +35 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.3.1.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.30.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.30.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.31.0.md +51 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.31.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.31.2.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.32.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.33.0.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.33.1.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.36.3.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.0.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.1.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.10.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.11.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.12.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.13.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.14.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.15.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.16.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.17.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.18.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.19.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.2.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.20.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.3.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.4.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.5.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.6.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.7.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.8.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.37.9.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.38.0.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.38.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.38.2.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.39.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.4.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.40.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.40.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.0.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.3.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.4.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.5.md +10 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.6.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.7.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.41.8.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.42.0.md +39 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.42.1.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.42.3.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.43.0.md +27 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.43.1.md +27 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.44.0.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.44.1.md +22 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.45.0.md +34 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.45.1.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.46.0.md +12 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.47.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.48.0.md +32 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.48.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.0.md +26 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.1.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.2.md +39 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.3.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.5.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.6.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.49.7.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.5.0.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.0.md +25 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.1.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.2.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.3.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.4.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.5.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.6.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.50.7.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.51.0.md +24 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.51.1.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.51.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.0.md +30 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.1.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.2.md +12 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.3.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.4.md +27 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.5.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.52.6.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.53.0.md +29 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.54.0.md +26 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.55.0.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.55.1.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.56.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.56.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.57.0.md +32 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.57.1.md +10 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.58.0.md +34 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.59.0.md +28 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.6.0.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.6.1.md +10 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.60.0.md +20 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.0.md +29 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.2.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.61.3.md +13 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.62.0.md +21 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.62.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.1.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.2.md +7 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.3.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.4.md +8 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.63.5.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.64.0.md +37 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.64.1.md +6 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.64.2.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.65.0.md +19 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.65.1.md +11 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.66.0.md +15 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.66.1.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.66.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.67.0.md +33 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.7.0.md +16 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.0.md +18 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.1.md +17 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.2.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.3.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.4.md +9 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.5.md +5 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.8.6.md +14 -0
- package/dist/web-ui/docs/cn/cli/release-notes/v2.9.0.md +5 -0
- package/dist/web-ui/docs/cn/cli/remote-control.md +247 -0
- package/dist/web-ui/docs/cn/cli/sandboxing.md +316 -0
- package/dist/web-ui/docs/cn/cli/scheduled-tasks.md +161 -0
- package/dist/web-ui/docs/cn/cli/sdk-custom-tools.md +1195 -0
- package/dist/web-ui/docs/cn/cli/sdk-demos.md +347 -0
- package/dist/web-ui/docs/cn/cli/sdk-hooks.md +803 -0
- package/dist/web-ui/docs/cn/cli/sdk-mcp.md +643 -0
- package/dist/web-ui/docs/cn/cli/sdk-permissions.md +501 -0
- package/dist/web-ui/docs/cn/cli/sdk-python.md +783 -0
- package/dist/web-ui/docs/cn/cli/sdk-sessions.md +332 -0
- package/dist/web-ui/docs/cn/cli/sdk-typescript.md +759 -0
- package/dist/web-ui/docs/cn/cli/sdk.md +1105 -0
- package/dist/web-ui/docs/cn/cli/security.md +387 -0
- package/dist/web-ui/docs/cn/cli/settings.md +602 -0
- package/dist/web-ui/docs/cn/cli/skills.md +448 -0
- package/dist/web-ui/docs/cn/cli/slash-commands.md +397 -0
- package/dist/web-ui/docs/cn/cli/statusline.md +525 -0
- package/dist/web-ui/docs/cn/cli/sub-agents.md +634 -0
- package/dist/web-ui/docs/cn/cli/terminal-config.md +77 -0
- package/dist/web-ui/docs/cn/cli/tools-reference.md +99 -0
- package/dist/web-ui/docs/cn/cli/troubleshooting.md +190 -0
- package/dist/web-ui/docs/cn/cli/web-ui.md +164 -0
- package/dist/web-ui/docs/cn/cli/wecom-bot-setup.md +274 -0
- package/dist/web-ui/docs/cn/cli/worktree.md +660 -0
- package/dist/web-ui/docs/en/cli/acp.md +126 -0
- package/dist/web-ui/docs/en/cli/agent-teams.md +327 -0
- package/dist/web-ui/docs/en/cli/bash-sandboxing.md +357 -0
- package/dist/web-ui/docs/en/cli/best-practices.md +554 -0
- package/dist/web-ui/docs/en/cli/channels-reference.md +293 -0
- package/dist/web-ui/docs/en/cli/channels.md +215 -0
- package/dist/web-ui/docs/en/cli/checkpointing.md +53 -0
- package/dist/web-ui/docs/en/cli/cli-reference.md +187 -0
- package/dist/web-ui/docs/en/cli/common-workflows.md +1011 -0
- package/dist/web-ui/docs/en/cli/costs.md +174 -0
- package/dist/web-ui/docs/en/cli/devcontainer.md +553 -0
- package/dist/web-ui/docs/en/cli/env-vars.md +326 -0
- package/dist/web-ui/docs/en/cli/gitlab-ci-cd.md +357 -0
- package/dist/web-ui/docs/en/cli/headless.md +258 -0
- package/dist/web-ui/docs/en/cli/hooks-guide.md +9 -0
- package/dist/web-ui/docs/en/cli/hooks.md +801 -0
- package/dist/web-ui/docs/en/cli/iam.md +526 -0
- package/dist/web-ui/docs/en/cli/ide-integrations.md +92 -0
- package/dist/web-ui/docs/en/cli/installation.md +266 -0
- package/dist/web-ui/docs/en/cli/interactive-mode.md +233 -0
- package/dist/web-ui/docs/en/cli/mcp.md +739 -0
- package/dist/web-ui/docs/en/cli/memory.md +436 -0
- package/dist/web-ui/docs/en/cli/models.md +355 -0
- package/dist/web-ui/docs/en/cli/overview.md +100 -0
- package/dist/web-ui/docs/en/cli/plugin-marketplaces.md +534 -0
- package/dist/web-ui/docs/en/cli/plugins-reference.md +774 -0
- package/dist/web-ui/docs/en/cli/plugins.md +688 -0
- package/dist/web-ui/docs/en/cli/quickstart.md +249 -0
- package/dist/web-ui/docs/en/cli/release-notes/README.md +193 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.10.0.md +23 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.10.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.11.0.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.12.0.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.13.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.14.0.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.14.1.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.15.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.15.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.16.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.17.0.md +29 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.18.0.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.19.0.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.19.1.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.19.2.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.20.0.md +23 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.20.1.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.21.0.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.22.0.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.0.md +41 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.3.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.4.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.23.5.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.24.0.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.25.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.25.1.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.26.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.0.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.1.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.2.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.27.3.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.28.0.md +26 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.28.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.29.0.md +35 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.3.1.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.30.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.30.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.31.0.md +51 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.31.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.31.2.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.32.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.33.0.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.33.1.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.34.0.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.34.1.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.35.0.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.0.md +23 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.2.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.36.3.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.0.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.1.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.10.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.11.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.12.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.13.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.14.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.15.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.16.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.17.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.18.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.19.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.2.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.20.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.3.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.4.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.5.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.6.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.7.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.8.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.37.9.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.38.0.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.38.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.38.2.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.39.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.4.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.40.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.40.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.0.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.3.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.4.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.5.md +10 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.6.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.7.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.41.8.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.42.0.md +39 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.42.1.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.42.3.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.43.0.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.43.1.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.44.0.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.44.1.md +22 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.45.0.md +34 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.45.1.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.46.0.md +12 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.47.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.48.0.md +32 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.48.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.0.md +26 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.1.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.2.md +39 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.3.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.5.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.6.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.49.7.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.5.0.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.0.md +25 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.1.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.2.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.3.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.4.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.5.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.6.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.50.7.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.51.0.md +24 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.51.1.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.51.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.0.md +30 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.1.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.2.md +12 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.3.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.4.md +27 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.5.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.52.6.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.53.0.md +29 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.54.0.md +26 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.55.0.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.55.1.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.56.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.56.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.57.0.md +32 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.57.1.md +10 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.58.0.md +34 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.59.0.md +28 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.6.0.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.6.1.md +10 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.60.0.md +20 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.0.md +29 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.2.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.61.3.md +13 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.62.0.md +21 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.62.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.1.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.2.md +7 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.3.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.4.md +8 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.63.5.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.64.0.md +37 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.64.1.md +6 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.64.2.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.65.0.md +19 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.65.1.md +11 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.66.0.md +15 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.66.1.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.66.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.67.0.md +33 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.7.0.md +16 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.0.md +18 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.1.md +17 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.2.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.3.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.4.md +9 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.5.md +5 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.8.6.md +14 -0
- package/dist/web-ui/docs/en/cli/release-notes/v2.9.0.md +5 -0
- package/dist/web-ui/docs/en/cli/remote-control.md +247 -0
- package/dist/web-ui/docs/en/cli/sandboxing.md +316 -0
- package/dist/web-ui/docs/en/cli/scheduled-tasks.md +160 -0
- package/dist/web-ui/docs/en/cli/sdk-custom-tools.md +1131 -0
- package/dist/web-ui/docs/en/cli/sdk-demos.md +347 -0
- package/dist/web-ui/docs/en/cli/sdk-hooks.md +813 -0
- package/dist/web-ui/docs/en/cli/sdk-mcp.md +645 -0
- package/dist/web-ui/docs/en/cli/sdk-permissions.md +461 -0
- package/dist/web-ui/docs/en/cli/sdk-python.md +797 -0
- package/dist/web-ui/docs/en/cli/sdk-sessions.md +340 -0
- package/dist/web-ui/docs/en/cli/sdk-typescript.md +770 -0
- package/dist/web-ui/docs/en/cli/sdk.md +1103 -0
- package/dist/web-ui/docs/en/cli/security.md +388 -0
- package/dist/web-ui/docs/en/cli/settings.md +602 -0
- package/dist/web-ui/docs/en/cli/skills.md +448 -0
- package/dist/web-ui/docs/en/cli/slash-commands.md +397 -0
- package/dist/web-ui/docs/en/cli/statusline.md +525 -0
- package/dist/web-ui/docs/en/cli/sub-agents.md +621 -0
- package/dist/web-ui/docs/en/cli/terminal-config.md +77 -0
- package/dist/web-ui/docs/en/cli/tools-reference.md +99 -0
- package/dist/web-ui/docs/en/cli/troubleshooting.md +190 -0
- package/dist/web-ui/docs/en/cli/web-ui.md +164 -0
- package/dist/web-ui/docs/en/cli/wecom-bot-setup.md +274 -0
- package/dist/web-ui/docs/en/cli/worktree.md +660 -0
- package/dist/web-ui/docs/search-index-en.json +1 -0
- package/dist/web-ui/docs/search-index-zh.json +1 -0
- package/dist/web-ui/docs/sidebar-en.json +1 -0
- package/dist/web-ui/docs/sidebar-zh.json +1 -0
- package/dist/web-ui/index.html +2 -2
- package/package.json +3 -2
- package/product.cloudhosted.json +2 -2
- package/product.internal.json +2 -2
- package/product.ioa.json +2 -2
- package/product.json +3 -3
- package/product.selfhosted.json +2 -2
- package/dist/web-ui/assets/index-f_ibHSHw.css +0 -32
|
@@ -0,0 +1,643 @@
|
|
|
1
|
+
# SDK MCP Integration Guide
|
|
2
|
+
|
|
3
|
+
> **版本要求**:本文档针对 CodeBuddy Agent SDK v0.1.24 及以上版本。
|
|
4
|
+
>
|
|
5
|
+
> **功能状态**:SDK MCP 支持是 CodeBuddy Agent SDK 的一项 **Preview** 功能。
|
|
6
|
+
|
|
7
|
+
本文档介绍如何在 CodeBuddy Agent SDK 中集成和使用 MCP(Model Context Protocol)服务器,为你的应用程序扩展自定义工具和功能。
|
|
8
|
+
|
|
9
|
+
## 概述
|
|
10
|
+
|
|
11
|
+
MCP 服务器允许你将自定义工具、资源和提示集成到 CodeBuddy Agent SDK 中。通过 SDK,你可以以编程方式启用这些工具,从而为你的 AI 工作流添加特定领域的功能。
|
|
12
|
+
|
|
13
|
+
### 核心概念
|
|
14
|
+
|
|
15
|
+
- **MCP 服务器**:提供工具、资源和提示的独立进程或服务
|
|
16
|
+
- **工具**:MCP 服务器暴露的可执行函数
|
|
17
|
+
- **资源**:MCP 服务器提供的可读取的数据或文件
|
|
18
|
+
- **提示**:MCP 服务器提供的模板化提示词
|
|
19
|
+
|
|
20
|
+
## 支持的传输类型
|
|
21
|
+
|
|
22
|
+
CodeBuddy Agent SDK 支持三种 MCP 服务器通信方式:
|
|
23
|
+
|
|
24
|
+
| 传输类型 | 使用场景 | 说明 |
|
|
25
|
+
|---------|---------|------|
|
|
26
|
+
| **STDIO** | 本地工具 | 通过标准输入输出与本地进程通信 |
|
|
27
|
+
| **HTTP/SSE** | 远程服务 | 通过 HTTP 流式传输或 Server-Sent Events 与远程服务通信 |
|
|
28
|
+
| **SDK MCP** | IDE/SDK 集成 | 由外部 SDK(如 IDE 扩展)注册的 MCP 服务器 |
|
|
29
|
+
|
|
30
|
+
## 配置 MCP 服务器
|
|
31
|
+
|
|
32
|
+
`mcpServers` 支持两种配置方式:
|
|
33
|
+
|
|
34
|
+
1. **对象格式**:直接在代码中定义服务器配置
|
|
35
|
+
2. **文件路径字符串**:指向一个 MCP 配置文件(JSON 格式)
|
|
36
|
+
|
|
37
|
+
### 对象格式
|
|
38
|
+
|
|
39
|
+
使用 `mcpServers` 选项配置 MCP 服务器。配置支持 STDIO、HTTP 和 SSE 传输类型。
|
|
40
|
+
|
|
41
|
+
**TypeScript**:
|
|
42
|
+
|
|
43
|
+
```typescript
|
|
44
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
45
|
+
|
|
46
|
+
const result = query({
|
|
47
|
+
prompt: 'Analyze my project structure',
|
|
48
|
+
options: {
|
|
49
|
+
mcpServers: {
|
|
50
|
+
'my-tools': {
|
|
51
|
+
type: 'stdio',
|
|
52
|
+
command: 'node',
|
|
53
|
+
args: ['./mcp-server.js'],
|
|
54
|
+
env: {
|
|
55
|
+
NODE_ENV: 'production'
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
'api-server': {
|
|
59
|
+
type: 'http',
|
|
60
|
+
url: 'https://api.example.com/mcp',
|
|
61
|
+
headers: {
|
|
62
|
+
'Authorization': 'Bearer your-token'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
'sse-server': {
|
|
66
|
+
type: 'sse',
|
|
67
|
+
url: 'https://events.example.com/mcp/sse',
|
|
68
|
+
headers: {
|
|
69
|
+
'X-API-Key': 'your-api-key'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
**Python**:
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
from codebuddy_agent_sdk import query
|
|
81
|
+
|
|
82
|
+
result = query(
|
|
83
|
+
prompt='Analyze my project structure',
|
|
84
|
+
options={
|
|
85
|
+
'mcp_servers': {
|
|
86
|
+
'my-tools': {
|
|
87
|
+
'type': 'stdio',
|
|
88
|
+
'command': 'python',
|
|
89
|
+
'args': ['-m', 'my_mcp_server'],
|
|
90
|
+
'env': {
|
|
91
|
+
'PYTHONPATH': '/path/to/tools'
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
'api-server': {
|
|
95
|
+
'type': 'http',
|
|
96
|
+
'url': 'https://api.example.com/mcp',
|
|
97
|
+
'headers': {
|
|
98
|
+
'Authorization': 'Bearer your-token'
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
'sse-server': {
|
|
102
|
+
'type': 'sse',
|
|
103
|
+
'url': 'https://events.example.com/mcp/sse',
|
|
104
|
+
'headers': {
|
|
105
|
+
'X-API-Key': 'your-api-key'
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### 文件路径格式
|
|
114
|
+
|
|
115
|
+
也可以传入一个 MCP 配置文件路径。配置文件为 JSON 格式,结构与 CLI `--mcp-config` 参数一致。
|
|
116
|
+
|
|
117
|
+
**TypeScript**:
|
|
118
|
+
|
|
119
|
+
```typescript
|
|
120
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
121
|
+
|
|
122
|
+
const result = query({
|
|
123
|
+
prompt: 'Analyze my project structure',
|
|
124
|
+
options: {
|
|
125
|
+
mcpServers: './mcp-config.json'
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**Python**:
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
from codebuddy_agent_sdk import query
|
|
134
|
+
|
|
135
|
+
result = query(
|
|
136
|
+
prompt='Analyze my project structure',
|
|
137
|
+
options={
|
|
138
|
+
'mcp_servers': './mcp-config.json'
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
配置文件格式示例(`mcp-config.json`):
|
|
144
|
+
|
|
145
|
+
```json
|
|
146
|
+
{
|
|
147
|
+
"mcpServers": {
|
|
148
|
+
"my-tools": {
|
|
149
|
+
"type": "stdio",
|
|
150
|
+
"command": "node",
|
|
151
|
+
"args": ["./mcp-server.js"]
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
> **注意**:使用文件路径格式时,不支持 SDK MCP 类型(`type: 'sdk'`)的服务器配置。SDK MCP 服务器仅在对象格式中可用。
|
|
158
|
+
|
|
159
|
+
## 服务器配置详解
|
|
160
|
+
|
|
161
|
+
### STDIO 配置
|
|
162
|
+
|
|
163
|
+
STDIO 服务器通过标准输入输出与本地进程通信,适用于本地工具。
|
|
164
|
+
|
|
165
|
+
```typescript
|
|
166
|
+
{
|
|
167
|
+
type: 'stdio',
|
|
168
|
+
command: 'python', // 可执行文件或命令
|
|
169
|
+
args: ['-m', 'my_mcp_server'], // 命令行参数
|
|
170
|
+
env: { // 环境变量
|
|
171
|
+
PYTHONPATH: '/path/to/tools',
|
|
172
|
+
DEBUG: 'true'
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**常见用例**:
|
|
178
|
+
|
|
179
|
+
```typescript
|
|
180
|
+
// Python MCP 服务器
|
|
181
|
+
{
|
|
182
|
+
type: 'stdio',
|
|
183
|
+
command: 'python',
|
|
184
|
+
args: ['-m', 'fastmcp']
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
// Node.js MCP 服务器
|
|
188
|
+
{
|
|
189
|
+
type: 'stdio',
|
|
190
|
+
command: 'node',
|
|
191
|
+
args: ['./server.js']
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// 本地二进制文件
|
|
195
|
+
{
|
|
196
|
+
type: 'stdio',
|
|
197
|
+
command: '/usr/local/bin/my-tool',
|
|
198
|
+
args: ['--config', '/etc/config.yaml']
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### HTTP 配置
|
|
203
|
+
|
|
204
|
+
HTTP 服务器通过 HTTP 流式传输与远程服务通信。
|
|
205
|
+
|
|
206
|
+
```typescript
|
|
207
|
+
{
|
|
208
|
+
type: 'http',
|
|
209
|
+
url: 'https://mcp.example.com/api/v1',
|
|
210
|
+
headers: {
|
|
211
|
+
'Authorization': 'Bearer your-token',
|
|
212
|
+
'Content-Type': 'application/json'
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### SSE 配置
|
|
218
|
+
|
|
219
|
+
SSE 服务器通过 Server-Sent Events 与远程服务通信。
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
{
|
|
223
|
+
type: 'sse',
|
|
224
|
+
url: 'https://events.example.com/mcp/sse',
|
|
225
|
+
headers: {
|
|
226
|
+
'Authorization': 'Bearer your-token',
|
|
227
|
+
'X-API-Version': 'v1'
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
## 权限管理
|
|
233
|
+
|
|
234
|
+
MCP 工具支持精细化的权限控制。通过 `canUseTool` 回调,你可以决定哪些工具可以被使用。
|
|
235
|
+
|
|
236
|
+
### 工具权限模式
|
|
237
|
+
|
|
238
|
+
```typescript
|
|
239
|
+
type PermissionMode =
|
|
240
|
+
| 'default' // 询问用户
|
|
241
|
+
| 'acceptEdits' // 接受自动编辑
|
|
242
|
+
| 'bypassPermissions' // 跳过权限检查(不推荐用于生产环境)
|
|
243
|
+
| 'plan'; // 仅规划模式
|
|
244
|
+
|
|
245
|
+
const result = query({
|
|
246
|
+
prompt: 'Process data',
|
|
247
|
+
options: {
|
|
248
|
+
permissionMode: 'acceptEdits',
|
|
249
|
+
canUseTool?: (toolCall) => {
|
|
250
|
+
// 自定义权限检查逻辑
|
|
251
|
+
if (toolCall.name === 'dangerous_operation') {
|
|
252
|
+
return false;
|
|
253
|
+
}
|
|
254
|
+
return true;
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
});
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
### 特定工具的权限控制
|
|
261
|
+
|
|
262
|
+
```typescript
|
|
263
|
+
options: {
|
|
264
|
+
canUseTool: (toolCall) => {
|
|
265
|
+
// 阻止特定服务器的工具
|
|
266
|
+
if (toolCall.name.startsWith('mcp__restricted')) {
|
|
267
|
+
return false;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
// 允许特定工具
|
|
271
|
+
if (toolCall.name === 'mcp__github__list_issues') {
|
|
272
|
+
return true;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// 默认询问
|
|
276
|
+
return null;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## 使用 MCP 工具
|
|
282
|
+
|
|
283
|
+
配置完 MCP 服务器后,Agent 会自动发现这些服务器提供的工具,并在需要时调用它们。
|
|
284
|
+
|
|
285
|
+
### 自动工具发现
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
const result = query({
|
|
289
|
+
prompt: `
|
|
290
|
+
Using the available MCP tools, complete these tasks:
|
|
291
|
+
1. Query the database for recent transactions
|
|
292
|
+
2. Analyze the results
|
|
293
|
+
3. Generate a summary report
|
|
294
|
+
`,
|
|
295
|
+
options: {
|
|
296
|
+
mcpServers: {
|
|
297
|
+
'database': {
|
|
298
|
+
type: 'stdio',
|
|
299
|
+
command: 'python',
|
|
300
|
+
args: ['-m', 'db_mcp_server']
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
|
|
306
|
+
for await (const message of result) {
|
|
307
|
+
if (message.type === 'tool_use') {
|
|
308
|
+
console.log(`Tool: ${message.name}`);
|
|
309
|
+
console.log(`Arguments: ${JSON.stringify(message.input)}`);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
```
|
|
313
|
+
|
|
314
|
+
### 处理工具结果
|
|
315
|
+
|
|
316
|
+
```typescript
|
|
317
|
+
for await (const message of result) {
|
|
318
|
+
if (message.type === 'content') {
|
|
319
|
+
console.log('Agent Response:', message.text);
|
|
320
|
+
} else if (message.type === 'tool_use') {
|
|
321
|
+
console.log(`Executing: ${message.name}`);
|
|
322
|
+
} else if (message.type === 'tool_result') {
|
|
323
|
+
console.log('Tool Result:', message.content);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
## 实例:数据库查询 MCP 服务器
|
|
329
|
+
|
|
330
|
+
以下是一个完整的示例,展示如何创建和使用数据库 MCP 服务器。
|
|
331
|
+
|
|
332
|
+
### 创建 MCP 服务器
|
|
333
|
+
|
|
334
|
+
**db_mcp_server.py**:
|
|
335
|
+
|
|
336
|
+
```python
|
|
337
|
+
from fastmcp import FastMCP
|
|
338
|
+
|
|
339
|
+
mcp = FastMCP('database')
|
|
340
|
+
|
|
341
|
+
@mcp.tool()
|
|
342
|
+
def query_database(sql: str) -> str:
|
|
343
|
+
"""Execute a SQL query and return results"""
|
|
344
|
+
# 实现数据库查询逻辑
|
|
345
|
+
return f"Query results for: {sql}"
|
|
346
|
+
|
|
347
|
+
@mcp.tool()
|
|
348
|
+
def get_schema(table_name: str) -> str:
|
|
349
|
+
"""Get the schema of a specific table"""
|
|
350
|
+
# 返回表结构
|
|
351
|
+
return f"Schema for: {table_name}"
|
|
352
|
+
|
|
353
|
+
if __name__ == '__main__':
|
|
354
|
+
mcp.run()
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
### 在 SDK 中使用
|
|
358
|
+
|
|
359
|
+
**TypeScript**:
|
|
360
|
+
|
|
361
|
+
```typescript
|
|
362
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
363
|
+
|
|
364
|
+
async function analyzeData() {
|
|
365
|
+
const result = query({
|
|
366
|
+
prompt: `
|
|
367
|
+
I need to analyze our user activity data.
|
|
368
|
+
1. First, check the schema of the users table
|
|
369
|
+
2. Query for users active in the last 7 days
|
|
370
|
+
3. Provide insights based on the results
|
|
371
|
+
`,
|
|
372
|
+
options: {
|
|
373
|
+
mcpServers: {
|
|
374
|
+
'database': {
|
|
375
|
+
type: 'stdio',
|
|
376
|
+
command: 'python',
|
|
377
|
+
args: ['-m', 'db_mcp_server'],
|
|
378
|
+
env: {
|
|
379
|
+
DATABASE_URL: process.env.DATABASE_URL
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
},
|
|
383
|
+
permissionMode: 'acceptEdits'
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
|
|
387
|
+
for await (const message of result) {
|
|
388
|
+
if (message.type === 'content') {
|
|
389
|
+
console.log('Analysis:', message.text);
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
analyzeData().catch(console.error);
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Python**:
|
|
398
|
+
|
|
399
|
+
```python
|
|
400
|
+
from codebuddy_agent_sdk import query
|
|
401
|
+
import os
|
|
402
|
+
|
|
403
|
+
async def analyze_data():
|
|
404
|
+
result = query(
|
|
405
|
+
prompt="""
|
|
406
|
+
I need to analyze our user activity data.
|
|
407
|
+
1. First, check the schema of the users table
|
|
408
|
+
2. Query for users active in the last 7 days
|
|
409
|
+
3. Provide insights based on the results
|
|
410
|
+
""",
|
|
411
|
+
options={
|
|
412
|
+
'mcp_servers': {
|
|
413
|
+
'database': {
|
|
414
|
+
'type': 'stdio',
|
|
415
|
+
'command': 'python',
|
|
416
|
+
'args': ['-m', 'db_mcp_server'],
|
|
417
|
+
'env': {
|
|
418
|
+
'DATABASE_URL': os.environ.get('DATABASE_URL')
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
},
|
|
422
|
+
'permission_mode': 'acceptEdits'
|
|
423
|
+
}
|
|
424
|
+
)
|
|
425
|
+
|
|
426
|
+
async for message in result:
|
|
427
|
+
if message.get('type') == 'content':
|
|
428
|
+
print('Analysis:', message.get('text'))
|
|
429
|
+
|
|
430
|
+
# 运行示例
|
|
431
|
+
import asyncio
|
|
432
|
+
asyncio.run(analyze_data())
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
## 实例:API 集成 MCP 服务器
|
|
436
|
+
|
|
437
|
+
以下示例展示如何创建一个通过 HTTP 连接到多个 API 的 MCP 服务器。
|
|
438
|
+
|
|
439
|
+
### 服务器实现
|
|
440
|
+
|
|
441
|
+
**api_mcp_server.py**:
|
|
442
|
+
|
|
443
|
+
```python
|
|
444
|
+
from fastmcp import FastMCP
|
|
445
|
+
import httpx
|
|
446
|
+
import os
|
|
447
|
+
|
|
448
|
+
mcp = FastMCP('api-gateway')
|
|
449
|
+
|
|
450
|
+
async def call_api(method: str, path: str, **kwargs):
|
|
451
|
+
"""Helper to call APIs with authentication"""
|
|
452
|
+
headers = kwargs.pop('headers', {})
|
|
453
|
+
headers['Authorization'] = f"Bearer {os.environ.get('API_TOKEN')}"
|
|
454
|
+
|
|
455
|
+
async with httpx.AsyncClient() as client:
|
|
456
|
+
response = await client.request(
|
|
457
|
+
method,
|
|
458
|
+
f"https://api.example.com{path}",
|
|
459
|
+
headers=headers,
|
|
460
|
+
**kwargs
|
|
461
|
+
)
|
|
462
|
+
return response.json()
|
|
463
|
+
|
|
464
|
+
@mcp.tool()
|
|
465
|
+
async def get_github_repos(username: str) -> dict:
|
|
466
|
+
"""Get GitHub repositories for a user"""
|
|
467
|
+
return await call_api('GET', f'/github/users/{username}/repos')
|
|
468
|
+
|
|
469
|
+
@mcp.tool()
|
|
470
|
+
async def search_issues(query: str, labels: list[str] = None) -> dict:
|
|
471
|
+
"""Search for issues in GitHub"""
|
|
472
|
+
params = {'q': query}
|
|
473
|
+
if labels:
|
|
474
|
+
params['labels'] = ','.join(labels)
|
|
475
|
+
return await call_api('GET', '/github/search/issues', params=params)
|
|
476
|
+
|
|
477
|
+
@mcp.tool()
|
|
478
|
+
async def create_slack_message(channel: str, text: str) -> dict:
|
|
479
|
+
"""Send a message to Slack"""
|
|
480
|
+
return await call_api(
|
|
481
|
+
'POST',
|
|
482
|
+
'/slack/chat.postMessage',
|
|
483
|
+
json={'channel': channel, 'text': text}
|
|
484
|
+
)
|
|
485
|
+
|
|
486
|
+
if __name__ == '__main__':
|
|
487
|
+
mcp.run()
|
|
488
|
+
```
|
|
489
|
+
|
|
490
|
+
### 在 SDK 中使用
|
|
491
|
+
|
|
492
|
+
```typescript
|
|
493
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
494
|
+
|
|
495
|
+
async function searchAndNotify() {
|
|
496
|
+
const result = query({
|
|
497
|
+
prompt: `
|
|
498
|
+
1. Search for open issues labeled "bug" and "critical"
|
|
499
|
+
2. Get my GitHub repositories
|
|
500
|
+
3. Send a summary to the #dev-team Slack channel
|
|
501
|
+
`,
|
|
502
|
+
options: {
|
|
503
|
+
mcpServers: {
|
|
504
|
+
'api-gateway': {
|
|
505
|
+
type: 'http',
|
|
506
|
+
url: 'https://mcp-gateway.example.com/api',
|
|
507
|
+
headers: {
|
|
508
|
+
'X-API-Key': process.env.API_GATEWAY_KEY,
|
|
509
|
+
'X-Request-ID': `req-${Date.now()}`
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
},
|
|
513
|
+
permissionMode: 'acceptEdits'
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
|
|
517
|
+
for await (const message of result) {
|
|
518
|
+
console.log(message);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
```
|
|
522
|
+
|
|
523
|
+
## 实例:远程 SSE 服务器
|
|
524
|
+
|
|
525
|
+
SSE 服务器适用于需要实时数据流或事件推送的场景。
|
|
526
|
+
|
|
527
|
+
```typescript
|
|
528
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
529
|
+
|
|
530
|
+
async function monitorSystem() {
|
|
531
|
+
const result = query({
|
|
532
|
+
prompt: 'Monitor system metrics and alert if any threshold is exceeded',
|
|
533
|
+
options: {
|
|
534
|
+
mcpServers: {
|
|
535
|
+
'monitoring': {
|
|
536
|
+
type: 'sse',
|
|
537
|
+
url: 'https://monitor.example.com/mcp/events',
|
|
538
|
+
headers: {
|
|
539
|
+
'Authorization': `Bearer ${process.env.MONITOR_TOKEN}`,
|
|
540
|
+
'X-Client-ID': 'codebuddy-sdk'
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
|
|
547
|
+
for await (const message of result) {
|
|
548
|
+
if (message.type === 'content') {
|
|
549
|
+
console.log('Alert:', message.text);
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
```
|
|
554
|
+
|
|
555
|
+
## 错误处理
|
|
556
|
+
|
|
557
|
+
在处理 MCP 服务器连接时,监控初始化状态并识别失败的连接:
|
|
558
|
+
|
|
559
|
+
### 检查服务器初始化状态
|
|
560
|
+
|
|
561
|
+
**TypeScript**:
|
|
562
|
+
|
|
563
|
+
```typescript
|
|
564
|
+
import { query } from '@tencent-ai/agent-sdk';
|
|
565
|
+
|
|
566
|
+
const result = query({
|
|
567
|
+
prompt: 'Use my MCP tools',
|
|
568
|
+
options: {
|
|
569
|
+
mcpServers: {
|
|
570
|
+
'my-tool': {
|
|
571
|
+
type: 'stdio',
|
|
572
|
+
command: 'python',
|
|
573
|
+
args: ['-m', 'my_mcp_server']
|
|
574
|
+
}
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
});
|
|
578
|
+
|
|
579
|
+
for await (const message of result) {
|
|
580
|
+
// 在初始化时检查 MCP 服务器状态
|
|
581
|
+
if (message.type === 'system' && message.subtype === 'init') {
|
|
582
|
+
const failedServers = message.mcp_servers.filter(
|
|
583
|
+
s => s.status !== 'connected'
|
|
584
|
+
);
|
|
585
|
+
if (failedServers.length > 0) {
|
|
586
|
+
console.warn('Failed to connect:', failedServers);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
|
|
590
|
+
// 处理执行错误
|
|
591
|
+
if (message.type === 'result' && message.subtype === 'error_during_execution') {
|
|
592
|
+
console.error('Tool execution failed:', message);
|
|
593
|
+
}
|
|
594
|
+
}
|
|
595
|
+
```
|
|
596
|
+
|
|
597
|
+
**Python**:
|
|
598
|
+
|
|
599
|
+
```python
|
|
600
|
+
from codebuddy_agent_sdk import query
|
|
601
|
+
|
|
602
|
+
result = query(
|
|
603
|
+
prompt='Use my MCP tools',
|
|
604
|
+
options={
|
|
605
|
+
'mcp_servers': {
|
|
606
|
+
'my-tool': {
|
|
607
|
+
'type': 'stdio',
|
|
608
|
+
'command': 'python',
|
|
609
|
+
'args': ['-m', 'my_mcp_server']
|
|
610
|
+
}
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
async for message in result:
|
|
616
|
+
# 在初始化时检查 MCP 服务器状态
|
|
617
|
+
if message.get('type') == 'system' and message.get('subtype') == 'init':
|
|
618
|
+
failed_servers = [
|
|
619
|
+
s for s in message.get('mcp_servers', [])
|
|
620
|
+
if s.get('status') != 'connected'
|
|
621
|
+
]
|
|
622
|
+
if failed_servers:
|
|
623
|
+
print(f'Failed to connect: {failed_servers}')
|
|
624
|
+
|
|
625
|
+
# 处理执行错误
|
|
626
|
+
if message.get('type') == 'result' and message.get('subtype') == 'error_during_execution':
|
|
627
|
+
print('Tool execution failed:', message)
|
|
628
|
+
```
|
|
629
|
+
|
|
630
|
+
## 相关文档
|
|
631
|
+
|
|
632
|
+
- [SDK 概览](sdk.md)
|
|
633
|
+
- [TypeScript SDK 参考](sdk-typescript.md)
|
|
634
|
+
- [Python SDK 参考](sdk-python.md)
|
|
635
|
+
- [MCP 使用文档](mcp.md)
|
|
636
|
+
- [SDK 权限系统](sdk-permissions.md)
|
|
637
|
+
- [SDK Hooks 系统](sdk-hooks.md)
|
|
638
|
+
|
|
639
|
+
## 更多资源
|
|
640
|
+
|
|
641
|
+
- [MCP 官方文档](https://modelcontextprotocol.io/)
|
|
642
|
+
- [MCP Python SDK - FastMCP](https://github.com/modelcontextprotocol/python-sdk)
|
|
643
|
+
- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
|