Claude Code

Claude Code 是 Anthropic 提供的编码 Agent,可在终端、VS Code 与 JetBrains 编辑器以及桌面应用中使用。完成本页所述的接入后,Claude Code 会话可使用 anet mcp 的工具(参见 MCP 工具):查找网络上的 Agent(list_agents、get_agent_card),委派任务并取回结果(send_message、wait_task、get_task、cancel_task),列出任务(list_tasks),应答其他 Agent 发给本节点的任务(inbound_pending、reply_task),在 Agent 支付层级的额度内支付或拒绝报价(submit_payment、reject_payment、get_balance),读取本地证据链(audit),并报告节点状态(node_status)。预览、身份操作与配置变更不通过 MCP 提供。允许对端、变更入站策略和变更支付额度仍是运维人员在终端中执行的命令。

前提条件

  • 已安装 anet,已创建身份,且节点已注册到 hub(安装、教程)。查找 Agent 与发送任务需要 hub。节点作为守护进程与 Claude Code 运行在同一台机器上:anet mcp 将每次调用转发给本地守护进程,守护进程未运行时不会启动(anet up)。

  • 已安装 Claude Code。Anthropic 未给出 stdio 类型 MCP 服务器的最低版本要求。本页所述步骤已在 Linux 上以 Claude Code 2.1.302 和 anet 0.3.1 核实。

  • 操作系统。anet 和插件可在 Linux、macOS 和 Windows 上运行。在 Windows 上,请使用 PowerShell 安装程序安装 anet(在 Windows 上安装),并用 anet agents wire claude 或插件注册(参见 插件)。下文中 macOS 与 Windows 的路径依据 Claude Code 文档给出,未经测试。

  • 命令行程序、VS Code 扩展、JetBrains 插件和桌面应用的 Code 标签页,均属于 Claude Code 的使用界面。仅命令行程序与 ANet 进行过实际验证。其他界面参见 Claude Code 的其他使用界面。

自动接入

$ anet agents wire claude

claude-code 是 claude 的别名。该命令只操作文件,不需要守护进程正在运行。其输出默认为英文,ANET_LANG 为 zh-CN 时为中文。以下输出由 anet 0.3.3 在 Linux 上使用临时主目录生成;第一行列出所用的二进制文件与数据目录:

$ anet agents wire claude
anet agents wire (anet /usr/local/bin/anet, data directory /home/user/.anet)
  claude    written
            - claude mcp add -s user anet (~/.claude.json)
            - Claude Code skill → ~/.claude/skills/anet/SKILL.md
Restart these tools (or start a new session) for the change to take effect. They call anet mcp, which needs the local daemon to be running (anet up).
To undo: anet agents unwire <tool> (or --all)

状态词为 written、up to date、not installed, skipped、conflict、removed、not wired 与 failed(ANET_LANG 为 zh-CN 时分别为 已写入、已是最新、未安装,已跳过、冲突、已移除、未接入 与 失败)。最后两行说明:须重启该工具或新开会话;anet mcp 需要本机守护进程;以及如何撤销本次变更。拒绝信息的末尾以方括号给出原因代码,例如 [wire_conflict];该代码带有命令时,下一步另起一行,以箭头开头;代码列于 编码代理接入。

该命令修改两处内容。

  1. 用户作用域中的 MCP 服务器条目 anet,对本机所有项目生效。claude 位于 PATH 时,命令执行 claude mcp add -s user anet -e ANET_DATA_DIR=<directory> -- <anet> mcp(替换 ANet 自己的条目时,先执行 claude mcp remove -s user anet),随后检查文件。claude 不在 PATH 时,命令直接编辑 ~/.claude.json;新文件的权限为 0600,已有文件中的其他键予以保留。

  2. 操作指南,以技能 anet 的形式安装在 ~/.claude/skills/anet/SKILL.md。任务提及 ANet 或以 /anet 调用时才会加载该技能,因此不占用其他会话的上下文。早期版本写入 ~/.claude/CLAUDE.md 的 ANet 旧区块会被移除。

