Commit e8906e6b0 for llama.cpp
commit e8906e6b0c0af70a974b8d398117180aa22e0fa7
Author: Aleksander Grygier <aleksander.grygier@gmail.com>
Date: Wed Nov 25 07:08:29 2026 +0100
ui: add --ui-agent for agent mode without server tools or the MCP proxy (#33004)
* ui: add --ui-agent to run Llama Chat with browser tools only
Assisted-by: Claude (Opus 5.5 Medium)
* ui: say that --ui-agent leaves direct MCP servers available
Assisted-by: Claude (Opus 5.5 Medium)
diff --git a/common/arg.cpp b/common/arg.cpp
index e99b48c5b..c322b5c0f 100644
--- a/common/arg.cpp
+++ b/common/arg.cpp
@@ -3494,6 +3494,14 @@ common_params_context common_params_parser_init(common_params & params, llama_ex
// note: do not modify cors_origins here, as the options are not evaluated in order (user may explicitly set --cors-origins before --agent)
}
).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_AGENT"));
+ add_opt(common_arg(
+ {"--ui-agent"},
+ "enable agent mode in Llama Chat with nothing enabled on the server: the tools that run in the browser and MCP servers the browser reaches itself, no server tools and no MCP proxy (default: disabled)\n"
+ "note: not needed with --agent, --tools or --ui-mcp-proxy, they enable agent mode in Llama Chat too",
+ [](common_params & params) {
+ params.ui_agent = true;
+ }
+ ).set_examples({LLAMA_EXAMPLE_SERVER}).set_env("LLAMA_ARG_UI_AGENT"));
add_opt(common_arg(
{"--ui", "--webui"},
{"--no-ui", "--no-webui"},
diff --git a/common/common.h b/common/common.h
index a8e89ed2d..22724e817 100644
--- a/common/common.h
+++ b/common/common.h
@@ -701,6 +701,7 @@ struct common_params {
// UI configs
bool ui = true;
+ bool ui_agent = false; // agent mode in Llama Chat, no server tools and no MCP proxy
bool ui_mcp_proxy = false;
bool ui_mcp_proxy_allow_private_urls = false; // allow the MCP CORS proxy to reach local or private addresses
std::string ui_config_json;
diff --git a/tools/server/README.md b/tools/server/README.md
index b995e7403..e854ea2ea 100644
--- a/tools/server/README.md
+++ b/tools/server/README.md
@@ -210,6 +210,7 @@ For the full list of features, please refer to [server's changelog](https://gith
| `--mcp-servers-config PATH` | experimental: path to JSON file with MCP server definitions (Cursor-compatible format) - do not enable in untrusted environments (default: none)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_MCP_SERVERS_CONFIG) |
| `--mcp-servers-json JSON` | experimental: inline JSON with MCP server definitions (Cursor-compatible format) - do not enable in untrusted environments (default: none)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_MCP_SERVERS_JSON) |
| `-ag, --agent, -no-ag, --no-agent` | whether to enable CORS proxy and all built-in tools - do not enable in untrusted environments (default: disabled)<br/>note: for security reasons, this will limit --cors-origins to localhost by default<br/>(env: LLAMA_ARG_AGENT) |
+| `--ui-agent` | enable agent mode in Llama Chat with nothing enabled on the server: the tools that run in the browser and MCP servers the browser reaches itself, no server tools and no MCP proxy (default: disabled)<br/>note: not needed with --agent, --tools or --ui-mcp-proxy, they enable agent mode in Llama Chat too<br/>(env: LLAMA_ARG_UI_AGENT) |
| `--ui, --webui, --no-ui, --no-webui` | whether to enable Llama Chat, the built-in chat app (default: enabled)<br/>(env: LLAMA_ARG_UI) |
| `--connect` | (experimental) open a peer-to-peer tunnel for server using llama-connect (default: disabled)<br/>(env: LLAMA_ARG_CONNECT) |
| `--connect-code CODE` | manually specify a 40-character code for --connect (default: generate a new one for each run)<br/>(env: LLAMA_ARG_CONNECT_CODE) |
@@ -362,6 +363,8 @@ The server includes a set of server tools that enable the LLM to access the loca
To use this feature, start the server with `--tools all`. You can also enable only specific tools by passing a comma-separated list: `--tools name1,name2,...`. Run `--help` for the full list of available tool names.
+To use the agent mode of Llama Chat with no access to the machine the server runs on, start the server with `--ui-agent` instead. The LLM then gets the tools that run in the browser (current time, JavaScript sandbox, ...) and the MCP servers the browser reaches itself.
+
### MCP servers
Besides the built-in tools, the server can expose tools coming from MCP servers, added in [#26062](https://github.com/ggml-org/llama.cpp/pull/26062). Only the stdio transport is supported: such a server is a child process reading JSON-RPC messages on its stdin and writing replies on its stdout, so nothing has to be started or maintained outside `llama-server`.
diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp
index 2f927d74f..a9040260c 100644
--- a/tools/server/server-context.cpp
+++ b/tools/server/server-context.cpp
@@ -5681,6 +5681,7 @@ static json get_res_props(const server_context_meta & meta, const common_params
{ "build_info", meta.build_info },
{ "is_sleeping", is_sleeping },
{ "cors_proxy_enabled", params.ui_mcp_proxy },
+ { "ui_agent", params.ui_agent },
};
if (!params.server_connect_code.empty()) {
diff --git a/tools/server/server-models.cpp b/tools/server/server-models.cpp
index 8e3bb4982..a8077bd71 100644
--- a/tools/server/server-models.cpp
+++ b/tools/server/server-models.cpp
@@ -2119,6 +2119,7 @@ void server_models_routes::init_routes() {
{"ui_settings", ui_settings},
{"build_info", std::string(llama_build_info())},
{"cors_proxy_enabled", params.ui_mcp_proxy},
+ {"ui_agent", params.ui_agent},
};
if (!params.server_connect_code.empty()) {
props["connect_code"] = params.server_connect_code;
diff --git a/ui/apps/chat/README.md b/ui/apps/chat/README.md
index c7da94dd8..ec4b38b57 100644
--- a/ui/apps/chat/README.md
+++ b/ui/apps/chat/README.md
@@ -161,7 +161,7 @@ llama-server serves the UI with `Cross-Origin-Embedder-Policy: require-corp` and
llama-server embeds it: when llama-server is built, `scripts/ui-assets.cmake` takes `ui/apps/chat/dist` if it exists, runs `npm run build` if `LLAMA_BUILD_UI` is on, or downloads the release's prebuilt `dist.tar.gz` from Hugging Face, and compiles every file into the binary. The same `dist` is what `npx @ggml-org/llama-chat` serves.
-**Plain chat and agent mode.** Llama Chat is a plain chat, a message and its reply with reasoning when the model gives it, unless llama-server offers the agentic features: its built-in tools or its proxy, which `llama-server --agent` turns on together. The app reads this from `/props` and `/tools`. With them it shows the tools menu, the working folder, MCP and the Tools and Agentic settings, and runs the agentic loop; without them it shows none of these and sends the classic request. Tool calls in earlier conversations still display.
+**Plain chat and agent mode.** Llama Chat is a plain chat, a message and its reply with reasoning when the model gives it, unless llama-server offers the agentic features: its built-in tools or its proxy, which `llama-server --agent` turns on together. `llama-server --ui-agent` turns agent mode on with neither: the model gets only the tools that run in the browser, and MCP servers the browser reaches itself. The app reads this from `/props` and `/tools`. With them it shows the tools menu, the working folder, MCP and the Tools and Agentic settings, and runs the agentic loop; without them it shows none of these and sends the classic request. Tool calls in earlier conversations still display.
**Chat-only build.** `VITE_PUBLIC_AGENTIC=false npm run build` builds an app that is a plain chat for every server, and `npm run dev:chat-only` runs the dev server the same way. Llama Harness's loop is left out of its bundle.
diff --git a/ui/apps/chat/src/lib/stores/agentic-mode.svelte.ts b/ui/apps/chat/src/lib/stores/agentic-mode.svelte.ts
index d31d664dd..0b5d91652 100644
--- a/ui/apps/chat/src/lib/stores/agentic-mode.svelte.ts
+++ b/ui/apps/chat/src/lib/stores/agentic-mode.svelte.ts
@@ -2,12 +2,15 @@
* agenticMode - Whether the agentic features are on
*
* They are on when the build has them (see AGENTIC_ENABLED) and llama-server
- * offers what they need: its built-in tools or its proxy, which `--agent`
- * turns on together. Without them Llama Chat is a plain chat: a message and
- * its reply, with no tools, no MCP and no agentic loop.
+ * asks for them: with its built-in tools or its proxy, which `--agent` turns
+ * on together, or with `--ui-agent`, which offers neither and leaves the
+ * tools that run in the browser and the MCP servers the browser reaches
+ * itself. Without them Llama Chat is a plain chat: a message and its reply,
+ * with no tools, no MCP and no agentic loop.
*
- * The server says so in two places: `/props` reports the proxy, and `/tools`
- * lists the built-in tools, which the tools store reports here.
+ * The server says so in two places: `/props` reports the proxy and
+ * `--ui-agent`, and `/tools` lists the built-in tools, which the tools store
+ * reports here.
*/
import { AGENTIC_ENABLED } from '#lib/constants/app.constants.ts';
@@ -21,8 +24,11 @@ class AgenticMode {
serverToolsKnown = $state(false);
get enabled(): boolean {
+ const props = serverStore.props;
+
return (
- AGENTIC_ENABLED && (this.serverHasTools || (serverStore.props?.cors_proxy_enabled ?? false))
+ AGENTIC_ENABLED &&
+ (this.serverHasTools || (props?.cors_proxy_enabled ?? false) || (props?.ui_agent ?? false))
);
}
diff --git a/ui/apps/chat/src/lib/types/api.d.ts b/ui/apps/chat/src/lib/types/api.d.ts
index abdd1b3de..e59406194 100644
--- a/ui/apps/chat/src/lib/types/api.d.ts
+++ b/ui/apps/chat/src/lib/types/api.d.ts
@@ -305,6 +305,8 @@ export interface ApiLlamaCppServerProps {
webui_settings?: Record<string, string | number | boolean>;
ui_settings?: Record<string, string | number | boolean>;
cors_proxy_enabled?: boolean;
+ /** llama-server was started with `--ui-agent`: agent mode with no server tools and no proxy */
+ ui_agent?: boolean;
}
export interface ApiChatCompletionRequest {
diff --git a/ui/apps/chat/tests/unit/chat-only-build.test.ts b/ui/apps/chat/tests/unit/chat-only-build.test.ts
index 8176dafa7..26077e624 100644
--- a/ui/apps/chat/tests/unit/chat-only-build.test.ts
+++ b/ui/apps/chat/tests/unit/chat-only-build.test.ts
@@ -63,6 +63,21 @@ describe('agentic mode', () => {
expect(agenticMode.enabled).toBe(true);
});
+ it('is on with the browser tools alone for a server started with --ui-agent', async () => {
+ vi.resetModules();
+
+ const { agenticMode } = await import('#lib/stores/agentic-mode.svelte.ts');
+ const { ToolSource } = await import('#lib/enums/index.ts');
+ const { serverStore } = await import('#lib/stores/llama-server.svelte.ts');
+ const { toolsStore } = await import('#lib/stores/tools.svelte.ts');
+
+ serverStore.props = { ui_agent: true } as typeof serverStore.props;
+
+ expect(agenticMode.enabled).toBe(true);
+ expect(toolsStore.allTools.length).toBeGreaterThan(0);
+ expect(toolsStore.allTools.every((tool) => tool.source === ToolSource.BROWSER)).toBe(true);
+ });
+
it('leaves the Tools and Agentic settings and the MCP entry out when it is off', async () => {
const c = await loadConstants();
const slugs = (agentic: boolean) => c.settingsChatSections(agentic).map((s) => s.slug);