The MTS Client Integration MCP is a local Model Context Protocol server that helps external developers integrate with MTS using the Transaction 3.0 API. It runs on the integrator’s machine and connects to AI-assisted editors such as Cursor and Claude Desktop, so they can validate tickets, interpret rejections, and test client behavior without guessing at schema rules or wire formats.
The MCP is built around Sportradar’s Ticket 3.0 JSON Schemas and complements the public Transaction 3.0 documentation and JSON schemas. It does not replace production MTS or the MTS Gate Sandbox used for hosted scenario testing; it provides local tools while a client is designed and debugged.
git clone https://github.com/sportradar/mts-client-integration-mcp.git
cd mts-client-integration-mcp
uv syncIf PyPI is blocked on your network, use .envrc.example → .envrc and direnv allow as described in the repository Contributing guide.
The server runs as a stdio MCP process. The client spawns:
uv run mts-mcp-server
from the cloned repository (via uv --directory <repo> run mts-mcp-server).
MCP Inspector (interactive tool browser):
uv run fastmcp dev inspector src/server.py:create_server --project .Open the URL printed in the terminal (often http://localhost:6274), choose STDIO, and connect.
CLI smoke test (no IDE):
uv run fastmcp list --command "uv run mts-mcp-server"
uv run fastmcp call \
--command "uv run mts-mcp-server" \
--target lookup_rejection_code \
--input-json '{"code": -702}' \
--jsonlookup_rejection_code
Look up the canonical MTS rejection message for a numeric code returned on the wire.
code as negative or positive (normalized to negative).ticket_context.operation (or top-level operation) when the same code applies to more than one Transaction 3.0 operation — otherwise the tool may return ambiguous: true and list variants.steps_to_reproduce and fix_suggestions.Typical use: an integrator pasted a rejection from MTS and needs the official wording and next steps.
validate_ticket_request
Validate a single outbound Ticket 3.0 envelope before sending it to MTS. Four layers:
| Layer | What it checks |
|---|---|
| JSON Schema | Structure against packaged Ticket 3.0 request schema |
| Envelope | Typed envelope fields and operation consistency |
| Business rules | Stake/odds/currency, selection caps, system/ways/custom-bet rules, partial cash-out cumulation, frame size (32 KB), channel/language expectations, and related MTS rules |
| ACK state machine | Cancellation and ticket-placement ACK/nACK flows when session_state includes prior wire messages |
session_state is optional: prior messages in chronological order (structured objects or a log string with ->/<- markers). The MCP resource mts://schemas/session-state documents the shape.
build_placement, build_cashout, build_ext_settlement, list_ticket_shapes
Build schema-conformant request JSON for tests and demos (34 placement/cash-out/settlement shapes).
list_ticket_shapes — discover shape ids, required params, and which build tool to call.shape + params (validated by Pydantic; the MCP tool schema is the contract).bet_type, size, partial flags, etc.). The integrator must supply business values (operator_id, limit_id, channel, selections, stake, cash-out codes, …) — nothing is invented from the environment.Response shape: { "shape", "operation", "payload" } where payload is the wire envelope. Always run validate_ticket_request on the result before production send.
MCP resources for builders:
| URI | Purpose |
|---|---|
mts://templates/{shape} | Defaults, required params, example_params for a shape |
mts://templates/builder-schema | JSON Schema for all three param models |
mts://integration/envelope-context | How to obtain operatorId, limitId, channel, end customer |
Fixture-driven local mock (ws://127.0.0.1:<port> plus stub OAuth). Not the hosted MTS Gate Sandbox.
Example sequence:
start_mock(scenarios=["realistic_mix"])
→ point your client at ws_url
→ place tickets (or use send_to_mock)
stop_mock() → pass wire_log into validate_ticket_requestRead-only context for the agent:
After MCP is connected, use natural language in the chat. The agent should call the tools above. Try these to confirm setup:
More copy-paste scenarios ship in the GitHub repository under examples/prompts/local_validator/, examples/prompts/build_ticket/, and examples/prompts/simulator/.
Read mts://integration/envelope-context for operator, limit, channel, and end-customer values your environment expects.
Use builder tools for greenfield tests, or paste JSON from your client.
Run validate_ticket_request until schema, business rules, and, if applicable, ACK checks are clean.
Exercise reconnect, rate limits, partial cash-out, or cancellation flows locally; reuse in the validator.
For hosted scenario-based testing, continue with MTS Gate Sandbox documentation after local validation.
uv run mts-mcp-server in a terminal speaks JSON-RPC on stdio — it is not an interactive shell. Use an MCP client, MCP Inspector, or fastmcp call for testing.
License: MIT (open source). Repository: github.com/sportradar/mts-client-integration-mcp.
The local WebSocket mock is for client-side integration testing on the integrator’s machine. For Sportradar-hosted sandbox scenarios, use MTS Gate Sandbox and its user manual.
Clone the repository and run uv sync.
Add a server entry in workspace .cursor/mcp.json or global ~/.cursor/mcp.json:
{
"mcpServers": {
"mts-client-integration": {
"command": "uv",
"args": [
"--directory",
"/path/to/mts-client-integration-mcp",
"run",
"mts-mcp-server"
]
}
}
}Replace /path/to/mts-client-integration-mcp with the absolute path to your clone.
Restart Cursor or reload MCP servers (Settings → MCP, or refresh in the MCP panel).
| Tool | Purpose |
|---|---|
list_mock_scenarios | Scenario ids, bundles, injectable events |
start_mock | Start mock WebSocket + OAuth stub |
mock_status | Check whether the mock is running |
send_to_mock | Send ticket JSON over the mock WebSocket; returns replies |
inject | Drive faults: connection_blocked, force_disconnect, fast_forward_timer, … |
stop_mock | Shutdown; returns wire_log for reuse in validate_ticket_request(session_state=...) |
| URI | Content |
|---|---|
mts://schemas/ticket3/request | Ticket 3.0 request JSON Schema |
mts://schemas/ticket3/response | Ticket 3.0 response JSON Schema |
mts://schemas/session-state | session_state format for the validator |
mts://templates/... | Builder presets (see above) |
mts://integration/envelope-context.md | Markdown guide for envelope fields |
| Goal | Example prompt |
|---|---|
| Rejection lookup | I got MTS rejection code -702 on a ticket-placement request. What does it mean? |
| Validator | Validate this ticket-placement JSON against MTS rules before I send it: then paste a full envelope. |
| Build + validate | List available ticket shapes, build an accumulator placement with my operator id, and validate the payload. |
| Mock | Start the local MTS mock with realistic_mix, send a single prematch ticket, and show the reply. |
| Mock + validator | Stop the mock and check the wire log against ACK rules with validate_ticket_request. |
wire_logConnect to Sportradar integration or production WebSocket per your credentials (see Transaction 3.0 connectivity docs).
Run lookup_rejection_code with the operation from the failed request; apply fix_suggestions when present.
| Symptom | Likely cause | What to do |
|---|---|---|
| MCP tools not visible in Cursor/Claude | Server not registered or failed to start | Check JSON path in args, run uv sync in the repo, reload MCP. Run CLI fastmcp list smoke test. |
uv or Python errors on start | Wrong Python version or missing deps | Use Python 3.14+; run uv sync from repo root. |
lookup_rejection_code returns ambiguous: true | Code shared across operations | Pass ticket_context.operation (e.g. ticket-placement, cashout-build). |
validate_ticket_request fails ACK checks | Missing or wrong session_state | Include prior placement/cancel/cash-out exchanges in order; see mts://schemas/session-state. |
| Partial cash-out rule errors | Increment vs cumulative percentage | Follow-up partial cash-out percentage must be cumulative, not incremental. |
| Builder tool validation errors | Incomplete params | Open mts://templates/{shape} for required_params and example_params; supply all business fields. |
| Mock connection refused | Mock not running or wrong URL | mock_status; use ws_url from start_mock response. |
fastmcp / Inspector issues | Run from repo root | Use commands exactly as in README; project path is the clone directory. |
| Corporate PyPI / SSL | Cannot install packages | Configure .envrc index per CONTRIBUTING; do not commit lockfile changes from blocked mirrors. |