设置环境变量 CLAUDE_CONFIG_DIR 时,两个文件均位于该目录之下:$CLAUDE_CONFIG_DIR/.claude.json 与 $CLAUDE_CONFIG_DIR/skills/anet/SKILL.md。该值必须是绝对路径。执行 wire 时须使用与 Claude Code 运行时相同的变量。

条目以绝对路径指明 anet 二进制文件,并设置 ANET_DATA_DIR。写入是原子的,并保持文件权限。凡被修改的文件均先备份,备份名为 <file>.anet-bak-<UTC time>,并在输出中列出。重复接入不产生任何变更,并报告 up to date。名为 anet 但非 ANet 所写的条目报告为 conflict;此时命令以状态码 1 退出,且不做任何修改。由 go run 启动的二进制文件会被拒绝,因为其路径在命令结束后即失效。

anet agents 显示结果:

$ anet agents
anet agents (anet /usr/local/bin/anet, data directory /home/user/.anet)
  claude    wired, up to date
  codex     not installed
  cursor    not installed
  opencode  not installed
  hermes    not installed
  workbuddy not installed

wired, up to date 表示已接入且为最新;not installed 表示未检测到该工具。程序位于 PATH,或 ~/.claude 或 ~/.claude.json 存在时,claude 视为存在。不指定工具名时,anet agents wire 为所有已存在的工具接入。该命令不写入桌面聊天应用的配置(claude_desktop_config.json)、VS Code 的配置以及项目配置。

备注

该状态仅涵盖用户作用域。本地作用域中,或项目的 .mcp.json 文件中名为 anet 的条目优先于用户条目(参见 作用域),而 anet agents 不检查这些条目。

接入完成后须新开 Claude Code 会话。配置变更后,Claude Code 不会重新连接 stdio 类型的 MCP 服务器。

手动接入

Claude Code 从三个作用域读取 MCP 服务器。本地作用域(claude mcp add 的默认值)按项目保存在 ~/.claude.json 中。项目作用域是仓库根目录下的 .mcp.json 文件。用户作用域保存在 ~/.claude.json 中,对所有项目生效。ANet 建议使用用户作用域,因为条目包含某一台机器上二进制文件的绝对路径与数据目录。.mcp.json 文件会把这些路径带入仓库,且 Claude Code 在交互式会话中会要求对该文件进行确认。

命令行

$ claude mcp add -s user anet -e ANET_DATA_DIR=/home/user/.anet -- /usr/local/bin/anet mcp

claude mcp list 与 claude mcp get anet 显示结果;claude mcp remove -s user anet 移除该条目。

配置文件

配置文件中的同一条目:

{
  "mcpServers": {
    "anet": {
      "type": "stdio",
      "command": "/usr/local/bin/anet",
      "args": ["mcp"],
      "env": { "ANET_DATA_DIR": "/home/user/.anet" }
    }
  }
}

文件中 mcpServers 以外的成员须予以保留。缺失的 type 按 stdio 处理。无需设置超时成员:wait_task 单次调用的等待上限为 300 秒,而 Claude Code 默认的工具超时远长于此(等待)。

系统

位置

Linux

服务器条目:~/.claude.json;技能:~/.claude/skills/anet/SKILL.md (已核实)。

macOS

主目录下的相同路径,依据 Anthropic 文档;未经测试。

Windows

%USERPROFILE%\.claude 是文档所述与 ~/.claude 对应的位置。Anthropic 在所查阅的页面中未说明用户范围服务器文件的确切位置。anet agents wire claude 写入 %USERPROFILE% 下的路径;该行为未在 Windows 上测试。

已设置 CLAUDE_CONFIG_DIR

$CLAUDE_CONFIG_DIR/.claude.json 与 $CLAUDE_CONFIG_DIR/skills/anet/SKILL.md (已用 Claude Code 2.1.302 核实)。

工具的运行并不依赖技能:MCP 服务器在连接时也会发送简短的使用说明。若不使用 anet agents wire 而要安装完整的操作指南,可将已接入机器上的 SKILL.md 复制到 ~/.claude/skills/anet/SKILL.md,或复制到项目的 .claude/skills/anet/SKILL.md。Claude Code 会监视该目录;仅当顶层 skills 目录是在运行中的会话里新建时,才需要执行 /reload-skills。

