AS AgentScopeAPI 手册 / API Reference
功能域Functional domain

MCP 集成MCP integration

通过 stdio / SSE / streamable HTTP 连接 Model Context Protocol 服务,把远端工具纳入 Toolkit,并管理连接生命周期和鉴权头。Connect Model Context Protocol servers over stdio, SSE or streamable HTTP and expose their tools through the toolkit.

7类型总数types total
3Python
4Java
3学习锚点learning anchors

心智模型Mental model

MCP 客户端把远端 MCP 服务的工具、资源和提示词映射为本地 Toolkit 能力,连接方式包括 stdio、SSE 与 streamable HTTP。The MCP client maps remote tools, resources and prompts into the local toolkit over stdio, SSE or streamable HTTP.

先学什么What to learn first

  • 连接是长生命周期资源:启动时注册,关闭时释放,并处理断线重连。Connections are long-lived resources: register on startup, release on shutdown, handle reconnects.
  • stdio 适合本地进程,HTTP 适合多租户远程服务,注意鉴权头透传。Use stdio for local processes and HTTP for multi-tenant remote services; forward auth headers carefully.
  • 远端工具名可能冲突,注册时统一加前缀并做白名单。Remote tool names can collide; prefix them and enforce an allowlist.

生产常见坑Production pitfalls

  • 每次请求都新建 MCP 连接,造成握手风暴。Creating an MCP connection per request causes handshake storms.
  • MCP 服务超时被当成模型错误处理。Treating MCP timeouts as model errors.

进入对应闯关单元Practice this domain →

域内图谱Domain map

点击节点打开 API 页面;拖拽平移,滚轮缩放。Click a node to open its API page. Drag to pan, scroll to zoom.

Python Java

Python API 集Python API set 3

归入本功能域的全部 Python 公开类型,按所属包分组。Every public Python type classified into this domain, grouped by owning package.

agentscope.mcp3
HttpMCPConfigclassHTTP MCP 服务端配置。
MCPClientclassMCP 客户端
StdioMCPConfigclassstdio MCP 配置,保存相关配置项。

Java API 集Java API set 4

归入本功能域的全部 Java 公开类型,按包分组并标注构件。Every public Java type classified into this domain, grouped by package with its artifact.

io.agentscope.extensions.nacos.mcp.client3
NacosMcpClientBuilderclassagentscope-extensions-mcp-nacosNacos MCP 客户端构建器,用于构建并配置目标实例。
NacosMcpClientWrapperclassagentscope-extensions-mcp-nacosNacos MCP 客户端包装器,把 MCP 服务提供的工具接入智能体。
RefreshHookinterfaceagentscope-extensions-mcp-nacos定义刷新钩子契约的接口。
io.agentscope.extensions.nacos.mcp1
NacosMcpServerManagerclassagentscope-extensions-mcp-nacosNacos MCP 服务端管理器,把 MCP 服务提供的工具接入智能体。

Python ↔ Java 对照Python ↔ Java

Java

McpClientBuilderMcpClientWrapperMcpTool

两套实现共享同一概念模型,但在并发(async/await 与 Reactor)、打包(wheel 模块与 Maven 构件)和生命周期 API 上存在差异。需要精确签名时请使用 API 全景。The two implementations follow the same conceptual model but differ in concurrency (async/await vs Reactor), packaging (wheel modules vs Maven artifacts) and lifecycle APIs. Use the full API map to locate exact signatures.

打开 API 全景Open full API map →

基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.