MCP ExplorerExplorer

Mcp Dart Codegen

1 NOASSERTION
FreeCommunity
AI Systems
A mono-repo for generating Dart servers from MCP annotations.

Overview

What is Mcp Dart Codegen

mcp_dart_codegen is a collection of packages that transform Model Context Protocol (MCP) annotations into fully-functional Dart servers and tool descriptors. It serves as a mono-repo hosting essential packages for building MCP-compliant applications.

Use cases

Use cases for mcp_dart_codegen include building RESTful APIs, creating server applications that follow the MCP standards, and developing tools that require automated code generation based on annotations.

How to use

To use mcp_dart_codegen, add the required packages to your project by updating your pubspec.yaml file. Annotate your functions or classes with MCP annotations, then run the build_runner to generate the necessary Dart files.

Key features

Key features include compile-time annotations for defining MCP servers and tools, a build_runner generator for converting these annotations into functional code, and example projects demonstrating the usage of these packages.

Where to use

mcp_dart_codegen is suitable for developing Dart applications that require adherence to the Model Context Protocol, making it ideal for server-side applications and tools that need structured data handling.

Content

MCP Dart Codegen

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.


Quick start

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.0

Annotate 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 watch

Generated .mcp.g.dart files will contain the server entry-points, handler glue code, and JSON descriptors expected by MCP tooling.


Repository layout

├── examples/             # Example projects that consume the packages
│   └── demo_server/
├── packages/             # Published Dart packages
│   ├── mcp_annotations/
│   └── mcp_codegen/
├── .github/
└── ...

Development

  1. Clone the repo and get dependencies:

    $ git clone [email protected]:nelsoncampos-cloudwalk/mcp_dart_codegen.git
    $ cd mcp_dart_codegen
    $ dart pub get
    
  2. Format & analyse:

    $ dart format .
    $ dart analyze
    
  3. Run tests:

    $ dart test ./packages/...  # or run from individual package folders
    
  4. Make your changes following the contribution guidelines and open a pull-request.


Contributing

We ❤️ pull-requests! Please read CONTRIBUTING.md for details on our coding standards, commit conventions, and release process.


License

This project is licensed under the terms of the Apache 2.0 License.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers