11# Manifold Markets MCP Server
22
3- An MCP server for interacting with Manifold Markets prediction markets. This server enables MCP clients to seamlessly interact with prediction markets, enabling collective intelligence and decision-making through market mechanisms.
4-
5- ## Features
6-
7- - Search and filter prediction markets with advanced criteria
8- - Get detailed market information and analytics
9- - Place bets and limit orders with precise probability specifications
10- - Track user positions and portfolio performance
11- - Send mana between users
12- - Manage market liquidity
13- - Cancel and sell positions
14-
15- ## Roadmap
16-
17- - [x] Market search and filtering
18- - [x] Market details and analytics
19- - [x] User profile management
20- - [x] Bet placement with limit orders
21- - [x] Position management and cancellation
22- - [x] Share selling functionality
23- - [x] Portfolio tracking
24- - [x] Liquidity provision
25- - [x] Mana transfer system
26- - [x] Basic market statistics
27-
28- Planned higher-order capabilities:
29- - [ ] Intelligent portfolio optimization and risk management
30- - [ ] Advanced market analysis with sentiment and correlations
31- - [ ] Social intelligence and expert network analysis
3+ An MCP server for interacting with Manifold Markets prediction markets. This server provides comprehensive access to Manifold's features through a clean MCP interface, enabling sophisticated market interactions and collective intelligence mechanisms.
4+
5+ ## Architecture
6+
7+ The server implements a complete mapping of Manifold Markets' API capabilities through a structured tool system:
8+
9+ ### Core Components
10+ - ** Schema Layer** : Zod-based validation schemas for all operations
11+ - ** API Integration** : Direct mapping to Manifold's REST endpoints
12+ - ** Tool Handlers** : Request processing with proper error management
13+ - ** Type Safety** : Full TypeScript implementation
14+
15+ ### Tool Categories
16+
17+ #### Market Creation & Management
18+ - ` create_market ` : Create markets (BINARY, MULTIPLE_CHOICE, PSEUDO_NUMERIC, POLL)
19+ - ` unresolve_market ` : Revert resolved markets
20+ - ` close_market ` : Close markets for trading
21+ - ` add_answer ` : Add options to multiple choice markets
22+
23+ #### Market Interaction
24+ - ` follow_market ` : Track markets of interest
25+ - ` react ` : Like/dislike markets and comments
26+ - ` add_bounty ` : Add bounties for analysis
27+ - ` award_bounty ` : Reward valuable contributions
28+
29+ #### Trading Operations
30+ - ` place_bet ` : Execute market trades
31+ - ` cancel_bet ` : Cancel limit orders
32+ - ` sell_shares ` : Liquidate positions
33+
34+ #### Liquidity Management
35+ - ` add_liquidity ` : Provide market liquidity
36+ - ` remove_liquidity ` : Withdraw provided liquidity
37+
38+ #### Information Retrieval
39+ - ` search_markets ` : Find markets with filters
40+ - ` get_market ` : Detailed market information
41+ - ` get_user ` : User profile data
42+ - ` get_positions ` : Portfolio tracking
43+
44+ #### Social Features
45+ - ` send_mana ` : Transfer mana between users
46+
47+ ## Verified Capabilities
48+
49+ The server has been tested through comprehensive interaction trajectories:
50+
51+ ### Successfully Tested
52+ 1 . Market Discovery & Following
53+ - ✅ Market search with filters
54+ - ✅ Market following
55+ - ✅ Detailed market information retrieval
56+
57+ 2 . Trading Operations
58+ - ✅ Liquidity provision
59+ - ✅ Bet placement with probability updates
60+ - ✅ Position liquidation
61+ - ✅ Share selling
62+
63+ 3 . Permission Management
64+ - ✅ Role-based access control
65+ - ✅ Authentication handling
66+ - ✅ Error messaging
67+
68+ ### Permission-Restricted Operations
69+ These operations are implemented but require specific user roles:
70+ - Market resolution/unresolving (market creator)
71+ - Market closing (market creator)
72+ - Bounty management (market creator)
73+ - Liquidity removal (liquidity provider)
3274
3375## Prerequisites
3476
3577- Node.js 18 or higher
3678- npm or yarn
37- - A Manifold Markets API key
79+ - Manifold Markets API key
80+ - Minimum M$1000 balance for market creation
3881
3982## Installation
4083
@@ -49,6 +92,7 @@ npm install manifold-mcp-server
49921 . Log in to [ Manifold Markets] ( https://manifold.markets )
50932 . Go to your profile settings
51943 . Generate an API key
95+ 4 . Ensure account has sufficient mana for intended operations
5296
5397### 3. Configure MCP Settings
5498
@@ -88,58 +132,145 @@ Add to `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude
88132}
89133```
90134
91- ### 4. Verify Installation
135+ ## Tool Documentation
92136
93- After configuring, restart your Claude client and verify the server appears in the connected MCP servers list.
137+ ### Market Creation & Management
94138
95- ## Available Tools
139+ #### create_market
140+ Create a new prediction market:
141+ ``` typescript
142+ {
143+ outcomeType : ' BINARY' | ' MULTIPLE_CHOICE' | ' PSEUDO_NUMERIC' | ' POLL' | ' BOUNTIED_QUESTION'
144+ question : string
145+ description ?: string | {
146+ type : ' doc'
147+ content : any []
148+ }
149+ closeTime ?: number // Unix timestamp ms
150+ visibility ?: ' public' | ' unlisted'
151+ initialProb ?: number // Required for BINARY (1-99)
152+ min ?: number // Required for PSEUDO_NUMERIC
153+ max ?: number // Required for PSEUDO_NUMERIC
154+ isLogScale ?: boolean
155+ initialValue ?: number // Required for PSEUDO_NUMERIC
156+ answers ?: string [] // Required for MULTIPLE_CHOICE/POLL
157+ addAnswersMode ?: ' DISABLED' | ' ONLY_CREATOR' | ' ANYONE'
158+ shouldAnswersSumToOne ?: boolean
159+ totalBounty ?: number // Required for BOUNTIED_QUESTION
160+ }
161+ ```
96162
97- ### search_markets
98- Search for prediction markets with optional filters:
99- - term: Search query
100- - limit: Max number of results (1-100)
101- - filter: 'all', 'open', 'closed', or 'resolved'
102- - sort: 'newest', 'score', or 'liquidity'
163+ #### unresolve_market
164+ Unresolve a previously resolved market:
165+ ``` typescript
166+ {
167+ contractId : string
168+ answerId ?: string // For multiple choice markets
169+ }
170+ ```
103171
104- ### get_market
105- Get detailed information about a specific market:
106- - marketId: Market ID
172+ #### close_market
173+ Close a market for trading:
174+ ``` typescript
175+ {
176+ contractId : string
177+ closeTime ?: number // Optional close time
178+ }
179+ ```
107180
108- ### get_user
109- Get user information by username:
110- - username: Username
181+ ### Market Interaction
111182
112- ### place_bet
113- Place a bet on a market:
114- - marketId: Market ID
115- - amount: Amount to bet in mana
116- - outcome: 'YES' or 'NO'
117- - limitProb: Optional limit order probability (0.01-0.99)
183+ #### follow_market
184+ Follow or unfollow a market:
185+ ``` typescript
186+ {
187+ contractId : string
188+ follow : boolean
189+ }
190+ ```
191+
192+ #### react
193+ React to markets or comments:
194+ ``` typescript
195+ {
196+ contentId : string
197+ contentType : ' comment' | ' contract'
198+ remove ?: boolean
199+ reactionType : ' like' | ' dislike'
200+ }
201+ ```
118202
119- ### cancel_bet
120- Cancel a limit order bet:
121- - betId: Bet ID to cancel
203+ ### Trading Operations
122204
123- ### sell_shares
205+ #### place_bet
206+ Place a bet on a market:
207+ ``` typescript
208+ {
209+ marketId : string
210+ amount : number
211+ outcome : ' YES' | ' NO'
212+ limitProb ?: number // 0.01-0.99
213+ }
214+ ```
215+
216+ #### sell_shares
124217Sell shares in a market:
125- - marketId: Market ID
126- - outcome: Which type of shares to sell ('YES' or 'NO', defaults to what you have)
127- - shares: How many shares to sell (defaults to all)
218+ ``` typescript
219+ {
220+ marketId : string
221+ outcome ?: ' YES' | ' NO'
222+ shares ?: number // Defaults to all
223+ }
224+ ```
225+
226+ ### Liquidity Management
227+
228+ #### add_liquidity
229+ Add liquidity to market pool:
230+ ``` typescript
231+ {
232+ marketId : string
233+ amount : number
234+ }
235+ ```
236+
237+ #### remove_liquidity
238+ Remove liquidity from market pool:
239+ ``` typescript
240+ {
241+ contractId : string
242+ amount : number
243+ }
244+ ```
245+
246+ ## Error Handling
247+
248+ The server implements comprehensive error handling:
249+
250+ 1 . Input Validation
251+ - Parameter type checking via Zod schemas
252+ - Value range validation
253+ - Required field verification
128254
129- ### add_liquidity
130- Add mana to market liquidity pool:
131- - marketId: Market ID
132- - amount: Amount of mana to add
255+ 2 . API Communication
256+ - Authentication errors
257+ - Network failures
258+ - Rate limiting
259+ - Permission checks
133260
134- ### get_positions
135- Get user positions across markets:
136- - userId: User ID
261+ 3 . Business Logic
262+ - Insufficient balance
263+ - Invalid market states
264+ - Unauthorized operations
137265
138- ### send_mana
139- Send mana to other users:
140- - toIds: Array of user IDs to send mana to
141- - amount: Amount of mana to send (min 10)
142- - message: Optional message to include
266+ 4 . Error Response Format
267+ ``` typescript
268+ {
269+ code : ErrorCode
270+ message : string
271+ details ?: any
272+ }
273+ ```
143274
144275## Development
145276
@@ -154,40 +285,25 @@ npm install
154285# Build
155286npm run build
156287
157- # Start the server
158- npm start
159-
160- # Run in development mode
161- npm run dev
162-
163288# Run tests
164289npm test
165290```
166291
167- ## Error Handling
168-
169- The server implements error handling for:
170- - Invalid parameters (type checking and validation)
171- - Missing or invalid API keys
172- - Network and API communication errors
173- - Unknown tool requests
174-
175- Additional error handling is provided by the Manifold Markets API for specific market operations.
176-
177292## Contributing
178293
179- Contributions are welcome! Please feel free to submit a Pull Request. We're particularly interested in :
180- - Additional market analysis tools
181- - Enhanced probability calibration features
182- - Integration with other prediction market platforms
183- - Improved documentation and examples
294+ Contributions welcome! Areas of interest :
295+ - Advanced market analysis tools
296+ - Portfolio optimization features
297+ - Integration with other prediction platforms
298+ - Documentation improvements
184299
185- ## Security Considerations
300+ ## Security
186301
187- - API keys are handled securely through environment variables
188- - Input validation for all parameters
302+ - API keys handled via environment variables
303+ - Input validation on all parameters
189304- Rate limiting protection
190- - Error messages don't expose sensitive information
305+ - Safe error messages
306+ - Role-based access control
191307
192308## License
193309
0 commit comments