Skip to content

MCP Services / MCP Coding

Added in version 7.6.0

"MCP Coding" is a feature of DataFlux Func that supports AI Agents in writing and managing scripts in Func.

Users can allow AI Agents to participate in writing and managing functions in DataFlux Func through MCP Services.

1. Access Steps

Follow the steps below to connect an MCP client / AI Agent to the MCP Coding service of DataFlux Func.

1.1 Create an Access Token

To access the MCP Coding service of DataFlux Func, you need to create an Access Token and enable the "MCP Coding" feature.

You can also specify the functions to be exposed in the rules, such as by script set ID.

add-access-token.png

add-access-token-2.png

1.2 Permission Rules

Permission rules can be edited manually. They are matched sequentially from top to bottom, and permissions are determined based on the first matching rule.

Example:

Rule (exact ID match) Matched Object Matched ID Permission
scriptSet:mytest:r Script Set mytest Read
scriptSet:mytest:rw Script Set mytest Read, modify
scriptSet:mytest:rwx Script Set mytest Read, modify, execute
scriptSet:mytest:rwxp Script Set mytest Read, modify, execute, publish
script:mytest__demo:r Script mytest__demo Read
Rule (wildcard ID) Matched Object Wildcard ID Permission
scriptSet:my*:r Script Set Wildcard by my* Read
script:mytest__de*:r Script Wildcard by mytest__de* Read

1.3 Configure the MCP Client

The MCP service of DataFlux Func follows the MCP specification

Before actual integration, it is recommended to use MCP Inspector for debugging.

Add the following configuration in the MCP client / AI Agent:

Configuration Item Value
URL {DataFlux Func access address}/mcp/coding
Request Header X-Dff-Access-Token: atk-xxxxx:xxxxx
Example: OpenCode configuration
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
{
  "mcp": {
    "dataflux-func-mcp-coding": {
      "enabled": true,
      "type"   : "remote",
      "url"    : "{DataFlux Func access address}/mcp/coding",
      "headers": {
        "X-Dff-Access-Token": "atk-xxxxx:xxxxx"
      }
    }
  }
}

1.4 Initialize Local Collaboration Instructions

The help tool of the latest MCP Coding service already includes the recommended local AGENTS.md collaboration instructions, so users do not need to create them manually.

After connecting, it is recommended to have the AI Agent first call the help tool of the MCP service dataflux-func-testing, and initialize according to the returned recommendations.

2. Examples of Actual Operations

MCP Coding already includes a large number of prompts and tool descriptions for Func development. When entering prompts, you can directly describe the objective on the premise that the "AI Agent already has a thorough understanding of the best practices for using Func".

For example:

  • Initialize according to the recommendations of the MCP service dataflux-func-testing
  • Synchronize all code in the demo script set

First, confirm whether the AI Agent has successfully connected to the MCP Coding service of DataFlux Func:

opencode-mcp-status.png

Then, enter prompts as usual.

opencode-process.png

opencode-process-2.png

After the AI Agent completes the task, refresh DataFlux Func to view the code written by the AI Agent.

code.png