mcp-server-flutter

0.1.0 • Public • Published

Flutter MCP Server

An MCP (Model Context Protocol) server providing tools for Flutter and Dart development. This server integrates with Claude and other AI assistants supporting the MCP protocol to enable Flutter/Dart development capabilities.

Installation

npx mcp-server-flutter <path-to-flutter-project>

Requirements

  • Node.js >= 18.0.0
  • Flutter SDK installed and available in PATH
  • A Flutter project directory

Available Tools

flutter_run

Run a Flutter application.

{
  target?: string;     // Target file to run (default: lib/main.dart)
  device?: string;     // Target device ID
  mode?: "debug" | "profile" | "release";  // Build mode
  webPort?: number;    // Port to use for web server
  verbose?: boolean;   // Enable verbose logging
}

flutter_pub

Manage Flutter packages.

{
  command: "get" | "upgrade" | "outdated" | "add" | "remove";  // Package management command
  package?: string;    // Package name for add/remove operations
  version?: string;    // Package version constraint
}

flutter_generate

Generate Dart files using build_runner.

{
  watch?: boolean;     // Watch for changes and rebuild automatically
  deleteConflicting?: boolean;  // Delete conflicting outputs
}

dart_fix

Automatically fix Dart style issues.

{
  folder?: string;     // Target folder (default: lib)
  dryRun?: boolean;    // Show proposed changes without applying
}

dart_run

Run a Dart file.

{
  file: string;        // Dart file to run
  args?: string[];     // Command line arguments
}

flutter_build

Build a Flutter application.

{
  platform: "apk" | "ios" | "web" | "macos" | "windows" | "linux";  // Target platform
  release?: boolean;   // Build in release mode
  splitDebugInfo?: boolean;  // Split debug info
  obfuscate?: boolean;  // Enable code obfuscation
}

flutter_analyze

Run Flutter analyzer to find issues.

{
  fatal?: string[];    // Treat specific issue levels as fatal
  directory?: string;  // Directory to analyze
}

flutter_test

Run Flutter tests.

{
  test?: string;       // Specific test file to run
  tags?: string[];     // Run only tests with these tags
  exclude?: string[];  // Exclude tests with these tags
  coverage?: boolean;  // Collect coverage information
}

flutter_doctor

Check Flutter development environment.

{
  verbose?: boolean;   // Show detailed information
}

flutter_clean

Clean Flutter project build and cache.

flutter_devices

List available devices.

flutter_version

Manage Flutter SDK version.

{
  channel?: "stable" | "beta" | "dev" | "master";  // Flutter channel to use
  version?: string;    // Specific Flutter version to use
}

Error Handling

The server handles common Flutter/Dart errors and categorizes them into:

  • BUILD: Build-related errors
  • RUNTIME: Runtime execution errors
  • DEPENDENCY: Package dependency issues
  • CONFIGURATION: Setup and configuration problems
  • UNKNOWN: Uncategorized errors

Each error response includes:

  • Category: The type of error
  • Message: A human-readable error description
  • Details: Additional error information (when available)

Development

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode with watch
npm run dev

# Clean build artifacts
npm run clean

# Rebuild the project
npm run rebuild

License

MIT

Package Sidebar

Install

npm i mcp-server-flutter

Weekly Downloads

5

Version

0.1.0

License

MIT

Unpacked Size

57.6 kB

Total Files

7

Last publish

Collaborators

  • asmagin