MCP on My SAMP
MCP on My SAMP
范围: 仅限本地服务器或你拥有/获准使用的服务器。不是用于公共服务器自动化的工具。
它能做什么?
MCP on My SAMP 让 AI 智能体能够以可重复的工作流来测试游戏服务器:
启动 / 停止 / 检查 open.mp 的状态;
启动 / 停止 / 检查无头 RakClient 的状态;
等待客户端真正进入
Spawned状态;发送允许的斜杠命令;
读取已缓冲的客户端输出历史;
验证客户端是否已收到服务器的响应;
从 Pawn 游戏模式的源码中发现命令;
拒绝允许列表之外的命令。
它不自带 flood、垃圾信息、延迟注入、任意 RCON,也不对公共服务器做自动化。
工作流程
flowchart LR
A[AI Agent] -->|MCP stdio| B[MCP on My SAMP]
B --> C[open.mp Server]
B --> D[Headless RakClient]
D -->|UDP localhost| C
C -->|server response| D
D --> B
B -->|assertion| A有效的往返(round-trip)证据:
command dikirim
→ server callback menerima command
→ gamemode mengirim response
→ client menerima response
→ MCP assertion berhasil仅凭 Spawned 并不能证明命令成功执行。
安装
1. 准备 Python
需要 Python 3.10 或更高版本。
2. 安装项目
在仓库根目录下运行:
Windows
py -3 -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install ".[dev]"Linux / macOS
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install ".[dev]"3. 验证
pytest -q预期输出:
35 passedopen.mp 和 RakClient 的二进制文件仅用于实时测试。Python 单元测试不需要这些二进制文件也可以运行。
配置
从模板创建本地配置文件:
Windows
copy config.example.json local-server.jsonLinux / macOS
cp config.example.json local-server.json填写文件内容:
{
"executable": "vendor/openmp/Server/omp-server.exe",
"working_dir": "vendor/openmp/Server",
"args": ["--config-path", "config.json"],
"ready_text": "Legacy Network started on port",
"startup_timeout": 30
}根据自己电脑上 open.mp 的位置修改 executable 和 working_dir。local-server.json 不会提交到 Git,因为不同电脑的路径不同。
运行 MCP 服务器
仅运行服务器
mcp-gta-samp --config local-server.json使用无头 RakClient
Windows
mcp-gta-samp ^
--config local-server.json ^
--client-executable vendor/rakclient-bin/rakclient.exe ^
--client-arg --server ^
--client-arg 127.0.0.1:7777 ^
--client-arg --nick ^
--client-arg MCPBot ^
--client-arg --scripts-dir ^
--client-arg vendor/rakclient-bin/scripts ^
--gamemode-source vendor/openmp/Server/gamemodes/mcp_test.pwnLinux / macOS
mcp-gta-samp \
--config local-server.json \
--client-executable vendor/rakclient-bin/rakclient \
--client-arg --server \
--client-arg 127.0.0.1:7777 \
--client-arg --nick \
--client-arg MCPBot \
--client-arg --scripts-dir \
--client-arg vendor/rakclient-bin/scripts \
--gamemode-source vendor/openmp/Server/gamemodes/mcp_test.pwnMCP 使用 stdio 传输。
MCP 工具
工具 | 功能 |
| 启动服务器并等待就绪。 |
| 检查服务器状态和 PID。 |
| 停止服务器。 |
| 启动无头 RakClient。 |
| 检查客户端状态。 |
| 停止客户端。 |
| 在进入 |
| 获取已缓冲的客户端输出。 |
| 断言客户端已收到特定输出。 |
| 从 Pawn 源码中显示命令。 |
| 针对允许列表验证命令。 |
最后两个工具仅在指定 --gamemode-source 时可用。
面向 AI 智能体的工作流程
1. server_status
2. server_start jika belum berjalan
3. client_start
4. tunggu state Spawned
5. server_list_commands
6. server_assert_command("/help")
7. client_send_chat("/help")
8. client_assert_output("MCP Test Commands:")
9. client_get_history bila perlu diagnosis
10. client_stop
11. server_stop给智能体的重要指令:
不要访问公共服务器;
不要将 boot、join 或
Spawned视为命令完成的往返;如果失败,请按边界分类:boot、连接、spawn、队列、出站数据包、服务器回调、服务器响应、客户端解析器,或 MCP 断言;
测试结束后一律停止进程;
确保 UDP 端口
7777重新恢复闲置。
实时测试示例
测试游戏模式位于:
vendor/openmp/Server/gamemodes/mcp_test.pwn可用的命令:
/help
/status如果修改 Pawn 源码,请从服务器目录重新编译 .amx:
qawno\pawncc.exe -i.\qawno\include -o.\gamemodes\mcp_test .\gamemodes\mcp_test.pwn实时工作流程:
server_start
→ client_start
→ client mencapai Spawned
→ client_send_chat("/help")
→ client_assert_output("MCP Test Commands:")
→ client_assert_output("/status - show a test response")
→ client_stop
→ server_stop无头 RakClient 可以证明协议、状态和命令是否正常。它不会生成截图。视觉测试需要单独的、带渲染的 GTA 客户端。
开发
运行测试:
pytest -q构建 wheel:
python -m pip wheel . --no-deps -w dist安装 wheel:
python -m pip install dist/mcp_gta_samp-0.1.0-py3-none-any.whl核心结构:
mcp_gta_samp/ package Python dan MCP facade
tests/ unit, contract, dan bridge tests
config.example.json template konfigurasi
vendor/ binary dan fixture live test安全
此 MCP 将使用范围限制在本地/自有服务器。请不要把凭据、代理池、私有配置、私有日志或服务器测试数据放进公共仓库。
如果服务器需要公网访问,请自行添加身份验证和网络隔离。本包不是为公开的游戏控制 API 而设计的。
许可协议
MIT License。请查看 LICENSE。
链接
问题反馈:报告问题
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Connect AI agents to Flato's editable canvas runtime through a hosted MCP server.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/marhenrik635-oss/mcponmysamp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server