FM Memory MCP Server
README.md
# FM Memory MCP Server
通过 **Model Context Protocol** 让 AI 读写游戏内存里的球员数据。
10 个工具,覆盖属性读写、对象定位、内存搜索。
## 安装
```bash
pip install numpy
```
Python 3.9+,Windows x64。
## 配置
```json
{
"mcpServers": {
"fm-memory": {
"command": "python",
"args": ["<本目录>/fm26_mcp_server.py"]
}
}
}
```
## 工具
| 工具 | 参数 | 作用 |
|---|---|---|
| `fm26_status` | — | 进程 PID、模块基址、内存访问权限 |
| `fm26_list_attributes` | — | 属性索引表(编号 ↔ 中英文名) |
| `fm26_find_player` | `attributes` | 按若干属性值反查球员对象地址 |
| `fm26_get_attributes` | `obj` | 读某球员全部属性 |
| `fm26_set_attribute` | `signature` `attribute` `value` | 改单项 |
| `fm26_set_attributes` | `signature` `changes` | 批量改 |
| `fm26_list_players` | `min_mean` `limit` | 扫全内存枚举球员对象 |
| `fm26_person_table` | `start` `count` | 解析 ID/名字记录表 |
| `fm26_read_memory` | `address` `size` | 读原始字节 |
| `fm26_search_memory` | `value` | 搜 32 位整数值 |
## 用法
**读一个球员的属性**
```python
fm26_find_player(attributes={"传中":17, "盘带":20, "射门":19})
# → {"found": 2, "players": [{"obj": "0x1575a7c0898", ...}]}
fm26_get_attributes(obj="0x1575a7c0898")
# → {"display": {"传中": 17, "盘带": 20, "射门": 19, ...}}
```
**改属性**
```python
fm26_set_attribute(
signature={"传中":17, "盘带":20, "射门":19},
attribute="传中",
value=20
)
# → {"success": true, "written": 5, "copies": 5}
```
`signature` 用来定位球员(3~6 项属性足够唯一锁定),写入会自动覆盖该球员在内存中的全部副本。
**批量改**
```python
fm26_set_attributes(
signature={"传中":17, "盘带":20, "射门":19},
changes={"传球":20, "远射":20, "任意球":20}
)
```
**枚举所有球员对象**
```python
fm26_list_players(min_mean=60, limit=20)
# → 按属性均值筛选,返回 20 个对象地址
```
**按字节读内存**
```python
fm26_read_memory(address="0x1575a7c0898", size=64)
# → {"hex": "28 98 20 1d fa 7f 00 00 ..."}
```
**搜值**
```python
fm26_search_memory(value=100)
# → {"hits": 50, "addresses": ["0x...", ...]}
```
## 结构
```
fm26_mcp_server.py MCP 协议层 + 10 个工具 + 内存扫描
fm26_attributes.py 属性表 + 显示值换算 + 读写
fm26_offsets.py 偏移常量
fm26_locate.py 按属性值定位对象
fm26_write.py 写入,自动覆盖全部副本
fm26_table.py ID/名字记录表解析
```
依赖:
```
fm26_mcp_server → fm26_attributes / fm26_locate / fm26_write / fm26_table
↓
fm26_offsets
```
## License
MIT
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo issues