Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
ff8ffca
feat(mcp): add SSE server for remote MCP deployment
bullish-lee Jan 24, 2026
b46a731
fix: remove unused Mount import
bullish-lee Jan 24, 2026
15e3324
style: apply ruff formatting
bullish-lee Jan 24, 2026
826634b
fix(ci): only run claude-default on PR when @claude mentioned
bullish-lee Jan 24, 2026
d6e0611
Revert workflow changes - out of scope for this PR
bullish-lee Jan 24, 2026
3081a74
Trigger CI with @claude in PR body
bullish-lee Jan 24, 2026
e651a3e
Improve SSE server security and code quality
bullish-lee Jan 24, 2026
9d25808
Fix CI: lazy load mcp-dependent definitions, fix test imports
bullish-lee Jan 24, 2026
48f8d21
fix: skip isort for test file with conditional imports
bullish-lee Jan 24, 2026
a60949a
Add documentation for remote MCP server (SSE)
guzus Jan 25, 2026
b5ebc6e
Add detailed Claude Code connection instructions
guzus Jan 25, 2026
7eebf83
Document read-only mode without credentials
guzus Jan 25, 2026
ec2cc89
Restrict write operations to Polymarket only (Builder profile)
guzus Jan 25, 2026
f10f7cf
feat: add PolymarketBuilder for secure trading via Builder profile
guzus Jan 25, 2026
42c8978
feat: add PolymarketOperator for server-wide operator mode
guzus Jan 25, 2026
998381c
docs: simplify remote-server.md to focus on Operator Mode
guzus Jan 25, 2026
342890f
docs: add direct PolygonScan link for operator approval
guzus Jan 25, 2026
9aac235
feat: add wallet onboarding website with operator authentication
guzus Jan 25, 2026
f705d90
fix: move assets to public folder, update hero buttons
guzus Jan 25, 2026
1feb2f5
feat: add syntax highlighting, fix MCP button link
guzus Jan 25, 2026
96b1b0b
feat: create comprehensive MCP integration guide
guzus Jan 25, 2026
2976d33
fix: prevent global nav styles from affecting guide page header
guzus Jan 25, 2026
48f580e
fix: move favicon to root for better browser compatibility
guzus Jan 25, 2026
7de2707
feat: rename /approve to /mcp, add read-only configuration guide
guzus Jan 25, 2026
038505f
Feat/polymarket package refactor (#80)
minkyun12 Feb 9, 2026
e924afc
fix: pin viem to restore website build
guzus Feb 9, 2026
088703a
fix: preserve code sample indentation on homepage
guzus Feb 9, 2026
bbb1b85
fix: restore polymarket import compatibility for CI
guzus Feb 9, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion .claude/settings.local.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@
"Bash(uv add:*)",
"Bash(uv sync:*)",
"Bash(find:*)",
"WebFetch(domain:docs.kalshi.com)"
"WebFetch(domain:docs.kalshi.com)",
"Bash(git rebase:*)",
"Bash(gh pr view:*)",
"Bash(gh pr diff:*)",
"WebFetch(domain:docs.polymarket.com)",
"WebSearch",
"Bash(python:*)",
"WebFetch(domain:github.com)",
"Bash(bun add:*)",
"Bash(ln:*)",
"Bash(grep:*)",
"Bash(bun run build:*)"
],
"deny": [],
"ask": []
Expand Down
28 changes: 28 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Environment and secrets
.env
.env.*

# Python
__pycache__/
*.py[cod]
.venv/
venv/

# IDE
.vscode/
.idea/

# Git
.git/

# Testing
.pytest_cache/
tests/

# Documentation (not needed in container)
examples/
wiki/

# Development files
.dev/
.claude/
6 changes: 6 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
POLYMARKET_PRIVATE_KEY=0x1234567890abcdef...
POLYMARKET_FUNDER=0xYourFunderAddressHere

# Polymarket Builder API (for CTF operations: split/merge/redeem)
# Get these from Polymarket's Builder API
BUILDER_API_KEY=your-builder-api-key
BUILDER_SECRET=your-builder-secret-base64
BUILDER_PASS_PHRASE=your-builder-passphrase

