easy_api_generator 0.6.0
easy_api_generator: ^0.6.0 copied to clipboard
Build Runner generator that creates MCP server code from @tool annotations.
Changelog #
All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.6.0 - 2026-04-30 #
Added #
- Added canonical
lib/easy_api_generator.dartentry point that re-exportsmcp_generator.dart. Consumers can now use the conventionalimport 'package:easy_api_generator/easy_api_generator.dart'— the legacymcp_generator.dartimport still works. - REST template now honors
@Server(logErrors:), mirroring the MCP templates: detailed exceptions + stack traces go tostderrwhenlogErrors: true, while the 500 response body stays generic. Previously the REST template silently swallowed caught exceptions, leaving operators with no diagnostic signal. @Parameter(sensitive: true)is now actually emitted:.mcp.jsoninputSchema adds"x-sensitive": trueon the property,.openapi.jsonaddswriteOnly: true, and string-typed sensitive parameters also getformat: 'password'. Previously the flag was extracted but never written anywhere.
Changed #
- Renamed
@Mcpto@Server— generator now recognizes@Serveras the primary annotation - Renamed
generateOpenApiparameter togenerateRest - Added
generateMcpparameter (default: true) to control .mcp.dart generation - Added
generateRestparameter (default: false) to control .openapi.json generation - Consolidated the 12 per-field
@Serverannotation scans inMcpBuilderinto a single_extractServerConfigAST walk; the library is now traversed once per build instead of 12 times - Removed the dead
_dartTypeToJsonSchemahelper and its unread'schema'entry from the collected parameter maps; callers already rely on the richerschemaMapproduced by_introspectType SchemaBuilderandOpenApiBuildernow expose private constructors (pure static helpers — not meant to be instantiated)- Enabled strict analyzer modes (
strict-casts,strict-inference,strict-raw-types) and addedalways_declare_return_types,always_use_package_imports,avoid_catches_without_on_clauses,unawaited_futureslints
Removed #
- BREAKING: Removed
lib/stubs.dart— obsolete re-export layer;package:buildis already a direct dependency - BREAKING: Removed
lib/builder/doc_extractor.dartalong with the unused public classesToolInfo,ParameterInfo, andDocExtractor— these were never wired into the builder after the full analyzer integration landed - Deleted the placeholder
test/mcp_builder_test.dartthat only assertedexpect(true, isTrue) - Dropped unused
code_builderandjson_annotationdirect dependencies
Deprecated #
@Mcptypedef — still recognized for backward compatibility
0.5.0 - 2026-04-18 #
Added #
- OpenAPI 3.0 specification generation with
generateOpenApi: trueparameter - RESTful API endpoint mapping following Swagger best practices
- Automatic resource inference from tool names (e.g.,
createUser→POST /users) - Full request/response schema generation with validation
- Proper HTTP status codes (200, 201, 204, 400, 404)
OpenApiBuilderclass for transforming MCP tools to OpenAPI specs
0.4.2 - 2026-04-15 #
Changed #
- Updated README with absolute logo URL for pub.dev compatibility
- Added Buy Me a Coffee image button
- Updated version references to 0.4.2
0.4.1 - 2026-04-15 #
Fixed #
- Fixed method name resolution when
autoClassPrefixis enabled - Method calls now correctly use original method names instead of prefixed tool names
- Example:
UserStore.createUser()instead ofUserStore.UserStore_createUser()
0.4.0 - 2026-04-15 #
Added #
- Added support for
autoClassPrefixparameter on@Mcpannotation - Generator now automatically prefixes tool names with class name when enabled
- Supports combining
autoClassPrefixwithtoolPrefixfor flexible naming - Updated documentation with examples for all naming options
0.3.0 - 2026-04-15 #
Added #
- Added support for custom tool names via
@Tool.nameparameter - Added support for tool name prefixes via
@Mcp.toolPrefixparameter - Generator now uses custom names and applies prefixes when generating tool definitions
- Updated documentation with examples for custom tool naming
0.2.1 - 2026-04-14 #
Fixed #
- Updated repository and homepage URLs to point to package-specific directories
0.2.0 - 2026-04-14 #
Added #
- Added support for
@Parameterannotation for rich parameter metadata- Extracts
title,description,examplefor documentation - Supports validation constraints:
minimum,maximum,pattern,enumValues - Supports
sensitiveflag for marking sensitive data
- Extracts
- Added support for
portparameter in HTTP transport configuration - Added support for
addressparameter in HTTP transport configuration - Added
generateJsonparameter to control.mcp.jsonmetadata file generation - HTTP server now uses
io.InternetAddress.loopbackIPv4for default address (127.0.0.1) - Conditional import of
dart:ioonly when needed for HTTP transport - Updated documentation with HTTP transport and
@Parameterexamples
Security #
- Fixed information leakage in generated code - error messages no longer expose internal exception details
- Generated error responses now return generic "An error occurred while processing the request." message
- Added proper string escaping for regex patterns and special characters
Fixed #
- Fixed unused import warning for
dart:ioin generated HTTP server code - Fixed annotation extraction to use
peek()instead ofread()for optional fields - Fixed complex schema corruption when applying metadata
- Fixed dollar sign escaping in generated strings for regex patterns
0.1.2 - 2026-04-13 #
Fixed #
- Widen analyzer constraint to support latest versions
- Add example for package usage
- Fix lint issues and improve pana score
0.1.0 - 2026-04-13 #
Added #
- Initial release of mcp_generator package
- Build runner generator for @tool annotations
- AST-based parsing using dart:analyzer and source_gen
- Support for both stdio (JSON-RPC) and HTTP (Shelf) transports
- Automatic JSON-Schema generation from Dart types
- Dynamic method dispatch in generated servers
- Template-based code generation with StdioTemplate and HttpTemplate
- Doc comment extraction for tool descriptions