flutterdocs_mcp 0.1.2
flutterdocs_mcp: ^0.1.2 copied to clipboard
Flutter/Dart API documentation for AI assistants and tools.
Flutter/Dart API Documentation for AI assistants #
Wraps the offline Flutter/Dart API documentation in an MCP server that AI assistants can navigate and search.
Features #
- Stores documentation in a local
sqlite3database file for fast response. - Defines a resource URI scheme that AI assistants can predict and navigate.
- Supports both targeted documentation retrieval and full-text queries.
Getting Started #
Install the latest version of flutterdocs_mcp.
dart install flutterdocs_mcp
The install command will print a message if you need to add the install directory to your shell's path.
Fetch the latest version of the documentation database file using curl or wget.
curl -L -O https://github.com/smoyerx/flutterdocs_mcp/releases/latest/download/flutterdocs.db.gz
wget --content-disposition https://github.com/smoyerx/flutterdocs_mcp/releases/latest/download/flutterdocs.db.gz
Unzip the database file and place it in a directory accessible by flutterdocs_mcp, which takes the path to the file as a command-line argument.
gunzip flutterdocs.db.gz
Verifying Versions #
The version of the flutterdocs_mcp executable must match that of the database file.
To check the executable version run:
flutterdocs_mcp --version
To check the database file version run:
flutterdocs_mcp --db-version --db /path/to/flutterdocs.db
Usage #
See examples and best practices for configuring flutterdocs_mcp with various hosts (e.g., GitHub Copilot in VS Code) and using it effectively.
Documentation Database #
The documentation database file is generated from the Flutter stable offline documentation as follows:
- HTML content is convert to markdown and sanitized.
- Internal documentation links are converted to a custom URI scheme.
- Image links are converted to text indicating the image is omitted.
- DartPad interactive code links are converted to text indicating the interactive code is omitted.
- Stub entries are generated for inherited members to keep the URI scheme robust.
- Code examples (snippets), where available, are appended as a new section of the documentation for classes, mixins, etc.
The changelog specifies the snapshot date of the Flutter offline documentation included with a given flutterdocs_mcp release.
Motivation #
There are several other MCP server projects for Flutter/Dart documentation, including:
- Context7, which is a widely-used MCP documentation service that includes various Flutter documentation sets in its inventory.
- flutter-mcp, which is built with the FastMCP Python library and fetches/caches online Flutter documentation.
- flutter_mcp_2, which is built with JavaScript and also fetches/caches online Flutter documentation.
My motivation for creating flutterdocs_mcp was to:
- Store all documentation locally for fast full-text search across all libraries.
- Eliminate first-time load delays.
- Avoid in-line conversion from HTML to markdown.
- Implement in
Dartusingdart_mcpfor native hosting onpub.dev.
Platforms #
I have only tested flutterdocs_mcp in limited configurations:
- Platforms: Ubuntu 24.04
- Hosts: GitHub Copilot in VS Code, MCP Inspector
MCP Server Operational Details #
Below is a summary of how flutterdocs_mcp operates as an MCP server. You do not need to know any of this to use it, but it's here for those who are interested.
URI Scheme #
- Library documentation: flutter-docs://api/{library_slug}
- Entity (class, mixin, etc.) documentation: flutter-docs://api/{library_slug}/{entity}
- Member (constructor, properties, etc.) documentation: flutter-docs://api/{library_slug}/{entity}/{member}
Library slugs are used in place of library display names to form valid URIs (e.g., dart:io uses slug dart-io). The slugs are the same as used for the native HTML documentation. AI assistants can access the mapping from library display name to slug using the listLibraries tool.
Tools #
listLibraries: lists slugs and display names for all available library documentation.searchDocumentation: performs a full-text search across all the library documentation.lookupEntity: resolves entity (class, mixin, etc.) identifier names.lookupMember: resolves member (constructor, property, method, etc.) identifier names.getDocumentation: fetches documentation for the specified URI; returns same result as the corresponding resource template.
The lookupEntity and lookupMember tools return arrays of [library_slug, entity, category] or [library_slug, entity, member, category] tuples, respectively, for constructing URIs to use with the getDocumentation tool or resource templates.
Resource Templates #
There is a resource template for each of the URI shapes above: libraryIndex, entityDocumentation, and memberDocumentation. They can be used instead of the getDocumentation tool.
Not all MCP hosts support resource templates, which is why the getDocumentation tool is also provided.
TODOs #
- Develop A/B tests to quantify the benefits AI assistants derive from having local access to the documentation.
- Experiment with additional tools and agent skill enhancements to increase the efficiency and effectiveness of documentation search, navigation, and retrieval.
- Add Flutter/Dart guides within a new flutter-docs://guide/... URI space.
- Test with a wider range of platforms and hosts.
- Support pagination for
searchDocumentation. - Automate the database file download via the
data_assetspackage.
LLMs are being released or updated at an accelerating rate, so it's an open question as to how much having the most up-to-date documentation improves the performance of AI assistants. Hence why I am prioritizing A/B testing and related experimentation over additional features.
Contributing #
Contributions are always appreciated and welcome! Please see these details on how you can help.
I am particularly interested in data regarding the efficacy of flutterdocs_mcp or any other MCP server that wraps Flutter/Dart documentation.
Acknowledgements #
- Flutter/Dart team for making their excellent documentation available offline, and for providing the
dart_mcppackage which makes building MCP servers a breeze. - Developers of the
html-to-markdownpackage which has proven robust and blazingly fast. - Sonnet 4.5/4.6 for writing most of the code. Yes, I reviewed it (OK, the tests not so much).