Skip to content

feat: generate ADK MCP client from spec.agent.mcp - #317

Merged
edenreich merged 3 commits into
mainfrom
feat/issue-310-20260723-0857
Jul 23, 2026
Merged

edenreich merged 3 commits into
mainfrom
feat/issue-310-20260723-0857

Conversation

@inference-gateway-maintainer

Copy link
Copy Markdown
Contributor

Summary

Consume the consolidated spec.agent.mcp block (inference-gateway/adl#119) so adl generate produces a working ADK MCP client - closing the generator half of this feature.

When spec.agent.mcp.enabled is true on a Go agent, the generator:

  • wires an MCPClientManager into main.go (guarded by cfg.A2A.MCPConfig.Enable) that connects to the servers in the background over streamable HTTP and registers the mcp_list_tools / mcp_call_tool selector tools into the toolbox - no manual env-var wiring needed;
  • emits each mcp field as its matching A2A_MCP_* default in .env.example (manifest value is the default, overridden by the env var at runtime);
  • derives A2A_MCP_SERVERS from the http servers' base URLs.

enabled: false (or an omitted block) generates no MCP code.

stdio/sse resolution

The ADK MCP client (adk#251, adk/server/mcp.go, already in the pinned adk v0.24.0) is streamable-HTTP-only and exists only in the Go ADK. So:

  • stdio/sse servers are dropped from A2A_MCP_SERVERS (the validator warns per server);
  • the whole block is ignored for TypeScript/Rust agents (the validator warns), mirroring how spec.telemetry treats Rust.

Schema

Refreshed the vendored schema + regenerated types (MCP block, MCPServer). No tagged adl release carries the consolidation yet, so ADL_SCHEMA_VERSION is pinned to the adl#119 commit (cc65494); bump it to the tag once cut.

Verification

  • Generated examples/go-agent-mcp.yaml and confirmed the project compiles against adk v0.24.0 (validates NewMCPClientManager, cfg.A2A.MCPConfig, Start/Close/RegisterTools).
  • New unit tests for the env-var derivation and validator warnings; go test ./..., golangci-lint, and adl validate over all examples pass.
  • Wired go-agent-mcp into both examples:test and examples:generate.

Downstream

ADL_SCHEMA_VERSION should be bumped to the tagged adl release once it ships. The operator#173 follow-up (documenting raw A2A_MCP_*) is superseded by this generation.

Closes #310

Consume the consolidated spec.agent.mcp block (adl#119): when
mcp.enabled is true on a Go agent, wire an MCPClientManager into
main.go (registering the mcp_list_tools / mcp_call_tool selector
tools) and emit the A2A_MCP_* defaults in .env.example. Each field
maps 1:1 to an A2A_MCP_* env var; A2A_MCP_SERVERS is derived from the
http servers' base URLs.

The ADK MCP client is Go-only and streamable-HTTP-only, so stdio/sse
servers are dropped from A2A_MCP_SERVERS and the block is ignored for
TypeScript/Rust agents - the validator warns in both cases.

Refresh the vendored schema to the adl#119 consolidation commit and
regenerate types (MCP block, MCPServer). Add examples/go-agent-mcp.yaml
and wire it into the regression lists.
@edenreich

Copy link
Copy Markdown
Contributor

@claude I want that mcp is generated by default as disabled and there is .mcp.servers empty array when running adl init --defaults - can you add this?

@inference-gateway-maintainer

inference-gateway-maintainer Bot commented Jul 23, 2026 •

Copy link
Copy Markdown
Contributor Author

Claude finished @edenreich's task in 4m 26s —— View job


Done: adl init --defaults now emits a disabled spec.agent.mcp block

  • Add mcp block (enabled: false, servers: []) to the init default manifest under spec.agent
  • Add a regression test (TestInitDefaultsEmitsMCPDisabled)
  • Run go test ./..., go vet, go fmt, and validate the generated manifest
  • Commit to the PR branch

adl init --defaults now writes:

  agent:
    provider: ""
    model: ""
    systemPrompt: You are a helpful AI assistant.
    mcp:
      enabled: false
      servers: []

What changed

  • cmd/init.go: added named mcpBlock / mcpServerBlock types and wired MCP: &mcpBlock{Enabled: false, Servers: []mcpServerBlock{}} into buildADL for ai-powered agents. servers renders without omitempty so servers: [] shows up as a breadcrumb (same pattern as vendor.deps: []), and the full server shape means an existing manifest's servers survive the "use existing ADL" read/rewrite round-trip.
  • cmd/init_test.go: TestInitDefaultsEmitsMCPDisabled asserts the block is present, disabled, has a non-nil empty servers list, and that the manifest passes schema validation.

Verification

  • go test ./... - all pass
  • go vet ./cmd/ clean, go fmt ./cmd/ no changes
  • adl validate on the generated default manifest: ✅ valid
  • Since mcp.enabled: false, validateMCP short-circuits, so no MCP warnings fire on the default manifest.

Note: mcp lives under spec.agent, so minimal agents (which have no agent block) get no mcp block - --defaults produces an ai-powered agent, so it always gets one.

  • branch feat/issue-310-20260723-0857

`adl init --defaults` now writes a spec.agent.mcp block with
enabled: false and an empty servers list, so the MCP client is off
by default and users can discover where to add servers.
@edenreich
edenreich merged commit f24cc4c into main Jul 23, 2026
1 check passed
@edenreich
edenreich deleted the feat/issue-310-20260723-0857 branch July 23, 2026 09:37
inference-gateway-releaser Bot added a commit that referenced this pull request Jul 23, 2026
## [0.54.0](v0.53.0...v0.54.0) (2026-07-23)

### ✨ Features

* generate ADK MCP client from spec.agent.mcp ([#317](#317)) ([f24cc4c](f24cc4c)), references [adl#119](https://github.com/adl/issues/119) [adl#119](https://github.com/adl/issues/119)

### 👷 CI

* add schema sync workflow triggered from adl ([#319](#319)) ([d003498](d003498))

### 📚 Documentation

* document schema sync process and symlink CLAUDE.md to AGENTS.md ([#321](#321)) ([851d662](851d662))

### 🔧 Miscellaneous

* sync ADL schema to v0.23.0 ([#322](#322)) ([50281c9](50281c9))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.54.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jul 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Generate the ADK MCP client from spec.agent.mcp

1 participant