Skip to main content

Model Context Protocol implementation for Frida

Project description

Frida MCP

A Model Context Protocol (MCP) implementation for Frida dynamic instrumentation toolkit.

๐Ÿ†• Kernel Backend Support (proyecto.sys)

This fork includes kernel backend support for accessing protected processes that are blocked by anti-cheats (EAC, BattlEye, Vanguard, etc.).

Features

  • โœ… Read/Write memory of protected processes via kernel driver
  • โœ… Attach to protected games (Fortnite, PUBG, Valorant, Apex, etc.)
  • โœ… Manual Map DLL injection (bypass anti-cheat detection)
  • โœ… Pattern scanning for finding addresses
  • โœ… Automatic detection - uses kernel if driver loaded, fallback to native Frida

Quick Start

# 1. Load the kernel driver
kdmapper.exe proyecto.sys

# 2. Use Frida MCP normally - it auto-detects the driver
# All tools now work with protected processes!

New Memory Tools for Kernel Backend

Tool Description
read_memory Read bytes from process memory (kernel or native)
write_memory Write bytes to process memory
read_pointer Read a pointer value (8 bytes on x64)
read_float Read a 32-bit float value
read_vector3 Read X, Y, Z position (3 floats)
follow_pointer_chain Follow multi-level pointers
scan_memory_pattern AOB scan with wildcard support

Example: Read Player Position

# Attach to protected game
session = create_interactive_session(pid, device_id="local")

# Read Vector3 position
pos = read_vector3(session_id, "0x12345678")
# Returns: {"x": 123.45, "y": 67.89, "z": 100.00}

# Follow pointer chain
addr = follow_pointer_chain(session_id, base, [0x10, 0x20, 0x30])

Overview

This package provides an MCP-compliant server for Frida, enabling AI systems to interact with mobile and desktop applications through Frida's dynamic instrumentation capabilities. It uses the official MCP Python SDK to enable seamless integration with AI applications like Claude Desktop.

Demo

https://github.com/user-attachments/assets/5dc0e8f5-5011-4cf2-be77-6a77ec960501

What's New in 0.3.7

  • 84 tools total โ€” 3 new VMProtect post-processing tools + 3 advanced variants
  • vmp_deep_clean โ€” removes all VMProtect traces: renames .vmp sections, zeros DataDirectories, disables ASLR, fixes section flags
  • vmp_fix_pdata โ€” fixes high-entropy .pdata caused by VMP encryption (eliminates 'packed data' warnings in PE-bear/DiE)
  • vmp_verify_strings โ€” verifies dump integrity by scanning .rdata for readable strings and game engine keywords
  • Enhanced vmp_full_unpack โ€” full 7-step pipeline: OEP โ†’ dump โ†’ patch โ†’ deep clean โ†’ fix pdata โ†’ rebuild IAT โ†’ verify strings
  • list_sessions_detailed โ€” extended session listing with PID, timestamp and persistent script count
  • close_session_force โ€” force-close with error recovery (reports warnings instead of failing)
  • follow_pointer_chain_detailed โ€” step-by-step pointer chain trace with dereferenced values at each level

What's New in 0.3.2

  • 7 new VMProtect Unpacker tools โ€” full runtime unpacking pipeline: OEP detection, PE dump, IAT reconstruction, section header fixing and all-in-one vmp_full_unpack
  • xrefs fixed โ€” rebuilt .idata section with proper IMAGE_IMPORT_DESCRIPTOR entries so IDA Pro and x64dbg resolve all API calls and string xrefs correctly
  • GetProcAddress hooking โ€” vmp_resolve_imports captures every import VMP resolves at runtime for 100% accurate IAT reconstruction

What's New in 0.3.1

  • 8 new VMProtect tools โ€” full VMProtect v2/v3 analysis: detection, section parsing, SDK hooking, anti-debug bypass, string decryption, handler AOB scan and dispatcher analysis
  • VMProtect integrated in detect_embedded_vm โ€” auto-detected alongside Mono, IL2CPP, Lua, Python, V8
  • Improved publish.py โ€” handles 400 File already exists gracefully instead of crashing

