Skip to main content
Glama

MCP on My SAMP

Umfang: Lokale Server oder Server, die dir gehören bzw. von dir autorisiert sind. Kein Werkzeug für die Automatisierung öffentlicher Server.


Was kann es?

MCP on My SAMP ermöglicht es KI-Agenten, Spieleserver mit wiederholbaren Workflows zu testen:

  • open.mp starten / stoppen / Status prüfen;

  • Headless-RakClient starten / stoppen / Status prüfen;

  • warten, bis der Client tatsächlich Spawned ist;

  • erlaubte Slash-Befehle senden;

  • den Ausgabeverlauf des Clients lesen;

  • verifizieren, dass die Serverantwort beim Client angekommen ist;

  • Befehle aus dem Pawn-Quellcode des Gamemodes ermitteln;

  • Befehle außerhalb der Zulassungsliste ablehnen.

Es bietet kein Flooding, Spamming, Lag Injection, beliebiges RCON oder die Automatisierung öffentlicher Server.

Related MCP server: Brainstorm

Arbeitsablauf

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

Gültiger Roundtrip-Nachweis:

command dikirim
→ server callback menerima command
→ gamemode mengirim response
→ client menerima response
→ MCP assertion berhasil

Allein Spawned ist kein Beweis dafür, dass der Befehl erfolgreich war.


Installation

1. Python einrichten

Python 3.10 oder neuer ist erforderlich.

2. Projekt installieren

Vom Repository-Stammverzeichnis ausführen:

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. Überprüfen

pytest -q

Erwartete Ausgabe:

35 passed

Die open.mp- und RakClient-Binärdateien werden nur für Live-Tests benötigt. Die Python-Unit-Tests können auch ohne diese Binärdateien ausgeführt werden.


Konfiguration

Erstelle eine lokale Konfigurationsdatei aus der Vorlage:

Windows

copy config.example.json local-server.json

Linux / macOS

cp config.example.json local-server.json

Inhalt der Datei:

{
  "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
}

Passe executable und working_dir an den Speicherort von open.mp auf deinem Computer an. local-server.json ist nicht in Git eingecheckt, da die Pfade auf jedem Computer unterschiedlich sind.


MCP-Server ausführen

Nur Server

mcp-gta-samp --config local-server.json

Mit Headless-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.pwn

Linux / 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.pwn

Der MCP-Transport verwendet stdio.


MCP-Tools

Tool

Funktion

server_start

Startet den Server und wartet auf die Bereitschaft.

server_status

Prüft den Serverstatus und die PID.

server_stop

Fährt den Server herunter.

client_start

Startet den Headless-RakClient.

client_status

Prüft den Clientstatus.

client_stop

Fährt den Client herunter.

client_send_chat

Sendet erlaubte Slash-Befehle nach Spawned.

client_get_history

Ruft die gepufferte Client-Ausgabe ab.

client_assert_output

Stellt sicher, dass eine bestimmte Ausgabe beim Client eintrifft.

server_list_commands

Zeigt Befehle aus dem Pawn-Quellcode an.

server_assert_command

Validiert Befehle anhand der Zulassungsliste.

Die letzten beiden Tools sind verfügbar, wenn --gamemode-source verwendet wird.


Workflow für KI-Agenten

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

Wichtige Anweisungen für den Agenten:

  • greife nicht auf öffentliche Server zu;

  • betrachte Booten, Beitreten oder Spawned nicht als Befehls-Roundtrip;

  • klassifiziere bei Fehlern die Grenze: Boot, Verbindung, Spawn, Warteschlange, ausgehendes Paket, Server-Callback, Serverantwort, Client-Parser oder MCP-Assertion;

  • beende die Prozesse nach dem Test immer;

  • stelle sicher, dass der UDP-Port 7777 wieder frei ist.


Beispiel für einen Live-Test

Ein Test-Gamemode ist verfügbar unter:

vendor/openmp/Server/gamemodes/mcp_test.pwn

Verfügbare Befehle:

/help
/status

Wenn der Pawn-Quellcode geändert wird, kompiliere die .amx aus dem Serverordner neu:

qawno\pawncc.exe -i.\qawno\include -o.\gamemodes\mcp_test .\gamemodes\mcp_test.pwn

Live-Workflow:

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

Der Headless-RakClient weist Protokoll, Zustand und Befehle nach. Er erzeugt keine Screenshots. Für visuelle Tests ist ein separater gerenderter GTA-Client erforderlich.


Entwicklung

Tests ausführen:

pytest -q

Wheel erstellen:

python -m pip wheel . --no-deps -w dist

Wheel installieren:

python -m pip install dist/mcp_gta_samp-0.1.0-py3-none-any.whl

Kernstruktur:

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

