← Discover MCPs and Agents
z
MCPAI & MLGitHub

zhin

AI-native TypeScript bot framework — one codebase for 20+ chat platforms (QQ, Discord, Telegram, Slack, WeChat…). Opt-in AI agent with MCP, tools & security policies. <10MB core.

Links

README

From the repo.

Zhin.js

Zhin.js

One codebase. Every chat platform. TypeScript.
Multi-channel · Opt-in AI · Remote Console

CI npm npm downloads Node License: MIT codecov Docs

English · 简体中文

Documentation · Wiki · Delivery Board · Live Demo · Remote Console · Contributing


Zhin.js is built for developers and teams shipping serious bots / assistants on chat platforms (DMs, groups, schedules, notifications, AI chat). It is not a Cursor / Claude Code–style coding agent.

  • Multi-channel — one codebase on 20+ platforms (QQ / WeChat / Discord / Slack / DingTalk / Telegram…); one bot can run many accounts across many platforms
  • Opt-in AI — default install is a <10MB IM framework; add @zhin.js/agent for a full agent (tools / memory / orchestration / MCP)
  • Remote Console — manage the bot in the browser: send messages, edit config, read logs, run schedules — no code required
// bot.ts — a whole bot can be this one file
import { defineCommand } from 'zhin.js/command'
import { definePlugin } from 'zhin.js/plugin-runtime'

export default definePlugin({
  name: 'my-bot',
  setup({ addCommand }) {
    addCommand('hello', defineCommand({
      description: 'Say hello',
      execute: () => 'Hello from Zhin!',
    }))
  },
})

Quick Start

Three steps. No adapter boilerplate:

npm create zhin-app my-bot -y
cd my-bot
pnpm dev