What's New in 0.3.0

  • 7 new tools โ€” typed memory read/write, hex dump, pointer chain, address watcher, session list/close
  • Full async refactor โ€” all tools now use threading.Event instead of fixed time.sleep delays (up to 10ร— faster responses)
  • Central _run_script helper โ€” eliminates ~250 lines of duplicated boilerplate across all modules
  • Bug fix โ€” read_memory was missing its @mcp.tool() decorator and was never registered
  • Better error reporting โ€” all tools now return structured timed_out errors with clear messages

Features

  • Built with the official MCP Python SDK
  • 84 tools covering all major Frida capabilities
  • Full VM support: Java/Android, Mono, IL2CPP (Unity), Lua, Python embedded, V8/Node.js
  • Full VMProtect v2/v3 analysis, bypass and unpacking with deep cleanup
  • Game engine reverse engineering support
  • Event-driven synchronization โ€” no wasted wait time

Tool Categories

๐Ÿ”ง Process & Device Management (10 tools) - โญ Kernel Backend Support

Tool Description Kernel
enumerate_processes List all running processes โœ…
enumerate_devices List connected devices (includes kernel device) โœ…
get_local_device Get local device (auto-detects kernel driver) โœ…
get_process_by_name Find process by name โœ…
attach_to_process Attach to process (works with protected processes!) โœ…
create_interactive_session Create session for memory operations โœ…
list_sessions List all active sessions โœ…
close_session Close and cleanup a session โœ…
spawn_process Spawn a new process โœ…
kill_process Terminate a process โœ…

๐Ÿ“ฆ Module & Symbol Analysis (6 tools)

Tool Description
list_modules List all loaded modules/libraries
find_module_by_name Find a module by name (partial match)
list_exports List all exported symbols of a module
list_imports List all imported symbols of a module
resolve_symbol Resolve the absolute address of an export
find_symbol_by_pattern Search exports by regex pattern

๐Ÿ’พ Memory Operations (12 tools) - โญ Kernel Backend Support

Tool Description Kernel
read_memory Read raw bytes from a memory address โœ…
write_memory Write bytes to a memory address โœ…
scan_memory_pattern AOB scan with wildcard support (??) โœ…
read_pointer Read a pointer-sized value โœ…
read_float Read a 32-bit float value โœ…
read_vector3 Read X,Y,Z position (3 floats) โœ…
read_string_at Read null-terminated string (UTF-8/16/ANSI) โœ…
follow_pointer_chain Follow multi-level pointer chain โœ…
enumerate_memory_ranges List all memory regions with permissions โŒ
resolve_symbol Resolve the absolute address of an export โŒ
find_symbol_by_pattern Search exports by regex pattern โŒ
get_process_architecture Get arch, platform, pointer size, page size โŒ

๐Ÿช Hooking & Tracing (4 tools)

Tool Description
hook_function Persistent Interceptor hook (args + retval)
enumerate_threads List all threads with state and context
get_thread_backtrace Get backtrace for a specific thread
stalker_trace_thread Trace a thread's execution with Stalker

โš™๏ธ Native Calls (2 tools)

Tool Description
call_native_function Call a native function at an address
install_native_callback Replace a function with a NativeCallback

โ˜• Java / Android Bridge (6 tools)

Tool Description
java_list_classes List all loaded Java classes (with filter)
java_list_methods List all methods of a Java class
java_hook_method Hook a Java method (persistent)
java_get_field_value Get a Java field value (static or instance)
java_set_field_value Set a Java field value
java_call_method Call a Java method directly

๐ŸŽฎ VM & Game Engine Support (16 tools)

