Skip to main content
The 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:
This launches an interactive CLI powered by @wong2/mcp-cli that allows you to:
  • 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:
This is particularly useful during development as it automatically reloads your server whenever you save changes to your code.
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:
Verbose mode displays:
  • 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 the stdio 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:
Common issues:
  • 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:

Inspect Command

Visual debugging with MCP Inspector

CLI Overview

Back to CLI overview