About Flutter + dart_mcp + AI Desktop App Demo
Flutter plus dart_mcp plus AI Desktop App Demo shows how to implement MCP Client in Flutter. Provides interface for managing MCP server configurations, API keys, and custom environment variables.
Key features
- 01API key management with local storage
- 02Add, edit, delete MCP server configurations
- 03Server connection state management
- 04Custom environment variables setup
- 05Stdio server support
- 06Toggle code block visibility in chat
Use cases
- 01Manage multiple MCP servers in desktop application
- 02Configure and test MCP server connections
- 03Build AI chat app integrated with Gemini model
MCP support
Flutter client uses dart_mcp package to communicate with stdio servers and manage MCP server connections and configurations.
Details
From the project READMEFlutter + dart_mcp + AI Desktop App Demo
This is a Flutter-based project designed to manage and configure MCP (Multi-Connection Protocol) servers. The application provides a user-friendly interface for managing API keys, configuring server settings, and handling custom environment variables. The application uses the mcp_dart package to facilitate communication with MCP servers.
Screenshots
Features
- API Key Management: Save, clear, and manage API keys securely using
SharedPreferences. - MCP Server Management:
- Add, edit, and delete MCP server configurations.
- Toggle server connection states.
- Apply changes to synchronize server connections.
- Custom Environment Variables: Define and manage custom environment variables for each server.
- Display Settings: Toggle the visibility of code blocks in chat messages.
Installation
To run this project, ensure you have Flutter SDK installed on your machine. Follow the guidelines.
-
Clone the repository:
git clone [email protected]:leehack/flutter-mcp-ai-chat.git cd flutter-mcp-ai-chat -
Install dependencies:
flutter pub get -
Run the application:
flutter run
Usage
API Key Management
The API key is necessary to talk to the Gemini model. You can manage your API key through the settings screen. The key can be created from the Google AI Studio.
- Navigate to the Settings screen.
- Enter your API key in the provided text field.
- Click Save Key to store the key locally.
- Use the Clear Key button to remove the stored key.
MCP Server Management
The MCP server management feature allows you to add, edit, and delete server configurations. You can also toggle the connection state of each server. At the moment, the application supports only the stdio based servers. For the example of MCP servers you can find from https://github.com/modelcontextprotocol/servers
- Add a new server by clicking the Add New MCP Server button.
- Fill in the server details, including name, command, arguments, and custom environment variables.
- Save the server configuration.
- Toggle the server's connection state using the switch in the server list.
- Apply changes to synchronize server connections.
Custom Environment Variables
- While adding or editing a server, use the Custom Environment Variables section to define key-value pairs.
- Add new variables using the Add Variable button.
- Remove variables using the delete icon next to each variable.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push them to your fork.
- Submit a pull request with a detailed description of your changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.