Skip to content
Back to search

frida-mcp

一个用于frida动态调试的mcp工具,支持自定义frida路径和名称端口,自动管理frida

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/zhizhuodemao--frida-mcp/badge.svg)](/listings/zhizhuodemao--frida-mcp)

HTML

<a href="/listings/zhizhuodemao--frida-mcp"><img src="/api/listings/zhizhuodemao--frida-mcp/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

# Clone repository
git clone http://git.dev.sh.ctripcorp.com/octopus/frida-mcp.git
cd frida-mcp

# Install dependencies (choose one method)
# Method 1: Using pip + requirements.txt
pip install -r requirements.txt

# Method 2: Using pip + pyproject.toml (recommended)
pip install -e .

# Setup frida-server on Android device
adb push frida-server /data/local/tmp/
adb shell "chmod 755 /data/local/tmp/frida-server"
adb shell "su -c /data/local/tmp/frida-server &"

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 286 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # Frida MCP Server | Frida MCP 服务器
  2. [English](#english) | [中文](#中文)
  3. ## English
  4. A Model Context Protocol (MCP) server that enables AI models to perform Android dynamic analysis using Frida.
  5. ### Project Structure
  6. ```
  7. frida-mcp/
  8. ├── frida_mcp.py # Core MCP server implementation
  9. ├── pyproject.toml # Project dependencies and configuration
  10. ├── requirements.txt # Alternative dependency file
  11. ├── config.json # Optional Frida server configuration
  12. ├── README.md # Documentation
  13. └── .gitignore # Git ignore rules
  14. ```
  15. ### Core Files
  16. - **`frida_mcp.py`**: Main MCP server with Frida integration
  17. - **`pyproject.toml`**: Modern Python project configuration (recommended)
  18. - **`requirements.txt`**: Traditional dependency file
  19. - **`config.json`**: Optional configuration for frida-server settings
  20. ### Installation
  21. ```bash
  22. # Clone repository
  23. git clone http://git.dev.sh.ctripcorp.com/octopus/frida-mcp.git
  24. cd frida-mcp
  25. # Install dependencies (choose one method)
  26. # Method 1: Using pip + requirements.txt
  27. pip install -r requirements.txt
  28. # Method 2: Using pip + pyproject.toml (recommended)
  29. pip install -e .
  30. # Setup frida-server on Android device
  31. adb push frida-server /data/local/tmp/
  32. adb shell "chmod 755 /data/local/tmp/frida-server"
  33. adb shell "su -c /data/local/tmp/frida-server &"
  34. ```
  35. ### MCP Configuration
  36. Add to your MCP client configuration (e.g., Claude Desktop config file):
  37. **Windows** (`%APPDATA%\Claude\claude_desktop_config.json`):
  38. ```json
  39. {
  40. "mcpServers": {
  41. "frida": {
  42. "command": "python",
  43. "args": ["C:\\Users\\YourName\\frida-mcp\\frida_mcp.py"],
  44. "transport": "stdio"
  45. }
  46. }
  47. }
  48. ```
  49. **macOS/Linux** (`~/.config/claude/claude_desktop_config.json`):
  50. ```json
  51. {
  52. "mcpServers": {
  53. "frida": {
  54. "command": "python",
  55. "args": ["/home/username/frida-mcp/frida_mcp.py"],
  56. "transport": "stdio"
  57. }
  58. }
  59. }
  60. ```
  61. ### Configuration (Optional)
  62. The `config.json` file contains optional Frida server configuration:
  63. ```json
  64. {
  65. "server_path": "/data/local/myfr",
  66. "server_name": "aaabbb",
  67. "server_port": 27042,
  68. "device_id": null,
  69. "adb_path": "adb"
  70. }
  71. ```
  72. - `server_path`: Custom path for frida-server on Android device
  73. - `server_name`: Custom frida-server binary name
  74. - `server_port`: Port for Frida server communication
  75. - `device_id`: Specific device ID (null for auto-detection)
  76. - `adb_path`: Path to ADB executable
  77. ### Available Tools
  78. #### `spawn(package_name, initial_script?, wait_seconds?, max_output_messages?)`
  79. Start an Android application with optional script injection.
  80. #### `attach(target, initial_script?, wait_seconds?, max_output_messages?)`
  81. Attach to a running process with optional script injection.
  82. #### `get_frontmost_application()`
  83. Get the currently active application.
  84. #### `list_applications()`
  85. List all installed applications.
  86. ### Example Usage
  87. ```javascript
  88. // Hook HashMap operations
  89. Java.perform(function() {
  90. var HashMap = Java.use("java.util.HashMap");
  91. HashMap.put.implementation = function(key, value) {
  92. console.log("HashMap.put:", key, value);
  93. return this.put(key, value);
  94. };
  95. });
  96. ```
  97. ---
  98. ## 中文
  99. 一个 Model Context Protocol (MCP) 服务器,使 AI 模型能够使用 Frida 进行 Android 动态分析。
  100. ### 项目结构
  101. ```
  102. frida-mcp/
  103. ├── frida_mcp.py # MCP 服务器核心实现
  104. ├── pyproject.toml # 项目依赖和配置文件
  105. ├── requirements.txt # 传统依赖文件
  106. ├── config.json # 可选的 Frida 服务器配置
  107. ├── README.md # 文档说明
  108. └── .gitignore # Git 忽略规则
  109. ```
  110. ### 核心文件
  111. - **`frida_mcp.py`**: 集成 Frida 的主要 MCP 服务器
  112. - **`pyproject.toml`**: 现代 Python 项目配置(推荐使用)
  113. - **`requirements.txt`**: 传统依赖文件
  114. - **`config.json`**: Frida 服务器设置的可选配置文件
  115. ### 安装
  116. ```bash
  117. # 克隆仓库
  118. git clone http://git.dev.sh.ctripcorp.com/octopus/frida-mcp.git
  119. cd frida-mcp
  120. # 安装依赖(选择一种方法)
  121. # 方法1:使用 pip + requirements.txt
  122. pip install -r requirements.txt
  123. # 方法2:使用 pip + pyproject.toml(推荐)
  124. pip install -e .
  125. # 在 Android 设备上设置 frida-server
  126. adb push frida-server /data/local/tmp/
  127. adb shell "chmod 755 /data/local/tmp/frida-server"
  128. adb shell "su -c /data/local/tmp/frida-server &"
  129. ```
  130. ### MCP 配置
  131. 添加到您的 MCP 客户端配置(如 Claude Desktop 配置文件):
  132. **Windows** (`%APPDATA%\Claude\claude_desktop_config.json`):
  133. ```json
  134. {
  135. "mcpServers": {
  136. "frida": {
  137. "command": "python",
  138. "args": ["C:\\Users\\你的用户名\\frida-mcp\\frida_mcp.py"],
  139. "transport": "stdio"
  140. }
  141. }
  142. }
  143. ```
  144. 注意:将 `你的用户名` 替换为实际的 Windows 用户名,路径使用双反斜杠 `\\`
  145. **macOS/Linux** (`~/.config/claude/claude_desktop_config.json`):
  146. ```json
  147. {
  148. "mcpServers": {
  149. "frida": {
  150. "command": "python",
  151. "args": ["/home/用户名/frida-mcp/frida_mcp.py"],
  152. "transport": "stdio"
  153. }
  154. }
  155. }
  156. ```
  157. 注意:将 `用户名` 替换为实际的系统用户名
  158. ```
  159. ### 配置说明(可选)
  160. `config.json` 文件包含可选的 Frida 服务器配置:
  161. ```json
  162. {
  163. "server_path": "/data/local/myfr",
  164. "server_name": "aaabbb",
  165. "server_port": 27042,
  166. "device_id": null,
  167. "adb_path": "adb"
  168. }
  169. ```
  170. - `server_path`: Android 设备上 frida-server 的自定义路径
  171. - `server_name`: frida-server 二进制文件的自定义名称
  172. - `server_port`: Frida 服务器通信端口
  173. - `device_id`: 指定设备 ID(null 为自动检测)
  174. - `adb_path`: ADB 可执行文件路径
  175. ### 可用工具
  176. #### `spawn(package_name, initial_script?, wait_seconds?, max_output_messages?)`
  177. 启动 Android 应用程序,可选注入脚本。
  178. - `package_name`: 应用包名
  179. - `initial_script`: 可选的 JavaScript 脚本
  180. - `wait_seconds`: 等待输出的时间(默认 1.5 秒)
  181. - `max_output_messages`: 最大输出消息数(默认 100)
  182. #### `attach(target, initial_script?, wait_seconds?, max_output_messages?)`
  183. 附加到运行中的进程,可选注入脚本。
  184. - `target`: 进程名或 PID
  185. - `initial_script`: 可选的 JavaScript 脚本
  186. - `wait_seconds`: 等待输出的时间(默认 1.0 秒)
  187. - `max_output_messages`: 最大输出消息数(默认 100)
  188. #### `get_frontmost_application()`
  189. 获取当前活跃的应用程序。
  190. #### `list_applications()`
  191. 列出所有已安装的应用程序。
  192. ### 使用示例
  193. ```javascript
  194. // Hook HashMap 操作
  195. Java.perform(function() {
  196. var HashMap = Java.use("java.util.HashMap");
  197. HashMap.put.implementation = function(key, value) {
  198. console.log("HashMap.put:", key, value);
  199. return this.put(key, value);
  200. };
  201. });
  202. ```
  203. ### 特性
  204. - 🚀 自动 Gson 对象序列化
  205. - 🔍 console.log 自动重定向
  206. - 📱 自动设备连接管理
  207. - 🤖 为 AI 交互优化
  208. ### 常见问题
  209. **Q: 应用崩溃怎么办?**
  210. A: 减少 hook 频率,避免复杂序列化操作。
  211. **Q: 没有输出?**
  212. A: 确认方法被调用,spawn 时脚本在应用启动前注入。
  213. **Q: 连接失败?**
  214. A: 检查 frida-server 是否运行:`adb shell ps | grep frida`
  215. ### Requirements
  216. - Python 3.8+
  217. - Android 设备 (root)
  218. - 查看 `requirements.txt`
  219. ## License
  220. MIT

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.