Model Integration (MCP/Agent)

This article explains how to connect FIRERPA with large language models (based on MCP or commands). FIRERPA has implemented the MCP server protocol and native OpenAI tool-calling functionality at its core, allowing you to write your own MCP plugins and serve them through the standard port 65000, or inherit the Agent class to achieve fully automated tool calls.

Built-in Agent Command

The built-in agent command allows you to quickly complete tasks using natural language through a large language model. It supports any service provider compatible with the OpenAI API + tool-calling, or self-hosted services. Combined with the built-in crontab, you can schedule natural language tasks to run at specific times.

Hint

The `agent` command must be used within the built-in terminal, and you need to provide a valid API endpoint and key. The performance of different large language models may vary, so please choose the one that best suits your needs. We recommend models like Gemini, OpenAI, DeepSeek, GLM, etc.
Parameter NameTypeRequiredDefaultDescription
--apiString (str)Yes-API endpoint
--modelString (str)Yes-Model name
--temperatureFloat (float)No0.2Model sampling temperature
--keyString (str)Yes-API key for authentication
--visionBoolean (bool)NoFalseWhether to enable vision mode
--imsizeInteger (int)No1000Image size in vision mode
--promptString (str)Yes-Instructions for the Agent to execute
--max-tokensInteger (int)No16384Maximum number of tokens to generate
--step-delayFloat (float)No0.0Delay time between steps

Attention

Note that the API parameter should be the full URL, not just the base_url. Typically, you need to append `/chat/completions` to the base_url to form the complete API address.

Once you have the required information, you can have the AI automatically operate your device by entering the following command in the remote desktop terminal.

agent --api https://generativelanguage.googleapis.com/v1beta/openai/chat/completions --key YOUR_API_KEY --model gemini-2.5-flash --prompt "Help me open the Settings app, package name com.android.settings, find network settings, and turn on airplane mode"

If your task prompt is too long, you can also provide the model prompt from a file.

agent --api https://generativelanguage.googleapis.com/v1beta/openai/chat/completions --key YOUR_API_KEY --model gemini-2.5-flash --prompt /path/to/prompt.txt

Claude & Cursor Integration (MCP)

This section explains how to integrate FIRERPA's MCP functionality with your large language model client. We provide examples for Claude and Cursor, but you can use it with any other client that supports the MCP protocol.

Note

FIRERPA's built-in MCP service supports tool-calling, resource-reading, prompts, progress notifications, and logging.

Attention

Please note that the communication protocol for the 8.0 server is different from the 9.0 server. Version 9.x uses streamable-http, while 8.x uses SSE (Server-Sent Events).

Install the Official Extension

We provide an official MCP service. You can download this extension module from extensions/firerpa.py. You can also refer to its implementation to write or extend your own plugin features. After downloading the extension script, upload it to the /data/usr/modules/extension directory on your device via remote desktop or a manual push, then restart the device or the FIRERPA service.

Attention

The extension scripts for version 8.0 and 9.0 are not compatible. Please strictly confirm your server version and pull the corresponding script from the correct GitHub branch.

Using the Official Extension

For Claude, you first need to go to the Claude settings page and follow the steps shown in the image below. Then, as prompted, edit Claude's claude_desktop_config.json configuration file and add the following MCP JSON service configuration.

{"mcpServers": {"firerpa": {"command": "npx", "args": ["-y", "supergateway", "--streamableHttp", "http://192.168.0.2:65000/firerpa/mcp/"]}}}

Example

For Cursor, you need to open Cursor Settings, follow the steps shown in the image, and enter the following configuration.

{"mcpServers": {"firerpa": {"url": "http://192.168.0.2:65000/firerpa/mcp/"}}}

Example

Attention

Please make sure to replace the URL in the configuration with your own device's IP address.

Writing an MCP Extension

Hint

Documentation coming soon. Stay tuned.