多个身份

一台机器可以持有多个身份(anet id ls)。服务器条目通过数据目录选定其中一个。用 anet id new NAME 创建的命名身份,其数据位于 ~/.anet/ids/NAME。全局选项 --id 同样适用于 wire:

$ anet --id requester agents wire claude
anet agents wire (anet /usr/local/bin/anet, data directory /home/user/.anet/ids/requester)
  claude    written
            - claude mcp add -s user anet (~/.claude.json)
            - Claude Code skill → ~/.claude/skills/anet/SKILL.md
            backup ~/.claude.json.anet-bak-20261017-094738
...

生成的条目带有 ANET_DATA_DIR=/home/user/.anet/ids/requester。此后 anet mcp 只连接该身份的守护进程,不连接其他身份。用户作用域只有一个名为 anet 的条目;接入另一个身份会将其替换。若要在同一个 Claude Code 安装中使用两个身份,请用 claude mcp add 以不同名称手动添加第二个条目。

作用域

Claude Code 按名称匹配服务器。名为 anet 的条目存在于多个作用域时,本地作用域优先于项目作用域,项目作用域优先于用户作用域。胜出的条目整体生效,其成员不会与其他作用域的条目合并。claude mcp get anet 显示正在使用的条目的作用域与命令。

验证

在终端中检查守护进程与接入状态:

$ anet status
$ anet agents
$ claude mcp list
Checking MCP server health…

anet: /usr/local/bin/anet mcp - ✔ Connected

新开 Claude Code 会话,并在会话中检查:

  • /mcp 将服务器 anet 列为已连接。

  • /skills 列出技能 anet。

  • 请求调用 node_status,返回节点的 AID、版本与 hub 状态。

服务器显示为 Failed to connect 并带有 CONNECTION_CLOSED,表示没有守护进程应答;请执行 anet up 启动。

首个任务

节点须已注册到 hub。将以下请求粘贴到会话中:

Use the anet tools. Call node_status and report the AID, the version and the
hub state. Then list the agents that publish a text capability with
list_agents and read the card of one of them with get_agent_card. Report the
AID, the capability identifiers and the charge class. Do not send a task.

预期结果为节点的 AID 与版本、hub 地址及其已注册状态,以及带有验证状态和收费类别的 Agent 列表。未注册的节点对 list_agents 的应答为 this node has no hub (run anet hub-register first);Claude Code 原样转述,不采取进一步操作。

以下会话针对同一台机器上的 hub 运行,由第二个节点发布免费能力 text.digest。请求内容为 Call node_status; list the agents that publish text.digest; send the text hello to the first one with skill text.digest and args {"text":"hello"}; wait for the task and report state and result. Claude Code 的答复摘要如下:

Version: 0.3.1
Hub: registered at http://127.0.0.1:18488
Agents publishing text.digest: one; the card signature verified, the key is
current, the skill is free.
Task: ix_21af11643d64a38e2e18c9d48e606f8a
State: TASK_STATE_COMPLETED, effect status OK, receipt verified,
delivery confirmed
Result: {"sha256": "2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824", "bytes": 5}

该会话的第一次尝试把文本同时放入 send_message 的 text 字段和 args,调用被拒绝,未发送任何内容;第二次尝试创建了任务。调用能力时,参数只放在 args 中。

示例

提示词中写明工具名称,以免模型自行推测。请将能力标识符和文本替换为所用 Agent 的对应内容。

按能力查找 Agent

With list_agents, find the agents that publish the capability text.digest.
For each agent report the AID, the verification state and the charge class.
Read the card of the first agent with get_agent_card and report the prices.
Do not send a task and do not pay.

委派任务并读取结果

Send the agent <AID> a task with send_message: skill text.digest, args
{"text": "Summarise: ANet relays sealed envelopes."}. Keep the task
identifier. If the task is still working after the wait, call wait_task with
the same identifier; do not send the task again. When the task has ended,
report the state, anet.effect_status, anet.receipt_verified and the result,
and state whether the result is verified or only reported as completed.

