MCP ExplorerExplorer

Pub Dev Mcp

@RandalSchwartzon 10 months ago
5 MIT
FreeCommunity
AI Systems
A server for interacting with pub.dev, enabling package search and detailed info retrieval.

Overview

What is Pub Dev Mcp

pub_dev_mcp is a Model Context Protocol (MCP) server that facilitates interaction with the pub.dev package repository for Dart and Flutter, enabling users to search for packages and access detailed information about them.

Use cases

Use cases include integrating pub_dev_mcp in development tools for package management, creating custom dashboards for package analytics, and automating the retrieval of package information for documentation purposes.

How to use

To use pub_dev_mcp, clone the repository, install dependencies using ‘dart pub get’, and run the server with ‘dart run bin/pub_dev_mcp.dart’. Optionally, you can compile it to a standalone executable for easier distribution.

Key features

Key features include the ability to search for packages, retrieve detailed package information such as the latest version, description, homepage, repository URLs, dependencies, package scores, and recent version history.

Where to use

pub_dev_mcp can be used in software development environments where Dart and Flutter packages are utilized, particularly for developers looking to manage and explore package dependencies effectively.

Content

Pub.dev MCP Server

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.

Features

  • 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

Prerequisites

Building and Running the Server

  1. Clone the repository (if you haven’t already):

    git clone <repository_url>
    cd pub_dev_mcp 
    
  2. Get dependencies:

    dart pub get
    
  3. 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.

  4. (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 
    

MCP Client Configuration Example

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.

Provided Tools

1. searchPubDev

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.

2. getPackageDetails

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.

Development

This server is built using the mcp_dart package for the MCP framework and pub_api_client for interacting with the pub.dev API.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers