Skip to content

Commit ee49aae

Browse files
authored
feat(mcp): facade-only run mode — adapter-less config with [mcp] is valid (#1453)
Closes #1451. An adapter-less config with [mcp] present now runs just the OAB MCP Facade listener in the foreground (one entrypoint, config-driven) instead of bailing with 'no adapter configured'. The bail message now mentions the [mcp] option. Removes the openab-agent mcp-facade subcommand — serving surfaces do not belong on the coding-agent binary (nothing shipped depends on it; #1449 established the openab-side home). Co-authored-by: chaodu-agent <chaodu-agent@users.noreply.github.com>
1 parent 189c12d commit ee49aae

3 files changed

Lines changed: 21 additions & 18 deletions

File tree

config.toml.example

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,9 @@ error_hold_ms = 2500
387387
# ~/.openab/agent/mcp.json. Any coding CLI on this host (Kiro, Claude Code,
388388
# Codex, ...) can connect to http://127.0.0.1:8848/mcp.
389389
# Presence of [mcp] enables the listener; omit the section to disable.
390+
# With no chat adapter configured, [mcp] alone is a valid config: openab
391+
# runs in facade-only mode (serves just the MCP listener) — for
392+
# coding-CLI-only hosts, dev loops, and CI runners (#1451).
390393
# NOTE: the endpoint has no authentication — it must stay on loopback
391394
# (non-loopback addresses are refused at startup).
392395
# [mcp]

openab-agent/src/main.rs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,6 @@ enum Commands {
2929
#[command(subcommand)]
3030
action: McpAction,
3131
},
32-
/// Serve the OAB MCP Facade over loopback Streamable HTTP: an inbound
33-
/// MCP server exposing `search_capabilities` / `execute_capability`
34-
/// backed by the configured downstream MCP servers (global + project
35-
/// mcp.json). The OAB broker hosts the same facade in-process when
36-
/// `[mcp]` is set in config.toml; this subcommand is the standalone way
37-
/// to run it.
38-
McpFacade {
39-
/// Loopback address to listen on (non-loopback addresses are refused).
40-
#[arg(long, default_value = "127.0.0.1:8848")]
41-
listen: String,
42-
},
4332
}
4433

4534
#[derive(Subcommand)]
@@ -171,12 +160,6 @@ async fn main() {
171160
}
172161
}
173162
},
174-
Some(Commands::McpFacade { listen }) => {
175-
if let Err(e) = mcp::facade::serve_http(&listen).await {
176-
eprintln!("mcp-facade: {e:#}");
177-
std::process::exit(1);
178-
}
179-
}
180163
}
181164
}
182165

src/main.rs

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,25 @@ async fn main() -> anyhow::Result<()> {
384384
&& cfg.telegram.is_none()
385385
&& !has_unified_platform(&cfg)
386386
{
387+
// Facade-only run mode (#1451): an adapter-less config with `[mcp]`
388+
// present is a valid deployment — the broker serves just the OAB MCP
389+
// Facade listener. One entrypoint, config-driven: hosts that only
390+
// need the capability surface (coding-CLI-only users, dev loops, CI
391+
// runners, agent hosts with no chat platform) run the same
392+
// `openab run` with a two-line config instead of a chat token.
393+
if let Some(mcp_cfg) = cfg.mcp.clone() {
394+
tracing::info!(
395+
listen = %mcp_cfg.listen,
396+
"no chat adapter configured — running in facade-only mode ([mcp] present)"
397+
);
398+
// Foreground, not spawned: the facade IS the workload. A bind
399+
// failure or server exit terminates the process (fail fast).
400+
return openab_mcp::mcp::facade::serve_http(&mcp_cfg.listen)
401+
.await
402+
.map_err(|e| anyhow::anyhow!("OAB MCP facade exited: {e:#}"));
403+
}
387404
anyhow::bail!(
388-
"no adapter configured — add [discord], [slack], [telegram], [wecom], [googlechat], or [gateway] to config, or set platform env vars (TELEGRAM_BOT_TOKEN, etc.)"
405+
"no adapter configured — add [discord], [slack], [telegram], [wecom], [googlechat], or [gateway] to config (or [mcp] for facade-only mode), or set platform env vars (TELEGRAM_BOT_TOKEN, etc.)"
389406
);
390407
}
391408

0 commit comments

Comments
 (0)