fastmcp dev command starts your MCP server in development mode with an interactive command-line interface for testing tools, resources, and prompts.
Command Syntax
Arguments
<file>- Required. Path to your server file (TypeScript or JavaScript)
Options
--watch,-w- Watch for file changes and automatically restart the server--verbose,-v- Enable verbose logging for debugging--help- Display help information
Basic Usage
Run your server in development mode:- List and execute tools
- Browse and read resources
- Test prompts with different arguments
- View server capabilities
- Monitor server logs in real-time
Watch Mode
Enable automatic server restarts when files change:Watch mode uses
tsx --watch under the hood, which monitors your source files and dependencies for changes.Verbose Logging
Enable detailed logging to troubleshoot issues:- The exact command being executed
- File path being loaded
- Watch mode status
- Detailed error stack traces
Examples
Transport Options
The dev command works with servers using thestdio transport, which is the default for development:
src/server.ts
The dev command is designed for
stdio transport. For testing HTTP-based transports (httpStream, sse), you should run your server directly and connect using an appropriate client.Interactive CLI Features
Once your server starts, the interactive CLI provides:Tool Execution
- List all available tools
- Execute tools with parameters
- View tool results in formatted output
Resource Access
- Browse resource URIs
- Read resource contents
- Test resource templates with different arguments
Prompt Testing
- List available prompts
- Test prompts with various arguments
- Preview generated prompt content
Server Information
- View server name and version
- Check enabled capabilities
- Monitor connection status
Troubleshooting
Server Won’t Start
If your server fails to start, try running with verbose logging:- TypeScript errors: Fix compilation errors in your server file
- Missing dependencies: Ensure all imports are installed
- Port conflicts: Check if the required port is already in use (for HTTP transports)
File Not Found
Ensure the path to your server file is correct:Related Commands
Inspect Command
Visual debugging with MCP Inspector
CLI Overview
Back to CLI overview