AS AgentScopeAPI 手册 / API Reference
类class agentscope.app.hub

MCPHubBase

class MCPHubBase(HubBase, ABC)
源码Source agentscope/app/hub/_mcp/_base.py:9–69

MCP 中心基类,把智能体接入外部消息渠道与企业平台。位于 agentscope.app.hub 包,继承自 HubBase, ABC。核心成员包括 list_mcps、get_mcp。

A hub exposes a browsable catalog of :class:MCPCard templates. Turning a card into a connectable MCPClient is the installer's job, not the hub's — see :func:agentscope.app._service.render_mcp.

方法摘要Method Summary

方法Method说明Description
async def list_mcps(user_id: str, q: str | None = None, cursor: str | None = None, limit: int = 20) -> MCPHubPageasyncabstractabstractmethod
列出 `list_mcps`。
Browse the hub catalog.
async def get_mcp(user_id: str, card_id: str) -> MCPCardasyncabstractabstractmethod
获取MCP。
Fetch a single card by its hub-local id.

方法详情Method Detail

list_mcps

async def list_mcps(user_id: str, q: str | None = None, cursor: str | None = None, limit: int = 20) -> MCPHubPage
asyncabstractabstractmethod

列出 list_mcps。

Pagination is cursor-based rather than page-numbered: registries commonly expose only a forward cursor and no total count, and an offset-based hub can always encode its offset into the cursor.

参数Parameters
名称Name类型Type说明Description
user_idstr用户标识(类型 `str`)。The user identifier to query MCP cards for.
q默认default Nonestr | Noneq(类型 `str | None`)。A keyword filtering the cards. When `None` the whole catalog is browsed.
cursor默认default Nonestr | None游标(类型 `str | None`)。The opaque cursor from a previous page. When `None` the first page is returned.
limit默认default 20int数量上限(类型 `int`)。The maximum number of cards per page.
返回Returns MCPHubPage
返回MCPHubPage。`MCPHubPage`:
源码Source agentscope/app/hub/_mcp/_base.py:18–46

get_mcp

async def get_mcp(user_id: str, card_id: str) -> MCPCard
asyncabstractabstractmethod

获取MCP。

Fetch a single card by its hub-local id.

参数Parameters
名称Name类型Type说明Description
user_idstr用户标识(类型 `str`)。The user identifier to query the card for.
card_idstr卡片标识(类型 `str`)。The :attr:`MCPCard.id` addressing the card on this hub.
返回Returns MCPCard
返回MCPCard。`MCPCard`:
异常Raises
  • 可能抛出 `Exception`。`KeyError`:
  • 可能抛出 `Exception`。When this hub has no card under `card_id`.
源码Source agentscope/app/hub/_mcp/_base.py:49–69

继承成员Inherited Members

继承自Inherited from HubBase
基于官方固定版本源码静态生成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.