qq-onebot-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@qq-onebot-mcp上QQ号"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
qq-onebot-mcp
A lightweight MCP server that connects QQ (NapCat / OneBot 11) to any MCP host (DSH, Claude, Cursor...).
Zero npm dependencies, pure Node.js ≥ 20, using only the built-in WebSocket.
Private chat (whitelisted owner) → messages go to inbox → host agent processes (full tool permissions) → replies.
Group chat @bot (whitelisted groups) → bridge answers directly via LLM API, without going through the agent, without touching the local machine.
Architecture
QQ 老大 ──私聊──▶ NapCat(QQ小号) ──OneBot11/WS:3001──▶ qq-mcp-server.mjs ──MCP──▶ 宿主 agent
▲
(inbox / 工具)Layer | File | Responsibility |
Access | NapCat | QQ protocol → OneBot 11 (WS 3001) |
Bridge |
| MCP server: tools, exclusive lock, inbox |
Bridge |
| OneBot WS client (zero dependencies) |
Bridge |
| Group chat pure LLM direct replies |
Wake-up |
| Resident listener + host session injection (optional closed loop) |
Control |
| Process lifecycle (start/stop/status) |
Related MCP server: NapCat MCP Server
Quick Start
NapCat: Install it and log in with a QQ alt account, enable OneBot WS (default
ws://127.0.0.1:3001).Configuration:
cp .env.example .env, fill inQQ_BOT,QQ_ALLOWED_SENDERS(optionally addLLM_API_KEYto enable group chat).Register MCP: Point the host to
qq-mcp-server.mjs(stdio). For DSH use thedsh-bundle/template, seeINSTALL-DSH.md.Go online: Tell the agent "get on QQ" → follow
skills/qq-online/SKILL.mdto attach → wait for messages → reply.
Environment variable | Required | Description |
| ✅ | Bot QQ number |
| ✅ | Private chat whitelist, comma-separated |
| NapCat WS address (default | |
| Static group whitelist (empty = dynamic) | |
| For group chat direct replies |
.envis git-ignored, never commit it.
MCP Tools
Tool | Description |
| Exclusive acquire / release the bridge (file lock, cross-host; auto-preempts crash leftovers) |
| Blocking wait for private messages (zero polling, recommended for loops) |
| Fetch inbox (with optional timeout) |
| Reply to the current conversation partner (whitelist only) |
| Bridge status |
| Read AGENTS.md role settings |
Standby mode: the server does not connect to NapCat on startup; it connects only on qq_attach and disconnects on qq_detach — zero resource usage.
Fully Automatic Closed Loop (Optional)
To have QQ messages automatically wake the agent (no need to say "get online" every time): run qq-listener.mjs as a separate process:
DSH_API_URL=http://127.0.0.1:3080 DSH_SESSION_ID=<session-id> \
node qq-listener.mjs <tag> <workdir> 0QQ 消息 → 监听器(wait_inbox) → 写入 <workdir>/inbox/ + POST http://127.0.0.1:3080/api/session.prompt
│
agent 自动醒来处理 → <workdir>/outbox/ → qq_send 回复The listener stays resident independently of the agent session;
session.prompt(mode: queue) injects messages into the host session to trigger a turn.Replies go to
<workdir>/outbox/*.json({type:"send", message}), and the listener sends them (connects directly to OneBot WS when there is no chat target).Graceful stop: write
stop.flagin<workdir>.
⚠️
session.prompthas no authentication and is loopback-only; use it only in a trusted local environment.
Security
Private chat: whitelist only; unknown private messages are discarded.
Group chat: pure LLM, never touches local files/commands.
qq_sendcan only reply to the current conversation partner (within the whitelist).When a whitelisted user pulls the bot into a group → auto-whitelist and announce.
Personalization
Edit AGENTS.md (persona/responsibilities/security boundaries); the bridge reloads it every session, no restart needed.
Local privacy (e.g., important personal relationships) can go in
data/(git-ignored) and be referenced fromAGENTS_MD— never uploaded to GitHub.
Dynamic Session Discovery (Closed Loop)
The listener no longer hardcodes DSH_SESSION_ID: on each incoming message it first calls session.list to find a running session whose title contains 上号/QQ/布卡, and falls back to env if none is found. This way the closed loop still works after the "get online" session is replaced or reopened.
Development
npm test # 全部入口语法检查Files
├── qq-mcp-server.mjs # MCP server(主入口)
├── onebot.mjs # OneBot WS 客户端
├── group_llm.mjs # 群聊 LLM 直答
├── bridge.mjs # 独立触发桥(无 MCP 宿主)
├── bridge-acp.mjs # ACP 连接器(持久 DSH 会话)
├── qq-listener.mjs # 闭环监听器
├── qqctl.mjs # 进程控制
├── dsh-bundle/ # DSH profile bundle 模板
├── skills/qq-online/ # 「上QQ号」技能
├── INSTALL-DSH.md # 新用户自装指南
└── .env.example # 配置模板License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceAn MCP server that enables AI clients to send and receive QQ messages through NapCatQQ (OneBot v11) for both private and group chats. It supports message context management, real-time WebSocket listening, and human-like typing simulation.724MIT
- FlicenseNot gradedqualityBmaintenanceEnables interaction with NapCat QQ bot APIs for group management, messaging, and system operations. Supports HTTP and WebSocket modes with security features like group restrictions and readonly mode.4
- AlicenseNot gradedqualityCmaintenanceA MCP server that exposes QQ bot capabilities over Streamable HTTP, enabling clients to query bot status, read group and friend info, fetch chat history, and send group/private text messages.2MIT
- AlicenseBqualityBmaintenanceConnects QQ via NapCat OneBot v11 to an Astral Code app-server, exposing MCP tools for sending messages, files, images, and fetching conversation history.101Apache 2.0
Related MCP Connectors
Telegram bridge for your MCP-compatible agent. Bidirectional, no LLM in our stack.
MCP server for AI dialogue using various LLM models via AceDataCloud
MCP server for QPost — lets AI agents publish video and image posts to YouTube, TikTok, Instagram.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/HUliangwei/qq-onebot-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server