Flutter Deprecations MCP Server

by jger

405 downloads Not rated yet

About

# Flutter Deprecations MCP Server This MCP server tracks Flutter API deprecations and provides tools to check code for deprecated APIs and suggest replacements. ## Project Structure ``` flutter-deprecations-server/ ├── cmd/ │ └── server/ # Main application entry point │ └── main.go ├── internal/ # Private application…

Explore

- Source-based deprecation tracking: Directly scans Flutter's GitHub source code for @Deprecated annotations
- Local caching: Stores deprecations locally with 24-hour cache duration
- Code analysis: Analyzes Flutter code snippets for deprecated APIs
- Replacement suggestions: Provides modern alternatives for deprecated APIs
- Comprehensive scanning: Scans key Flutter directories (widgets, material, cupertino, services, etc.)
- Version checking: Gets latest Flutter version using Flutter CLI (most reliable) with GitHub API fallback
- Multi-platform support: Checks FVM and Docker image availability
- Command-line cache management: Manual cache updates and clearing with progress reporting
- Short command options: Support for both long and short command flags
- Rate limit handling: Graceful handling of GitHub API rate limits with helpful error messages
- Verbose logging: Detailed logging with -vvv flag for troubleshooting

make deps

Add to your MCP configuration (e.g., mcp.json):

{
  "mcpServers": {
    "flutter-deprecations": {
      "command": "/path/to/flutter-deprecations-server/bin/flutter-deprecations-server",
      "args": [],
      "env": {}
    }
  }
}

Ask your AI assistant:
- "Check this Flutter code for deprecations: Color.red.withOpacity(0.5)"
- "List all Flutter deprecations"
- "What should I use instead of RaisedButton?"
- "What's the latest Flutter version and is it available in FVM and Docker?"
- "Check Flutter version info"

The server supports several command-line options for cache management:

```bash

This MCP server tracks Flutter API deprecations and provides tools to check code for deprecated APIs and suggest replacements.

Project Structure

flutter-deprecations-server/
├── cmd/
│   └── server/          # Main application entry point
│       └── main.go
├── internal/            # Private application code
│   ├── handlers/        # MCP tool handlers
│   │   ├── mcp_handlers.go
│   │   ├── mcp_handlers_test.go
│   │   └── testdata/
│   ├── models/          # Data structures
│   │   └── flutter.go
│   └── services/        # Business logic
│       ├── cache.go
│       ├── cache_test.go
│       ├── deprecations.go
│       ├── deprecations_test.go
│       ├── flutter_api.go
│       ├── flutter_api_test.go
│       ├── flutter_version.go
│       ├── interfaces.go
│       ├── version_info.go
│       ├── version_info_test.go
│       └── testdata/
├── pkg/                 # Public libraries
│   └── config/          # Configuration constants
│       └── config.go
├── bin/                 # Compiled binaries
├── Makefile            # Build automation
├── go.mod              # Go module definition
├── go.sum              # Dependency checksums
└── README.md

Features

- Source-based deprecation tracking: Directly scans Flutter's GitHub source code for @Deprecated annotations
- Local caching: Stores deprecations locally with 24-hour cache duration
- Code analysis: Analyzes Flutter code snippets for deprecated APIs
- Replacement suggestions: Provides modern alternatives for deprecated APIs
- Comprehensive scanning: Scans key Flutter directories (widgets, material, cupertino, services, etc.)
- Version checking: Gets latest Flutter version using Flutter CLI (most reliable) with GitHub API fallback
- Multi-platform support: Checks FVM and Docker image availability
- Command-line cache management: Manual cache updates and clearing with progress reporting
- Short command options: Support for both long and short command flags
- Rate limit handling: Graceful handling of GitHub API rate limits with helpful error messages
- Verbose logging: Detailed logging with -vvv flag for troubleshooting

MCP Tools

1. check_flutter_deprecations

Analyzes provided Flutter code for deprecated APIs and suggests replacements.

Parameters:
- code (string): Flutter code snippet to analyze

Example:

Color.red.withOpacity(0.5)  // Will suggest Color.red.withValues(alpha: 0.5)

2. list_flutter_deprecations

Lists all known Flutter deprecations from the cache.

Parameters: None

Returns: Complete list of deprecations with replacements and version information.

3. check_flutter_version_info

Gets the latest stable Flutter version and checks availability across different tools and platforms.

Parameters: None

Returns:
- Latest stable Flutter version (using Flutter CLI when available, GitHub API fallback)
- Flutter CLI installation status and channel information
- FVM installation status and version availability
- Docker image availability for instrumentisto/flutter and ghcr.io/cirruslabs/flutter
- Usage examples and installation commands

Known Deprecations

The server includes built-in patterns for common deprecations:

- Color.withOpacity() → Color.withValues(alpha:)
- RaisedButton → ElevatedButton
- FlatButton → TextButton
- OutlineButton → OutlinedButton
- Scaffold.of(context).showSnackBar → ScaffoldMessenger.of(context).showSnackBar

Installation

Using Makefile (Recommended)

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.