ClientAgentJS brings AI agents to the browser without a backend
ClientAgentJS is a JavaScript library that runs conversational AI agents directly in the browser — no backend required — with support for the Model Context Protocol (MCP) and providers like OpenAI, Anthropic, Google, and local Ollama models.
Score breakdown
Developers building internal tools, browser extensions, or quick prototypes can use ClientAgentJS to add multi-provider AI capabilities — including MCP tool use — without standing up any backend infrastructure.
- 01ClientAgentJS is a JavaScript library that runs conversational AI agents entirely in the browser, with no backend server required.
- 02It supports commercial providers (OpenAI, Anthropic, Google) via user-supplied API keys, as well as local models through Ollama.
- 03The library includes compatibility with the Model Context Protocol (MCP), enabling agents to connect to MCP servers and invoke remote tools.
Fran Bar Instance describes ClientAgentJS, a JavaScript utility designed to run conversational AI agents directly in the browser without any backend infrastructure. The library provides a unified interface for chatting with or tasking AI models, whether those are commercial services accessed via a user's personal API key (OpenAI, Anthropic, Google) or locally hosted models such as Ollama. Crucially, it also includes compatibility with the Model Context Protocol (MCP), allowing the agent to connect to MCP servers and invoke remote tools automatically. The project's code is publicly available on GitHub.
The first is CORS: browsers block cross-origin requests unless the destination server explicitly permits them, which means not all AI providers can be reached directly from a client page.
Two hard constraints define the design space. The first is CORS: browsers block cross-origin requests unless the destination server explicitly permits them, which means not all AI providers can be reached directly from a client page. The second is user behavior — most people will not install Ollama or enter personal API keys on an unfamiliar website, which explains why browser-native AI libraries remain rare. Despite this, the author identifies several scenarios where the approach is a natural fit: internal team tools where developers already manage their own keys, admin forms (such as e-commerce product-description generators where operators use their own OpenAI or Anthropic accounts), browser extensions that already operate in the client context, quick prototypes that skip backend setup entirely, and any product that wants to give users freedom to choose their own provider without the developer writing a separate adapter for each.
Four demos ship with the library to illustrate these use cases: Chat Explorer (a full conversational UI with session management, streaming cancellation, and Markdown rendering), Form Assistance (AI help layered onto existing forms such as bios, product descriptions, and support responses), MCP Tools (a technical demo connecting the agent to an example MCP server for tool inspection), and a Simple HTML Editor (a visual template editor where users can prompt the AI to write, translate, or modify content directly in the editing panel).
Key facts
- 01ClientAgentJS is a JavaScript library that runs conversational AI agents entirely in the browser, with no backend server required.
- 02It supports commercial providers (OpenAI, Anthropic, Google) via user-supplied API keys, as well as local models through Ollama.
- 03The library includes compatibility with the Model Context Protocol (MCP), enabling agents to connect to MCP servers and invoke remote tools.