Skip to main content
Glama

MCP on My SAMP

スコープ: ローカルサーバー、または自分が所有・許可したサーバーのみを対象とします。公開サーバーを自動化するためのツールではありません。


できること

MCP on My SAMP を使用すると、AI エージェントが再現可能なワークフローでゲームサーバーをテストできます:

  • open.mp の起動 / 停止 / ステータス確認;

  • ヘッドレス RakClient の起動 / 停止 / ステータス確認;

  • クライアントが実際に Spawned になるのを待機;

  • 許可されたスラッシュコマンドの送信;

  • クライアントの出力履歴の読み取り;

  • サーバーのレスポンスがクライアントに届いたことを検証;

  • Pawn のゲームモードソースからコマンドを発見;

  • 許可リスト外のコマンドを拒否。

フラッド、スパム、ラグ注入、任意の RCON、公開サーバー向けの自動化は提供しません。

Related MCP server: Brainstorm

ワークフロー

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

有効なラウンドトリップの証明:

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 passed

open.mp と RakClient のバイナリはライブテストでのみ必要です。Python のユニットテストは、これらのバイナリがなくても実行できます。


設定

テンプレートからローカル設定ファイルを作成します:

Windows

copy config.example.json local-server.json

Linux / 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
}

executable と working_dir は、お使いのコンピューター上の open.mp の場所に合わせて変更してください。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.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

MCP のトランスポートは stdio を使用します。


MCP ツール

ツール

機能(はたらき)

server_start

サーバーを起動し、準備完了(レディネス)を待機します。

server_status

サーバーのステータスと PID を確認します。

server_stop

サーバーを停止します。

client_start

ヘッドレス RakClient を起動します。

client_status

クライアントのステータスを確認します。

client_stop

クライアントを停止します。

client_send_chat

Spawned 後に許可されたスラッシュコマンドを送信します。

client_get_history

バッファリングされたクライアントの出力を取得します。

client_assert_output

特定の出力がクライアントに届いたことを確認します。

server_list_commands

Pawn ソースからコマンドを表示します。

server_assert_command

コマンドを許可リストに対して検証します。

最後の 2 つのツールは、--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

エージェントへの重要な指示:

  • 公開サーバーにアクセスしないこと;

  • ブート、参加、Spawned をコマンドのラウンドトリップとして見なさないこと;

  • 失敗した場合は、境界を分類すること: ブート、接続、スポーン、キュー、アウトバウンドパケット、サーバーコールバック、サーバーレスポンス、クライアントパーサー、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を参照してください。

リンク

Available Tools

3 tools
server_startA
Idempotent

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

Inputs: no named parameters. Returns: object

server_statusA
Read-only

Return local open.mp test server process status.

Inputs: no named parameters. Returns: object

server_stopA
Destructive

Stop the configured local open.mp test server.

Inputs: no named parameters. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    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

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      F
      maintenance
      Enables AI agents to communicate, coordinate, and collaborate on complex tasks through a local MCP server.
      8
      Business Source 1.1
    • F
      license
      Not graded
      quality
      C
      maintenance
      Turns your local machine into an MCP server with a GUI, allowing agents to execute file operations, run commands (including admin), manage background processes, and query databases, with optional ngrok exposure.
      -
    • F
      license
      C
      quality
      D
      maintenance
      An MCP server that enables AI agents to execute terminal commands and Python code on the host system, leveraging Agent Zero's battle-tested implementation with session management and smart output handling.
      4
      -