Open Remote Console → enter the API Base printed at startup (new projects currently use http://127.0.0.1:8068) → send /hello in Sandbox. Done.

-y takes the IM golden path: Sandbox + Host + Console. No model key required.

PathWhoTime
demo.zhin.devZero installInstant
npm create zhin-app -yStandalone project (recommended)~1 min
examples/single-file-bot“One bot.ts is the bot”Clone, then pnpm --filter single-file-bot dev
examples/minimal-botContributors / convention-dir templateRoot pnpm dev

More: Getting started · Examples · npx zhin setup · npx zhin doctor

Requirements: scaffolded TypeScript projects require Node.js ≥22.12.0, pnpm 9+. The compiled IM library supports Node.js ^20.19.0 or >=22.12.0.

The <10MB figure applies to the IM library install. The generated project also installs the CLI, Sandbox adapter, page/layout contracts, and a Satori card example. The browser UI lives at console.zhin.dev; the CLI assembles its HTTP Host and Console API. Neither the browser UI nor an MCP server is bundled into zhin.js.

From a message to durable work

Zhin starts with one normalized message stream. A message can match a command, pass through middleware, enter an Agent turn, call governed capabilities, start durable work, and return through the same send pipeline.

Each layer is optional. The IM core stays small; AI, rich media, speech, Remote Console, and external protocols are installed only when the product needs them.

flowchart LR
    A[Adapters & Endpoints] --> B[Message pipeline]
    B --> C[Commands & Middleware]
    B --> D[Agent turn]
    D --> E[Tools · Skills · MCP]
    E --> F[Sub-agents · Schedules · Workroom]
    C --> G[Reply]
    F --> G
    H[Plugin Runtime · Config · Generations] -. governs .-> B
    H -. governs .-> D
    H -. governs .-> E
    I[Journal · Console · Host APIs] -. observes .-> B
    I -. observes .-> D
    I -. observes .-> F

Capability map

SurfaceWhat it coversExplore
Connect20+ adapters, multiple accounts and endpoints, normalized inbound/outbound messages, rich media, STT and TTSAdapters · Message flow · Speech
InteractCommands, middleware, components, replies, schedules, notifications, and AI trigger/access rulesCommands · Middleware & components · AI configuration
ExtendPlugin manifests, convention directories, scoped instances, child plugins, Console pages, and reusable npm deliveryPlugin model · Conventions · Plugin delivery
UnderstandModel/provider routing, multimodal input, Prompt Sections, conversation history, memory, session trees, and compactionAI overview · Agent authoring · Agent deep dive
ActBuilt-in and plugin Tools, Skills, MCP, deferred discovery, permissions, approval, cancellation, and execution JournalTools & Skills · Agent runtime · Capability Seam
CoordinateSub-agents, scheduled turns, persistent Workroom runs/tasks, review, sponsor gates, recovery, and A2A hostsAgent orchestration · Governed Agent · packages/host
Evolve safelyGeneration-based HMR, candidate validation, atomic publication, owner-scoped configuration, rollback, and endpoint lifecycleGeneration lifecycle · Config as data · Endpoint lifecycle
Operate & deliverRemote Console, logs and diagnostics, HTTP/MCP/A2A hosts, scaffolding, production templates, harnesses, and changesetsConsole · Production · Contributing

Built to stay operable

These surfaces share one Plugin Runtime instead of forming separate execution islands:

  • Published plugins have a runtime contract — the manifest declares protocol, engine range, Features, child plugins, isolation and instances; one package can be mounted more than once with separate scope and config (plugin model).
  • Hot reload is a Generation transaction — the next plugin tree is prepared and validated off-path, then published atomically; a failed candidate leaves the active Generation serving traffic (Generation lifecycle).
  • Configuration is owned data — schemas compose across the plugin tree, each plugin receives its owner projection, and revisioned updates can roll back when activation fails (config as data).
  • Agent execution has one authority path — Prompt, Tool, Skill and MCP capabilities enter a fixed snapshot; generation checks, permissions, approval, cancellation and journaling stay in the Turn runtime (Agent deep dive).
  • External providers use the same governance — the Advanced Capability Seam projects Root services through CapabilityIngress; it does not expose a policy-free execute-by-name path.
Stable / Advanced capability tiers
TierFeatureNotes
StableIM coreSandbox + commands + Console
StableAI (optional)@zhin.js/agent + provider
StablePlugins / HMR / TypeScriptHooks API, full types
StableSecurity (baseline)Bash allowlist, file policy, approval
AdvancedMulti-endpointIM / email / GitHub / webhook…
AdvancedFeature / MCP / toolSearchOrchestration, deferred workers

Install tiers (zhin.js 1.1.x)

Official packages use the owner-governed 1.1.x stable line. Routine releases are patch-only.

SSOT (Chinese table): docs/snippets/install-tiers.md · site: Install tiers · Chinese README: README.zh-CN.md

TierInstall~production sizeCapabilities
IMpnpm add zhin.js + an adapter (e.g. @zhin.js/adapter-sandbox); dev: @zhin.js/cli<10MB (library)Plugin Runtime; command / component / adapter convention dirs (Stable Features inherited via @zhin.js/core zhin.features; Host is optional peer + zhin.plugins, see ADR 0053)
AI+ @zhin.js/agent zod ai+~12–15MBZhinAgent, sessions, tools, compaction
Provider+ @ai-sdk/openai etc.per vendorLLM calls
MCP+ @modelcontextprotocol/sdk+ a few MBMCP client
Rich media+ @zhin.js/html-renderer+ a few MBoutbound html / markdown → PNG (falls back to text if missing)
Speech+ @zhin.js/speech+ a few MBinbound STT, outbound TTS, segment.tts (warn + degrade if missing)

Compatibility note for the 1.1 stable line: import from 'zhin.js' no longer includes ZhinAgent / AIService. Use zhin.js/agent or zhin.js/ai. See ADR 0019.

MCP has two separate roles: ai.mcpServers connects the optional Agent to external servers (client setup); a top-level mcp: block exposes this bot as a server and requires @zhin.js/mcp plus the Agent runtime (server setup). Neither is enabled by the IM library alone.

Windows: Getting started.

Enable AI (optional)

pnpm add @zhin.js/agent zod ai
pnpm add @ai-sdk/openai   # swap as needed
# zhin.config.yml
ai:
  enabled: true
  providers:
    openai-main:
      sdk: openai
      apiKey: ${AI_API_KEY}
  agents:
    zhin:
      provider: openai-main
      model: gpt-4o-mini
  agent:
    execSecurity: allowlist
    execApprovalMode: ask

Deeper: AI · Agent runtime & security · Prompt Sections, tools & skills

Adapters

PlatformPackagePlatformPackage
Sandbox (Stable)@zhin.js/adapter-sandboxQQ / ICQQ@zhin.js/adapter-icqq
QQ official@zhin.js/adapter-qqNapCat@zhin.js/adapter-napcat
OneBot 11 / 12@zhin.js/adapter-onebot11 / onebot12Discord@zhin.js/adapter-discord
Telegram@zhin.js/adapter-telegramSlack@zhin.js/adapter-slack
KOOK / DingTalk / Larkkook / dingtalk / larkGitHub@zhin.js/adapter-github
Email / WeCom / LINEemail / wecom / lineSatori / WeChat MPsatori / wechat-mp

Full list: adapter docs · plugins/adapters

Package Map

PackageRole
zhin.jsIM entry (1.1.x stable line)
@zhin.js/corePlugin / Adapter / Dispatcher
@zhin.js/aiAI engine (no IM)
@zhin.js/agentAgent orchestration & security
@zhin.js/cli · create-zhin-appCLI / scaffold

Layers and dependency direction: architecture · repo structure

Documentation

StartGetting started · Roadmap & boundaries · Stability · Docker · Windows
BasicsArchitecture · Config · Commands · Plugins
AdvancedAI · Prompt Sections, Tools & Skills · Agent runtime · Message flow
DevelopPlugin authoring · Contributing · Architecture
Knowledge indexPractical answers · Source archive and corrections

Site: zhin.js.org · Chinese docs: zhin.js.org (switch language in the docs nav)

CLI

pnpm dev                 # this repo defaults to minimal-bot; maintainers: pnpm dev:test
npx zhin new my-plugin   # plugin template
npx zhin setup           # incremental config wizard
npx zhin doctor          # environment diagnostics
npx zhin search <kw>     # search plugins

Contributing

git clone https://github.com/zhinjs/zhin.git
cd zhin
pnpm install && pnpm build
cd examples/minimal-bot && pnpm dev

See Contributing. Root pnpm dev points at the Stable convention-dir template minimal-bot. For “one file is the bot”, use pnpm --filter single-file-bot dev. Kitchen-sink: pnpm dev:test (test-bot) — not a user template.

Contributors

Repobeats

License

MIT

Collected info

  • ★ 136 stars
  • ⎇ 19 forks
  • Language: TypeScript
  • Source updated: 9/23/2026

Config for your environment

Replace {MCP_ENDPOINT_URL} with this MCP’s endpoint URL (from its repo or docs above). No API key — you connect directly.

Tool

OS

Config file: ~/.cursor/mcp.json

{
  "mcpServers": {
    "mcp-server": {
      "url": "{MCP_ENDPOINT_URL}"
    }
  }
}

Paste into mcpServers in the config file. Restart Cursor after saving.

If this MCP is also published on mcpchannel.ai, you can subscribe from Browse and use the gateway config there instead.