widgetbook_mcp_server
A Model Context Protocol (MCP) server that supercharges Flutter Widgetbook development by giving AI assistants direct access to create, modify, and test UI components in your design system.
claude mcp add --transport stdio mastersam07-widgetbook_mcp_server dart run bin/widgetbook_mcp_server.dart --project-path /path/to/your/flutter/project
How to use
The Widgetbook MCP Server provides a set of MCP endpoints that integrate with your AI assistant to manage Flutter Widgetbook projects. Core capabilities include discovering widgets in your project, inspecting detailed widget information (properties and use cases), retrieving existing use cases, generating new use case code snippets, modifying use cases, running tests for use cases, and capturing visual screenshots. You can interact with these tools through your MCP client by invoking the respective endpoints (for example widgetbook.list_widgets, widgetbook.get_widget_details, widgetbook.generate_use_case_code, widgetbook.run_use_case_test, and widgetbook.generate_screenshot). The server is designed for fast responses and secure access to your project files, enabling conversational UI prototyping, automated UI documentation, and automated UI testing workflows. To begin, configure your MCP client to point at the running Dart server, then start issuing commands to explore your Widgetbook project and iteratively generate and refine UI components through use cases.
How to install
Prerequisites:
- Dart SDK 3.0.0 or higher
- Flutter project with Widgetbook dependency
- Git (for cloning the repository)
Install from source:
- Clone the repository: git clone https://github.com/mastersam07/widgetbook_mcp_server.git
- Change into the project directory: cd widgetbook_mcp_server
- Get dependencies: dart pub get
- Compile the MCP server to an executable (example): dart compile exe bin/widgetbook_mcp_server.dart -o widgetbook-mcp-server
- Run the server (example path usage): ./widgetbook-mcp-server --project-path /path/to/your/flutter/project
Install from pub.dev (if published as a Dart package):
- Add the package to your pubspec.yaml and run dart pub get.
- Run the server using the published entry point as described in the package documentation.
Additional notes
Tips and considerations:
- Ensure your Flutter project includes the Widgetbook dependency so the MCP server can discover and manipulate widgets.
- The MCP server aims for sub-500ms response times; if you experience latency, ensure your project files are accessible and not on a slow network drive.
- Use the provided MCP endpoints to list widgets first, then drill down into details for precise use case generation.
- For production-like environments, consider securing access and configuring appropriate environment variables if the MCP server supports them in your setup.
- When using code generation, review and adapt generated WidgetbookUseCase snippets to fit your project's naming conventions and architecture.
Related MCP Servers
mcp-for-beginners
This open-source curriculum introduces the fundamentals of Model Context Protocol (MCP) through real-world, cross-language examples in .NET, Java, TypeScript, JavaScript, Rust and Python. Designed for developers, it focuses on practical techniques for building modular, scalable, and secure AI workflows from session setup to service orchestration.
ReActMCP
ReActMCP is a reactive MCP client that empowers AI assistants to instantly respond with real-time, Markdown-formatted web search insights powered by the Exa API.
spring-ai
From Java Dev to AI Engineer: Spring AI Fast Track
furi
CLI & API for MCP management
mcp-lite-dev
共学《MCP极简开发》项目代码
unity-editor
An MCP server and client for LLMs to interact with Unity Projects