Skip to content

MCP Server

FlutterProbe ships an MCP (Model Context Protocol) server as a standalone binary called probe-mcp that exposes your test suite as tools callable by AI agents. Once connected, Claude Desktop, Cursor, or any MCP-compatible client can read the live widget tree, write tests, run them, and inspect results — all without leaving the AI chat.

As of v0.6.0, the MCP server is a separate binary probe-mcp. The legacy probe mcp-server subcommand still works (it runs the same code embedded in the main binary) but prints a deprecation notice on stderr. Update your MCP client configuration to point at probe-mcp directly.

ToolDescription
get_widget_treeDump the live Flutter widget tree from the running app
take_screenshotCapture the current screen and return it as an image
read_testRead the contents of a .probe file
write_testCreate or overwrite a .probe file
run_scriptExecute inline ProbeScript without creating a file
run_testsRun .probe test files against the connected app
list_filesList all .probe files in a directory
lintValidate .probe file syntax without running
get_reportRead the latest JSON test run report
generate_testAI-generate a test from a natural language prompt

The workflow this enables: get_widget_treewrite_testrun_testsget_report — a complete AI-driven test authoring loop.

  • probe-mcp binary v0.6.0+ installed and in PATH (legacy probe mcp-server v0.5.7+ also works but is deprecated)
  • Flutter app running with --dart-define=PROBE_AGENT=true (for live tools like get_widget_tree, take_screenshot, run_tests)
  • An MCP-compatible client (Claude Desktop, Cursor, etc.)

Verify the binary is accessible:

Terminal window
which probe-mcp # should print /opt/homebrew/bin/probe-mcp or similar

probe-mcp reads JSON-RPC 2.0 messages from stdin and writes responses to stdout, so it has no --version flag of its own — verify by sending an initialize request (see Verifying the connection).

Edit ~/Library/Application Support/Claude/claude_desktop_config.json:

{
"mcpServers": {
"flutter-probe": {
"command": "probe-mcp"
}
}
}

If probe-mcp is not in your shell PATH (common when Claude Desktop doesn’t inherit your shell environment), use the absolute path:

{
"mcpServers": {
"flutter-probe": {
"command": "/opt/homebrew/bin/probe-mcp"
}
}
}

Find the absolute path with:

Terminal window
which probe-mcp

Edit %APPDATA%\Claude\claude_desktop_config.json:

{
"mcpServers": {
"flutter-probe": {
"command": "probe-mcp.exe"
}
}
}

After editing the config, restart Claude Desktop. The flutter-probe tools appear in the tool picker (hammer icon) in any new conversation.

In Cursor, open Settings → MCP (or edit .cursor/mcp.json at the repo root):

{
"mcpServers": {
"flutter-probe": {
"command": "probe-mcp"
}
}
}

Restart Cursor after saving.

If you previously used the legacy subcommand, change:

{ "command": "probe", "args": ["mcp-server"] }

to:

{ "command": "probe-mcp" }

The tools, protocol, and behavior are identical. The legacy form continues to work in v0.6.0 but prints a deprecation notice and will be removed in a future release.

Any client that supports the MCP stdio transport works. The server command is:

Terminal window
probe-mcp

It reads JSON-RPC 2.0 messages from stdin and writes responses to stdout, one message per line (newline-delimited).

The MCP server inherits the working directory from the client. For tools like run_tests, list_files, and get_report to find your test files, the working directory must be your Flutter project root (the folder containing probe.yaml and tests/).

Claude Desktop launches the server with its own working directory, which may not be your project. Pass the correct directory explicitly:

{
"mcpServers": {
"flutter-probe": {
"command": "probe-mcp",
"env": {
"PWD": "/Users/you/dev/my-flutter-app"
}
}
}
}

Or use the cwd field if your client supports it:

{
"mcpServers": {
"flutter-probe": {
"command": "probe-mcp",
"cwd": "/Users/you/dev/my-flutter-app"
}
}
}

Test the server manually in your terminal:

Terminal window
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{}}' | probe-mcp

Expected response (version reflects the installed binary):

{"jsonrpc":"2.0","id":1,"result":{"capabilities":{"tools":{}},"protocolVersion":"2024-11-05","serverInfo":{"name":"probe-mcp","version":"0.6.0"}}}

List all available tools:

Terminal window
echo '{"jsonrpc":"2.0","id":2,"method":"tools/list","params":{}}' | probe-mcp

Once connected, you can prompt Claude to:

“Look at the widget tree and write a test that verifies the login flow works.”

Claude will:

  1. Call get_widget_tree to inspect the running app’s UI
  2. Call take_screenshot to see what is on screen
  3. Call write_test to create tests/login.probe
  4. Call run_tests to execute it
  5. Call get_report to verify all steps passed
  • Restart Claude Desktop after editing the config
  • Verify the JSON is valid (no trailing commas)
  • Check Claude Desktop logs: ~/Library/Logs/Claude/

Claude Desktop may not inherit your shell PATH. Use the absolute binary path:

Terminal window
which probe-mcp # copy this output

Then set "command": "/absolute/path/to/probe-mcp" in the config.

get_widget_tree / take_screenshot return errors

Section titled “get_widget_tree / take_screenshot return errors”

These tools require the Flutter app to be running and connected to the probe agent. Start the app first:

Terminal window
flutter run --dart-define=PROBE_AGENT=true

Then confirm the agent is reachable:

Terminal window
probe test --dry-run

The MCP server looks for screenshots in reports/screenshots/ relative to its working directory. Set cwd in your MCP config to your project root (see Working directory above).