Changelog — Cloudflare の新しい更新と改善
公開日: 2026-07-13
概要
Agents が Model Context Protocol (MCP) サーバーへ addMcpServer で接続している場合、サーバーからの「elicitation ↗」要求を処理できるようになりました。
- エリシテーションは、MCP サーバーがツール呼び出しを処理中にユーザー入力を要求するための仕組みです。
form モードは構造化された非機密データを収集します。
url モードは、サードパーティの認可や支払いなどのアウトオブバンドフローを開く前に同意を求めます。
シーケンス(概要)
- Server -> Agent:
elicitation/create
- Agent -> User: サーバー情報・理由・入力またはURLを表示
- User -> Agent: 提出(Submit)、開く(Open)、拒否(Decline)、またはキャンセル(Cancel)
- Agent -> Browser: 同意後に URL を開く(URL モード)
- Agent -> Server:
accept、decline、または cancel
- Server ->> Agent: 任意の URL 完了通知
ハンドラーの登録
サポートする各モードについて、onStart() 内でハンドラーを登録してください。接続は、設定されたハンドラーがあるモードのみを広告(advertise)します。ハンドラーが無い Agent はエリシテーション機能を広告しないため、サーバーはフォールバックを使用できます。
SDK は MCP サーバー登録ごとに広告されたモードを保存するので、Durable Object のハイバネーションをまたいで保持されます。コールバック関数はメモリ上に残り、onStart() が再実行されると再アタッチされます。
JavaScript 例
import { Agent } from "agents";
export class MyAgent extends Agent {
onStart() {
this.mcp.configureElicitationHandlers({
form: (request, serverId) => this.forwardToUser(request, serverId),
url: (request, serverId) => this.forwardToUser(request, serverId),
});
}
forwardToUser(request, serverId) {
throw new Error(`Implement elicitation for ${serverId}: ${request.params.message}`);
}
}
TypeScript 例
import { Agent } from "agents";
import type { ElicitRequest, ElicitResult } from "agents/mcp";
export class MyAgent extends Agent<Env> {
onStart() {
this.mcp.configureElicitationHandlers({
form: (request, serverId) => this.forwardToUser(request, serverId),
url: (request, serverId) => this.forwardToUser(request, serverId),
});
}
private forwardToUser(request: ElicitRequest, serverId: string): Promise<ElicitResult> {
throw new Error(`Implement elicitation for ${serverId}: ${request.params.message}`);
}
}
実装の詳細と参考
- 実装の詳細およびブラウザへの転送パターンについては「MCP client elicitation ↗」を参照してください。
mcp-client ↗ と mcp-elicitation ↗ のサンプルは、サーバー側とクライアント側の双方(両方の側面)を実装しています。
アップグレード
このリリースにアップデートするには、以下のいずれかのコマンドを使用してください:
npm i agents@latest
yarn add agents@latest
pnpm add agents@latest
bun add agents@latest
その他
- 接続時に広告されるモードは、
configureElicitationHandlers に登録したハンドラーに基づきます。
- Durable Object のハイバネーション後も設定は保持され、コールバックは
onStart() 実行時に再アタッチされます。
参照: Cloudflare ドキュメント、API リファレンス、該当サンプルプロジェクト(mcp-client、mcp-elicitation)。
© 2026 Cloudflare, Inc. プライバシーポリシー | 利用規約 | セキュリティ問題の報告 | 商標情報