# Opinion Trading Configuration
OPINION_API_KEY=your_api_key_here
OPINION_PRIVATE_KEY=0x1234567890abcdef...
Expand Down
33 changes: 33 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Dr. Manhattan MCP Server - SSE Transport
# For Railway deployment

FROM python:3.13-slim

WORKDIR /app

# Install uv for fast dependency management (per CLAUDE.md rule 3)
RUN pip install --no-cache-dir uv

# Copy dependency files first (layer caching optimization)
COPY pyproject.toml README.md ./

# Install dependencies before copying code (changes to code won't invalidate this layer)
RUN uv pip install --system ".[mcp]"

# Copy source code (this layer changes frequently)
COPY dr_manhattan/ ./dr_manhattan/

# Expose port (Railway will set PORT env var)
EXPOSE 8080

# Environment defaults
ENV PORT=8080
ENV LOG_LEVEL=INFO
ENV HOST=0.0.0.0

# Health check using Python (curl not available in python:slim)
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \
CMD python -c "import urllib.request; urllib.request.urlopen('http://localhost:8080/health')" || exit 1

# Run SSE server
CMD ["python", "-m", "dr_manhattan.mcp.server_sse"]
39 changes: 36 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,23 @@ dr_manhattan/
│ ├── websocket.py # WebSocket base class
│ └── errors.py # Exception hierarchy
├── exchanges/ # Exchange implementations
│ ├── polymarket.py
│ ├── polymarket_ws.py
│ ├── polymarket/ # Polymarket (mixin-based package) → [detailed docs](dr_manhattan/exchanges/polymarket/README.md)
│ │ ├── __init__.py # Unified Polymarket class
│ │ ├── polymarket_core.py # Constants, init, request helpers
│ │ ├── polymarket_clob.py # CLOB API (orders, positions)
│ │ ├── polymarket_gamma.py # Gamma API (markets, events, search)
│ │ ├── polymarket_data.py # Data API (trades, analytics)
│ │ ├── polymarket_ctf.py # CTF (split/merge/redeem)
│ │ ├── polymarket_ws.py # Market/User WebSocket
│ │ ├── polymarket_ws_ext.py # Sports/RTDS WebSocket
│ │ ├── polymarket_builder.py # Builder API
│ │ └── polymarket_operator.py # Operator API
│ ├── kalshi.py
│ ├── opinion.py
│ ├── limitless.py
│ ├── limitless_ws.py
│ └── predictfun.py
│ ├── predictfun.py
│ └── predictfun_ws.py
├── models/ # Data models
│ ├── market.py
│ ├── order.py
Expand Down Expand Up @@ -210,6 +221,28 @@ Add to Claude Desktop config (`~/Library/Application Support/Claude/claude_deskt
}
```

#### Remote Server (No Installation Required)

Connect to the hosted MCP server via SSE. No private keys needed - uses Polymarket Builder profile:

```json
{
"mcpServers": {
"dr-manhattan": {
"type": "sse",
"url": "https://dr-manhattan-mcp-production.up.railway.app/sse",
"headers": {
"X-Polymarket-Api-Key": "your_api_key",
"X-Polymarket-Api-Secret": "your_api_secret",
"X-Polymarket-Passphrase": "your_passphrase"
}
}
}
}
```

**Note:** Remote server supports Polymarket trading only. Other exchanges are read-only for security. See [wiki/mcp/remote-server.md](wiki/mcp/remote-server.md) for details.

After restarting, you can:
- "Show my Polymarket balance"
- "Find active prediction markets"
Expand Down
4 changes: 4 additions & 0 deletions dr_manhattan/exchanges/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
from .limitless import Limitless
from .opinion import Opinion
from .polymarket import Polymarket
from .polymarket.polymarket_builder import PolymarketBuilder
from .polymarket.polymarket_operator import PolymarketOperator
from .predictfun import PredictFun

__all__ = [
"Polymarket",
"PolymarketBuilder",
"PolymarketOperator",
"Limitless",
"Opinion",
"PredictFun",
Expand Down
Loading