Connect MaiMai with NapCat and the Adapter
You can use NapCat to receive QQ messages and information.
Then use the adapter to translate those messages and send them to MaiBot.
Adapter Repository
NapCat adapter source code: Mai-with-u/MaiBot-Napcat-Adapter
Install the Adapter
You can find the NapCat Adapter directly in the WebUI plugin store and install it there.
After installation, you still need to enable it manually. You can see which plugins are enabled in WebUI plugin management.
If something goes wrong, you can also try manual installation
# Clone the plugin
git clone -b main https://github.com/Mai-with-u/MaiBot-Napcat-Adapter.gitPut the adapter directory into MaiBot's plugins/ folder.
Configure NapCat
- Open NapCat's web interface.
- Find the "Forward WebSocket" or "WebSocket Server" settings.
- Enable the Forward WebSocket server. Its listening port must match the
Portsetting in the NapCat Adapter plugin (napcat_server.portinplugins/MaiBot-Napcat-Adapter/config.toml). - If your WebSocket connection has an access token, copy that token into the Access Token setting in the adapter plugin configuration. This is not the NapCat WebUI token and not the MaiBot WebUI token.
For detailed configuration, see the NapCat official documentation.
The Forward WebSocket server usually uses 3001 by default. The adapter connects to NapCat as a client, for example ws://127.0.0.1:3001. Use the actual address and port from the adapter config.
Start
Start MaiBot directly. The adapter will be loaded and connected automatically.
Group Chat Whitelist
The NapCat adapter enables chat list filtering by default, and group chats use whitelist mode by default. Messages from groups not listed in the Group List will be dropped directly. If NapCat is connected successfully but the bot does not respond when mentioned in a group, check the plugin's Chat Filter configuration first.
Detailed configuration file items
plugins/MaiBot-Napcat-Adapter/config.toml
[chat]
enable_chat_list_filter = true
show_dropped_chat_list_messages = true
group_list_type = "whitelist"
group_list = ["your QQ group number"]During testing, you can also temporarily disable chat list filtering:
[chat]
enable_chat_list_filter = falseStandalone Mode Guide
Legacy method
The standalone adapter is an earlier integration method. It is usually only recommended when you already have a standalone deployment, need compatibility with an old environment, or have special network requirements. For new deployments, prefer the plugin adapter described above. It needs less configuration and is easier to maintain.
Expand to view standalone adapter configuration
If you need to run the adapter independently, follow these steps.
Use the main branch:
# Clone the main branch (default)
git clone https://github.com/Mai-with-u/MaiBot-Napcat-Adapter.git
# Or, if you have already cloned it, make sure you are on the main branch
cd MaiBot-Napcat-Adapter
git checkout mainConfigure MaiBot
Add this to config/bot_config.toml:
[bot]
platform = "qq" # Use the QQ platform
qq_account = 123456789 # Your bot QQ account
nickname = "MaiMai" # Bot nicknameStill in config/bot_config.toml, set the connection parameters:
[maim_message]
ws_server_host = "127.0.0.1" # Server address, use this for local deployment
ws_server_port = 8080 # Port number, default 8080
auth_token = [] # Auth token, leave emptyws_server_host— Server address. Use127.0.0.1locally, or the actual IP on a serverws_server_port— Port number. Default8080; remember the number if you change itauth_token— Password verification. Leave it empty
Note:
maim_messageconfigures the legacy WebSocket service, usually on port 8080. The adapter connects to MaiBot through the MMC protocol and uses thews_server_portconfigured under[maim_message]in MaiBot'sconfig/bot_config.toml. Make suremaibot_server.portin the adapter'sconfig.tomlmatches MaiBot'sws_server_port.
Install NapCat
See the NapCat official documentation to install NapCat.
Docker users: if you use the project's built-in docker-compose.yml, NapCat is already included as the napcat service. Start it together with MaiBot:
docker compose up -dSet Up the NapCat Connection
- Open NapCat's web interface.
- Find the "Reverse WebSocket" settings.
- Fill in the MaiBot address:
ws://127.0.0.1:8080/ws.
For detailed configuration, see the NapCat official documentation.
Tip: if NapCat and MaiBot both run in Docker Compose, make sure MaiBot's maim_message.ws_server_host listening address allows access from the container network.
Log in to QQ
After starting NapCat, you need to log in to QQ. For login methods, see the NapCat official documentation.
Connection Steps
Recommended startup order:
- Start NapCat -> wait for QQ login to succeed.
- Start MaiBot -> wait for the WebSocket service to start.
- Start the adapter -> the adapter connects to NapCat and MaiBot.
- Automatic connection -> NapCat will automatically connect to the adapter.
# One-command Docker startup (recommended)
docker compose up -d
# Manual startup
# Terminal 1: start NapCat
# Terminal 2: start the adapter (run it from the adapter directory)
# Terminal 3: uv run python bot.pyCommon Issues
How do you know it is connected? Check these places:
Plugin mode:
- WebUI plugin list: the NapCat adapter plugin is loaded.
- MaiBot logs: there is a message indicating that the adapter plugin has loaded.
- Message test: mention the bot in a QQ group and see whether it replies.
Standalone mode:
- MaiBot logs: shows "WebSocket service started successfully".
- NapCat logs: shows "Reverse WebSocket connection successful".
- Adapter logs: shows a successful connection.
- Message test: mention the bot in a QQ group and see whether it replies.
Cannot Connect?
Check these points:
- Is the plugin enabled? Plugins are disabled by default.
- Are the address, port, and WebSocket token correct?
- Are NapCat and MaiBot on the same machine?
- Are there any errors in the logs?
Not Receiving Messages?
Possible causes:
- Is the group chat whitelist configured correctly? Which groups are allowed to chat?
- Is the QQ account correct? It must match the account logged in through NapCat.
- Did NapCat itself receive the message? Check the NapCat logs.
- Is the network connection normal?