Sicherheit

Dieses MCP beschränkt die Nutzung auf lokale/eigene Server. Gib keine Anmeldedaten, Proxy-Pools, privaten Konfigurationen, privaten Protokolle oder Testserverdaten in ein öffentliches Repository.

Wenn du den Server aus dem Internet erreichbar machst, füge selbst Authentifizierung und Netzwerkisolierung hinzu. Dieses Paket ist nicht als öffentliche Spielsteuerungs-API konzipiert.

Lizenz

MIT-Lizenz. Siehe LICENSE.

Available Tools

3 tools
server_startA
Idempotent

Start the configured local open.mp test server and wait for readiness.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already cover idempotency (idempotentHint=true), read-only status (readOnlyHint=false), and destructiveness (destructiveHint=false). The description adds the 'wait for readiness' behavior, which is beyond what annotations provide, giving the agent a clear expectation of the tool's runtime behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler. Every word contributes meaning: 'start', 'configured local open.mp test server', and 'wait for readiness' are all necessary and sufficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

This is a simple tool with no parameters, an output schema, and annotations covering idempotency and safety. The description fully covers the intended action and readiness behavior, leaving no critical gaps for an agent to call it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, so there are no parameter semantics to document. Per the baseline for 0 params, a score of 4 is appropriate; the description doesn't need to compensate for schema gaps.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb ('Start') and resource ('configured local open.mp test server') and adds 'wait for readiness' as a behavioral outcome. This clearly distinguishes it from siblings server_stop and server_status through action and intent.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The start action and readiness wait make the context obvious: this is for bringing the server up. It does not explicitly name alternatives or when-not conditions, but the sibling names and the verb provide clear contextual guidance.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

server_statusA
Read-only

Return local open.mp test server process status.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

The annotations already declare readOnlyHint=true and destructiveHint=false, so the safe read-only nature is covered. The description adds the 'local' and 'process status' scope, but does not provide additional behavioral detail such as what exactly the status output contains or whether it might throw errors if no server is running. With the output schema present, the agent can likely infer return structure, so the description adds minimal but acceptable value.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single, front-loaded sentence delivers the essential meaning with no filler. It names the resource and the type of operation without unnecessary elaboration.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a no-parameter, read-only status tool with an output schema present, the description is complete enough to guide correct invocation. There are no prerequisites, options, or alternatives that need clarifying beyond what the summary already provides.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, so the description has no parameter meaning to add. The baseline for no-parameter tools is 4, and there is no relevant gap to compensate for.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses a specific verb ('Return') and a clear resource ('local open.mp test server process status'), making the tool's function immediately obvious. It also differentiates itself from siblings server_start and server_stop by describing a read-only status check rather than a state-changing operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description clearly implies the tool is for checking status rather than starting or stopping the server, which are the sibling operations. It does not explicitly state 'use this when you need to check status and not start/stop', but the context and naming make the intended use clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

server_stopA
Destructive

Stop the configured local open.mp test server.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.6/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations already declare destructiveHint=true and idempotentHint=false, but the description adds no behavioral context beyond the verb 'Stop'. It does not clarify consequences such as terminating active sessions or clearing server state. There is no contradiction with annotations, but the description relies entirely on structured metadata.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no filler. It names the action and the target directly, and every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter destructive action with annotations covering safety and an output schema present, the description is sufficient for basic invocation. It is slightly thin on operational context such as behavior when the server is already stopped, but that is not necessary for calling the tool correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool accepts zero parameters and schema description coverage is 100%, so there are no parameter semantics to document. The baseline of 4 applies because the description cannot add meaning beyond the empty schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a precise action ('Stop') and the exact target ('configured local open.mp test server'). This clearly distinguishes it from sibling tools server_start and server_status, which have complementary purposes.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is given on when to use this tool versus server_start or server_status. The description only states the action and target, leaving the agent to infer usage from the tool name and siblings rather than from explicit instructions.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv0.1.0
    • First observedserver_start
    • First observedserver_status
    • First observedserver_stop

TDQS

A4.2/5.0

Scored across 3 tools

Disambiguation5/5

Each tool has a single, clear responsibility: start, stop, or check status. There is no overlap or ambiguity between them.

Naming Consistency5/5

All tools follow the identical pattern of 'server_' followed by a simple verb (start, stop, status). This is perfectly consistent and predictable.

Tool Count5/5

Three tools is exactly right for the narrow scope of managing a local server. Each tool is essential and earns its place without unnecessary bloat.

Completeness4/5

The tool set covers the core lifecycle (start, stop, status) but lacks a restart operation, which is a common need. However, agents can still accomplish restart via stop+start, so this is a minor gap.

Maintenance

ActivitySlowing
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers