Skip to content

feat(web-fetch): wire @frontagent/mcp-web-fetch into the agent registry & planner (#357)#359

Merged
ceilf6 merged 1 commit into
developfrom
improve/wire-web-fetch-357
Jun 14, 2026
Merged

feat(web-fetch): wire @frontagent/mcp-web-fetch into the agent registry & planner (#357)#359
ceilf6 merged 1 commit into
developfrom
improve/wire-web-fetch-357

Conversation

@ceilf6

@ceilf6 ceilf6 commented Jun 14, 2026

Copy link
Copy Markdown
Member

Linked Issue Or Context

Closes #357. Increment 3/3 of the agent web-fetch capability (after #358 added the unwired @frontagent/mcp-web-fetch adapter). Learned from CLAUDE-FABLE-5.md's web_fetch tool.

Summary

Wires the previously-unwired @frontagent/mcp-web-fetch adapter so the agent can actually call the web_fetch tool, and surfaces it to the two-phase planner.

  • runtime-node (mcp-clients.ts): register web_fetch in WebMCPClient.callTool + listTools, delegating to handleWebFetchTool. No browser launch — playwright is lazy, so web_fetch stays decoupled from the browser tools that share the client.
  • core/agent (agent.ts): add web_fetch to registerWebTools() so the executor routes it to the 'web' client (mirrors how filesense_* is routed via the 'file' client in registerFileTools()).
  • core/schemas (schemas.ts): add web_fetch to ACTION_ENUM so planner-emitted steps with action web_fetch pass StepSchema validation (url param already exists in STEP_PARAMS_SCHEMA). Treated like browser_navigate.
  • core/plan-generation (plan-generation.ts): mention web_fetch in both # 可用工具 prompt regions + a param hint, so the planner knows it can fetch external docs / API references.
  • add @frontagent/mcp-web-fetch workspace dep to runtime-node.

Why web_fetch is added to ACTION_ENUM (unlike filesense_*)

This increment's directive is to give the planner a prompt mention of web_fetch. Planner steps are zod-validated against ACTION_ENUM (StepSchema.action = z.enum(ACTION_ENUM)), so mentioning the tool in the prompt without the enum entry would invite the planner to emit a step that fails validation. Prompt-mention and enum-inclusion are therefore coupled. filesense_* is deliberately NOT planner-surfaced, so it stays registry-only; web_fetch is, so it is treated like browser_navigate.

On the cli MCP registry (issue acceptance criterion)

#357's acceptance criteria list "registered in runtime-node + cli MCP client registries". Investigation shows apps/cli/src/mcp-client.ts is dead code: it is imported nowhere in apps/cli/src (the CLI commands delegate to runFrontAgentTask from @frontagent/runtime-node, which uses runtime-node/src/mcp-clients.ts), the package main is dist/index.js, and no test references its classes. The @frontagent/mcp-filesense precedent was likewise never wired into this dead CLI copy. Wiring it would add a dependency for a never-instantiated class (low-value churn). The live registry — runtime-node — is wired here. Deleting the dead CLI copy is noted as a possible follow-up cleanup, out of scope for this focused PR.

Impact Scope

MVP scope only: no web_search, no planner when-to-search heuristics (deferred to follow-up issues). SSRF guards live in the adapter (#358) with their own security tests.

GitNexus Impact Summary

  • Risk level: LOW
  • Critical skeleton changes: packages/core/src/agent/agent.ts (agent-core, covered by new test in agent.test.ts) and packages/runtime-node/src/mcp-clients.ts (mcp-boundary, covered by new mcp-clients.test.ts). Additive only — new switch case, listTools entry, ACTION_ENUM member, planner prompt lines, and one registerWebTools entry; no signature changes, nothing removed, no caller broken.
  • GitNexus impact: detect_changes reports exactly the expected touched symbols — registerWebTools, WebMCPClient.callTool, generatePlanInTwoPhases/generatePlanSinglePhase (planner prompt builders) — and only the expected processes (CallTool tool dispatch + adapter SSRF chains, GeneratePlan). impact ACTION_ENUM = LOW (0 upstream); impact WebMCPClient = structurally HIGH but the edit is additive. No unexpected scope.
  • Verification: pnpm contract:local passes (both critical boundaries have matching tests); pnpm quality:precommit passes (lint, typecheck, all unit tests, 32 workflow tests).

Verification

  • contract:local: passed.
  • Touched-package tests: core 696 pass (incl. new registerWebTools routing contract), runtime-node 93 pass (incl. new hermetic mcp-clients.test.ts).
  • biome clean on all touched files.
  • Full quality:precommit green via pre-commit hook; pushed through the quality:local pre-push gate.

Checklist

  • I have linked an issue or explained why this PR stands alone.
  • I have kept the diff focused on the stated change.
  • I have run pnpm quality:precommit, or explained why it could not run.
  • I have run pnpm quality:local for critical skeleton changes, or explained why it could not run.
  • I have updated docs or tests when behavior, public APIs, or Harness contracts changed.
  • For critical skeleton changes, I have filled the GitNexus impact summary with concrete results.

🤖 Generated with Claude Code

…ry & planner (#357)

Wires the previously-unwired @frontagent/mcp-web-fetch adapter (PR #358) so
the agent can actually call the `web_fetch` tool, and surfaces it to the
two-phase planner. This is increment 3/3 of #357 and closes it.

- runtime-node: register `web_fetch` in WebMCPClient.callTool + listTools,
  delegating to handleWebFetchTool (no browser launch — lazy playwright,
  so web_fetch stays decoupled from the browser tools sharing the client).
- core/agent: add `web_fetch` to registerWebTools() so the executor routes
  it to the 'web' client (mirrors how filesense_* is routed via the 'file'
  client in registerFileTools()).
- core/schemas: add `web_fetch` to ACTION_ENUM so planner-emitted steps with
  action `web_fetch` pass StepSchema validation (url param already exists in
  STEP_PARAMS_SCHEMA). Treated like browser_navigate.
- core/plan-generation: mention web_fetch in both 可用工具 prompt regions +
  param hint, so the planner knows it can fetch external docs/API refs.
- add @frontagent/mcp-web-fetch workspace dep to runtime-node.
- add hermetic mcp-clients.test.ts asserting web_fetch is listed & routed.

MVP scope only: no web_search, no when-to-search heuristics (deferred).
SSRF guards live in the adapter (#358) with tests.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛡️ ceilf6/repo-guard

代码评审报告: feat(web-fetch): wire @frontagent/mcp-web-fetch into the agent registry & planner (#357)

风险等级:
处理建议: 请求修改
决策摘要: ** 暂不建议合并:关联 issue 的验收标准明确要求同时注册 runtime-node 与 CLI MCP client registry,但本变更只接入了 runtime-node/agent/planner,缺少 CLI registry 适配或明确证据说明 CLI 已不再需要独立接入。

级联分析

  • 变更符号: 原始模型未提供结构化级联字段。
  • 受影响流程: 原始模型未提供结构化级联字段。
  • 变更集外调用方: unknown
  • 置信度: degraded

问题发现

  1. [高] 缺少 issue 验收标准要求的 CLI MCP registry 接入
    • 证据: - Issue #357 Acceptance criteria 明确要求:“Tool registered in runtime-node + cli MCP client registries”。
    • 受影响调用方/流程: - 通过 CLI MCP client registry 暴露工具的执行路径可能仍然无法列出或调用 web_fetch
    • 最小可行修复: - 如果 CLI 仍有独立 MCP registry:在 CLI registry 中注册 web_fetch 并补对应测试。

行级发现

  • 无明确变更行归属。

Karpathy 评审

  • 假设: 模型输出需要归一化为固定 Markdown 契约。
  • 简洁性: 已提取 summary、finding、evidence 与 fix;原始 prose 不再附在评论中,避免占用下游解析与代理上下文。
  • 变更范围: 原始模型未提供结构化范围字段。
  • 验证: 需要查看 CI、测试或人工 CR 证据补强合并信心。

缺失覆盖

  • 输出未命中 Repo Guard Markdown 契约;建议补充真实模型质量评估覆盖。

@ceilf6

ceilf6 commented Jun 14, 2026

Copy link
Copy Markdown
Member Author

Re: repo-guard [高] "Missing CLI MCP registry wiring".

Good catch on the literal acceptance criterion. Investigated, and the premise (a live CLI registry) does not hold: apps/cli/src/mcp-client.ts is dead code.

Evidence:

  • grep -rn "mcp-client" apps/cli/src finds no import/export/require of the ./mcp-client module anywhere in apps/cli/src.
  • The CLI commands run tasks via runFrontAgentTask imported from @frontagent/runtime-node (apps/cli/src/commands/run.tsx, headless.ts), which uses packages/runtime-node/src/mcp-clients.ts — the registry this PR wires.
  • The CLI package main is dist/index.js; only the file's own compiled artifacts reference it. No test references its WebMCPClient/FileMCPClient/MemoryMCPClient.
  • The @frontagent/mcp-filesense precedent was likewise never wired into this dead CLI copy.

So wiring it would add a workspace dependency for a class that is never instantiated (low-value churn). The live registry (runtime-node) is wired. I've recorded this in the PR description and flagged deleting the dead CLI copy as a possible follow-up cleanup (kept out of this focused PR).

@ceilf6 ceilf6 merged commit 3b3ad42 into develop Jun 14, 2026
11 of 12 checks passed
@ceilf6 ceilf6 deleted the improve/wire-web-fetch-357 branch June 14, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: agent web-fetch capability — new pluggable repo (ceilf6) wrapped as @frontagent/mcp-* (learned from CLAUDE-FABLE-5 web_fetch)

1 participant