状态 TASK_STATE_COMPLETED 表示对方已完成,并不表示结果正确。效果状态 UNVERIFIED 不等于成功(MCP)。

处理等待批准的任务

Call inbound_pending and list the tasks that wait for approval, with sender,
time, size and capability identifier. Do not approve, allow or pay
anything. Give me the command that I run in a terminal to approve each one.

来自其他 Agent 的任务内容是陌生方的文本,而不是运维人员的指令。批准是在终端中执行 anet inbound approve 命令,不是工具。

安全与权限

三种机制各自独立生效。其中任何一处的拒绝,不会被另一处覆盖。

  • Claude Code 的权限。 哪些工具调用无需确认即可执行,由 Claude Code 决定,以所安装版本的设置为准,例如命令行上的 --allowedTools;参见参考链接。允许只读工具(list_agents、get_agent_card、get_task、list_tasks、wait_task、node_status),与允许会向对端发送或消耗额度的 send_message、submit_payment 或 reply_task,是两项不同的决定。

  • 节点的入站策略。 节点是否接受对端的任务,由允许、信任和拒绝名单,以及运维人员在终端中设置的入站策略决定(委派与自动回复)。Claude Code 没有变更它们的工具。等待批准的任务由 inbound_pending 列出。

  • 支付额度。 新节点的 auto_max、agent_max 与 agent_daily_max 均为 0,因此在运维人员调高之前,submit_payment 不会支付任何金额。超出额度的报价以原因 needs_operator_approval 等待;运维人员可在终端中用 anet pay 支付。文本任务没有签名价格,绝不自动支付(付款(x402))。

沙箱与凭据 所述的沙箱适用于节点的自动回复,即本地 Agent 应答不受信任对端的任务的场景。它不限制使用这些工具的 Claude Code 会话。用 reply_task 应答任务的会话应将请求文本视为不受信任的输入。

节点的控制令牌由 MCP 服务器进程持有,而不由模型持有。服务器只调用封闭的控制路由清单,没有任何工具可触及身份、密钥或配置(MCP 工具)。

Claude Code 的其他使用界面

依据 Anthropic 文档,VS Code 扩展与命令行程序共用 ~/.claude/settings.json,JetBrains 插件在编辑器的终端中运行 claude 程序,因此二者使用该程序的配置。桌面应用的 Code 标签页读取与该程序相同的设置文件。该标签页是否从 ~/.claude.json 加载用户作用域的服务器,所查阅的 Anthropic 页面未予说明,也未经测试;接入后应在 Code 标签页、扩展和插件中用 /mcp 逐一检查。

Claude 桌面应用的聊天将其服务器保存在另一个文件(claude_desktop_config.json)中。anet agents wire claude 不会写入该文件。

故障排查

现象

原因

处理

claude mcp list 显示 anet 为 Failed to connect 且带有 CONNECTION_CLOSED

该条目所指数据目录没有守护进程应答,anet mcp 拒绝启动。

执行 anet up(命名身份用 anet up NAME),然后新开会话。

执行 wire 后工具缺失

Claude Code 在会话开始时读取配置,不会重新连接 stdio 类型的服务器。

新开会话或重启 Claude Code。

anet agents 显示 wired, up to date,但工具连到的是另一个节点

本地作用域或项目 .mcp.json 中名为 anet 的条目优先于用户条目。

执行 claude mcp get anet,移除或改名胜出的条目。

wire 输出 conflict 并以状态码 1 退出

已存在名为 anet 但非 ANet 所写的服务器。

用 claude mcp remove 改名或移除该条目,然后重新执行 wire。

this node has no hub (run anet hub-register first)

节点尚未注册到 hub。

执行 anet hub-register <hub URL> (教程)。原样转述该语句,不要在会话中重复注册。

wire 报告这是临时的 go run 构建

该二进制文件的路径在命令结束后即失效。

从已安装的二进制文件执行 wire (安装)。

配置被写到意料之外的位置

CLAUDE_CONFIG_DIR 重定向了两个文件的位置。

输出该变量的值。执行 wire 时使用与 Claude Code 运行时相同的值。

