MCP on My SAMP
MCP on My SAMP
AI-native testing bridge untuk server open.mp / SA-MP lokal.
๐ Website: marhenrik635-oss.github.io/mcponmysamp-web โ landing page interaktif: arsitektur 3D, daftar 77 tools, dan quickstart.
Gunakan hanya untuk server lokal atau server yang kamu miliki / izinkan. Bukan tool public-server automation.
Fitur
Lifecycle open.mp: start, status, stop.
Lifecycle headless RakClient: start, status, stop.
Spawn-gated command dispatch.
Command allowlist dari source Pawn.
Client history dan response assertion.
Evidence-based command round-trip.
Visual observer: jalankan client render sungguhan via
omp-launcher, screenshot PNG jendela game (PrintWindow), window diparkir off-screen agar tidak mengganggu desktop.77 MCP tools: driving, dialog-awareness, textdraw/checkpoint awareness, key sequence, dan tool observasi visual.
Tidak menyediakan flood, spam, lag injection, arbitrary RCON, atau automation server publik.
Alur kerja
AI agent
โ MCP stdio
โผ
MCP on My SAMP โโโบ open.mp server
โ โฒ
โโโ RakClient โโ UDP lokalBukti valid:
command dikirim
โ server callback menerima command
โ gamemode mengirim response
โ client menerima response
โ MCP assertion berhasilInstalasi Windows
Jalankan dari root repository yang baru di-clone:
git clone https://github.com/marhenrik635-oss/mcponmysamp.git
cd mcponmysamp
py -3 -m venv .venv
.venv\Scripts\activate
python -m pip install --upgrade pip
python -m pip install ".[dev]"
pytest -qLinux / macOS:
git clone https://github.com/marhenrik635-oss/mcponmysamp.git
cd mcponmysamp
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install ".[dev]"
pytest -qDependency game
Binary open.mp, RakClient, dan Pawn compiler tidak disimpan di Git repository agar clone tetap kecil dan tidak mendistribusikan binary pihak ketiga.
Siapkan dependency tersebut sendiri. Struktur lokal bebas; contoh:
D:/Games/open.mp/omp-server.exe
D:/Games/RakClient/rakclient.exe
D:/Games/RakClient/scripts/Konfigurasi
Salin template:
copy config.example.json local-server.jsonLinux / macOS:
cp config.example.json local-server.jsonEdit local-server.json:
{
"executable": "D:/Games/open.mp/omp-server.exe",
"working_dir": "D:/Games/open.mp",
"args": ["--config-path", "config.json"],
"ready_text": "Legacy Network started on port",
"startup_timeout": 30
}local-server.json sengaja di-ignore Git. Gunakan path sesuai komputer sendiri.
Menjalankan MCP
Server saja:
mcp-gta-samp --config local-server.jsonDengan headless RakClient:
mcp-gta-samp ^
--config local-server.json ^
--client-executable D:/Games/RakClient/rakclient.exe ^
--client-arg --server ^
--client-arg 127.0.0.1:7777 ^
--client-arg --nick ^
--client-arg MCPBot ^
--client-arg --scripts-dir ^
--client-arg D:/Games/RakClient/scripts ^
--gamemode-source examples/mcp_test.pwnUntuk PowerShell, gunakan satu baris. MCP menggunakan transport stdio; terminal yang diam berarti proses sedang menunggu request dari MCP client.
MCP tools
Total 77 tools. Tool bot_wait_for_*, bot_scan_*, dan bot_key_sequence berjalan blocking di dalam newTask, jadi aman menunggu event server (textdraw, checkpoint, player) tanpa mengganggu dispatch.
Tool | Fungsi |
| Start server dan tunggu readiness. |
| Cek server dan PID. |
| Stop server. |
| Daftar command dari source Pawn. |
| Validasi command terhadap allowlist. |
| Start headless RakClient. |
| Cek status client. |
| Stop client. |
| Kirim command slash allowlisted setelah |
| Ambil output client. |
| Pastikan response diterima client. |
| Jalan ke titik (walk/jog/sprint/direct). |
| Berhenti jalan. |
| Teleport body. |
| Hadap arah (derajat). |
| Hadap titik. |
| Pulse lompat. |
| Hold key mask (8=sprint, 4=fire, 32=jump, 128=crouch). |
| Lepas semua key. |
| Macro key blocking, steps |
| Masuk kendaraan (ID, seat). |
| Keluar kendaraan. |
| Paksa animasi (ID, flags). |
| Mainkan animasi bernama (sit/dance/wave/dll). |
| Daftar animasi bernama yang tersedia. |
| Set velocity vector. |
| Kirim chat (tanpa slash). |
| Kirim command slash via RPC (tanpa cek allowlist). |
| Ganti nickname bot. |
| Force respawn. |
| Putus & reconnect ke server. |
| Jawab dialog server. |
| Hold key kendaraan (gas/rem/stir -1/0/1). |
| Klakson. |
| HP kendaraan (1000 = sempurna). |
| Posisi kendaraan. |
| Set velocity kendaraan. |
| Kecepatan kendaraan (units/s). |
| Baca dialog server aktif. |
| Tunggu dialog muncul. |
| Tunggu pesan server (opsional marker). |
| Klik textdraw (RPC 83). |
| Textdraw 2D yang tampil ke bot (ID, posisi, style, teks). |
| Tunggu textdraw muncul (opsional marker teks). |
| Ambil pickup (RPC 131). |
| Checkpoint server aktif (posisi + radius), atau inactive. |
| Jalan ke checkpoint server aktif (direct). |
| Set target aim (object/vehicle/player/actor). |
| 3D text label di sekitar. |
| Pickup di sekitar. |
| Object di sekitar. |
| Posisi body. |
| Heading body. |
| ID kendaraan saat ini. |
| HP + armour. |
| ID senjata saat ini. |
| Uang. |
| Nickname. |
| Interior ID. |
| Posisi kamera. |
| Key mask yang dihold. |
| Alamat server. |
| Info world server: waktu, cuaca, gravitasi. |
| State gabungan bot: posisi, kendaraan, waktu world, interior. |
| Apakah sedang berjalan? |
| Cek apakah bridge script hidup. |
| Pulse tombol fire (tembak sekali). |
| Player di sekitar (ID, posisi). |
| Player di sekitar detail (HP, armour, senjata, kendaraan). |
| Kendaraan di sekitar (ID, posisi, model). |
| Kendaraan di sekitar detail (HP, speed, posisi). |
| Tunggu chat mengandung marker. |
| Tunggu player muncul (filter nick/jarak, timeout). |
| Launch omp-launcher (rendered client) ke server localhost-only; default background ( |
| Screenshot PNG window game (PrintWindow, fallback fullscreen). |
| Status observer (proses, judul window, connected). |
| Kill tree proses game yang di-start observer. |
Visual Observer
Fitur opsional: melihat hasil render client sungguhan lewat screenshot. Prasyarat (sekali saja, salin manual โ tool tidak menyalin file sistem):
samp.dlldari%LOCALAPPDATA%\mp.open.launcher\samp\0.3.7-R5\samp.dllomp-client.dlldari%LOCALAPPDATA%\mp.open.launcher\omp\omp-client.dll
keduanya ke direktori game, lalu isi launcher_path + game_path di config (lihat config.example.json). observer_start default background: window diparkir off-screen (Z-bottom, koordinat -32000) sehingga tidak mengganggu desktop, dan PrintWindow tetap valid untuk screenshot. Catatan: client yang idle tanpa fokus bisa crash ~90 detik; lakukan screenshot berkala bila butuh observasi lama.
Workflow AI agent
1. server_status
2. server_start jika belum berjalan
3. client_start
4. tunggu 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_stopJangan menganggap boot, join, atau Spawned sebagai bukti command berhasil. Jika gagal, klasifikasikan boundary: boot, koneksi, spawn, queue, outbound packet, callback server, response server, parser client, atau assertion MCP.
Fixture gamemode
Source minimal ada di:
examples/mcp_test.pwnCommand:
/help
/statusFixture ini perlu dimasukkan ke folder gamemodes pada instalasi open.mp lalu di-compile menggunakan Pawn compiler. Dari folder instalasi open.mp:
qawno\pawncc.exe -i.\qawno\include -o.\gamemodes\mcp_test examples\mcp_test.pwnPastikan config.json open.mp memuat gamemode:
"main_scripts": ["mcp_test 1"]Contoh MCP client
MCP client menjalankan executable sebagai subprocess melalui stdio. Sesuaikan semua path:
{
"mcpServers": {
"mcponmysamp": {
"command": "D:/path/mcponmysamp/.venv/Scripts/mcp-gta-samp.exe",
"args": [
"--config", "D:/path/mcponmysamp/local-server.json",
"--client-executable", "D:/Games/RakClient/rakclient.exe",
"--client-arg", "--server",
"--client-arg", "127.0.0.1:7777",
"--client-arg", "--nick",
"--client-arg", "MCPBot",
"--client-arg", "--scripts-dir",
"--client-arg", "D:/Games/RakClient/scripts",
"--gamemode-source", "D:/path/mcponmysamp/examples/mcp_test.pwn"
]
}
}
}Testing dan build
.venv\Scripts\activate
pytest -q
python -m pip wheel . --no-deps -w distTarget minimal: seluruh test Python lulus. Live test membutuhkan dependency game lokal dan tidak dijalankan di CI.
Rilis versi (semantic versioning): bump version di pyproject.toml dan mcp_gta_samp/__init__.py, perbarui README bila fitur berubah, commit, tag v<version>, push tag.
Struktur repository
mcp_gta_samp/ package MCP Python (cli, config, core, headless, mcp_server, observer, openmp, remote, server)
tests/ unit dan contract tests
examples/ fixture Pawn kecil
scripts/ CI helper (check_luau.py)
config.example.json template konfigurasi
README.md dokumentasi
LICENSE MIT LicenseKeamanan dan batasan
Gunakan hanya pada server lokal atau server yang kamu miliki / izinkan. Jangan commit credential, proxy, log privat, konfigurasi sensitif, atau binary game besar. Headless RakClient membuktikan protocol, state, command, dan response; bukan screenshot atau gameplay visual.
Lisensi
MIT License. Lihat LICENSE.
Repository ยท Website ยท Issues
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