agent: add MCP server mode with task tool

This commit is contained in:
Adrià Arrufat
2026-04-30 17:11:48 +02:00
parent 85f2a08128
commit 300fdfb34c
13 changed files with 406 additions and 111 deletions

View File

@@ -189,6 +189,7 @@ const Commands = cli.Builder(.{
.{ .name = "interactive", .type = bool },
.{ .name = "task", .type = ?[]const u8 },
.{ .name = "task_attachments", .type = []const u8, .multiple = true },
.{ .name = "mcp", .type = bool },
},
.shared_options = CommonOptions,
},
@@ -763,6 +764,12 @@ pub fn printUsageAndExit(self: *const Config, success: bool) void {
\\ a positional script is present, any new commands
\\ entered in the REPL are appended to that file.
\\
\\--mcp Run as an MCP server over stdio that exposes a single
\\ `task` tool. Each call delegates a high-level task to
\\ the agent and returns only the final answer to the
\\ MCP client. Requires --provider; cannot be combined
\\ with --task, -i, or a script file.
\\
\\The API key is read from the environment:
\\ANTHROPIC_API_KEY, OPENAI_API_KEY, or GOOGLE_API_KEY.
\\Ollama does not require an API key.