# mordn chat-widget > A secure-by-default, open-source AI agent widget for React and Next.js. One component, one server route, one versioned agent config. Streaming, history, memory, knowledge, attachments, and tools are already built. MIT licensed; self-host it or let mordn run it. ## Agent entry points - [MCP server](https://www.mordn.com/docs/mcp): Remote MCP server at https://www.mordn.com/mcp (Streamable HTTP, OAuth sign-in with a mordn account). Tools: mordn_get_started, mordn_create_agent (creates the agent, publishes its config, mints the server API key — or with runtime "hosted" enables hosted mode and returns the publishable key), mordn_enable_hosted_mode, mordn_install_snippet (frameworks incl. vite; runtime server|hosted), mordn_add_knowledge, mordn_describe_config / mordn_get_config / mordn_update_config (canonical AgentConfig discovery, read, and non-destructive JSON Merge Patch), mordn_agent_status. The fastest path: connect it, then ask your agent to "add a mordn agent to this app". - [Hosted mode](https://www.mordn.com/docs/hosted-mode): For apps with NO server route (Vite / Lovable / Bolt SPAs, Supabase-backed apps). Mount `` — mordn runs the handler and verifies the end user from the JWT the app's auth provider signed (Supabase Auth, Clerk, any JWKS); `anonymous` allows visitors. Publishable key is public; origin allowlist per agent. - [SKILL.md](https://www.mordn.com/SKILL.md): Install @mordn/chat-widget into an existing app with an AI coding agent. Detects framework + auth, scaffolds the route, wires getUserId from the verified session, mounts the widget, sets env, and verifies the build. Point Claude Code, Cursor, Codex, Copilot, Windsurf, or Gemini CLI here. - [llms-full.txt](https://www.mordn.com/llms-full.txt): The complete agent-readable reference in one file — install, the identity boundary, the handler contract, config, CLI, script-tag embed, and the tools/actions contract. Fetch this once instead of crawling every page. - [Agents page](https://www.mordn.com/agents): Human-facing page with the copyable install prompt and the list of supported coding agents. ## Get started - [Introduction](https://www.mordn.com/docs): How the verified server identity, model, store, and optional capabilities fit together. - [Quickstart](https://www.mordn.com/docs/quickstart): Install the required peers, scaffold the backend, and mount the widget. - [Quickstart: Vite + Supabase](https://www.mordn.com/docs/quickstart/vite): No server — one component, a publishable key, and the Supabase session the app already has. - [Security model](https://www.mordn.com/docs/security): Why browser identity is never authorization and how stores are user-bound. - [Production launch](https://www.mordn.com/docs/guides/production-readiness): Gate launch on identity isolation, configuration, observability, and rollback. ## Guides - [Authentication](https://www.mordn.com/docs/guides/authentication): Implement getChatUserId from a verified server session. - [Persistence & history](https://www.mordn.com/docs/guides/persistence): Persist turns, load history, and understand adapter pagination. - [Attachments](https://www.mordn.com/docs/guides/attachments): Private uploads with a server-enforced policy and signed URLs. - [Streaming](https://www.mordn.com/docs/guides/streaming): Streaming, bounded tool loops, error mapping, and finish hooks. - [Theming](https://www.mordn.com/docs/guides/theming): Three required brand colors and the popup, inline, and page layouts. - [Models & tools](https://www.mordn.com/docs/guides/models-and-tools): Choose a model and build request-scoped tools with cleanup. - [Build actions](https://www.mordn.com/docs/guides/build-actions): Let your chat agent perform real actions in your app. - [Knowledge / RAG](https://www.mordn.com/docs/guides/knowledge): Namespace-bound retrieval and admin-only docs-aware ingestion. - [Memory](https://www.mordn.com/docs/guides/memory): Long-term memory, adapter-dependent tiers, and user controls. - [Per-turn context](https://www.mordn.com/docs/guides/context): Validate live client hints before injecting model context. - [MCP tools](https://www.mordn.com/docs/guides/mcp): Remote MCP tools and the developer-managed hosted integration boundary. - [Feedback](https://www.mordn.com/docs/guides/feedback): Verify and persist answer ratings through the server seam. - [Streaming reliability](https://www.mordn.com/docs/guides/streaming-reliability): Error visibility, anti-buffering, and deployed stream probes. - [AI UX extras](https://www.mordn.com/docs/guides/ai-ux): Prompts, server-first follow-ups, action cards, panel state, and approvals. - [Action templates](https://www.mordn.com/docs/guides/action-templates): Reusable action primitives, manifests, and execution safety. ## Backends - [Choosing a backend](https://www.mordn.com/docs/backends/overview): Choose persistence and attachment storage independently. - [Drizzle / Postgres](https://www.mordn.com/docs/backends/drizzle): The current handler schema and shared Postgres client. - [Supabase storage](https://www.mordn.com/docs/backends/supabase): Private attachment storage with signed URLs. - [Hosted](https://www.mordn.com/docs/backends/hosted): Hosted persistence, storage, config, and feedback clients. - [Custom store & adapter](https://www.mordn.com/docs/backends/custom): Implement the user-bound contracts yourself. ## API reference - [ChatWidget](https://www.mordn.com/docs/api/chat-widget): The shipped client contract and extension points. - [createChatHandler](https://www.mordn.com/docs/api/create-chat-handler): Required dependencies, hooks, limits, and CORS. - [ChatStore](https://www.mordn.com/docs/api/chat-store): The user-bound persistence contract. - [StorageAdapter](https://www.mordn.com/docs/api/storage-adapter): The private attachment-storage contract. - [Exports](https://www.mordn.com/docs/api/exports): Client, server, backend, actions, and legacy package entry points. - [CLI](https://www.mordn.com/docs/api/cli): Scaffolding, ingestion, inspection, and retrieval evaluation. - [Usage & Analytics API](https://www.mordn.com/docs/api/usage): Hosted usage filters, response envelopes, and unanswered questions. ## Links - [npm: @mordn/chat-widget](https://www.npmjs.com/package/@mordn/chat-widget) - [GitHub: arnavv-guptaa/chat-widget](https://github.com/arnavv-guptaa/chat-widget) - [GitHub: arnavv-guptaa/chat-web](https://github.com/arnavv-guptaa/chat-web) (dashboard)