Tool Description
detect_embedded_vm Auto-detect embedded VMs (Lua, LuaJIT, Python, Mono, IL2CPP, V8, JVM, Chakra)
mono_list_assemblies Detect Mono/.NET runtime and assemblies
il2cpp_find_class Find an IL2CPP class by namespace and name
il2cpp_find_method Find a method in an IL2CPP class
il2cpp_read_field Read a field from an IL2CPP object at offset
il2cpp_hook_method Hook an IL2CPP native method
lua_list_globals List Lua global variables
lua_exec Execute Lua code in the embedded runtime
python_detect Detect embedded CPython runtime
python_exec Execute Python code in the embedded interpreter
python_hook_function Hook PyEval_EvalCode to trace Python execution
python_import_module Import a Python module in the embedded interpreter
v8_detect Detect V8 / Node.js engine
v8_list_scripts List JavaScript scripts loaded in V8
v8_hook_script_compile Hook Node.js script compilation entry points
v8_enumerate_exports Enumerate V8/Node.js module exports

๐Ÿ›ก๏ธ VMProtect Analysis (8 tools) โญ New in 0.3.1

Tool Description
vmp_detect Detect VMProtect presence, version (v2/v3), confidence level, sections and SDK exports
vmp_list_sections Parse PE headers in memory and list all .vmp0/.vmp1/.vmp2 sections with VA, size and flags
vmp_list_sdk_functions Find all 22 known VMProtect SDK exports across loaded modules
vmp_hook_antidebug Hook and bypass IsDebuggerPresent, IsVirtualMachinePresent, IsValidImageCRC
vmp_decrypt_strings Hook VMProtectDecryptStringA/W to capture decrypted strings at runtime
vmp_scan_handlers AOB scan .vmp sections for VM entry stubs, CPUID, RDTSC, indirect JMP patterns
vmp_analyze_dispatcher Locate and analyze the VM dispatcher region with hex context
vmp_hook_sdk Hook any VMProtect SDK function by name (license, HWID, activation tracing)

๐Ÿ”“ VMProtect Unpacker (10 tools) โญ Enhanced in 0.3.7

Tool Description
vmp_full_unpack All-in-one 7-step pipeline: OEP โ†’ dump โ†’ patch โ†’ deep clean โ†’ fix pdata โ†’ IAT rebuild โ†’ verify strings
vmp_find_oep Find Original Entry Point via prolog scan + dispatcher exit hook
vmp_dump_pe Dump decrypted PE from memory to disk with fixed section headers
vmp_rebuild_iat Scan live IAT thunks, build IMAGE_IMPORT_DESCRIPTOR entries, append .idata section
vmp_fix_section_headers Fix PointerToRawData/SizeOfRawData alignment for IDA Pro / x64dbg
vmp_resolve_imports Hook GetProcAddress to capture every runtime import (most accurate IAT method)
vmp_scan_iat_region Scan and map all IAT thunks with reverse API lookup
vmp_deep_clean Deep clean all VMProtect traces: rename .vmp sections, zero DataDirs, disable ASLR, fix flags
vmp_fix_pdata Fix high-entropy .pdata (Shannon entropy check + zero encrypted RUNTIME_FUNCTION entries)
vmp_verify_strings Verify dump integrity: scan .rdata for readable strings + game engine keywords

๐Ÿ”ง Advanced Session & Memory (7 tools)

Tool Description
list_sessions_detailed List sessions with extended metadata (PID, timestamp, persistent script count)
close_session_force Force-close session with error recovery (reports warnings instead of failing)
read_memory_typed Read a typed scalar value (int8โ€ฆdoubleโ€ฆpointer)
write_memory_typed Write a typed scalar value
dump_memory_region Hex editor-style dump: offset + hex + ASCII
follow_pointer_chain_detailed Follow pointer chain with full step-by-step trace (dereferenced values at each level)
watch_address Poll a memory address and report value changes

Installation

Prerequisites

  • Python 3.8 or later
  • pip package manager
  • Frida 16.0.0 or later

Quick Install

