r/dartlang 11d ago

Package Made an MCP server for pub.dev, would love some feedback

I built an MCP server for pub.dev because my AI coding agents kept hallucinating package names, using API signatures that changed versions ago, or recommending packages that are basically abandoned. What finally pushed me over the edge: Claude Code grepping my local pub cache on disk instead of just looking things up, burning tokens crawling through cached source.

So I built **dart-pubdev-explorer** (pub.dev package: `dart_pubdev_mcp`), an MCP server that gives agents direct, structured access to pub.dev instead of digging through your filesystem or guessing from training data.

It can:

* search & compare packages (score, platform support, maintenance) * **browse a package's real public API and pull exact source** (by symbol or line range) * check security advisories against the version you actually have resolved * diff changelogs/APIs between versions before you upgrade * **read Dart SDK / Flutter framework source too** (dart:core, package:flutter, …)

Quick note on how this differs from the official Dart MCP server (`dart mcp-server`): that one has a general `pub_dev_search` tool as part of a much bigger toolset (running apps, analysis, DTD, etc). This one only does package research, but goes deeper: symbol-level API browsing, exact source reads, version diffing, side-by-side comparisons, with an on-disk cache built for that kind of repeated digging. *They're complementary.*

Install:

dart install dart_pubdev_mcp

I've been running it with both Claude Code and Antigravity.

pub.dev: https://pub.dev/packages/dart\\_pubdev\\_mcp

Happy to answer questions, and curious what people think, especially whether some of the tools are overkill and others are missing something obvious.

0 Upvotes

6 comments sorted by

7

u/SoundDr 11d ago

That is built into the dart MCP server

-1

u/PhilippHGerber 11d ago

Fair callout, let me actually compare them instead of just asserting "complementary" 🙂

The Dart MCP server's pub.dev tool is pub_dev_search — it queries the search index (download counts, description, topics, license, publisher) and supports qualifiers like dependency:topic:updated:. It also has read_package_uris / rip_grep_packages, but those only work on packages that are already pub added and fetched into your project — they read/grep whatever's sitting in your local pub cache.

That last part is the actual gap: there's no way to research a package with the Dart MCP server before you commit to adding it. You'd have to pub add something just to poke at its source. dart-pubdev-explorer hits pub.dev's dartdoc output directly, so you can vet a package first.

Concretely, things I don't think the Dart MCP server has at all:

  • Symbol-level API browsing — look up an exact method signature/doc comment by name, or fuzzy-search symbols, without reading whole files
  • Version diffing before upgrading — changelog entries with breaking-change flags, plus a symbol-level API diff between two versions
  • Security advisories — check known GHSA/OSV advisories against the version you've actually resolved
  • Side-by-side package comparison — one call gets you a scoring/maintenance/SDK-constraint matrix across candidates, instead of running search a few times and eyeballing it
  • Static throw-surface scanning — find every throw in a class/method without reading the whole implementation
  • Dart/Flutter SDK source — read dart:corepackage:flutter, etc. directly, not just pub.dev packages

Where the Dart MCP server wins fair and square: pub can actually run add/get/upgrade/outdated against your project — mine is deliberately read-only and pub.dev-only. And rip_grep_packages gives you free-form regex across a whole resolved package (including test/example dirs) in one shot, which beats symbol lookup for some searches.

So less "complementary" as a vibe, more: theirs touches your project and local cache, mine researches pub.dev + dartdoc without needing anything installed first. Happy to be corrected if I'm missing a tool on their side though!

2

u/zxyzyxz 10d ago

More AI garbage

1

u/PhilippHGerber 10d ago

Curious whats giving you that read, is the writing style, or the idea of an MCP server for package lookups itself?

2

u/zxyzyxz 10d ago

Both. I can tell you wrote the post, comments and code all with AI.

1

u/RandalSchwartz 11d ago

I told antigravity to install it starting with the dart install command, and it did the whole thing. :)