Skip to main content

基于 pymem 的内存扫描与修改 MCP 服务器,支持进程内存读写、扫描、模式搜索等功能

Project description

Memory Scanner MCP

基于 pymem 的内存扫描与修改 MCP 服务器。

通过 MCP 协议将内存读写、扫描、特征码搜索等能力暴露给 AI Agent,实现自然语言驱动的内存修改。

功能

工具 说明
list_processes 列出运行中的进程
attach_process 附加到目标进程
detach_process 断开进程连接
get_process_info 获取进程详细信息和模块列表
read_memory 读取指定地址的值
write_memory 写入值到指定地址
scan_memory_first 首次扫描(全内存搜索)
scan_memory_next 再次扫描(缩小范围)
scan_memory_filter 条件过滤(大于/小于等)
write_scan_results 批量写入扫描结果
get_scan_results 查看扫描结果及当前值
scan_pattern AOB/特征码扫描(支持通配符)
get_module_base 获取模块基地址
read_pointer_chain 多级指针链读取
write_pointer_chain 多级指针链写入
dump_memory 内存转储(Hex + ASCII)
freeze_address 冻结地址值
unfreeze_address 解除冻结
apply_frozen 执行冻结写入
list_frozen 列出冻结列表

支持的数据类型

int8 int16 int32 int64 uint8 uint16 uint32 uint64 float double string bytes

安装

从源码安装(推荐开发使用)

git clone https://github.com/miloira/MemoryScaner.git
cd MemoryScaner
pip install -e .

直接安装

pip install memory-scanner-mcp

需要 Python 3.10+,仅支持 Windows。

使用方式

作为命令行工具运行

memory-scanner-mcp

作为 Python 模块运行

python -m memory_scanner

MCP 客户端配置

推荐使用 uvx(无需手动安装):

{
  "mcpServers": {
    "memory-scanner": {
      "command": "uvx",
      "args": ["memory-scanner-mcp"]
    }
  }
}

也可以先 pip install 后直接使用命令:

{
  "mcpServers": {
    "memory-scanner": {
      "command": "memory-scanner-mcp"
    }
  }
}

或者使用 Python 模块方式:

{
  "mcpServers": {
    "memory-scanner": {
      "command": "python",
      "args": ["-m", "memory_scanner"]
    }
  }
}

项目结构

MemoryScaner/
├── pyproject.toml          # 项目配置与依赖管理
├── README.md
├── LICENSE
└── src/
    └── memory_scanner/
        ├── __init__.py     # 包初始化与版本号
        ├── __main__.py     # python -m memory_scanner 入口
        └── server.py       # MCP 服务器实现(所有工具定义)

使用示例

典型的内存修改流程(以游戏修改为例):

  1. 附加进程: "附加到 game.exe"
  2. 首次扫描: "搜索 int32 类型的值 100"(当前血量为100)
  3. 改变值: 在游戏中让血量变化
  4. 再次扫描: "搜索新的值 95"(血量变为95)
  5. 重复缩小: 直到结果只剩1-2个
  6. 修改值: "把找到的地址写入 9999"
  7. 冻结: "冻结这个地址为 9999"

开发

# 克隆项目
git clone https://github.com/miloira/MemoryScaner.git
cd MemoryScaner

# 创建虚拟环境
python -m venv .venv
.venv\Scripts\activate

# 安装开发依赖(可编辑模式)
pip install -e .

注意事项

  • 必须以 管理员权限 运行才能读写其他进程的内存
  • 部分进程有保护机制,可能无法正常读写
  • 冻结功能需要客户端定期调用 apply_frozen 来维持
  • 扫描大量内存时可能需要较长时间

许可证

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

memory_scanner_mcp-0.0.2.tar.gz (13.3 kB view details)

Uploaded Source

Built Distribution

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

memory_scanner_mcp-0.0.2-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

Details for the file memory_scanner_mcp-0.0.2.tar.gz.

File metadata

  • Download URL: memory_scanner_mcp-0.0.2.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for memory_scanner_mcp-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b4f5eb5560bb09789d7c30ef2293fcf7865d95c906b5235d6b8e5adf34c8de22
MD5 524f74432b204c33b35babec211c3df9
BLAKE2b-256 1e0c874006a319b74f8afc69dfc735771e1ef95801315a91455a11eeb1e08ba3

See more details on using hashes here.

File details

Details for the file memory_scanner_mcp-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: memory_scanner_mcp-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 12.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for memory_scanner_mcp-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6c4dfefc9c48d591b3b9723dc97738a48d11e874e3699ca823ce97660445eb1c
MD5 cc07e11a87b0afedbdebec2d77f99147
BLAKE2b-256 a9705e137bb2f3938313d2244afd94b6b629a24a3ce14770b71c08af89c5b41a

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