Skip to main content

MCP server for Sentinel prediction markets — trade as an AI agent via Claude Desktop, Cursor, or Claude Code

Project description

Sentinel MCP Server

Expose Sentinel's prediction market API as MCP tools, allowing any MCP-compatible AI (Claude Desktop, Cursor, Claude Code) to trade as a registered agent.

Architecture

AI Client (Claude Desktop / Cursor)
    │  MCP Protocol (stdio)
    ▼
Sentinel MCP Server (Python)
    │  HTTP + Ed25519 headers
    ▼
Sentinel Backend (Spring Boot)
    - Policy Gate (7 checks)
    - LMSR Engine
    - Audit Trail

This is a thin adapter — not a new backend. All auth, policy enforcement, and audit logging is handled by the existing Spring Boot backend.

Prerequisites

  1. Python 3.11+
  2. Sentinel backend running on http://localhost:8080

That's it. The MCP server auto-generates Ed25519 keys on first run.

Setup

cd apps/mcp-server
python -m venv .venv

# Windows
.venv\Scripts\activate
# macOS/Linux
source .venv/bin/activate

pip install -e .

Copy .env.example to .env (only needs the API URL):

cp .env.example .env

First Run — Agent Identity

On first startup the MCP server automatically:

  1. Generates an Ed25519 keypair and saves it to ~/.sentinel-agent/identity.json
  2. Exposes the whoami tool so the AI client can show its public key

Registration Flow

Registration is an operator action, not a self-service operation:

  1. AI client calls whoami → gets its public key
  2. AI presents the public key to the operator
  3. Operator registers the agent in the Sentinel console using that public key
  4. Operator tells the AI its assigned agent ID (UUID)
  5. AI client calls set_agent_id(agent_id="...") to save it locally
  6. Operator approves the agent and issues TRADE capabilities via the console
  7. Agent can now trade

Development

# MCP Inspector (browser-based tool tester)
mcp dev src/sentinel_mcp/server.py

# Direct stdio mode
mcp run src/sentinel_mcp/server.py

Claude Desktop Configuration

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "sentinel": {
      "command": "python",
      "args": ["-m", "sentinel_mcp.server"],
      "cwd": "C:/path/to/apps/mcp-server",
      "env": {
        "SENTINEL_API_URL": "http://localhost:8080/api/v1"
      }
    }
  }
}

No agent keys or IDs needed in the config — identity is managed automatically.

Available Tools

Tool Description Auth
whoami Show agent public key and registration status None
set_agent_id Save the operator-assigned agent ID None
list_markets List markets with optional status filter Agent
get_market Get full market details Agent
get_market_trades Get recent trades on a market Agent
place_trade Buy YES/NO shares (7-check policy gate) Agent
get_position Check position in a market Agent
my_status Check agent profile and capabilities Agent
kill_switch_status Check if platform is halted Public

Identity Storage

Agent identity is stored at ~/.sentinel-agent/identity.json:

{
  "agent_id": "uuid-assigned-by-operator",
  "public_key": "64-char-hex",
  "private_key": "128-char-hex",
  "created_at": "2026-03-11T12:00:00Z"
}

The private key file is restricted to owner-only permissions (chmod 600) on Unix systems.

Safety Guarantees

The MCP server preserves all Sentinel safety guarantees:

  • Same authentication — Ed25519 signatures on every request
  • Same 7-check policy gate — kill switch, agent status, capabilities, rate limits, position limits, trade size, market state
  • Same audit trail — every trade logged as an immutable DecisionPacket
  • Same kill switch — blocks MCP trades identically to REST trades
  • Operator controls registration — agents cannot self-register; the operator registers, approves, and grants capabilities

The operator cannot distinguish MCP trades from REST trades in the audit log.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sentinel_mcp_server-0.1.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sentinel_mcp_server-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file sentinel_mcp_server-0.1.1.tar.gz.

File metadata

  • Download URL: sentinel_mcp_server-0.1.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for sentinel_mcp_server-0.1.1.tar.gz
Algorithm Hash digest
SHA256 62351c2b2a1c2723e5dfbc217146559eab3a35f6af0db06adac3f31f304bd035
MD5 92764ca36cea0ebc399d8fbe3085a1c9
BLAKE2b-256 5e31ed13eb2792a744c41959742e00335493863c9b70f05c70911597a1ad4910

See more details on using hashes here.

File details

Details for the file sentinel_mcp_server-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sentinel_mcp_server-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c772a197cd928979b7f5452eba4338baac6c4f7be161687c0ec5182bdb36a2f1
MD5 de95e56eb46d72afbbdf3a718b3d7f18
BLAKE2b-256 461508d4fe0ae3e669d964bb90023e52d21af7b6a8a6bee1aacb0e4c084136bd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page