Skip to main content

Contribute to Flow MCP

This tutorial will guide you through the process of contributing to the Flow MCP server. The Model Context Protocol (MCP) is an open standard developed by Anthropic that enables AI applications to interact seamlessly with external tools, systems, and data sources.

Learning Objectives

After completing this tutorial, you should be able to:

  • Set up and build the Flow MCP server development environment.
  • Create and register a new Action Tool, including schema, handler, and tests.
  • Test and validate the functionality of a new Action Tool within the MCP system.
  • Submit a complete pull request that follows Flow MCP contribution guidelines.

Prerequisites

Installation

  1. Fork the Flow MCP server repository

  2. Clone the repository


    _10
    git clone https://github.com/your-username/flow-mcp.git

  3. Install the dependencies


    _10
    bun install

  4. Build the project


    _10
    bun build

Create new Action Tool for Flow MCP

  1. Create a new folder in the src/tools directory


    _10
    mkdir src/tools/your-tool-name

  2. Create and implement the index.ts, schema.ts, and your-tool.test.ts files, which is the entry point, schema, and test file for the new tool respectively.

    The export of index.ts file should be a ToolRegistration object, which is the registration of the new tool.


    _10
    type ToolRegistration<T> = {
    _10
    name: string;
    _10
    description: string;
    _10
    inputSchema: z.ZodSchema;
    _10
    handler: (args: T) => CallToolResult | Promise<CallToolResult>;
    _10
    };

    If you want to add new Cadence files for your new tool, you can add them in the src/cadence directory. The bun will compile the Cadence files into String, so the dedicated Cadence files will help the project to be more organized.

    And it is recommended to add a test for your new tool in the src/tools/your-tool-name/your-tool.test.ts file.

  3. Add a prompt export in the src/prompts directory which is used to ensure MCP client can understand the new tool. You can refer to the existing tools for examples.

  4. Add your new tool to the src/tools/index.ts file.


    _10
    export const createTools = (): ToolRegistration<any>[] => {
    _10
    return [
    _10
    // ... other tools
    _10
    yourTool,
    _10
    ];
    _10
    };

  5. Run the test to ensure your new tool works as expected


    _10
    bun test

  6. Commit and push your changes to your forked repository, and create a pull request.

We will review your pull request and merge it if it is ready.