Log Levels
The server provides different logging levels through environment variables:Production Mode (Default)
Clean, informative logs showing MCP operations:Debug Mode
Enable debug mode for development and troubleshooting:Verbose Debug Mode
Full request/response logging with JSON-RPC details:Built-in Logging System
v1.12.0 Breaking Change: mcp-use replaced
winston with a built-in
SimpleConsoleLogger that works in both Node.js and browser environments. See
the migration guide below.Logger Configuration API
Configure the logger programmatically using theLogger class:
Log Levels
The logger supports seven log levels (from least to most verbose):| Level | Use Case |
|---|---|
error | Error conditions that need attention |
warn | Warning messages for potential issues |
info | General informational messages (default) |
http | HTTP request/response logging |
verbose | Verbose informational messages |
debug | Detailed debugging information |
silly | Very detailed debug information |
Log Formats
Choose from three output formats:Minimal Format (Default)
Clean, simple output with timestamp and level:Detailed Format
More verbose output with full context:Using the Logger
Get a logger instance for custom logging:Browser Compatibility
The built-in logger works in both Node.js and browser environments without any configuration changes. This is a key improvement over the previous winston-based system, which was Node.js-only.Migration from Winston
If you’re upgrading from mcp-use < v1.12.0, replace winston with the new Logger: Before (winston - removed in v1.12.0):Tool Logging with ctx.log
Tools can send log messages directly to clients during execution usingctx.log(). This allows real-time visibility into what your tool is doing, which is especially useful for long-running operations or debugging tool behavior.
Log Levels
Thectx.log() function supports eight log levels, from least to most severe:
| Level | Use Case |
|---|---|
debug | Detailed debugging information, verbose output |
info | General informational messages about progress |
notice | Normal but significant events |
warning | Warning messages for recoverable issues |
error | Error messages for failures that don’t stop execution |
critical | Critical conditions requiring immediate attention |
alert | Action must be taken immediately |
emergency | System is unusable |
Parameters
level(required): One of the eight log levels listed abovemessage(required): The log message content as a stringlogger(optional): Logger name for categorization (defaults to'tool')
Related
- Client Logging - Logging for MCP clients
- Notifications - Send status updates to clients
- Configuration - Configure server options
- Tools Guide - Building tools with proper error handling