pip install frida-mcp-re

Development Install

git clone https://github.com/yourusername/frida-mcp.git
cd frida-mcp
pip install -e ".[dev]"

Claude Desktop Integration

Add to your Claude Desktop config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "frida": {
      "command": "frida-mcp"
    }
  }
}

Game Reverse Engineering

Frida MCP is specifically designed for reverse engineering games that use embedded VMs or custom scripting engines:

Supported Engines & VMs

  • Unity (Mono) โ€” Hook managed methods, read/write fields
  • Unity (IL2CPP) โ€” Native compiled code, class/method finder, field reader
  • Android (Java) โ€” Full Java bridge: class listing, method hooking, field access
  • Lua-based games โ€” Execute Lua code inside the game's Lua state
  • Python embedded โ€” Execute and trace CPython runtimes embedded in games/apps
  • V8 / Node.js โ€” Detect, enumerate and hook embedded V8 runtimes
  • Custom VM detection โ€” Auto-detects Lua, LuaJIT, Python, V8, Chakra, Mono, IL2CPP, JVM

Typical Game RE Workflow

1. attach to game process     โ†’ attach_to_process
2. create session             โ†’ create_interactive_session
3. detect VM / engine         โ†’ detect_embedded_vm
4. map loaded modules         โ†’ list_modules
5. AOB scan                   โ†’ scan_memory_pattern  (ViewMatrix, EntityListโ€ฆ)
6. follow pointer chain       โ†’ follow_pointer_chain (static base โ†’ offsets)
7. read typed values          โ†’ read_memory_typed    (health, ammo, position)
8. watch address changes      โ†’ watch_address        (live monitoring)
9. hook game logic            โ†’ hook_function / java_hook_method / il2cpp_hook_method
10. dump struct layout        โ†’ dump_memory_region
11. patch values              โ†’ write_memory_typed
12. close when done           โ†’ close_session

VMProtect Unpack Workflow (xrefs + IAT fixed)

# One-liner: full 7-step pipeline with deep cleanup
vmp_full_unpack(session_id, output_path="C:/dumps/unpacked.exe")
# Pipeline: OEP โ†’ dump โ†’ patch โ†’ deep_clean โ†’ fix_pdata โ†’ rebuild_IAT โ†’ verify_strings

# Or step by step for maximum control:
vmp_find_oep(session_id)                                    # find real entry point
vmp_resolve_imports(session_id, duration_ms=15000)          # hook GetProcAddress
# ... interact with the game to trigger more imports ...
get_session_messages(session_id)                            # collect captured imports
vmp_dump_pe(session_id, output_path="C:/dumps/raw.exe")     # dump from memory
vmp_deep_clean(dump_path="C:/dumps/raw.exe")                # remove VMP traces
vmp_fix_pdata(dump_path="C:/dumps/raw.exe")                 # fix encrypted .pdata
vmp_rebuild_iat(session_id, dump_path="C:/dumps/raw.exe",
                output_path="C:/dumps/unpacked.exe")        # fix imports + xrefs
vmp_verify_strings(dump_path="C:/dumps/unpacked.exe")       # confirm data integrity
# Load C:/dumps/unpacked.exe in IDA Pro โ†’ all xrefs, strings, API names work

VMProtect RE Workflow

1. detect VMProtect           โ†’ vmp_detect           (version, confidence, sections)
2. list VMP sections          โ†’ vmp_list_sections    (VA, size, flags of .vmp0/.vmp1/.vmp2)
3. find SDK functions         โ†’ vmp_list_sdk_functions
4. bypass anti-debug          โ†’ vmp_hook_antidebug   (bypass=True)
5. capture strings            โ†’ vmp_decrypt_strings  + get_session_messages
6. scan VM handlers           โ†’ vmp_scan_handlers    (CPUID, RDTSC, indirect JMPโ€ฆ)
7. analyze dispatcher         โ†’ vmp_analyze_dispatcher
8. trace license validation   โ†’ vmp_hook_sdk("VMProtectSetSerialNumber")
9. capture HWID               โ†’ vmp_hook_sdk("VMProtectGetCurrentHWID")