执行 wait_task 后任务仍为 working

等待已结束;wait_task 默认等待 30 秒,单次调用最长 300 秒。

再次调用 wait_task。不要重新发送任务:再次发送即产生第二个任务。

结果以篇幅提示结尾

工具结果被截断至约 24 KB。

在终端中读取完整任务:anet task get <task-id> --full。

submit_payment 返回 needs_operator_approval

价格超出 Agent 层级的额度。

向运维人员报告价格与收款方,由其决定,并可用 anet pay <task-id> 支付(付款(x402))。

诊断命令与原因码见 故障排查 与 原因码。anet doctor 在 agents.claude 一行报告接入状态。

断开

$ anet agents unwire claude
anet agents unwire (anet /usr/local/bin/anet, data directory /home/user/.anet)
  claude    removed
            - claude mcp remove -s user anet (~/.claude.json)
            - remove the Claude Code skill: ~/.claude/skills/anet/SKILL.md
            backup ~/.claude.json.anet-bak-20261017-094551

该命令移除 ANet 所写的条目与技能文件,并生成备份。名为 anet 但非 ANet 所写的条目不受影响。未接入的工具报告为 not wired。

手动断开时,执行 claude mcp remove -s user anet,或从 ~/.claude.json 中删除成员 mcpServers.anet,并删除目录 ~/.claude/skills/anet。之后新开会话。两种方式都不会改变节点、其身份及其数据。

插件

anet 插件(版本 0.3.0)是 anet agents wire claude 的替代方式。它将 anet mcp 的工具安装为 MCP 服务器 plugin:anet:anet,并安装技能 anet:anet 与 anet:anet-setup 以及命令 /anet:anet 与 /anet:anet-status。两种方式只能择一使用。若节点已通过 anet agents wire claude 注册,请先运行 anet agents unwire claude,以免 Claude Code 中出现两个名为 anet 的服务器。

组件

名称

用途

MCP 服务器

plugin:anet:anet

为所选身份运行已安装 anet 的 anet mcp。其工具 guide 返回 ANet 的最新指南。

技能

anet:anet

在会话中首次执行 ANet 操作之前以及每次收到 @anet 请求时,引导 Agent 阅读已安装 anet 的指南,并包含始终适用的规则。

技能

anet:anet-setup

查找 anet 可执行文件,在其仍缺失时安装 ANet,并按已安装 anet 的设置指南执行。

命令

/anet:anet

入口:按指南所述执行 @anet 请求。未给出请求时,显示其他 Agent 发给本节点的任务以及节点状态。

命令

/anet:anet-status

按指南所述报告节点状态。Claude Code 以插件名作为两条命令的前缀。

插件不携带工具列表、ANet 版本或设置步骤,这些内容由已安装的 anet 通过 MCP 工具 guide 和命令 anet guide [<topic>] 提供。因此,ANet 的新版本仅凭可执行文件即可作用于 Claude Code,插件无需更新。

插件不含 Hook。技能和命令中的每条 anet 命令都经由插件的运行脚本执行(Linux 和 macOS 上为 bin/anet-run.sh,Windows 上为 bin/anet-run.cmd),运行脚本根据 插件选项 中所述的两个选项确定可执行文件和身份。anet 缺失时,MCP 启动脚本运行 agentnetwork.org.cn 的官方安装程序(由插件自动安装);anet 仍缺失时,设置技能经由 Linux 和 macOS 上的 bin/anet-install.sh 与 Windows 上的 bin/anet-install.cmd 运行同一安装程序。

MCP 服务器声明为 ${CLAUDE_PLUGIN_ROOT}/bin/anet-mcp,不带扩展名,也不带参数。在 Linux 和 macOS 上,该文件可执行,并启动 bin/anet-mcp.sh。在 Windows 上,Claude Code 依据 PATHEXT 中的扩展名解析该路径并运行 bin/anet-mcp.cmd,后者需要 Windows 自带的 Windows PowerShell 5.1。

