A collection of packages that turn Model Context Protocol (MCP) annotations into fully-functional Dart servers and tool descriptors.
This repository is a mono-repo that hosts:
| Package | Description |
|---|---|
packages/mcp_annotations |
Compile-time annotations (e.g. @MCPTool, @MCPServerApp) used to describe MCP servers and tools. |
packages/mcp_codegen |
A build_runner generator that converts the annotations above into: |
An example server that demonstrates these packages in action can be found under examples/demo_server.
Add both packages to your own project:
# pubspec.yaml
name: my_app
dependencies:
mcp_annotations: ^0.1.0
dev_dependencies:
build_runner: ^2.4.0
mcp_codegen: ^0.1.0Annotate your functions / classes and run the generator:
# One-shot build
$ dart run build_runner build
# Or keep it running during development
$ dart run build_runner watchGenerated .mcp.g.dart files will contain the server entry-points, handler glue code, and JSON descriptors expected by MCP tooling.
├── examples/ # Example projects that consume the packages
│ └── demo_server/
├── packages/ # Published Dart packages
│ ├── mcp_annotations/
│ └── mcp_codegen/
├── .github/
└── ...
-
Clone the repo and get dependencies:
$ git clone git@github.com:nelsoncampos-cloudwalk/mcp_dart_codegen.git $ cd mcp_dart_codegen $ dart pub get -
Format & analyse:
$ dart format . $ dart analyze -
Run tests:
$ dart test ./packages/... # or run from individual package folders
-
Make your changes following the contribution guidelines and open a pull-request.
We ❤️ pull-requests! Please read CONTRIBUTING.md for details on our coding standards, commit conventions, and release process.
This project is licensed under the terms of the Apache 2.0 License.