guessmarket-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 GuessMarket
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,131 @@
1
+ # GuessMarket MCP Server
2
+
3
+ MCP server for [GuessMarket](https://guessmarket.com) prediction markets. Gives AI agents read access to discover markets, analyze price history, view wallet portfolios, and get smart contract ABIs for on-chain trading.
4
+
5
+ Live on 5 EVM chains: Ethereum, Base, Polygon, BSC, and PulseChain.
6
+
7
+ ## Tools
8
+
9
+ | Tool | Description |
10
+ |------|-------------|
11
+ | `list_markets` | List prediction markets with filters for status and chain |
12
+ | `get_market` | Get detailed market info: question, YES/NO odds, volume, liquidity, end time |
13
+ | `get_market_history` | Get timestamped price history for trend analysis |
14
+ | `get_networks` | Get all supported chains with contract addresses |
15
+ | `get_portfolio` | Get a wallet's trading activity across all markets |
16
+ | `get_abi` | Get smart contract ABI for building on-chain transactions |
17
+
18
+ ## Quickstart
19
+
20
+ ### Claude Desktop
21
+
22
+ Add to your `claude_desktop_config.json`:
23
+
24
+ ```json
25
+ {
26
+ "mcpServers": {
27
+ "guessmarket": {
28
+ "command": "npx",
29
+ "args": ["-y", "guessmarket-mcp"]
30
+ }
31
+ }
32
+ }
33
+ ```
34
+
35
+ ### Claude Code
36
+
37
+ Add to your project with the CLI:
38
+
39
+ ```bash
40
+ claude mcp add guessmarket -- npx -y guessmarket-mcp
41
+ ```
42
+
43
+ Or add to `.mcp.json` in your project root:
44
+
45
+ ```json
46
+ {
47
+ "mcpServers": {
48
+ "guessmarket": {
49
+ "command": "npx",
50
+ "args": ["-y", "guessmarket-mcp"]
51
+ }
52
+ }
53
+ }
54
+ ```
55
+
56
+ ### VS Code
57
+
58
+ Add to your VS Code settings or `.vscode/mcp.json`:
59
+
60
+ ```json
61
+ {
62
+ "mcp": {
63
+ "servers": {
64
+ "guessmarket": {
65
+ "command": "npx",
66
+ "args": ["-y", "guessmarket-mcp"]
67
+ }
68
+ }
69
+ }
70
+ }
71
+ ```
72
+
73
+ ## Supported Chains
74
+
75
+ | Chain | Chain ID |
76
+ |-------|----------|
77
+ | Ethereum | 1 |
78
+ | Base | 8453 |
79
+ | Polygon | 137 |
80
+ | BSC | 56 |
81
+ | PulseChain | 369 |
82
+
83
+ ## Configuration
84
+
85
+ No API keys required — the server uses the public GuessMarket REST API.
86
+
87
+ ### Custom API URL
88
+
89
+ By default the server connects to `https://guessmarket.com/wp-json/guessmarket/v1`. Override with an environment variable:
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "guessmarket": {
95
+ "command": "npx",
96
+ "args": ["-y", "guessmarket-mcp"],
97
+ "env": {
98
+ "GUESSMARKET_API_URL": "https://your-instance.com/wp-json/guessmarket/v1"
99
+ }
100
+ }
101
+ }
102
+ }
103
+ ```
104
+
105
+ ## Architecture
106
+
107
+ This server is read-only. It fetches data from the GuessMarket REST API and returns it to the AI agent. Trading happens on-chain — the agent builds and signs its own transactions using the ABIs and contract addresses provided by this server.
108
+
109
+ ```
110
+ AI Agent <--> MCP Server <--> GuessMarket REST API
111
+ |
112
+ 5 EVM Chains
113
+ (Ethereum, Base, Polygon,
114
+ BSC, PulseChain)
115
+ ```
116
+
117
+ ## Requirements
118
+
119
+ - Node.js 18 or later (uses native `fetch`)
120
+
121
+ ## Development
122
+
123
+ ```bash
124
+ npm install
125
+ npm run build
126
+ node build/index.js
127
+ ```
128
+
129
+ ## License
130
+
131
+ MIT
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * GuessMarket MCP Server
4
+ *
5
+ * Gives AI agents read access to GuessMarket prediction markets:
6
+ * discover markets, analyze prices, view portfolios, and get contract
7
+ * ABIs needed for on-chain trading.
8
+ *
9
+ * All data comes from the GuessMarket WordPress REST API.
10
+ * Trading happens on-chain — the agent signs its own transactions.
11
+ */
12
+ export {};
package/build/index.js ADDED
@@ -0,0 +1,112 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * GuessMarket MCP Server
4
+ *
5
+ * Gives AI agents read access to GuessMarket prediction markets:
6
+ * discover markets, analyze prices, view portfolios, and get contract
7
+ * ABIs needed for on-chain trading.
8
+ *
9
+ * All data comes from the GuessMarket WordPress REST API.
10
+ * Trading happens on-chain — the agent signs its own transactions.
11
+ */
12
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
13
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
14
+ import { z } from 'zod';
15
+ const API_BASE = process.env.GUESSMARKET_API_URL?.replace(/\/+$/, '') ||
16
+ 'https://guessmarket.com/wp-json/guessmarket/v1';
17
+ // ─── Helper ──────────────────────────────────────────────────────
18
+ async function api(path) {
19
+ const url = `${API_BASE}${path}`;
20
+ const res = await fetch(url, {
21
+ headers: { 'Accept': 'application/json', 'User-Agent': 'GuessMarket-MCP/1.0' },
22
+ });
23
+ if (!res.ok) {
24
+ const body = await res.text();
25
+ throw new Error(`API ${res.status}: ${body}`);
26
+ }
27
+ return res.json();
28
+ }
29
+ // ─── Server ──────────────────────────────────────────────────────
30
+ const server = new McpServer({
31
+ name: 'guessmarket',
32
+ version: '1.0.0',
33
+ });
34
+ // ─── Tool: list_markets ──────────────────────────────────────────
35
+ server.tool('list_markets', 'List prediction markets on GuessMarket. Filter by status (active/resolved/all) ' +
36
+ 'and chain_id. Returns market address, question, odds, volume, and end time.', {
37
+ status: z.enum(['active', 'resolved', 'all']).default('active').describe('Market status filter'),
38
+ chain_id: z.number().int().optional().describe('EVM chain ID to filter by (e.g. 8453 for Base)'),
39
+ page: z.number().int().default(1).describe('Page number for pagination'),
40
+ per_page: z.number().int().default(20).describe('Results per page (max 100)'),
41
+ }, async ({ status, chain_id, page, per_page }) => {
42
+ const params = new URLSearchParams();
43
+ params.set('status', status);
44
+ params.set('page', String(page));
45
+ params.set('per_page', String(Math.min(per_page, 100)));
46
+ if (chain_id)
47
+ params.set('chain_id', String(chain_id));
48
+ const data = await api(`/markets?${params}`);
49
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
50
+ });
51
+ // ─── Tool: get_market ────────────────────────────────────────────
52
+ server.tool('get_market', 'Get detailed info for a single prediction market by its contract address. ' +
53
+ 'Returns question, current YES/NO odds, volume, liquidity, end time, resolution status, and chain.', {
54
+ address: z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe('Market contract address'),
55
+ }, async ({ address }) => {
56
+ const data = await api(`/market/${address.toLowerCase()}`);
57
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
58
+ });
59
+ // ─── Tool: get_market_history ────────────────────────────────────
60
+ server.tool('get_market_history', 'Get price history for a market. Returns timestamped YES/NO price data points ' +
61
+ 'for charting and trend analysis. Optionally specify chain_id and limit.', {
62
+ address: z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe('Market contract address'),
63
+ chain_id: z.number().int().optional().describe('EVM chain ID (auto-detected if omitted)'),
64
+ limit: z.number().int().default(500).describe('Max data points to return (max 5000)'),
65
+ }, async ({ address, chain_id, limit }) => {
66
+ const params = new URLSearchParams();
67
+ if (chain_id)
68
+ params.set('chain_id', String(chain_id));
69
+ params.set('limit', String(Math.min(limit, 5000)));
70
+ const data = await api(`/markets/${address.toLowerCase()}/history?${params}`);
71
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
72
+ });
73
+ // ─── Tool: get_networks ──────────────────────────────────────────
74
+ server.tool('get_networks', 'Get all blockchain networks GuessMarket is deployed on, with contract addresses ' +
75
+ '(MarketFactory, FeeManager, Oracle, Stablecoin) for each chain. Essential for on-chain trading.', async () => {
76
+ const data = await api('/networks');
77
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
78
+ });
79
+ // ─── Tool: get_portfolio ─────────────────────────────────────────
80
+ server.tool('get_portfolio', "Get a wallet's trading activity across all GuessMarket markets. " +
81
+ 'Returns trades with market address, outcome, shares, cost, and timestamp.', {
82
+ wallet: z.string().regex(/^0x[a-fA-F0-9]{40}$/).describe('Wallet address'),
83
+ limit: z.number().int().default(50).describe('Max trades to return (max 100)'),
84
+ offset: z.number().int().default(0).describe('Offset for pagination'),
85
+ }, async ({ wallet, limit, offset }) => {
86
+ const params = new URLSearchParams();
87
+ params.set('limit', String(Math.min(limit, 100)));
88
+ params.set('offset', String(offset));
89
+ const data = await api(`/portfolio/${wallet.toLowerCase()}?${params}`);
90
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
91
+ });
92
+ // ─── Tool: get_abi ───────────────────────────────────────────────
93
+ server.tool('get_abi', 'Get the ABI (Application Binary Interface) for a GuessMarket smart contract. ' +
94
+ 'Use this to build transactions for on-chain trading. ' +
95
+ 'Valid contracts: PredictionMarket, MarketFactory, ERC20, FeeManager, Oracle, SimpleOracle.', {
96
+ contract: z
97
+ .enum(['PredictionMarket', 'MarketFactory', 'ERC20', 'FeeManager', 'Oracle', 'SimpleOracle'])
98
+ .describe('Contract name'),
99
+ }, async ({ contract }) => {
100
+ const data = await api(`/abis/${contract}`);
101
+ return { content: [{ type: 'text', text: JSON.stringify(data, null, 2) }] };
102
+ });
103
+ // ─── Start ───────────────────────────────────────────────────────
104
+ async function main() {
105
+ const transport = new StdioServerTransport();
106
+ await server.connect(transport);
107
+ console.error('GuessMarket MCP server running on stdio');
108
+ }
109
+ main().catch((err) => {
110
+ console.error('Fatal:', err);
111
+ process.exit(1);
112
+ });
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "guessmarket-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for GuessMarket prediction markets — lets AI agents discover markets, analyze prices, view portfolios, and get contract ABIs for on-chain trading across 5 EVM chains",
5
+ "type": "module",
6
+ "main": "build/index.js",
7
+ "bin": {
8
+ "guessmarket-mcp": "build/index.js"
9
+ },
10
+ "files": [
11
+ "build",
12
+ "README.md",
13
+ "LICENSE"
14
+ ],
15
+ "scripts": {
16
+ "build": "tsc",
17
+ "start": "node build/index.js",
18
+ "prepublishOnly": "npm run build"
19
+ },
20
+ "keywords": [
21
+ "mcp",
22
+ "model-context-protocol",
23
+ "prediction-markets",
24
+ "blockchain",
25
+ "ai-agent",
26
+ "defi",
27
+ "evm",
28
+ "pulsechain",
29
+ "base",
30
+ "polygon",
31
+ "ethereum",
32
+ "bsc",
33
+ "guessmarket",
34
+ "on-chain-trading"
35
+ ],
36
+ "author": "GuessMarket (https://guessmarket.com)",
37
+ "license": "MIT",
38
+ "homepage": "https://guessmarket.com",
39
+ "engines": {
40
+ "node": ">=18.0.0"
41
+ },
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.11.4",
44
+ "zod": "^3.24.0"
45
+ },
46
+ "devDependencies": {
47
+ "typescript": "^5.3.0",
48
+ "@types/node": "^20.0.0"
49
+ }
50
+ }