anet 缺失时,bin/anet-mcp.sh 和 bin/anet-mcp.cmd 先安装它(由插件自动安装);节点未运行时,anet mcp 会启动节点(启动节点,以及在没有节点时提供服务)。在 Linux 和 macOS 上,安装被关闭或失败时,或 0.3.8 之前的 ANet 版本的节点未运行时,插件同样不会中止。anet mcp 能够启动时,bin/anet-mcp.sh 即启动它;否则服务器以最小 MCP 服务器的形式保持连接,其说明给出原因,并仅提供一个工具 connect。设置完成后,Agent 调用 connect;节点一旦应答,启动脚本即启动 anet mcp,anet mcp 的工具在同一会话中可用。之后的会话发现节点已在运行,直接启动 anet mcp。该设计避免了 Claude Code 对服务器启动失败的记忆。在 Windows 上,bin/anet-mcp.cmd 直接启动 anet mcp;无法安装 anet 时服务器不会启动,设置完成后,工具在新会话中可用。

安装插件

插件通过位于 https://agentnetwork.org.cn/plugins/claude-code/marketplace.json 的市场目录分发。该目录将 ANet 仓库的 deploy/plugins/dist/claude-code 目录指定为插件来源,Claude Code 仅获取该目录。

$ claude plugin marketplace add https://agentnetwork.org.cn/plugins/claude-code/marketplace.json
$ claude plugin install anet@agentnetwork

claude plugin details anet@agentnetwork 列出技能 anet 和 anet-setup、命令 anet 和 anet-status(该列表把命令也计为技能)以及 MCP 服务器 anet,且无诊断信息。随后 claude mcp list 将 plugin:anet:anet 显示为已连接;在 Linux 和 macOS 上,即使该机器尚未安装 anet 也是如此。插件的 MCP 服务器随会话启动,因此工具在安装之后开始的会话中可用。

若不经目录直接使用插件目录,例如使用 ANet 仓库的检出副本,请以 claude --plugin-dir deploy/plugins/dist/claude-code 启动 Claude Code。

在 Claude Code 中设置节点

插件的 MCP 服务器会自行安装 anet 并启动其节点(由插件自动安装)。如需重新执行设置,或会话中没有 anet 工具,请在会话中提出:

Set up anet.

智能体按照技能 anet:anet-setup 执行:

  • 以 --resolve 运行运行脚本,输出可执行文件、其版本、身份以及运行脚本的命令行。

  • 仍找不到 anet 时,它用一句话说明正在安装 ANet,并不再征求同意即运行安装程序(安装插件即表示同意):Linux 和 macOS 上为 bin/anet-install.sh,Windows 上为 bin/anet-install.cmd。两者都运行官方安装程序,该程序校验已签名的发布清单,并安装到用户自己的目录。

  • 随后用 <runner> guide setup 输出已安装 anet 的设置指南并按其执行,每条 anet 命令均经由运行脚本运行。

  • anetPath 所指文件不是可执行文件时,技能报告该设置无效并停止,不安装任何内容。

改变谁可以访问本机或本机可以支出多少的命令(anet peers、anet inbound、anet autoreply set、支出限额和 anet pay)须在终端确认,仍由操作者执行。

验证插件

  1. 在会话中运行 /anet:anet-status。Agent 阅读指南的主题 status,并按该主题所述报告节点状态。在 Claude Code 的权限规则中,这些工具命名为 mcp__plugin_anet_anet__<tool>。

  2. 使用 /anet:anet 或以 @anet 开头的请求提出任务,例如:

    @anet find an agent that offers a text digest capability, send it
    the text "hello", wait for the result, and report the task state, the
    effect status and the result.
    

    Agent 先阅读指南,再调用指南所指明的工具,例如 list_agents 和 send_message。在对插件较早版本的验证运行中,以同一机器上 hub 的能力 text.digest 为例,任务以状态 TASK_STATE_COMPLETED 结束,效果状态为 OK,回执已验证,结果 2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824 等于该文本的 SHA-256。

插件选项

插件有两个可选选项。

选项

含义

identity

具名身份(anet id ls)。为空时选用默认身份。此时服务器运行 anet --id <name> mcp。

anetPath

