This project implements a Model Context Protocol (MCP) server that allows interaction with the pub.dev package repository for Dart and Flutter.
It provides tools to search for packages and retrieve detailed information about specific packages.
- Search for packages on pub.dev.
- Get detailed information for a specific package, including:
- Latest version
- Description
- Homepage, Repository, Issue Tracker URLs
- Dependencies (regular, dev, overrides)
- Package score (likes, pub points, popularity)
- Recent version history
- Dart SDK installed (see Dart installation guide)
-
Clone the repository (if you haven't already):
git clone <repository_url> cd pub_dev_mcp
-
Get dependencies:
dart pub get
-
Run the server: The server communicates via Stdio.
dart run bin/pub_dev_mcp.dart
The server will print
Pub.dev MCP Server listening on stdio...when it's ready. -
(Optional) Compile to an executable: You can compile the server to a standalone executable for easier distribution or use:
dart compile exe bin/pub_dev_mcp.dart -o pub_dev_mcp_server
Then run the executable:
./pub_dev_mcp_server
To connect to this server using an MCP client, you can use a configuration similar to the following (adjust paths as necessary):
Using dart run:
{
"name": "Pub.dev Server (Dart Run)",
"transport": {
"type": "stdio",
"command": "dart",
"args": ["run", "bin/pub_dev_mcp.dart"],
"cwd": "/path/to/your/pub_dev_mcp_project_directory"
}
}Using a compiled executable:
{
"name": "Pub.dev Server (Executable)",
"transport": {
"type": "stdio",
"command": "/path/to/your/pub_dev_mcp_project_directory/pub_dev_mcp_server",
"args": [],
"cwd": "/path/to/your/pub_dev_mcp_project_directory"
}
}Make sure the command and cwd (current working directory) paths are correct for your setup.
Searches for packages on pub.dev.
- Description: Searches for packages on pub.dev.
- Input Schema:
query(string, required): The search term for pub.dev packages.page(integer, optional): The page number for search results. Defaults to 1.sort(string, optional): Sort order. Valid values:top(default): Sort by a combination of relevance, points, and popularity.text: Sort by text relevance.created: Sort by creation date (newest first).updated: Sort by update date (newest first).popularity: Sort by popularity score.like: Sort by like count.points: Sort by pub points.
- Output: A formatted string listing the packages found, or an error message. Includes pagination hints if more results are available.
Retrieves detailed information for a specific package from pub.dev.
- Description: Retrieves detailed information for a specific package from pub.dev.
- Input Schema:
packageName(string, required): The name of the package on pub.dev (e.g., "http", "mcp_dart").
- Output: A Markdown-formatted string containing:
- Package Name
- Latest Version
- Description
- Homepage URL
- Repository URL
- Issue Tracker URL
- Dependencies (regular, dev, overrides) with their version constraints.
- Package Score (Likes, Pub Points, Popularity).
- Recent Version History.
- Or an error message if the package is not found or an issue occurs.
This server is built using the mcp_dart package for the MCP framework and pub_api_client for interacting with the pub.dev API.