memory-scanner-mcp 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- memory_scanner_mcp-0.0.1/.gitignore +207 -0
- memory_scanner_mcp-0.0.1/.kiro/settings/mcp.json +24 -0
- memory_scanner_mcp-0.0.1/LICENSE +21 -0
- memory_scanner_mcp-0.0.1/PKG-INFO +185 -0
- memory_scanner_mcp-0.0.1/README.md +158 -0
- memory_scanner_mcp-0.0.1/pyproject.toml +43 -0
- memory_scanner_mcp-0.0.1/src/memory_scanner/__init__.py +6 -0
- memory_scanner_mcp-0.0.1/src/memory_scanner/__main__.py +9 -0
- memory_scanner_mcp-0.0.1/src/memory_scanner/server.py +1089 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[codz]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py.cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
cover/
|
|
53
|
+
|
|
54
|
+
# Translations
|
|
55
|
+
*.mo
|
|
56
|
+
*.pot
|
|
57
|
+
|
|
58
|
+
# Django stuff:
|
|
59
|
+
*.log
|
|
60
|
+
local_settings.py
|
|
61
|
+
db.sqlite3
|
|
62
|
+
db.sqlite3-journal
|
|
63
|
+
|
|
64
|
+
# Flask stuff:
|
|
65
|
+
instance/
|
|
66
|
+
.webassets-cache
|
|
67
|
+
|
|
68
|
+
# Scrapy stuff:
|
|
69
|
+
.scrapy
|
|
70
|
+
|
|
71
|
+
# Sphinx documentation
|
|
72
|
+
docs/_build/
|
|
73
|
+
|
|
74
|
+
# PyBuilder
|
|
75
|
+
.pybuilder/
|
|
76
|
+
target/
|
|
77
|
+
|
|
78
|
+
# Jupyter Notebook
|
|
79
|
+
.ipynb_checkpoints
|
|
80
|
+
|
|
81
|
+
# IPython
|
|
82
|
+
profile_default/
|
|
83
|
+
ipython_config.py
|
|
84
|
+
|
|
85
|
+
# pyenv
|
|
86
|
+
# For a library or package, you might want to ignore these files since the code is
|
|
87
|
+
# intended to run in multiple environments; otherwise, check them in:
|
|
88
|
+
# .python-version
|
|
89
|
+
|
|
90
|
+
# pipenv
|
|
91
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
92
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
93
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
94
|
+
# install all needed dependencies.
|
|
95
|
+
#Pipfile.lock
|
|
96
|
+
|
|
97
|
+
# UV
|
|
98
|
+
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
|
+
# commonly ignored for libraries.
|
|
101
|
+
#uv.lock
|
|
102
|
+
|
|
103
|
+
# poetry
|
|
104
|
+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
105
|
+
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
106
|
+
# commonly ignored for libraries.
|
|
107
|
+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
|
108
|
+
#poetry.lock
|
|
109
|
+
#poetry.toml
|
|
110
|
+
|
|
111
|
+
# pdm
|
|
112
|
+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
|
113
|
+
# pdm recommends including project-wide configuration in pdm.toml, but excluding .pdm-python.
|
|
114
|
+
# https://pdm-project.org/en/latest/usage/project/#working-with-version-control
|
|
115
|
+
#pdm.lock
|
|
116
|
+
#pdm.toml
|
|
117
|
+
.pdm-python
|
|
118
|
+
.pdm-build/
|
|
119
|
+
|
|
120
|
+
# pixi
|
|
121
|
+
# Similar to Pipfile.lock, it is generally recommended to include pixi.lock in version control.
|
|
122
|
+
#pixi.lock
|
|
123
|
+
# Pixi creates a virtual environment in the .pixi directory, just like venv module creates one
|
|
124
|
+
# in the .venv directory. It is recommended not to include this directory in version control.
|
|
125
|
+
.pixi
|
|
126
|
+
|
|
127
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
|
128
|
+
__pypackages__/
|
|
129
|
+
|
|
130
|
+
# Celery stuff
|
|
131
|
+
celerybeat-schedule
|
|
132
|
+
celerybeat.pid
|
|
133
|
+
|
|
134
|
+
# SageMath parsed files
|
|
135
|
+
*.sage.py
|
|
136
|
+
|
|
137
|
+
# Environments
|
|
138
|
+
.env
|
|
139
|
+
.envrc
|
|
140
|
+
.venv
|
|
141
|
+
env/
|
|
142
|
+
venv/
|
|
143
|
+
ENV/
|
|
144
|
+
env.bak/
|
|
145
|
+
venv.bak/
|
|
146
|
+
|
|
147
|
+
# Spyder project settings
|
|
148
|
+
.spyderproject
|
|
149
|
+
.spyproject
|
|
150
|
+
|
|
151
|
+
# Rope project settings
|
|
152
|
+
.ropeproject
|
|
153
|
+
|
|
154
|
+
# mkdocs documentation
|
|
155
|
+
/site
|
|
156
|
+
|
|
157
|
+
# mypy
|
|
158
|
+
.mypy_cache/
|
|
159
|
+
.dmypy.json
|
|
160
|
+
dmypy.json
|
|
161
|
+
|
|
162
|
+
# Pyre type checker
|
|
163
|
+
.pyre/
|
|
164
|
+
|
|
165
|
+
# pytype static type analyzer
|
|
166
|
+
.pytype/
|
|
167
|
+
|
|
168
|
+
# Cython debug symbols
|
|
169
|
+
cython_debug/
|
|
170
|
+
|
|
171
|
+
# PyCharm
|
|
172
|
+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
|
173
|
+
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
|
174
|
+
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
|
175
|
+
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
|
176
|
+
#.idea/
|
|
177
|
+
|
|
178
|
+
# Abstra
|
|
179
|
+
# Abstra is an AI-powered process automation framework.
|
|
180
|
+
# Ignore directories containing user credentials, local state, and settings.
|
|
181
|
+
# Learn more at https://abstra.io/docs
|
|
182
|
+
.abstra/
|
|
183
|
+
|
|
184
|
+
# Visual Studio Code
|
|
185
|
+
# Visual Studio Code specific template is maintained in a separate VisualStudioCode.gitignore
|
|
186
|
+
# that can be found at https://github.com/github/gitignore/blob/main/Global/VisualStudioCode.gitignore
|
|
187
|
+
# and can be added to the global gitignore or merged into this file. However, if you prefer,
|
|
188
|
+
# you could uncomment the following to ignore the entire vscode folder
|
|
189
|
+
# .vscode/
|
|
190
|
+
|
|
191
|
+
# Ruff stuff:
|
|
192
|
+
.ruff_cache/
|
|
193
|
+
|
|
194
|
+
# PyPI configuration file
|
|
195
|
+
.pypirc
|
|
196
|
+
|
|
197
|
+
# Cursor
|
|
198
|
+
# Cursor is an AI-powered code editor. `.cursorignore` specifies files/directories to
|
|
199
|
+
# exclude from AI features like autocomplete and code analysis. Recommended for sensitive data
|
|
200
|
+
# refer to https://docs.cursor.com/context/ignore-files
|
|
201
|
+
.cursorignore
|
|
202
|
+
.cursorindexingignore
|
|
203
|
+
|
|
204
|
+
# Marimo
|
|
205
|
+
marimo/_static/
|
|
206
|
+
marimo/_lsp/
|
|
207
|
+
__marimo__/
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"mcpServers": {
|
|
3
|
+
"memory-scanner": {
|
|
4
|
+
"command": "python",
|
|
5
|
+
"args": [
|
|
6
|
+
"memory_scanner_mcp.py"
|
|
7
|
+
],
|
|
8
|
+
"cwd": "c:\\Users\\张明明\\Desktop\\github\\MemoryScaner",
|
|
9
|
+
"disabled": false,
|
|
10
|
+
"autoApprove": [
|
|
11
|
+
"list_processes",
|
|
12
|
+
"scan_memory_first",
|
|
13
|
+
"attach_process",
|
|
14
|
+
"dump_memory",
|
|
15
|
+
"read_memory",
|
|
16
|
+
"read_memory",
|
|
17
|
+
"read_memory",
|
|
18
|
+
"read_memory",
|
|
19
|
+
"read_memory",
|
|
20
|
+
"read_memory"
|
|
21
|
+
]
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 miloira
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: memory-scanner-mcp
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: 基于 pymem 的内存扫描与修改 MCP 服务器,支持进程内存读写、扫描、模式搜索等功能
|
|
5
|
+
Project-URL: Homepage, https://github.com/miloira/MemoryScaner
|
|
6
|
+
Project-URL: Repository, https://github.com/miloira/MemoryScaner
|
|
7
|
+
Project-URL: Issues, https://github.com/miloira/MemoryScaner/issues
|
|
8
|
+
Author: miloira
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: mcp,memory,process,pymem,scanner
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: Microsoft :: Windows
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Debuggers
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Requires-Dist: mcp>=1.0.0
|
|
24
|
+
Requires-Dist: psutil>=5.9.0
|
|
25
|
+
Requires-Dist: pymem>=1.13.1
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
|
|
28
|
+
# Memory Scanner MCP
|
|
29
|
+
|
|
30
|
+
基于 [pymem](https://github.com/srounet/Pymem) 的内存扫描与修改 MCP 服务器。
|
|
31
|
+
|
|
32
|
+
通过 MCP 协议将内存读写、扫描、特征码搜索等能力暴露给 AI Agent,实现自然语言驱动的内存修改。
|
|
33
|
+
|
|
34
|
+
## 功能
|
|
35
|
+
|
|
36
|
+
| 工具 | 说明 |
|
|
37
|
+
|------|------|
|
|
38
|
+
| `list_processes` | 列出运行中的进程 |
|
|
39
|
+
| `attach_process` | 附加到目标进程 |
|
|
40
|
+
| `detach_process` | 断开进程连接 |
|
|
41
|
+
| `get_process_info` | 获取进程详细信息和模块列表 |
|
|
42
|
+
| `read_memory` | 读取指定地址的值 |
|
|
43
|
+
| `write_memory` | 写入值到指定地址 |
|
|
44
|
+
| `scan_memory_first` | 首次扫描(全内存搜索) |
|
|
45
|
+
| `scan_memory_next` | 再次扫描(缩小范围) |
|
|
46
|
+
| `scan_memory_filter` | 条件过滤(大于/小于等) |
|
|
47
|
+
| `write_scan_results` | 批量写入扫描结果 |
|
|
48
|
+
| `get_scan_results` | 查看扫描结果及当前值 |
|
|
49
|
+
| `scan_pattern` | AOB/特征码扫描(支持通配符) |
|
|
50
|
+
| `get_module_base` | 获取模块基地址 |
|
|
51
|
+
| `read_pointer_chain` | 多级指针链读取 |
|
|
52
|
+
| `write_pointer_chain` | 多级指针链写入 |
|
|
53
|
+
| `dump_memory` | 内存转储(Hex + ASCII) |
|
|
54
|
+
| `freeze_address` | 冻结地址值 |
|
|
55
|
+
| `unfreeze_address` | 解除冻结 |
|
|
56
|
+
| `apply_frozen` | 执行冻结写入 |
|
|
57
|
+
| `list_frozen` | 列出冻结列表 |
|
|
58
|
+
|
|
59
|
+
## 支持的数据类型
|
|
60
|
+
|
|
61
|
+
`int8` `int16` `int32` `int64` `uint8` `uint16` `uint32` `uint64` `float` `double` `string` `bytes`
|
|
62
|
+
|
|
63
|
+
## 安装
|
|
64
|
+
|
|
65
|
+
### 从源码安装(推荐开发使用)
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone https://github.com/miloira/MemoryScaner.git
|
|
69
|
+
cd MemoryScaner
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
### 直接安装
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
pip install memory-scanner-mcp
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
> 需要 Python 3.10+,仅支持 Windows。
|
|
80
|
+
|
|
81
|
+
## 使用方式
|
|
82
|
+
|
|
83
|
+
### 作为命令行工具运行
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
memory-scanner-mcp
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### 作为 Python 模块运行
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
python -m memory_scanner
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### MCP 客户端配置
|
|
96
|
+
|
|
97
|
+
推荐使用 `uvx`(无需手动安装):
|
|
98
|
+
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"mcpServers": {
|
|
102
|
+
"memory-scanner": {
|
|
103
|
+
"command": "uvx",
|
|
104
|
+
"args": ["memory-scanner-mcp"]
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
也可以先 `pip install` 后直接使用命令:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"mcpServers": {
|
|
115
|
+
"memory-scanner": {
|
|
116
|
+
"command": "memory-scanner-mcp"
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
或者使用 Python 模块方式:
|
|
123
|
+
|
|
124
|
+
```json
|
|
125
|
+
{
|
|
126
|
+
"mcpServers": {
|
|
127
|
+
"memory-scanner": {
|
|
128
|
+
"command": "python",
|
|
129
|
+
"args": ["-m", "memory_scanner"]
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## 项目结构
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
MemoryScaner/
|
|
139
|
+
├── pyproject.toml # 项目配置与依赖管理
|
|
140
|
+
├── README.md
|
|
141
|
+
├── LICENSE
|
|
142
|
+
└── src/
|
|
143
|
+
└── memory_scanner/
|
|
144
|
+
├── __init__.py # 包初始化与版本号
|
|
145
|
+
├── __main__.py # python -m memory_scanner 入口
|
|
146
|
+
└── server.py # MCP 服务器实现(所有工具定义)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 使用示例
|
|
150
|
+
|
|
151
|
+
典型的内存修改流程(以游戏修改为例):
|
|
152
|
+
|
|
153
|
+
1. **附加进程**: "附加到 game.exe"
|
|
154
|
+
2. **首次扫描**: "搜索 int32 类型的值 100"(当前血量为100)
|
|
155
|
+
3. **改变值**: 在游戏中让血量变化
|
|
156
|
+
4. **再次扫描**: "搜索新的值 95"(血量变为95)
|
|
157
|
+
5. **重复缩小**: 直到结果只剩1-2个
|
|
158
|
+
6. **修改值**: "把找到的地址写入 9999"
|
|
159
|
+
7. **冻结**: "冻结这个地址为 9999"
|
|
160
|
+
|
|
161
|
+
## 开发
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
# 克隆项目
|
|
165
|
+
git clone https://github.com/miloira/MemoryScaner.git
|
|
166
|
+
cd MemoryScaner
|
|
167
|
+
|
|
168
|
+
# 创建虚拟环境
|
|
169
|
+
python -m venv .venv
|
|
170
|
+
.venv\Scripts\activate
|
|
171
|
+
|
|
172
|
+
# 安装开发依赖(可编辑模式)
|
|
173
|
+
pip install -e .
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## 注意事项
|
|
177
|
+
|
|
178
|
+
- 必须以 **管理员权限** 运行才能读写其他进程的内存
|
|
179
|
+
- 部分进程有保护机制,可能无法正常读写
|
|
180
|
+
- 冻结功能需要客户端定期调用 `apply_frozen` 来维持
|
|
181
|
+
- 扫描大量内存时可能需要较长时间
|
|
182
|
+
|
|
183
|
+
## 许可证
|
|
184
|
+
|
|
185
|
+
MIT
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
# Memory Scanner MCP
|
|
2
|
+
|
|
3
|
+
基于 [pymem](https://github.com/srounet/Pymem) 的内存扫描与修改 MCP 服务器。
|
|
4
|
+
|
|
5
|
+
通过 MCP 协议将内存读写、扫描、特征码搜索等能力暴露给 AI Agent,实现自然语言驱动的内存修改。
|
|
6
|
+
|
|
7
|
+
## 功能
|
|
8
|
+
|
|
9
|
+
| 工具 | 说明 |
|
|
10
|
+
|------|------|
|
|
11
|
+
| `list_processes` | 列出运行中的进程 |
|
|
12
|
+
| `attach_process` | 附加到目标进程 |
|
|
13
|
+
| `detach_process` | 断开进程连接 |
|
|
14
|
+
| `get_process_info` | 获取进程详细信息和模块列表 |
|
|
15
|
+
| `read_memory` | 读取指定地址的值 |
|
|
16
|
+
| `write_memory` | 写入值到指定地址 |
|
|
17
|
+
| `scan_memory_first` | 首次扫描(全内存搜索) |
|
|
18
|
+
| `scan_memory_next` | 再次扫描(缩小范围) |
|
|
19
|
+
| `scan_memory_filter` | 条件过滤(大于/小于等) |
|
|
20
|
+
| `write_scan_results` | 批量写入扫描结果 |
|
|
21
|
+
| `get_scan_results` | 查看扫描结果及当前值 |
|
|
22
|
+
| `scan_pattern` | AOB/特征码扫描(支持通配符) |
|
|
23
|
+
| `get_module_base` | 获取模块基地址 |
|
|
24
|
+
| `read_pointer_chain` | 多级指针链读取 |
|
|
25
|
+
| `write_pointer_chain` | 多级指针链写入 |
|
|
26
|
+
| `dump_memory` | 内存转储(Hex + ASCII) |
|
|
27
|
+
| `freeze_address` | 冻结地址值 |
|
|
28
|
+
| `unfreeze_address` | 解除冻结 |
|
|
29
|
+
| `apply_frozen` | 执行冻结写入 |
|
|
30
|
+
| `list_frozen` | 列出冻结列表 |
|
|
31
|
+
|
|
32
|
+
## 支持的数据类型
|
|
33
|
+
|
|
34
|
+
`int8` `int16` `int32` `int64` `uint8` `uint16` `uint32` `uint64` `float` `double` `string` `bytes`
|
|
35
|
+
|
|
36
|
+
## 安装
|
|
37
|
+
|
|
38
|
+
### 从源码安装(推荐开发使用)
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
git clone https://github.com/miloira/MemoryScaner.git
|
|
42
|
+
cd MemoryScaner
|
|
43
|
+
pip install -e .
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 直接安装
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install memory-scanner-mcp
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
> 需要 Python 3.10+,仅支持 Windows。
|
|
53
|
+
|
|
54
|
+
## 使用方式
|
|
55
|
+
|
|
56
|
+
### 作为命令行工具运行
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
memory-scanner-mcp
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### 作为 Python 模块运行
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
python -m memory_scanner
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### MCP 客户端配置
|
|
69
|
+
|
|
70
|
+
推荐使用 `uvx`(无需手动安装):
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"memory-scanner": {
|
|
76
|
+
"command": "uvx",
|
|
77
|
+
"args": ["memory-scanner-mcp"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
也可以先 `pip install` 后直接使用命令:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"memory-scanner": {
|
|
89
|
+
"command": "memory-scanner-mcp"
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
或者使用 Python 模块方式:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcpServers": {
|
|
100
|
+
"memory-scanner": {
|
|
101
|
+
"command": "python",
|
|
102
|
+
"args": ["-m", "memory_scanner"]
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## 项目结构
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
MemoryScaner/
|
|
112
|
+
├── pyproject.toml # 项目配置与依赖管理
|
|
113
|
+
├── README.md
|
|
114
|
+
├── LICENSE
|
|
115
|
+
└── src/
|
|
116
|
+
└── memory_scanner/
|
|
117
|
+
├── __init__.py # 包初始化与版本号
|
|
118
|
+
├── __main__.py # python -m memory_scanner 入口
|
|
119
|
+
└── server.py # MCP 服务器实现(所有工具定义)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 使用示例
|
|
123
|
+
|
|
124
|
+
典型的内存修改流程(以游戏修改为例):
|
|
125
|
+
|
|
126
|
+
1. **附加进程**: "附加到 game.exe"
|
|
127
|
+
2. **首次扫描**: "搜索 int32 类型的值 100"(当前血量为100)
|
|
128
|
+
3. **改变值**: 在游戏中让血量变化
|
|
129
|
+
4. **再次扫描**: "搜索新的值 95"(血量变为95)
|
|
130
|
+
5. **重复缩小**: 直到结果只剩1-2个
|
|
131
|
+
6. **修改值**: "把找到的地址写入 9999"
|
|
132
|
+
7. **冻结**: "冻结这个地址为 9999"
|
|
133
|
+
|
|
134
|
+
## 开发
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# 克隆项目
|
|
138
|
+
git clone https://github.com/miloira/MemoryScaner.git
|
|
139
|
+
cd MemoryScaner
|
|
140
|
+
|
|
141
|
+
# 创建虚拟环境
|
|
142
|
+
python -m venv .venv
|
|
143
|
+
.venv\Scripts\activate
|
|
144
|
+
|
|
145
|
+
# 安装开发依赖(可编辑模式)
|
|
146
|
+
pip install -e .
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## 注意事项
|
|
150
|
+
|
|
151
|
+
- 必须以 **管理员权限** 运行才能读写其他进程的内存
|
|
152
|
+
- 部分进程有保护机制,可能无法正常读写
|
|
153
|
+
- 冻结功能需要客户端定期调用 `apply_frozen` 来维持
|
|
154
|
+
- 扫描大量内存时可能需要较长时间
|
|
155
|
+
|
|
156
|
+
## 许可证
|
|
157
|
+
|
|
158
|
+
MIT
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "memory-scanner-mcp"
|
|
7
|
+
version = "0.0.1"
|
|
8
|
+
description = "基于 pymem 的内存扫描与修改 MCP 服务器,支持进程内存读写、扫描、模式搜索等功能"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "miloira" },
|
|
14
|
+
]
|
|
15
|
+
keywords = ["mcp", "memory", "scanner", "pymem", "process"]
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Development Status :: 4 - Beta",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Operating System :: Microsoft :: Windows",
|
|
21
|
+
"Programming Language :: Python :: 3",
|
|
22
|
+
"Programming Language :: Python :: 3.10",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Software Development :: Debuggers",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"pymem>=1.13.1",
|
|
30
|
+
"mcp>=1.0.0",
|
|
31
|
+
"psutil>=5.9.0",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.urls]
|
|
35
|
+
Homepage = "https://github.com/miloira/MemoryScaner"
|
|
36
|
+
Repository = "https://github.com/miloira/MemoryScaner"
|
|
37
|
+
Issues = "https://github.com/miloira/MemoryScaner/issues"
|
|
38
|
+
|
|
39
|
+
[project.scripts]
|
|
40
|
+
memory-scanner-mcp = "memory_scanner.__main__:main"
|
|
41
|
+
|
|
42
|
+
[tool.hatch.build.targets.wheel]
|
|
43
|
+
packages = ["src/memory_scanner"]
|