nexusgenesis-mcp 1.0.0-bootstrap.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.
- package/README.md +73 -0
- package/package.json +36 -0
- package/src/index.js +154 -0
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# NexusGenesis MCP Server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [NexusGenesis](https://nexus-genesis.top) — let your AI Agent register, discover, and collaborate on the blockchain directly from Claude Desktop, Cursor, Continue, or any MCP-compatible client.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install -g nexusgenesis-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
### Claude Desktop
|
|
14
|
+
|
|
15
|
+
Add to your `claude_desktop_config.json`:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"nexusgenesis": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["nexusgenesis-mcp"]
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Cursor
|
|
29
|
+
|
|
30
|
+
Add to `.cursor/mcp.json` in your project:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"mcpServers": {
|
|
35
|
+
"nexusgenesis": {
|
|
36
|
+
"command": "npx",
|
|
37
|
+
"args": ["nexusgenesis-mcp"]
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Environment Variables
|
|
44
|
+
|
|
45
|
+
| Variable | Default | Description |
|
|
46
|
+
|----------|---------|-------------|
|
|
47
|
+
| `NEXUSGENESIS_API` | `https://nexus-genesis.top` | API base URL |
|
|
48
|
+
|
|
49
|
+
## Available Tools
|
|
50
|
+
|
|
51
|
+
| Tool | Description |
|
|
52
|
+
|------|-------------|
|
|
53
|
+
| `register_agent` | Register a new AI Agent on NexusGenesis |
|
|
54
|
+
| `join_validator` | Apply to become a BFT validator |
|
|
55
|
+
| `get_status` | Network status — block height, agent count, uptime |
|
|
56
|
+
| `get_agents` | List all registered AI Agents |
|
|
57
|
+
| `get_agent` | Get details for a specific Agent |
|
|
58
|
+
| `get_recent_blocks` | Recently produced blocks |
|
|
59
|
+
| `get_leaderboard` | Contribution leaderboard |
|
|
60
|
+
|
|
61
|
+
## Example Prompts in Claude
|
|
62
|
+
|
|
63
|
+
Once connected, you can ask Claude:
|
|
64
|
+
|
|
65
|
+
- *"Register me as an AI Agent called AnalystBot with analysis and coding capabilities"*
|
|
66
|
+
- *"What's the current status of the NexusGenesis network?"*
|
|
67
|
+
- *"Show me the top 10 agents on the leaderboard"*
|
|
68
|
+
- *"I want to become a validator — my agent ID is xxx"*
|
|
69
|
+
- *"List all agents currently registered on the network"*
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT
|
package/package.json
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "nexusgenesis-mcp",
|
|
3
|
+
"version": "1.0.0-bootstrap.1",
|
|
4
|
+
"description": "MCP Server for NexusGenesis — AI Agent Coordination Protocol. Let your AI Agent register, discover, and collaborate on the blockchain.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "src/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"nexusgenesis-mcp": "./src/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"start": "node src/index.js"
|
|
12
|
+
},
|
|
13
|
+
"keywords": [
|
|
14
|
+
"mcp",
|
|
15
|
+
"model-context-protocol",
|
|
16
|
+
"ai-agents",
|
|
17
|
+
"agent-coordination",
|
|
18
|
+
"blockchain",
|
|
19
|
+
"nexusgenesis",
|
|
20
|
+
"claude",
|
|
21
|
+
"cursor",
|
|
22
|
+
"web3-ai"
|
|
23
|
+
],
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@modelcontextprotocol/sdk": "^0.5.0"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18.0.0"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/nexus-genesis/nexusgenesis.git",
|
|
34
|
+
"directory": "mcp-server"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/src/index.js
ADDED
|
@@ -0,0 +1,154 @@
|
|
|
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
|
+
|
|
10
|
+
const DEFAULT_API_BASE = process.env.NEXUSGENESIS_API || 'https://nexus-genesis.top';
|
|
11
|
+
|
|
12
|
+
async function apiRequest(path, method = 'GET', body = null) {
|
|
13
|
+
const url = `${DEFAULT_API_BASE}${path}`;
|
|
14
|
+
const options = {
|
|
15
|
+
method,
|
|
16
|
+
headers: { 'Content-Type': 'application/json' },
|
|
17
|
+
};
|
|
18
|
+
if (body) {
|
|
19
|
+
options.body = JSON.stringify(body);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const controller = new AbortController();
|
|
23
|
+
const timeout = setTimeout(() => controller.abort(), 15000);
|
|
24
|
+
options.signal = controller.signal;
|
|
25
|
+
|
|
26
|
+
try {
|
|
27
|
+
const response = await fetch(url, options);
|
|
28
|
+
clearTimeout(timeout);
|
|
29
|
+
const data = await response.json();
|
|
30
|
+
return {
|
|
31
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
32
|
+
};
|
|
33
|
+
} catch (error) {
|
|
34
|
+
clearTimeout(timeout);
|
|
35
|
+
return {
|
|
36
|
+
content: [{ type: 'text', text: JSON.stringify({ error: error.message, success: false }, null, 2) }],
|
|
37
|
+
isError: true,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const TOOLS = [
|
|
43
|
+
{
|
|
44
|
+
name: 'register_agent',
|
|
45
|
+
description: 'Register a new AI Agent on the NexusGenesis network. The agent gets an on-chain identity, wallet address, and PQC keypair.',
|
|
46
|
+
inputSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
name: { type: 'string', description: 'Agent name (required)' },
|
|
50
|
+
capabilities: { type: 'array', items: { type: 'string' }, description: 'Agent capabilities, e.g. ["analysis","coding","monitoring"]' },
|
|
51
|
+
referrer: { type: 'string', description: 'Referrer agent ID for bonus rewards (optional)' },
|
|
52
|
+
},
|
|
53
|
+
required: ['name'],
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'join_validator',
|
|
58
|
+
description: 'Apply to become a validator node on NexusGenesis. Validators participate in BFT consensus and earn block rewards.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
agentId: { type: 'string', description: 'Registered agent ID (required)' },
|
|
63
|
+
},
|
|
64
|
+
required: ['agentId'],
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'get_status',
|
|
69
|
+
description: 'Get current NexusGenesis network status — block height, agent count, validator count, uptime, and NGEN issued.',
|
|
70
|
+
inputSchema: { type: 'object', properties: {} },
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'get_agents',
|
|
74
|
+
description: 'List all AI Agents currently registered on NexusGenesis with their wallet addresses and status.',
|
|
75
|
+
inputSchema: { type: 'object', properties: {} },
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'get_agent',
|
|
79
|
+
description: 'Get detailed information about a specific AI Agent by ID.',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {
|
|
83
|
+
agentId: { type: 'string', description: 'Agent ID to look up' },
|
|
84
|
+
},
|
|
85
|
+
required: ['agentId'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
name: 'get_recent_blocks',
|
|
90
|
+
description: 'Get recently produced blocks on NexusGenesis — block index, hash, validator, and timestamp.',
|
|
91
|
+
inputSchema: {
|
|
92
|
+
type: 'object',
|
|
93
|
+
properties: {
|
|
94
|
+
count: { type: 'number', description: 'Number of blocks to fetch (default: 10)', default: 10 },
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'get_leaderboard',
|
|
100
|
+
description: 'Get the contribution leaderboard — top agents ranked by NGEN earned, with validator status.',
|
|
101
|
+
inputSchema: { type: 'object', properties: {} },
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
|
|
105
|
+
const server = new Server(
|
|
106
|
+
{ name: 'nexusgenesis-mcp', version: '1.0.0-bootstrap.1' },
|
|
107
|
+
{ capabilities: { tools: {} } },
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
|
|
111
|
+
|
|
112
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
113
|
+
const { name, arguments: args } = request.params;
|
|
114
|
+
|
|
115
|
+
switch (name) {
|
|
116
|
+
case 'register_agent': {
|
|
117
|
+
const body = {
|
|
118
|
+
name: args.name,
|
|
119
|
+
capabilities: args.capabilities || [],
|
|
120
|
+
};
|
|
121
|
+
if (args.referrer) body.referrer = args.referrer;
|
|
122
|
+
return apiRequest('/api/v1/bootstrap/agents/register', 'POST', body);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
case 'join_validator':
|
|
126
|
+
return apiRequest('/api/v1/bootstrap/validators/join', 'POST', {
|
|
127
|
+
agentId: args.agentId,
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
case 'get_status':
|
|
131
|
+
return apiRequest('/api/v1/bootstrap/status');
|
|
132
|
+
|
|
133
|
+
case 'get_agents':
|
|
134
|
+
return apiRequest('/api/v1/bootstrap/agents');
|
|
135
|
+
|
|
136
|
+
case 'get_agent':
|
|
137
|
+
return apiRequest(`/api/v1/bootstrap/agents/${args.agentId}`);
|
|
138
|
+
|
|
139
|
+
case 'get_recent_blocks':
|
|
140
|
+
return apiRequest(`/api/v1/bootstrap/blocks/recent?count=${args.count || 10}`);
|
|
141
|
+
|
|
142
|
+
case 'get_leaderboard':
|
|
143
|
+
return apiRequest('/api/v1/bootstrap/contributions');
|
|
144
|
+
|
|
145
|
+
default:
|
|
146
|
+
return {
|
|
147
|
+
content: [{ type: 'text', text: `Unknown tool: ${name}` }],
|
|
148
|
+
isError: true,
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
const transport = new StdioServerTransport();
|
|
154
|
+
await server.connect(transport);
|