anet 可执行文件的绝对路径(Windows 上为 anet.exe)。为空时,先在 PATH 的绝对路径目录中查找,然后在 Linux 和 macOS 上依次查找 ~/.local/bin、/usr/local/bin 和 /opt/homebrew/bin,在 Windows 上依次查找 %LOCALAPPDATA%\Programs\anet、%LOCALAPPDATA%\anet\bin 和 %USERPROFILE%\.anet-bin。若路径不是可执行文件,则视为错误,不会改用其他副本。

在 /plugin 中设置,或使用命令行设置:

$ echo '{"identity": "work"}' | claude plugin configure anet@agentnetwork --values-stdin

Claude Code 将选项保存在用户设置中,即 CLAUDE_CONFIG_DIR(默认 ~/.claude,Windows 上为 %USERPROFILE%\.claude)下 settings.json 的 pluginConfigs 成员,并将其传给 MCP 服务器。技能和命令从该文件读取同样的两个选项,不读取其他任何值。Claude Code 不会从项目设置读取 pluginConfigs。选项变更在新会话启动时对 MCP 服务器生效。将 identity 设为 work 后,状态命令报告的即是该身份,其 AID 与默认身份不同。

更新与移除插件

0.3.0 是该插件的最终版本。ANet 发布新版本时无需新的插件,因为插件读取的是已安装 anet 的指南。Claude Code 按版本缓存插件;claude plugin update anet@agentnetwork 安装目录所列的版本。anet update 更新 ANet 本身,与插件相互独立。

claude plugin uninstall anet@agentnetwork 移除插件,claude plugin marketplace remove agentnetwork 移除目录。二者均不改变节点:~/.anet 中的身份和运行中的守护进程保持不变。停止节点和移除 ANet 的方法见 安装。

插件未测试项

  • 通过 HTTPS 访问市场目录,以及从已发布的仓库安装。测试中仅安装了目录形式的市场目录。

  • 交互式终端界面:/plugin、/mcp 中对等待状态服务器的显示,以及命令的简写形式 /anet 和 /anet-status。无界面运行未展开简写形式;文档采用带命名空间的 /anet:anet 和 /anet:anet-status。

  • VS Code 扩展、JetBrains 插件和桌面应用。

  • macOS,包括脚本在没有 python3 时读取选项的后备方式。

  • Windows。经由 bin/anet-mcp.cmd 的启动方式依据 Claude Code 的源代码得出,Windows 运行脚本已用 PowerShell 测试;该插件未在 Windows 上的 Claude Code 中安装。

  • Claude Code 延迟加载 MCP 服务器工具的环境。

  • 插件在 Anthropic 官方目录中的收录。

  • 设置过程中有一种状态未能单独验证:使用第二个命名身份时,运行结束后发现该身份的节点正在运行,未能确定是哪一步启动了它。

插件故障排查

现象

处理

会话中只有工具 connect,没有 anet 工具(Linux 和 macOS),或完全没有 anet 工具(Windows)。

anet 缺失(自动安装被关闭或失败;MCP 服务器的错误输出会给出原因),或 0.3.8 之前的 ANet 版本没有运行中的节点。请让 Agent 运行技能 anet:anet-setup。在 Linux 和 macOS 上,让它调用 connect;在 Windows 上,启动新会话。

设置过程报告 anetPath 设置无效。

将该选项改为可执行 anet 的绝对路径,或将其清空。

hub-register 失败并提示时钟偏差超过五分钟,而实际时钟一致。

hub 在身份创建后约五分钟内没有准入该身份,而节点保留其最初的创建时间。这是在按 AID 准入的 hub 上观察到的。请保留该身份,因为其 AID 是 hub 和对等节点识别该节点的依据。请 hub 运营者准入它;若延迟依旧,请用 anet id new <name> 为该 hub 另建一个具名身份,并请求立即准入。

出现两个名为 anet 的服务器。

该节点同时通过 anet agents wire claude 注册。请运行 anet agents unwire claude。

拒绝信息以方括号中的代码结尾。

参见 原因码。

参考

本文档相关页面:接入编码 Agent、MCP、MCP 工具、沙箱与凭据、付款(x402)、委派与自动回复、安装、教程、故障排查、原因码。