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
- 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/tools
directory_10mkdir src/tools/your-tool-name -
Create and implement the
index.ts
,schema.ts
, andyour-tool.test.ts
files, which is the entry point, schema, and test file for the new tool respectively.The
export
ofindex.ts
file should be aToolRegistration
object, 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/cadence
directory. Thebun
will compile the Cadence files intoString
, 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. -
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. -
Add your new tool to the
src/tools/index.ts
file._10export const createTools = (): ToolRegistration<any>[] => {_10return [_10// ... other tools_10yourTool,_10];_10}; -
Run the test to ensure 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 is ready.