An interactive AI agent built with the Claude Agent SDK that lets you explore Polymarket prediction markets through a chat interface.
This agent uses the polymarket-mcp server to interact with Polymarket. You can ask questions about markets, search for specific predictions, get price data, and save results to files.
- Node.js >= 18.0.0
- polymarket-mcp server built and available at
/Volumes/Lexar/repos/polymarket-mcp/dist/index.js - Anthropic API key configured
npm installBuild and run the agent:
npm run build # Compile TypeScript
npm start # Run the agentOr use the dev script:
npm run dev # Build and run in one commandThe agent runs in interactive chat mode:
Polymarket Agent - Interactive Mode
====================================
Ask me anything about Polymarket prediction markets.
Type 'quit' or 'exit' to end the session.
You: What are the current box office prediction markets?
Assistant: [responds with market data]
You: Save those to a file called markets.json
Assistant: [saves the data]
You: quit
Goodbye!
- "Search for markets about the 2024 election"
- "What's the current price for [market name]?"
- "Get details about market ID xyz"
- "Find all active box office markets and save them to a JSON file"
The agent is configured in src/agent.ts:
- Model:
claude-opus-4-5-20251101 - MCP Server: polymarket-mcp (stdio transport)
- Tools: Read, Write, Glob, Grep, AskUserQuestion
polymarket-agent/
├── src/
│ └── agent.ts # Agent source code
├── dist/ # Compiled JavaScript
├── package.json
├── tsconfig.json
└── README.md
MIT