@champz-llc/legends-mcp-server 1.1.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.
Files changed (4) hide show
  1. package/PUBLISHING.md +257 -0
  2. package/README.md +127 -0
  3. package/index.js +257 -0
  4. package/package.json +39 -0
package/PUBLISHING.md ADDED
@@ -0,0 +1,257 @@
1
+ # Publishing to npm - Step by Step Guide
2
+
3
+ ## Prerequisites
4
+
5
+ 1. **npm account**: Create one at https://www.npmjs.com/signup
6
+ 2. **Email verified**: npm will send verification email
7
+ 3. **Node.js installed**: Version 18+ required
8
+
9
+ ---
10
+
11
+ ## Step 1: Create npm Account (If you don't have one)
12
+
13
+ 1. Go to https://www.npmjs.com/signup
14
+ 2. Fill in:
15
+ - Username: `champz` (or your preferred username)
16
+ - Email: Your email
17
+ - Password: Strong password
18
+ 3. Verify your email
19
+
20
+ ---
21
+
22
+ ## Step 2: Login to npm via CLI
23
+
24
+ Open terminal in the `legends-mcp-server` directory:
25
+
26
+ ```bash
27
+ npm login
28
+ ```
29
+
30
+ Enter:
31
+ - Username: Your npm username
32
+ - Password: Your npm password
33
+ - Email: Your npm email
34
+
35
+ You should see: `Logged in as <username> on https://registry.npmjs.org/`
36
+
37
+ ---
38
+
39
+ ## Step 3: Test Package Locally
40
+
41
+ Before publishing, test that everything works:
42
+
43
+ ```bash
44
+ # Install dependencies
45
+ npm install
46
+
47
+ # Test the server
48
+ node index.js
49
+ ```
50
+
51
+ The server should start without errors.
52
+
53
+ ---
54
+
55
+ ## Step 4: Check Package Name Availability
56
+
57
+ Our package name is: `@champz/legends-mcp-server`
58
+
59
+ Check if it's available:
60
+ ```bash
61
+ npm view @champz/legends-mcp-server
62
+ ```
63
+
64
+ If you get "404 Not Found" → Name is available ✅
65
+ If you get package info → Name is taken ❌ (choose different name)
66
+
67
+ **Note**: Scoped packages (starting with `@`) require npm organization or paid account, OR you can publish as public:
68
+
69
+ ### Option A: Use scoped package (requires npm org)
70
+ - Package name: `@champz/legends-mcp-server`
71
+ - You'll need to create "champz" organization on npm
72
+ - Create org at: https://www.npmjs.com/org/create
73
+
74
+ ### Option B: Use unscoped package (free, easier)
75
+ - Package name: `legends-mcp-server` (without @champz/)
76
+ - Change in package.json: `"name": "legends-mcp-server"`
77
+
78
+ **Recommendation**: Start with Option B (unscoped) for simplicity, migrate to scoped later if needed.
79
+
80
+ ---
81
+
82
+ ## Step 5: Publish Package
83
+
84
+ ### For Scoped Package (@champz/legends-mcp-server):
85
+
86
+ ```bash
87
+ npm publish --access public
88
+ ```
89
+
90
+ The `--access public` flag is required for scoped packages.
91
+
92
+ ### For Unscoped Package (legends-mcp-server):
93
+
94
+ ```bash
95
+ npm publish
96
+ ```
97
+
98
+ ---
99
+
100
+ ## Step 6: Verify Publication
101
+
102
+ 1. Check npm website:
103
+ - Scoped: https://www.npmjs.com/package/@champz/legends-mcp-server
104
+ - Unscoped: https://www.npmjs.com/package/legends-mcp-server
105
+
106
+ 2. Test installation:
107
+ ```bash
108
+ # In a different directory
109
+ npm install -g @champz/legends-mcp-server
110
+ # or
111
+ npm install -g legends-mcp-server
112
+ ```
113
+
114
+ 3. Test execution:
115
+ ```bash
116
+ npx @champz/legends-mcp-server
117
+ # or
118
+ npx legends-mcp-server
119
+ ```
120
+
121
+ ---
122
+
123
+ ## Step 7: Update Version (For Future Updates)
124
+
125
+ When you make changes and want to publish an update:
126
+
127
+ ```bash
128
+ # Increment version (patch: 1.1.0 → 1.1.1)
129
+ npm version patch
130
+
131
+ # Or minor version (1.1.0 → 1.2.0)
132
+ npm version minor
133
+
134
+ # Or major version (1.1.0 → 2.0.0)
135
+ npm version major
136
+
137
+ # Then publish again
138
+ npm publish --access public
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Users Installing Your Package
144
+
145
+ Once published, other users can install with:
146
+
147
+ ### Global Installation:
148
+ ```bash
149
+ npm install -g @champz/legends-mcp-server
150
+ ```
151
+
152
+ ### Use with npx (no installation):
153
+ ```bash
154
+ npx @champz/legends-mcp-server
155
+ ```
156
+
157
+ ### Claude Desktop Configuration:
158
+
159
+ Users add to `claude_desktop_config.json`:
160
+
161
+ ```json
162
+ {
163
+ "mcpServers": {
164
+ "legends-champz": {
165
+ "command": "npx",
166
+ "args": ["@champz/legends-mcp-server"]
167
+ }
168
+ }
169
+ }
170
+ ```
171
+
172
+ **Config File Locations**:
173
+
174
+ **Windows (Standard)**: `%APPDATA%\Claude\claude_desktop_config.json`
175
+ - Full path: `C:\Users\[username]\AppData\Roaming\Claude\claude_desktop_config.json`
176
+
177
+ **Windows (Microsoft Store)**: `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
178
+ - Full path: `C:\Users\[username]\AppData\Local\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
179
+
180
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
181
+
182
+ **How to check which version**: If your Claude was installed from Microsoft Store, use the second Windows path.
183
+
184
+ ---
185
+
186
+ ## Common Issues
187
+
188
+ ### Issue 1: "You do not have permission to publish"
189
+ **Solution**: Make sure you're logged in with `npm login`
190
+
191
+ ### Issue 2: "Package name too similar to existing package"
192
+ **Solution**: Choose a more unique name
193
+
194
+ ### Issue 3: "You must verify your email"
195
+ **Solution**: Check your email and verify npm account
196
+
197
+ ### Issue 4: "Payment required for scoped packages"
198
+ **Solution**: Either:
199
+ - Create an npm organization (free for public packages)
200
+ - Use unscoped package name instead
201
+ - Publish with `--access public` flag
202
+
203
+ ---
204
+
205
+ ## Package Maintenance
206
+
207
+ ### Update README on npm:
208
+ Just publish a new version - npm automatically updates README from your package.
209
+
210
+ ### Deprecate a version:
211
+ ```bash
212
+ npm deprecate @champz/legends-mcp-server@1.1.0 "Use version 1.2.0 instead"
213
+ ```
214
+
215
+ ### Unpublish (within 72 hours):
216
+ ```bash
217
+ npm unpublish @champz/legends-mcp-server@1.1.0
218
+ ```
219
+
220
+ **Warning**: Unpublishing is permanent and discouraged. Use deprecate instead.
221
+
222
+ ---
223
+
224
+ ## Promotion
225
+
226
+ Once published, promote your package:
227
+
228
+ 1. **Tweet about it**: Tag @buildonbase, @jessepollak, @AnthropicAI
229
+ 2. **Post on Farcaster**: Share in /base channel
230
+ 3. **Add to Base MCP directory**: Submit to https://mcp.base.org
231
+ 4. **Update game website**: Add "Use with Claude Desktop" section
232
+
233
+ ---
234
+
235
+ ## Quick Checklist
236
+
237
+ Before publishing:
238
+ - [ ] package.json has correct name, version, description
239
+ - [ ] README.md is complete and helpful
240
+ - [ ] .npmignore excludes dev files
241
+ - [ ] Code tested and working
242
+ - [ ] npm account created and verified
243
+ - [ ] Logged in via `npm login`
244
+ - [ ] Version incremented (if updating)
245
+
246
+ Ready to publish!
247
+
248
+ ```bash
249
+ npm publish --access public
250
+ ```
251
+
252
+ ---
253
+
254
+ **Status**: Ready to publish
255
+ **Package**: @champz/legends-mcp-server
256
+ **Version**: 1.1.0
257
+ **License**: MIT
package/README.md ADDED
@@ -0,0 +1,127 @@
1
+ # 🍄 Legends of Champz MCP Server
2
+
3
+ **Query game stats and manage rewards through Claude Desktop using Model Context Protocol**
4
+
5
+ Built for [Legends of Champz](https://legends.champz.world) - a blockchain-based battle game on Base L2.
6
+
7
+ ## ✨ Features
8
+
9
+ - 📊 **Global Game Statistics** - Real-time stats (legends rolled, CHAMPZ burned, battles, rewards)
10
+ - 💰 **Reward Checking** - Check claimable CHAMPZ and USDC rewards
11
+ - ⚡ **Base L2 Integration** - Execute on-chain claims via smart contracts
12
+ - 🤖 **Conversational Interface** - Natural language queries through Claude Desktop
13
+
14
+ ## 🚀 Installation
15
+
16
+ ### Option 1: Global Install (Recommended)
17
+
18
+ ```bash
19
+ npm install -g @champz-llc/legends-mcp-server
20
+ ```
21
+
22
+ ### Option 2: Use with npx (No installation)
23
+
24
+ ```bash
25
+ npx @champz-llc/legends-mcp-server
26
+ ```
27
+
28
+ ## ⚙️ Configuration
29
+
30
+ Add to your Claude Desktop config file:
31
+
32
+ **Windows (Standard Install)**: `%APPDATA%\Claude\claude_desktop_config.json`
33
+ **Windows (Microsoft Store)**: `%LOCALAPPDATA%\Packages\Claude_pzs8sxrjxfjjc\LocalCache\Roaming\Claude\claude_desktop_config.json`
34
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
35
+
36
+ **Tip**: If you're unsure which version you have, check both locations. The Microsoft Store version has `Packages\Claude_` in the path.
37
+
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "legends-champz": {
42
+ "command": "npx",
43
+ "args": ["@champz-llc/legends-mcp-server"]
44
+ }
45
+ }
46
+ }
47
+ ```
48
+
49
+ **Restart Claude Desktop** after saving.
50
+
51
+ ## 📖 Usage Examples
52
+
53
+ Once configured, you can ask Claude:
54
+
55
+ ### Global Statistics
56
+ - "What are the global stats for Legends of Champz?"
57
+ - "How many legends have been rolled?"
58
+ - "How much CHAMPZ has been burned?"
59
+ - "How much USDC has been distributed to players?"
60
+
61
+ ### Reward Management
62
+ - "Check my claimable rewards in Legends"
63
+ - "Get my CHAMPZ claim data"
64
+ - "Show me my USDC rewards"
65
+
66
+ ## 🛠️ Available Tools
67
+
68
+ ### `legends_global_stats`
69
+ Get real-time global game statistics.
70
+
71
+ **Returns**:
72
+ - Legends rolled
73
+ - Thrones claimed
74
+ - CHAMPZ earned/spent/burned
75
+ - USDC distributed
76
+ - Total battles
77
+ - Battles today
78
+
79
+ ### `check_legends_rewards`
80
+ Check claimable rewards (demo data).
81
+
82
+ ### `get_champz_claim_data`
83
+ Get contract call data for claiming CHAMPZ tokens.
84
+
85
+ ### `get_usdc_claim_data`
86
+ Get contract call data for claiming USDC rewards.
87
+
88
+ ## 📡 API Endpoints
89
+
90
+ The server connects to:
91
+ - **Global Stats**: `https://api.champz.world/game/spore-trainer/global-stats`
92
+ - **Rewards**: (Coming soon - player-specific endpoints)
93
+
94
+ ## 🔧 Development
95
+
96
+ ```bash
97
+ # Clone repository
98
+ git clone https://github.com/champz/legends-mcp-server.git
99
+ cd legends-mcp-server
100
+
101
+ # Install dependencies
102
+ npm install
103
+
104
+ # Run locally
105
+ npm start
106
+ ```
107
+
108
+ ## 🎮 About Legends of Champz
109
+
110
+ Legends of Champz is a blockchain-based battle game on Base L2 featuring:
111
+ - 20,000 unique mushroom warrior NFTs
112
+ - Ghost PvP battles with point-based resolution
113
+ - Guardian king-of-the-hill mechanics
114
+ - CHAMPZ token + USDC rewards
115
+ - Cycle-based gameplay (12-hour cycles)
116
+
117
+ **Play now**: https://legends.champz.world
118
+
119
+ ## 🔗 Links
120
+
121
+ - **Game**: https://legends.champz.world
122
+ - **Base MCP**: https://mcp.base.org
123
+ - **Contest**: BuildOnBase X (Twitter)
124
+
125
+ ## 📄 License
126
+
127
+ MIT - Created for Base MCP demo contest
package/index.js ADDED
@@ -0,0 +1,257 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
4
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
5
+ import {
6
+ CallToolRequestSchema,
7
+ ListToolsRequestSchema,
8
+ } from '@modelcontextprotocol/sdk/types.js';
9
+ import fetch from 'node-fetch';
10
+
11
+ // Hardcoded rewards data for demo
12
+ const DEMO_WALLET = '0xfbc159e35f56580d5d297af18a8c19f83d66088a';
13
+
14
+ const REWARDS_DATA = {
15
+ wallet: DEMO_WALLET,
16
+ champz_claims: [
17
+ {
18
+ token_name: 'CHAMPZ',
19
+ amount_human: '8,423 CHAMPZ',
20
+ contract: '0x50b868CdeAEBe6e4a3bF0cb24Df1B4d24Fff01CB',
21
+ function_name: 'claim',
22
+ parameters: {
23
+ recipient: DEMO_WALLET,
24
+ amount: '842300000000', // 8423 * 10^8 (8 decimals)
25
+ claimType: '18',
26
+ nonce: '16320',
27
+ signature: '0x957f074e39a7a3819dac5d6b4a851aa4e5d5898a0ec6bbda0b070654d25d0e080cbecc2cb188f28d824dee604e04f5a81466c70d247fa4fe90d9bf812db220281b'
28
+ },
29
+ abi_function: 'function claim(address recipient, uint256 amount, uint8 claimType, uint256 nonce, bytes signature)'
30
+ }
31
+ ],
32
+ usdc_claims: [
33
+ {
34
+ token_name: 'USDC',
35
+ amount_human: '11 USDC',
36
+ contract: '0x7058895cC9150a283743C1bB35E17817A9A299e7',
37
+ function_name: 'claimReward',
38
+ claim_type: 8,
39
+ parameters: {
40
+ recipient: DEMO_WALLET,
41
+ amount: '11000000', // 11 * 10^6 (6 decimals)
42
+ cycle: '41',
43
+ nonce: '16319',
44
+ signature: '0x1cca70ee94eeec714ecdebffbd0707b514098423b36c5281bacf5e4dc1fba5ba5d7d80970b1537da851abd963c77486e171b63c8e0b3fcafa53c0433b747b9dc1c'
45
+ },
46
+ abi_function: 'function claimReward(address recipient, uint256 amount, uint256 cycle, uint256 nonce, bytes signature)'
47
+ }
48
+ ],
49
+ summary: {
50
+ total_champz: 8423,
51
+ total_usdc: 11,
52
+ message: 'You have 8,423 CHAMPZ tokens and 11 USDC ready to claim from Legends of Champz!'
53
+ }
54
+ };
55
+
56
+ // ABIs for contract interactions
57
+ const CHAMPZ_REWARDS_ABI = [
58
+ {
59
+ "inputs": [
60
+ { "name": "recipient", "type": "address" },
61
+ { "name": "amount", "type": "uint256" },
62
+ { "name": "claimType", "type": "uint8" },
63
+ { "name": "nonce", "type": "uint256" },
64
+ { "name": "signature", "type": "bytes" }
65
+ ],
66
+ "name": "claim",
67
+ "outputs": [],
68
+ "stateMutability": "nonpayable",
69
+ "type": "function"
70
+ }
71
+ ];
72
+
73
+ const USDC_REWARDS_ABI = [
74
+ {
75
+ "inputs": [
76
+ { "name": "recipient", "type": "address" },
77
+ { "name": "amount", "type": "uint256" },
78
+ { "name": "cycle", "type": "uint256" },
79
+ { "name": "nonce", "type": "uint256" },
80
+ { "name": "signature", "type": "bytes" }
81
+ ],
82
+ "name": "claimReward",
83
+ "outputs": [],
84
+ "stateMutability": "nonpayable",
85
+ "type": "function"
86
+ }
87
+ ];
88
+
89
+ const server = new Server(
90
+ {
91
+ name: 'legends-rewards-server',
92
+ version: '1.0.0',
93
+ },
94
+ {
95
+ capabilities: {
96
+ tools: {},
97
+ },
98
+ }
99
+ );
100
+
101
+ // List available tools
102
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
103
+ return {
104
+ tools: [
105
+ {
106
+ name: 'legends_global_stats',
107
+ description: 'Get overall Legends of Champz game statistics including total legends rolled, CHAMPZ burned, USDC distributed, total battles, and more',
108
+ inputSchema: {
109
+ type: 'object',
110
+ properties: {},
111
+ required: []
112
+ },
113
+ },
114
+ {
115
+ name: 'check_legends_rewards',
116
+ description: 'Check claimable rewards in Legends of Champz game. Returns pending CHAMPZ tokens and USDC claims with contract details.',
117
+ inputSchema: {
118
+ type: 'object',
119
+ properties: {},
120
+ required: []
121
+ },
122
+ },
123
+ {
124
+ name: 'get_champz_claim_data',
125
+ description: 'Get complete contract call data for claiming CHAMPZ tokens (includes ABI, parameters, signature)',
126
+ inputSchema: {
127
+ type: 'object',
128
+ properties: {},
129
+ required: []
130
+ },
131
+ },
132
+ {
133
+ name: 'get_usdc_claim_data',
134
+ description: 'Get complete contract call data for claiming USDC rewards (includes ABI, parameters, signature)',
135
+ inputSchema: {
136
+ type: 'object',
137
+ properties: {},
138
+ required: []
139
+ },
140
+ }
141
+ ],
142
+ };
143
+ });
144
+
145
+ // Handle tool calls
146
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
147
+ const { name } = request.params;
148
+
149
+ switch (name) {
150
+ case 'legends_global_stats':
151
+ try {
152
+ const response = await fetch('https://api.champz.world/game/spore-trainer/global-stats');
153
+ const data = await response.json();
154
+
155
+ if (!data.success) {
156
+ throw new Error('Failed to fetch global stats');
157
+ }
158
+
159
+ const stats = data.stats;
160
+ const formattedStats = `Legends of Champz - Global Statistics
161
+
162
+ 🎲 Legends Rolled: ${stats.trainers_rolled.toLocaleString()}
163
+ 👑 Thrones Claimed: ${stats.thrones_claimed}
164
+ 🍄 CHAMPZ Earned: ${(stats.champz_earned / 100000000).toLocaleString()} tokens
165
+ 💸 CHAMPZ Spent: ${(stats.champz_spent / 100000000).toLocaleString()} tokens
166
+ 🔥 CHAMPZ Burned: ${(stats.champz_burned / 100000000).toLocaleString()} tokens
167
+ 💵 USDC Distributed: $${stats.usdc_distributed.toLocaleString()}
168
+ ⚔️ Total Battles: ${stats.battles_total.toLocaleString()}
169
+ 🎯 Battles Today: ${stats.battles_today.toLocaleString()}
170
+
171
+ Last updated: ${new Date(stats.cached_at * 1000).toLocaleString()}`;
172
+
173
+ return {
174
+ content: [
175
+ {
176
+ type: 'text',
177
+ text: formattedStats,
178
+ },
179
+ ],
180
+ };
181
+ } catch (error) {
182
+ return {
183
+ content: [
184
+ {
185
+ type: 'text',
186
+ text: `Error fetching global stats: ${error.message}`,
187
+ },
188
+ ],
189
+ };
190
+ }
191
+
192
+ case 'check_legends_rewards':
193
+ return {
194
+ content: [
195
+ {
196
+ type: 'text',
197
+ text: `Legends of Champz - Claimable Rewards\n\n${REWARDS_DATA.summary.message}\n\nDetails:\n- CHAMPZ: ${REWARDS_DATA.champz_claims[0].amount_human}\n- USDC: ${REWARDS_DATA.usdc_claims[0].amount_human}\n\nBoth claims are ready to execute on Base L2.`,
198
+ },
199
+ ],
200
+ };
201
+
202
+ case 'get_champz_claim_data':
203
+ return {
204
+ content: [
205
+ {
206
+ type: 'text',
207
+ text: JSON.stringify({
208
+ claim_type: 'CHAMPZ Tokens',
209
+ contract_address: REWARDS_DATA.champz_claims[0].contract,
210
+ chain: 'Base (8453)',
211
+ amount: REWARDS_DATA.champz_claims[0].amount_human,
212
+ contract_call: {
213
+ function: 'claim',
214
+ parameters: REWARDS_DATA.champz_claims[0].parameters,
215
+ abi: CHAMPZ_REWARDS_ABI
216
+ }
217
+ }, null, 2),
218
+ },
219
+ ],
220
+ };
221
+
222
+ case 'get_usdc_claim_data':
223
+ return {
224
+ content: [
225
+ {
226
+ type: 'text',
227
+ text: JSON.stringify({
228
+ claim_type: 'USDC Rewards',
229
+ contract_address: REWARDS_DATA.usdc_claims[0].contract,
230
+ chain: 'Base (8453)',
231
+ amount: REWARDS_DATA.usdc_claims[0].amount_human,
232
+ contract_call: {
233
+ function: 'claim',
234
+ parameters: REWARDS_DATA.usdc_claims[0].parameters,
235
+ abi: USDC_REWARDS_ABI
236
+ }
237
+ }, null, 2),
238
+ },
239
+ ],
240
+ };
241
+
242
+ default:
243
+ throw new Error(`Unknown tool: ${name}`);
244
+ }
245
+ });
246
+
247
+ // Start server
248
+ async function main() {
249
+ const transport = new StdioServerTransport();
250
+ await server.connect(transport);
251
+ console.error('Legends of Champz MCP server running');
252
+ }
253
+
254
+ main().catch((error) => {
255
+ console.error('Server error:', error);
256
+ process.exit(1);
257
+ });
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@champz-llc/legends-mcp-server",
3
+ "version": "1.1.0",
4
+ "description": "MCP server for Legends of Champz - Query game stats and claim rewards through Claude Desktop",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "bin": {
8
+ "legends-mcp-server": "index.js"
9
+ },
10
+ "scripts": {
11
+ "start": "node index.js"
12
+ },
13
+ "keywords": [
14
+ "mcp",
15
+ "claude",
16
+ "base",
17
+ "blockchain",
18
+ "gaming",
19
+ "web3",
20
+ "legends-of-champz"
21
+ ],
22
+ "author": "Champz",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/champz/legends-mcp-server.git"
27
+ },
28
+ "bugs": {
29
+ "url": "https://github.com/champz/legends-mcp-server/issues"
30
+ },
31
+ "homepage": "https://legends.champz.world",
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "dependencies": {
36
+ "@modelcontextprotocol/sdk": "^1.0.0",
37
+ "node-fetch": "^3.3.2"
38
+ }
39
+ }