npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dart_mcp

v1.0.0

Published

MCP server for Dart SDK commands

Readme

Dart MCP Server

A Model Context Protocol (MCP) server that exposes Dart SDK commands to Cline and Windsurf (Codium IDE). This tool bridges the gap between AI-powered coding assistants and Dart/Flutter development workflows.

Features

This MCP server wraps the Dart SDK command-line tools and exposes them as MCP tools that can be used by any MCP client, including Cline and Windsurf. It supports the following Dart commands:

  • dart analyze - Analyze Dart code for errors, warnings, and lints
  • dart compile - Compile Dart to various formats (exe, AOT/JIT snapshots, JavaScript)
  • dart create - Create new Dart projects from templates
  • dart doc - Generate API documentation for Dart projects
  • dart fix - Apply automated fixes to Dart source code
  • dart format - Format Dart source code according to style guidelines
  • dart info - Show diagnostic information about the installed Dart tooling
  • dart pub - Work with packages (get, add, upgrade, outdated, etc.)
  • dart run - Run Dart programs with support for passing arguments
  • dart test - Run tests with support for filtering and reporting options

Path Handling

This MCP server automatically converts relative paths to absolute paths, ensuring that commands work correctly regardless of the current working directory. The server:

  1. Attempts to resolve paths relative to the current working directory
  2. Checks against known project roots (automatically detected upon server start)
  3. Handles special cases for monorepo structures like paths starting with 'apps/'
  4. Supports cross-platform path resolution

Prerequisites

  • Node.js 18.x or higher
  • npm or pnpm (pnpm recommended)
  • Dart SDK (3.0 or higher) installed and available in your PATH

Installation

As a development dependency

# Using npm
npm install dart_mcp --save-dev

# Using pnpm (recommended)
pnpm add dart_mcp -D

From source

# Clone the repository
git clone https://github.com/yourusername/dart_mcp.git
cd dart_mcp

# Install dependencies using pnpm
pnpm install

# Build the project
pnpm run build

Usage

Standalone

Run the MCP server directly:

pnpm start

This starts the server in stdio mode, which can be used with MCP clients that support stdio transport.

Configuration

Windsurf (Codium IDE)

Add the following to your mcp_config.json:

{
  "mcpServers": {
    "dart": {
      "command": "npx",
      "args": [
        "-y",
        "dart_mcp"
      ]
    }
  }
}

Local Development Setup

For developers working on the MCP server:

{
  "mcpServers": {
    "dart": {
      "command": "node",
      "args": [
        "/path/to/dart_mcp/dist/index.js"
      ]
    }
  }
}

Tool API Reference

dart-analyze

Analyze Dart code in a directory or file.

{
  path?: string;       // Directory or file to analyze
  options?: string[];  // Additional options for the dart analyze command
}

Example:

{
  path: "lib",
  options: ["--fatal-infos", "--fatal-warnings"]
}

dart-compile

Compile Dart to various formats.

{
  format: 'exe' | 'aot-snapshot' | 'jit-snapshot' | 'kernel' | 'js'; // Output format
  path: string;        // Path to the Dart file to compile
  output?: string;     // Output file path
  options?: string[];  // Additional compilation options
}

Example:

{
  format: "exe",
  path: "bin/main.dart",
  output: "bin/app"
}

dart-create

Create a new Dart project.

{
  template: 'console' | 'package' | 'server-shelf' | 'web'; // Project template
  projectName: string; // Name of the project to create
  output?: string;     // Directory where to create the project
  options?: string[];  // Additional project creation options
}

Example:

{
  template: "package",
  projectName: "my_dart_library",
  output: "projects"
}

dart-doc

Generate API documentation for Dart projects.

{
  path?: string;       // Directory containing the Dart package to document
  output?: string;     // Output directory for the generated documentation
  options?: string[];  // Additional documentation options
}

Example:

{
  path: ".",
  output: "doc/api"
}

dart-fix

Apply automated fixes to Dart source code.

{
  path?: string;       // Directory or file to apply fixes to
  apply?: boolean;     // Whether to apply the suggested fixes (default: true)
  options?: string[];  // Additional fix options
}

Example:

{
  path: "lib",
  apply: true,
  options: ["--pedantic"]
}

dart-format

Idiomatically format Dart source code.

{
  paths: string[];     // Files or directories to format
  setExitIfChanged?: boolean; // Return exit code 1 if there are formatting changes (default: false)
  options?: string[];  // Additional format options
}

Example:

{
  paths: ["lib", "test"],
  setExitIfChanged: true,
  options: ["--line-length=80"]
}

dart-info

Show diagnostic information about the installed tooling.

{
  options?: string[];  // Additional info options
}

Example:

{
  options: ["--verbose"]
}

dart-package

Work with packages (pub commands).

{
  command: 'get' | 'upgrade' | 'outdated' | 'add' | 'remove' | 'publish' | 'deps' | 'downgrade' | 'cache' | 'run' | 'global'; // Pub subcommand
  args?: string[];     // Arguments for the pub subcommand
  workingDir?: string; // Working directory for the command
}

Examples:

// Add a package
{
  command: "add",
  args: ["rxdart"],
  workingDir: "my_project"
}

// Get dependencies
{
  command: "get",
  workingDir: "my_project"
}

dart-run

Run a Dart program.

{
  script: string;      // Path to the Dart script to run
  args?: string[];     // Arguments to pass to the script
  workingDir?: string; // Working directory for the command
}

Example:

{
  script: "bin/main.dart",
  args: ["--verbose"],
  workingDir: "my_project"
}

dart-test

Run tests for a project.

{
  path?: string;       // Path to the test file or directory
  options?: string[];  // Additional test options
  workingDir?: string; // Working directory for the command
}

Example:

{
  path: "test",
  options: ["--coverage", "--name=auth"],
  workingDir: "my_project"
}

Development

# Watch mode for development
pnpm run dev

# Build for production
pnpm run build

Error Handling

The server implements comprehensive error handling:

  • Command execution errors are captured and formatted appropriately
  • Path resolution issues are reported with detailed diagnostics
  • Timeout handling for long-running operations
  • Proper exit code propagation from Dart commands

Contributing

Please see CONTRIBUTING.md for detailed contribution guidelines.

Our commit format follows:

<type>[optional scope]: [JIRA-123(optional)] <description>

Example:

feat(tools): [DART-456] add support for dart test tags

License

MIT