Sphere MCP Gaming Server

Sphere MCP Gaming Server

Provides LLM access to Unicity gaming platform games through a payment-gated day pass system. Supports game discovery, access management, and payment processing via Nostr protocol and Unicity blockchain.

Category
访问服务器

README

Sphere MCP Gaming Server

MCP (Model Context Protocol) server for the Unicity gaming platform. Provides LLM access to games with payment-gated day passes via Nostr.

Features

  • Day Pass System: Users pay once for 24-hour access to all games
  • Nostr Integration: Payment requests sent via Nostr protocol
  • Unicity Blockchain: Uses nametags for identity and payment routing
  • Auto Identity: Server creates its own blockchain identity on first run
  • HTTP Transport: Supports both legacy SSE and modern Streamable HTTP

Available Games

ID Name Description
unicity-quake Unicity Quake Fast-paced multiplayer arena shooter
boxy-run Boxy Run Endless runner with blockchain rewards
unirun Unirun Unicity-native endless runner

MCP Tools

Tool Parameters Description
list_games - List all available games
check_access unicity_id Check access status and day pass validity
get_game unicity_id, game Get access to a specific game (initiates payment if needed)
confirm_payment unicity_id, game (optional) Wait for payment confirmation
get_wallet_balance password Get MCP wallet balance (admin)

All tools that require user identity take unicity_id as a parameter, making the API stateless and suitable for multi-user scenarios.

HTTP Endpoints

The server runs on HTTP (default port 3001) with two transport protocols:

Legacy SSE (MCP Inspector, older clients)

Endpoint Method Description
/sse GET Establish SSE stream, returns POST endpoint
/messages?sessionId=xxx POST Send JSON-RPC messages

Streamable HTTP (modern clients)

Endpoint Method Description
/mcp POST Send JSON-RPC requests
/mcp GET SSE stream for responses

Session ID is passed via mcp-session-id header.

Health Check

Endpoint Method Description
/health GET Returns { status, sseSessions, httpSessions }

Quick Start

1. Configure Environment

cp .env.example .env

Edit .env with required values:

# Required
MCP_NAMETAG=gaming-mcp
PAYMENT_COIN_ID=your_coin_id_here

2. Run with Docker Compose

docker compose up -d

The server will:

  1. Generate a new private key (saved to ./data/identity.json)
  2. Mint a nametag on Unicity blockchain
  3. Publish Nostr binding for the nametag
  4. Start listening for MCP connections

3. View Logs

docker compose logs -f

Testing the MCP

Option 1: MCP Inspector (Recommended)

The MCP Inspector provides a web UI to interact with the server:

# Start the server
npm run build && npm start

# In another terminal, connect inspector to HTTP endpoint
npx @modelcontextprotocol/inspector --url http://localhost:3001/sse

This opens a browser UI where you can call tools interactively.

Option 2: curl (Health Check)

curl http://localhost:3001/health

Option 3: Claude Desktop Integration

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "gaming": {
      "url": "http://localhost:3001/sse"
    }
  }
}

Example Workflow

  1. User lists available games:

    Tool: list_games
    
  2. User requests a game with their Unicity ID:

    Tool: get_game
    Args: { "unicity_id": "alice", "game": "unicity-quake" }
    
  3. If no day pass, payment is requested. The user receives a payment request in their Unicity wallet.

  4. User confirms payment:

    Tool: confirm_payment
    Args: { "unicity_id": "alice" }
    
  5. On successful payment, user gets game URL and 24h access.

Configuration

Variable Required Default Description
MCP_NAMETAG Yes - Nametag for this MCP server
PAYMENT_COIN_ID Yes - Coin ID for payments
MCP_PRIVATE_KEY_HEX No Auto-generated Private key (hex)
NOSTR_RELAY_URL No wss://nostr-relay.testnet.unicity.network Nostr relay
AGGREGATOR_URL No https://goggregator-test.unicity.network Unicity aggregator
AGGREGATOR_API_KEY No (testnet key) Aggregator API key
PAYMENT_AMOUNT No 1000000000 Payment amount
DAY_PASS_HOURS No 24 Day pass duration
PAYMENT_TIMEOUT_SECONDS No 120 Payment timeout
DATA_DIR No ./data Data persistence directory
ADMIN_PASSWORD No Auto-generated Admin password for wallet access
HTTP_PORT No 3001 HTTP server port

Data Persistence

The server stores identity and nametag data in DATA_DIR:

  • identity.json - Private key (keep this safe!)
  • nametag-{name}.json - Minted nametag token

Mount this directory as a volume to persist across container restarts.

Development

# Install dependencies
npm install

# Build
npm run build

# Run locally
npm start

# Watch mode
npm run dev

Architecture

┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐
│   LLM Client    │────▶│   MCP Server    │────▶│  Nostr Relay    │
│ (Claude, etc.)  │     │ (HTTP transport)│     │                 │
└─────────────────┘     └─────────────────┘     └─────────────────┘
                               │                        │
                               ▼                        ▼
                        ┌─────────────────┐     ┌─────────────────┐
                        │    Unicity      │     │  User Wallet    │
                        │   Aggregator    │     │  (Sphere app)   │
                        └─────────────────┘     └─────────────────┘

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选