New Tools in Action

# Read player health (float at known address)
read_memory_typed(session_id, "0x7FF12340", type="float")

# Follow pointer chain: base โ†’ +0x0 โ†’ +0x58 โ†’ +0x1A0 (player struct)
follow_pointer_chain(session_id, "0x14B8C2A0", offsets=[0x0, 0x58, 0x1A0])

# Watch ammo counter live (poll every 200ms for 10 seconds)
watch_address(session_id, "0x7FF12344", type="int32", interval_ms=200, duration_ms=10000)

# Hex dump 256 bytes of a struct
dump_memory_region(session_id, "0x7FF12300", size=256)

# Patch: set health to 9999
write_memory_typed(session_id, "0x7FF12340", type="float", value="9999.0")

# Clean up
close_session(session_id)

Architecture

frida_mcp/
โ”œโ”€โ”€ server.py          # FastMCP instance + shared state + _run_script helpers
โ”œโ”€โ”€ cli.py             # STDIO entrypoint for Claude Desktop
โ””โ”€โ”€ tools/
    โ”œโ”€โ”€ processes.py   # Device & process management (10 tools)
    โ”œโ”€โ”€ sessions.py    # Interactive REPL sessions (5 tools)
    โ”œโ”€โ”€ modules.py     # Module & symbol analysis (4 tools)
    โ”œโ”€โ”€ memory.py      # Memory read/write/scan/symbols (12 tools)
    โ”œโ”€โ”€ hooks.py       # Hooking, tracing, Stalker (4 tools)
    โ”œโ”€โ”€ native.py      # NativeFunction / NativeCallback (2 tools)
    โ”œโ”€โ”€ java_bridge.py # Java/Android bridge (6 tools)
    โ”œโ”€โ”€ vm_support.py  # Mono, IL2CPP, Lua, Python, V8 (16 tools)
    โ”œโ”€โ”€ advanced.py    # Advanced session & memory variants (7 tools)
    โ”œโ”€โ”€ vmprotect.py   # VMProtect v2/v3 analysis and bypass (8 tools)
    โ””โ”€โ”€ vmp_dumper.py  # VMProtect unpacker + cleanup + IAT rebuild (10 tools)
                                                            โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€
                                                            84 tools total

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

frida_mcp_re-0.3.7.tar.gz (53.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

frida_mcp_re-0.3.7-py3-none-any.whl (63.1 kB view details)

Uploaded Python 3

File details

Details for the file frida_mcp_re-0.3.7.tar.gz.

File metadata

  • Download URL: frida_mcp_re-0.3.7.tar.gz
  • Upload date:
  • Size: 53.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for frida_mcp_re-0.3.7.tar.gz
Algorithm Hash digest
SHA256 3728b4793efcffd2b7c0a338b3fc40f1cec533dc0294a54420541d32fb4f54e3
MD5 be673f6397df64a0e9e638ba09ef3764
BLAKE2b-256 a66d455e3693ac256b19f546e9a5943553a8c597a1cda1692f7403e6d8deb48d

See more details on using hashes here.

File details

Details for the file frida_mcp_re-0.3.7-py3-none-any.whl.

File metadata

  • Download URL: frida_mcp_re-0.3.7-py3-none-any.whl
  • Upload date:
  • Size: 63.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for frida_mcp_re-0.3.7-py3-none-any.whl
Algorithm Hash digest
SHA256 2ceb65301db0c90205e534e017c0cc897eaea7b5eb4d19f0578f7b2ac1eee700
MD5 cac50939bb2b3a19e39a0ccbfb95cec4
BLAKE2b-256 2774ea01ceeb78abbc27a559d7e3ba0d4e5cd7ef9f953b3982be58b2c23c691e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page