@pmxt/mcp 2.29.0 → 2.30.1

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 PMXT
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,111 @@
1
+ # @pmxt/mcp
2
+
3
+ MCP server that exposes the [PMXT](https://pmxt.dev) unified prediction market API as tools for Claude and other AI agents.
4
+
5
+ One tool per API method. Same interface regardless of venue -- Polymarket, Kalshi, Limitless, Probable, Baozi, Myriad, Opinion, Metaculus, Smarkets, and more.
6
+
7
+ ## Quick start
8
+
9
+ Add to your Claude Desktop config (`claude_desktop_config.json`):
10
+
11
+ ```json
12
+ {
13
+ "mcpServers": {
14
+ "pmxt": {
15
+ "command": "npx",
16
+ "args": ["-y", "@pmxt/mcp"],
17
+ "env": {
18
+ "PMXT_API_KEY": "pmxt_live_..."
19
+ }
20
+ }
21
+ }
22
+ }
23
+ ```
24
+
25
+ Or run directly:
26
+
27
+ ```sh
28
+ PMXT_API_KEY=pmxt_live_... npx @pmxt/mcp
29
+ ```
30
+
31
+ Get an API key at [pmxt.dev/dashboard](https://pmxt.dev/dashboard).
32
+
33
+ ## Modes
34
+
35
+ The MCP server doesn't run prediction market logic itself -- it forwards every tool call to a PMXT API server over HTTP. Where that server lives depends on the mode:
36
+
37
+ **Hosted** -- Set `PMXT_API_KEY` and the server calls `https://api.pmxt.dev`. No local setup required; the hosted service manages exchange connections, caching, and rate limits for you.
38
+
39
+ **Local (sidecar)** -- If no API key is set, the server assumes you're running the PMXT core server locally on `http://localhost:3847`. This is useful for development, self-hosting, or when you want full control over the runtime. See the [pmxt core repo](https://github.com/pmxt-dev/pmxt) for how to run the server.
40
+
41
+ You can point at any PMXT-compatible server by setting `PMXT_API_URL` explicitly.
42
+
43
+ ## Environment variables
44
+
45
+ | Variable | Description |
46
+ |----------|-------------|
47
+ | `PMXT_API_KEY` | API key for the hosted PMXT service |
48
+ | `PMXT_API_URL` | Override the API base URL (defaults based on mode) |
49
+
50
+ ## Tools
51
+
52
+ Every tool requires an `exchange` parameter (e.g. `polymarket`, `kalshi`, `limitless`). Read-only tools are safe to call freely. Order-related tools (`createOrder`, `submitOrder`, `cancelOrder`) require explicit user confirmation -- they spend real money.
53
+
54
+ **Market discovery:** `fetchMarkets`, `fetchMarketsPaginated`, `fetchEvents`, `fetchEvent`, `fetchMarket`
55
+
56
+ **Order book & pricing:** `fetchOrderBook`, `fetchTrades`, `fetchOHLCV`, `getExecutionPrice`, `getExecutionPriceDetailed`
57
+
58
+ **Trading:** `buildOrder`, `createOrder`, `submitOrder`, `cancelOrder`
59
+
60
+ **Account:** `fetchBalance`, `fetchPositions`, `fetchOpenOrders`, `fetchClosedOrders`, `fetchAllOrders`, `fetchOrder`, `fetchMyTrades`, `loadMarkets`
61
+
62
+ ## How it works
63
+
64
+ The server translates MCP tool calls into HTTP requests to the PMXT REST API:
65
+
66
+ 1. Agent calls a tool (e.g. `fetchMarkets`) with flat `{ exchange, limit, query }` input
67
+ 2. The server reconstructs positional arguments from the flat input using embedded arg specs
68
+ 3. Sends `POST /api/{exchange}/{method}` with `{ args: [...] }` to the PMXT API
69
+ 4. Returns the JSON response to the agent
70
+
71
+ ## Auto-generation pipeline
72
+
73
+ The tool definitions in `src/generated/tools.ts` are **not hand-written**. They are generated from the PMXT core OpenAPI spec by `scripts/generate-tools.cjs`.
74
+
75
+ The full pipeline runs automatically on every PMXT release:
76
+
77
+ 1. A new version tag (`v*`) is pushed to the [pmxt core repo](https://github.com/pmxt-dev/pmxt)
78
+ 2. The [`sync-mcp.yml`](https://github.com/pmxt-dev/pmxt/blob/main/.github/workflows/sync-mcp.yml) GitHub Actions workflow triggers
79
+ 3. It clones this repo, copies the latest spec files from core into `spec/`:
80
+ - [`core/src/server/openapi.yaml`](https://github.com/pmxt-dev/pmxt/blob/main/core/src/server/openapi.yaml) -- full API spec (endpoints, parameters, response schemas)
81
+ - [`core/src/server/method-verbs.json`](https://github.com/pmxt-dev/pmxt/blob/main/core/src/server/method-verbs.json) -- HTTP verb and positional argument metadata per method
82
+ 4. Runs `node scripts/generate-tools.cjs` to regenerate `src/generated/tools.ts`
83
+ 5. Bumps `package.json` to match the core version
84
+ 6. Commits, tags, and pushes to this repo
85
+ 7. Publishes to npm with `npm publish --provenance --access public`
86
+
87
+ **What the generator does:**
88
+ - Reads both spec files
89
+ - Skips streaming/internal methods (`watchOrderBook`, `close`, `healthCheck`, etc.)
90
+ - Flattens complex parameters into flat MCP tool input schemas
91
+ - Embeds `ArgSpec` metadata so the server can reconstruct positional args at runtime
92
+ - Adds annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`) per tool
93
+ - Marks order-related tools with a `credentials` input property
94
+
95
+ To regenerate locally:
96
+
97
+ ```sh
98
+ npm run generate
99
+ ```
100
+
101
+ ## Development
102
+
103
+ ```sh
104
+ npm install
105
+ npm run generate # regenerate tools from spec/
106
+ npm run build # compile TypeScript
107
+ ```
108
+
109
+ ## License
110
+
111
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pmxt/mcp",
3
- "version": "2.29.0",
3
+ "version": "2.30.1",
4
4
  "description": "MCP server for PMXT - the unified prediction market API",
5
5
  "type": "module",
6
6
  "bin": {