Overview
NapCat supports multiple network adapter types for flexible integration with your applications. You can configure servers (where your app connects to NapCat) or clients (where NapCat connects to your app).Adapter Types
HTTP Server
HTTP server adapter that receives OneBot 11 API requests via HTTP POST.string
default:"http-server"
required
Unique identifier for this adapter instance.
boolean
default:false
required
Enable or disable this adapter.
number
default:3000
Port number to listen on.
string
default:"127.0.0.1"
Host address to bind to. Use
0.0.0.0 to listen on all interfaces.boolean
default:true
Enable Cross-Origin Resource Sharing (CORS) for web-based clients.
boolean
default:false
Enable WebSocket upgrade support on this HTTP server.
string
default:"array"
Message format:
array (CQ code format) or string.string
default:""
Authentication token. Clients must include this in the
Authorization header or access_token query parameter.boolean
default:false
Enable debug logging for this adapter.
HTTP SSE Server
HTTP Server-Sent Events adapter for real-time event streaming.string
default:"http-sse-server"
required
Unique identifier for this adapter instance.
boolean
default:false
required
Enable or disable this adapter.
number
default:3000
Port number to listen on.
string
default:"127.0.0.1"
Host address to bind to.
boolean
default:true
Enable CORS support.
string
default:"array"
Message format:
array or string.string
default:""
Authentication token.
boolean
default:false
Report messages sent by the bot itself.
boolean
default:false
Enable debug logging.
WebSocket Server
WebSocket server adapter for bidirectional real-time communication.string
default:"websocket-server"
required
Unique identifier for this adapter instance.
boolean
default:false
required
Enable or disable this adapter.
string
default:"127.0.0.1"
Host address to bind to.
number
default:3001
Port number to listen on.
string
default:"array"
Message format:
array or string.boolean
default:false
Report messages sent by the bot itself.
string
default:""
Authentication token.
boolean
default:true
Force push events even if the client is not ready.
boolean
default:false
Enable debug logging.
number
default:30000
Heartbeat interval in milliseconds.
HTTP Client (Reverse Connection)
HTTP client adapter that posts events to your server.string
default:"http-client"
required
Unique identifier for this adapter instance.
boolean
default:false
required
Enable or disable this adapter.
string
default:"http://localhost:8080"
required
Target URL where events will be posted.
string
default:"array"
Message format:
array or string.boolean
default:false
Report messages sent by the bot itself.
string
default:""
Authentication token sent in the
Authorization header.boolean
default:false
Enable debug logging.
WebSocket Client (Reverse Connection)
WebSocket client adapter that connects to your WebSocket server.string
default:"websocket-client"
required
Unique identifier for this adapter instance.
boolean
default:false
required
Enable or disable this adapter.
string
default:"ws://localhost:8082"
required
Target WebSocket URL to connect to.
string
default:"array"
Message format:
array or string.boolean
default:false
Report messages sent by the bot itself.
number
default:5000
Reconnection interval in milliseconds when connection is lost.
string
default:""
Authentication token.
boolean
default:false
Enable debug logging.
number
default:30000
Heartbeat interval in milliseconds.
Plugin Adapter
Plugin adapter for custom integrations and extensions.string
default:"plugin"
required
Unique identifier for this plugin adapter.
boolean
default:false
required
Enable or disable this adapter.
string
default:"array"
Message format:
array or string.boolean
default:false
Report messages sent by the bot itself.
boolean
default:false
Enable debug logging.
Configuration Examples
Authentication
All adapters support token-based authentication: For Server Adapters (HTTP/WebSocket Servers):- Include token in
Authorizationheader:Authorization: Bearer your-token - Or include as query parameter:
?access_token=your-token
- NapCat includes the token in the
Authorizationheader when connecting to your server
Common Use Cases
Single Application
Use HTTP or WebSocket server:Multiple Applications
Enable multiple adapters:Reverse Connection (NAT/Firewall)
Use client adapters when NapCat can’t accept incoming connections:Notes
- Each adapter can be individually enabled/disabled
- Multiple adapters of the same type can run simultaneously
- Adapter names must be unique across all adapter types
- Debug mode increases log verbosity for troubleshooting
- Heart interval controls keep-alive ping frequency for WebSocket connections
