@battlegrid/mcp-server 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 +21 -0
- package/README.md +152 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +163 -0
- package/dist/index.js.map +1 -0
- package/package.json +54 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 BattleGrid
|
|
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,152 @@
|
|
|
1
|
+
# @battlegrid/mcp-server
|
|
2
|
+
|
|
3
|
+
Play crypto prediction games on [BattleGrid](https://battlegrid.gg) directly from AI agents. This MCP server connects your agent to BattleGrid's platform — analyze markets, make predictions, and compete on leaderboards.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
1. **Get an API key** at [battlegrid.gg](https://battlegrid.gg) → Profile → MCP tab
|
|
8
|
+
2. **Add to your MCP client** (see below)
|
|
9
|
+
3. **Ask your agent**: *"Play a free Market Grid game for me"*
|
|
10
|
+
|
|
11
|
+
## Setup
|
|
12
|
+
|
|
13
|
+
### Claude Desktop
|
|
14
|
+
|
|
15
|
+
Add to your Claude Desktop MCP settings:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"battlegrid": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["-y", "@battlegrid/mcp-server"],
|
|
23
|
+
"env": {
|
|
24
|
+
"BATTLEGRID_API_KEY": "bg_live_your_key_here"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Claude Code
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
claude mcp add battlegrid \
|
|
35
|
+
--transport stdio \
|
|
36
|
+
-- npx -y @battlegrid/mcp-server \
|
|
37
|
+
--env BATTLEGRID_API_KEY=bg_live_your_key_here
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Cursor
|
|
41
|
+
|
|
42
|
+
In **Settings > MCP**, click **Add new MCP server**:
|
|
43
|
+
|
|
44
|
+
```json
|
|
45
|
+
{
|
|
46
|
+
"mcpServers": {
|
|
47
|
+
"battlegrid": {
|
|
48
|
+
"command": "npx",
|
|
49
|
+
"args": ["-y", "@battlegrid/mcp-server"],
|
|
50
|
+
"env": {
|
|
51
|
+
"BATTLEGRID_API_KEY": "bg_live_your_key_here"
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Windsurf / Other MCP Clients
|
|
59
|
+
|
|
60
|
+
Any client supporting stdio transport:
|
|
61
|
+
|
|
62
|
+
| Setting | Value |
|
|
63
|
+
|---------|-------|
|
|
64
|
+
| **Command** | `npx` |
|
|
65
|
+
| **Args** | `-y @battlegrid/mcp-server` |
|
|
66
|
+
| **Env** | `BATTLEGRID_API_KEY=bg_live_your_key_here` |
|
|
67
|
+
|
|
68
|
+
## Alternative: Direct Remote Connection
|
|
69
|
+
|
|
70
|
+
If you prefer connecting directly without npm (no Node.js required):
|
|
71
|
+
|
|
72
|
+
| Setting | Value |
|
|
73
|
+
|---------|-------|
|
|
74
|
+
| **URL** | `https://mcp.battlegrid.trade` |
|
|
75
|
+
| **Transport** | `streamable-http` |
|
|
76
|
+
| **Auth Header** | `Authorization: Bearer bg_live_your_key_here` |
|
|
77
|
+
|
|
78
|
+
## Environment Variables
|
|
79
|
+
|
|
80
|
+
| Variable | Required | Description |
|
|
81
|
+
|----------|----------|-------------|
|
|
82
|
+
| `BATTLEGRID_API_KEY` | Yes | Your API key (starts with `bg_live_`) |
|
|
83
|
+
| `BATTLEGRID_API_URL` | No | Override server URL (default: `https://mcp.battlegrid.trade`) |
|
|
84
|
+
|
|
85
|
+
## What You Get
|
|
86
|
+
|
|
87
|
+
### 23 Tools
|
|
88
|
+
|
|
89
|
+
| Category | Tools |
|
|
90
|
+
|----------|-------|
|
|
91
|
+
| **Market Grid** (7) | `list_market_grid_sessions`, `get_market_grid_session`, `check_market_grid_submission`, `submit_market_grid`, `update_market_grid`, `get_market_grid_results`, `get_market_grid_player_grid` |
|
|
92
|
+
| **Coin Grid** (6) | `list_coin_grid_sessions`, `get_coin_grid_session`, `check_coin_grid_submission`, `submit_coin_grid`, `get_coin_grid_results`, `get_coin_grid_player_grid` |
|
|
93
|
+
| **Account** (3) | `get_account_balance`, `get_user_profile`, `get_user_stats` |
|
|
94
|
+
| **Leaderboard** (3) | `get_leaderboard`, `get_market_grid_leaderboard`, `get_hall_of_fame` |
|
|
95
|
+
| **Market Data** (4) | `get_coin_overview`, `get_recent_candles`, `get_top_ranked_coins`, `list_game_presets` |
|
|
96
|
+
|
|
97
|
+
### 5 Prompts
|
|
98
|
+
|
|
99
|
+
| Prompt | Description |
|
|
100
|
+
|--------|-------------|
|
|
101
|
+
| `play-market-grid` | Full game workflow: find session, research coins, submit predictions |
|
|
102
|
+
| `play-coin-grid` | Coin Grid game workflow |
|
|
103
|
+
| `analyze-market` | Deep market analysis for a coin or broad overview |
|
|
104
|
+
| `check-performance` | Review stats, rankings, recent results |
|
|
105
|
+
| `strategy-guide` | Learn game rules and strategies |
|
|
106
|
+
|
|
107
|
+
### 3 Resources
|
|
108
|
+
|
|
109
|
+
| Resource | URI |
|
|
110
|
+
|----------|-----|
|
|
111
|
+
| Game Rules | `battlegrid://rules/overview` |
|
|
112
|
+
| Grid Format | `battlegrid://reference/grid-format` |
|
|
113
|
+
| Quick Start | `battlegrid://guide/quick-start` |
|
|
114
|
+
|
|
115
|
+
## How It Works
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
Your MCP Client (Claude, Cursor, etc.)
|
|
119
|
+
|
|
|
120
|
+
| stdio (local process)
|
|
121
|
+
v
|
|
122
|
+
@battlegrid/mcp-server (this package)
|
|
123
|
+
|
|
|
124
|
+
| streamable-http (authenticated)
|
|
125
|
+
v
|
|
126
|
+
https://mcp.battlegrid.trade
|
|
127
|
+
(23 tools + 5 prompts + 3 resources)
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
This package is a thin proxy — it connects to BattleGrid's remote server and re-exposes all capabilities over stdio. Tools, prompts, and resources auto-sync with the server. No package updates needed when new features launch.
|
|
131
|
+
|
|
132
|
+
## Paid Games
|
|
133
|
+
|
|
134
|
+
1. Enable signer policy at **Profile > MCP** tab
|
|
135
|
+
2. Agent calls `submit_market_grid` — server handles payment automatically
|
|
136
|
+
3. Daily limits: 50 operations, $500 USD per day
|
|
137
|
+
|
|
138
|
+
Free games work immediately — no signer policy needed.
|
|
139
|
+
|
|
140
|
+
## Troubleshooting
|
|
141
|
+
|
|
142
|
+
| Problem | Solution |
|
|
143
|
+
|---------|----------|
|
|
144
|
+
| `BATTLEGRID_API_KEY is required` | Set the environment variable in your MCP config |
|
|
145
|
+
| `API key must start with "bg_live_"` | Create a new key at Profile > MCP tab |
|
|
146
|
+
| `Cannot connect to BattleGrid server` | Check internet connection; verify `https://mcp.battlegrid.trade/health` |
|
|
147
|
+
| `Invalid or revoked API key` | Create a new key at Profile > MCP tab |
|
|
148
|
+
| Agent doesn't know game rules | Game instructions are auto-delivered on connect |
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @battlegrid/mcp-server — stdio proxy to BattleGrid's remote MCP server
|
|
4
|
+
*
|
|
5
|
+
* Reads BATTLEGRID_API_KEY from environment, connects to the remote BattleGrid
|
|
6
|
+
* MCP server via Streamable HTTP, and re-exposes all tools, prompts, and
|
|
7
|
+
* resources over stdio transport for local MCP clients.
|
|
8
|
+
*
|
|
9
|
+
* Architecture: Matches Stripe's @stripe/mcp pattern — thin authenticated proxy.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* BATTLEGRID_API_KEY=bg_live_... npx @battlegrid/mcp-server
|
|
13
|
+
*
|
|
14
|
+
* Environment Variables:
|
|
15
|
+
* BATTLEGRID_API_KEY (required) — Your BattleGrid API key (starts with bg_live_)
|
|
16
|
+
* BATTLEGRID_API_URL (optional) — Override server URL (default: https://mcp.battlegrid.trade)
|
|
17
|
+
*/
|
|
18
|
+
export declare const VERSION = "1.0.0";
|
|
19
|
+
export declare const DEFAULT_URL = "https://mcp.battlegrid.trade";
|
|
20
|
+
export interface EnvConfig {
|
|
21
|
+
apiKey: string;
|
|
22
|
+
apiUrl: string;
|
|
23
|
+
}
|
|
24
|
+
export declare function validateEnv(env: Record<string, string | undefined>): EnvConfig;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;AAeH,eAAO,MAAM,OAAO,UAAU,CAAC;AAC/B,eAAO,MAAM,WAAW,iCAAiC,CAAC;AAM1D,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,GAAG,SAAS,CAmB9E"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @battlegrid/mcp-server — stdio proxy to BattleGrid's remote MCP server
|
|
4
|
+
*
|
|
5
|
+
* Reads BATTLEGRID_API_KEY from environment, connects to the remote BattleGrid
|
|
6
|
+
* MCP server via Streamable HTTP, and re-exposes all tools, prompts, and
|
|
7
|
+
* resources over stdio transport for local MCP clients.
|
|
8
|
+
*
|
|
9
|
+
* Architecture: Matches Stripe's @stripe/mcp pattern — thin authenticated proxy.
|
|
10
|
+
*
|
|
11
|
+
* Usage:
|
|
12
|
+
* BATTLEGRID_API_KEY=bg_live_... npx @battlegrid/mcp-server
|
|
13
|
+
*
|
|
14
|
+
* Environment Variables:
|
|
15
|
+
* BATTLEGRID_API_KEY (required) — Your BattleGrid API key (starts with bg_live_)
|
|
16
|
+
* BATTLEGRID_API_URL (optional) — Override server URL (default: https://mcp.battlegrid.trade)
|
|
17
|
+
*/
|
|
18
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
19
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
20
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
21
|
+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
|
22
|
+
import { ListToolsRequestSchema, CallToolRequestSchema, ListPromptsRequestSchema, GetPromptRequestSchema, ListResourcesRequestSchema, ReadResourceRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
23
|
+
export const VERSION = '1.0.0';
|
|
24
|
+
export const DEFAULT_URL = 'https://mcp.battlegrid.trade';
|
|
25
|
+
const MAX_RETRIES = 3;
|
|
26
|
+
const RETRY_DELAYS_MS = [2000, 4000, 8000];
|
|
27
|
+
export function validateEnv(env) {
|
|
28
|
+
const apiKey = env.BATTLEGRID_API_KEY;
|
|
29
|
+
const apiUrl = env.BATTLEGRID_API_URL || DEFAULT_URL;
|
|
30
|
+
if (!apiKey) {
|
|
31
|
+
throw new Error('BATTLEGRID_API_KEY environment variable is required.\n' +
|
|
32
|
+
'Get your API key at: https://battlegrid.gg → Profile → MCP tab');
|
|
33
|
+
}
|
|
34
|
+
if (!apiKey.startsWith('bg_live_')) {
|
|
35
|
+
throw new Error('API key must start with "bg_live_"\n' +
|
|
36
|
+
'Create a new key at: https://battlegrid.gg → Profile → MCP tab');
|
|
37
|
+
}
|
|
38
|
+
return { apiKey, apiUrl };
|
|
39
|
+
}
|
|
40
|
+
// --- Connection with retry ---
|
|
41
|
+
function isAuthError(error) {
|
|
42
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
43
|
+
return message.includes('401') || message.includes('Unauthorized') || message.includes('403');
|
|
44
|
+
}
|
|
45
|
+
function sleep(ms) {
|
|
46
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
47
|
+
}
|
|
48
|
+
async function connectWithRetry(client, transport, apiUrl) {
|
|
49
|
+
for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {
|
|
50
|
+
try {
|
|
51
|
+
await client.connect(transport);
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
// Auth errors should not be retried — the key is wrong
|
|
56
|
+
if (isAuthError(error)) {
|
|
57
|
+
throw new Error('Invalid or revoked API key.\n' +
|
|
58
|
+
'Create a new key at: https://battlegrid.gg → Profile → MCP tab');
|
|
59
|
+
}
|
|
60
|
+
if (attempt === MAX_RETRIES) {
|
|
61
|
+
throw new Error(`Cannot connect to BattleGrid server at ${apiUrl} after ${MAX_RETRIES + 1} attempts.\n` +
|
|
62
|
+
`Check your internet connection or verify the server is running.\n` +
|
|
63
|
+
`Health check: ${apiUrl.replace('/mcp', '')}/health`);
|
|
64
|
+
}
|
|
65
|
+
const delay = RETRY_DELAYS_MS[attempt] ?? 8000;
|
|
66
|
+
process.stderr.write(`Connection attempt ${attempt + 1} failed, retrying in ${delay / 1000}s...\n`);
|
|
67
|
+
await sleep(delay);
|
|
68
|
+
// Recreate transport for retry (previous one may be in a broken state)
|
|
69
|
+
// Note: we can't reconnect the same transport, so we create a fresh Client+Transport
|
|
70
|
+
// on each retry in the main function instead
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// --- Main ---
|
|
75
|
+
async function main() {
|
|
76
|
+
let config;
|
|
77
|
+
try {
|
|
78
|
+
config = validateEnv(process.env);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
82
|
+
process.exit(1);
|
|
83
|
+
}
|
|
84
|
+
// Connect to remote BattleGrid MCP server with retry
|
|
85
|
+
const remoteTransport = new StreamableHTTPClientTransport(new URL(config.apiUrl), { requestInit: { headers: { Authorization: `Bearer ${config.apiKey}` } } });
|
|
86
|
+
const remoteClient = new Client({ name: 'battlegrid-proxy', version: VERSION }, { capabilities: {} });
|
|
87
|
+
try {
|
|
88
|
+
await connectWithRetry(remoteClient, remoteTransport, config.apiUrl);
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
process.stderr.write(`Error: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
// Discover remote capabilities
|
|
95
|
+
const [toolsResult, promptsResult, resourcesResult] = await Promise.all([
|
|
96
|
+
remoteClient.listTools(),
|
|
97
|
+
remoteClient.listPrompts(),
|
|
98
|
+
remoteClient.listResources(),
|
|
99
|
+
]);
|
|
100
|
+
process.stderr.write(`BattleGrid MCP: ${toolsResult.tools.length} tools, ` +
|
|
101
|
+
`${promptsResult.prompts.length} prompts, ` +
|
|
102
|
+
`${resourcesResult.resources.length} resources\n`);
|
|
103
|
+
// Create local stdio server
|
|
104
|
+
const localServer = new Server({ name: 'battlegrid', version: VERSION }, {
|
|
105
|
+
capabilities: {
|
|
106
|
+
tools: {},
|
|
107
|
+
prompts: {},
|
|
108
|
+
resources: {},
|
|
109
|
+
},
|
|
110
|
+
});
|
|
111
|
+
// --- Proxy: tools ---
|
|
112
|
+
localServer.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
113
|
+
tools: toolsResult.tools,
|
|
114
|
+
}));
|
|
115
|
+
localServer.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
116
|
+
try {
|
|
117
|
+
return await remoteClient.callTool({
|
|
118
|
+
name: request.params.name,
|
|
119
|
+
arguments: request.params.arguments,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
catch (error) {
|
|
123
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
124
|
+
return {
|
|
125
|
+
content: [{ type: 'text', text: `Error: ${message}` }],
|
|
126
|
+
isError: true,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
// --- Proxy: prompts ---
|
|
131
|
+
localServer.setRequestHandler(ListPromptsRequestSchema, async () => ({
|
|
132
|
+
prompts: promptsResult.prompts,
|
|
133
|
+
}));
|
|
134
|
+
localServer.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
135
|
+
return await remoteClient.getPrompt({
|
|
136
|
+
name: request.params.name,
|
|
137
|
+
arguments: request.params.arguments,
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
// --- Proxy: resources ---
|
|
141
|
+
localServer.setRequestHandler(ListResourcesRequestSchema, async () => ({
|
|
142
|
+
resources: resourcesResult.resources,
|
|
143
|
+
}));
|
|
144
|
+
localServer.setRequestHandler(ReadResourceRequestSchema, async (request) => {
|
|
145
|
+
return await remoteClient.readResource({
|
|
146
|
+
uri: request.params.uri,
|
|
147
|
+
});
|
|
148
|
+
});
|
|
149
|
+
// --- Start stdio transport ---
|
|
150
|
+
const stdioTransport = new StdioServerTransport();
|
|
151
|
+
await localServer.connect(stdioTransport);
|
|
152
|
+
process.stderr.write('BattleGrid MCP server running on stdio\n');
|
|
153
|
+
}
|
|
154
|
+
// Only run when executed directly (not when imported for testing)
|
|
155
|
+
const isDirectExecution = process.argv[1] &&
|
|
156
|
+
(process.argv[1].endsWith('/index.js') || process.argv[1].endsWith('/battlegrid-mcp'));
|
|
157
|
+
if (isDirectExecution) {
|
|
158
|
+
main().catch((error) => {
|
|
159
|
+
process.stderr.write(`Fatal error: ${error}\n`);
|
|
160
|
+
process.exit(1);
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,wBAAwB,EACxB,sBAAsB,EACtB,0BAA0B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 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@battlegrid/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "BattleGrid MCP server — play crypto prediction games from AI agents",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"battlegrid-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md",
|
|
13
|
+
"LICENSE"
|
|
14
|
+
],
|
|
15
|
+
"scripts": {
|
|
16
|
+
"build": "tsc",
|
|
17
|
+
"prepublishOnly": "npm run build",
|
|
18
|
+
"dev": "tsc --watch",
|
|
19
|
+
"test": "vitest run",
|
|
20
|
+
"test:watch": "vitest"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"model-context-protocol",
|
|
25
|
+
"ai",
|
|
26
|
+
"claude",
|
|
27
|
+
"cursor",
|
|
28
|
+
"battlegrid",
|
|
29
|
+
"crypto",
|
|
30
|
+
"prediction",
|
|
31
|
+
"gaming"
|
|
32
|
+
],
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@modelcontextprotocol/sdk": "^1.26.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/node": "^25.3.3",
|
|
38
|
+
"typescript": "^5.7.0",
|
|
39
|
+
"vitest": "^4.0.18"
|
|
40
|
+
},
|
|
41
|
+
"engines": {
|
|
42
|
+
"node": ">=18.0.0"
|
|
43
|
+
},
|
|
44
|
+
"license": "MIT",
|
|
45
|
+
"repository": {
|
|
46
|
+
"type": "git",
|
|
47
|
+
"url": "https://github.com/blockfer-rp/battlegrid-app",
|
|
48
|
+
"directory": "packages/mcp-server"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://battlegrid.gg",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/blockfer-rp/battlegrid-app/issues"
|
|
53
|
+
}
|
|
54
|
+
}
|