Contribute to Flow MCP
Overview
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 allows AI applications to interact seamlessly with external tools, systems, and data sources.
Learning Objectives
After you complete 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
- Bun - the JavaScript runtime.
- Flow MCP server - the Flow MCP server repository.
Installation
-
Fork the Flow MCP server repository.
-
Clone the repository:
_10git clone https://github.com/your-username/flow-mcp.git -
Install the dependencies:
_10bun install -
Build the project:
_10bun build
Create new Action Tool for Flow MCP
-
Create a new folder in the
src/toolsdirectory:_10mkdir src/tools/your-tool-name -
Create and implement the
index.ts,schema.ts, andyour-tool.test.tsfiles, which is the entry point, schema, and test file for the new tool respectively.The
exportofindex.tsfile should be aToolRegistrationobject, which is the registration of the new tool._10type ToolRegistration<T> = {_10name: string;_10description: string;_10inputSchema: z.ZodSchema;_10handler: (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/cadencedirectory. Thebunwill compile the Cadence files intoString, so the dedicated Cadence files will help the project to be more organized.And we recommended that you add a test for your new tool in the
src/tools/your-tool-name/your-tool.test.tsfile. -
Add a prompt export in the
src/promptsdirectory which is used to confirm that MCP clients can understand the new tool. You can refer to the existing tools for examples. -
Add your new tool to the
src/tools/index.tsfile._10export const createTools = (): ToolRegistration<any>[] => {_10return [_10// ... other tools_10yourTool,_10];_10}; -
Run the test to confirm your new tool works as expected:
_10bun test -
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's ready.