@ghostspeak/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/README.md +331 -0
- package/dist/index.js +6073 -0
- package/package.json +53 -0
package/README.md
ADDED
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
# GhostSpeak MCP Server
|
|
2
|
+
|
|
3
|
+
**Model Context Protocol (MCP) server for GhostSpeak agent discovery and claiming**
|
|
4
|
+
|
|
5
|
+
This standalone MCP server exposes GhostSpeak's agent discovery functionality to any MCP-compatible client, including ElizaOS, Claude Desktop, OpenAI Assistants, and custom LangChain agents.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **search_discovered_agents**: Search for agents discovered on-chain but not yet claimed
|
|
10
|
+
- **claim_agent**: Claim ownership of a discovered agent (with cryptographic ownership validation)
|
|
11
|
+
- **get_discovery_stats**: Get current statistics about agent discovery
|
|
12
|
+
- **Resource**: `discovery://stats` for real-time discovery statistics
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
bun install
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
### Running Locally
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Development mode
|
|
26
|
+
bun run dev
|
|
27
|
+
|
|
28
|
+
# Production mode
|
|
29
|
+
bun run build
|
|
30
|
+
bun run start
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### Environment Variables
|
|
34
|
+
|
|
35
|
+
Required:
|
|
36
|
+
- `NEXT_PUBLIC_CONVEX_URL`: Convex backend URL (e.g., `https://lovely-cobra-639.convex.cloud`)
|
|
37
|
+
|
|
38
|
+
Example `.env`:
|
|
39
|
+
```bash
|
|
40
|
+
NEXT_PUBLIC_CONVEX_URL=https://lovely-cobra-639.convex.cloud
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## MCP Protocol
|
|
44
|
+
|
|
45
|
+
This server implements the Model Context Protocol specification (2025-11-25).
|
|
46
|
+
|
|
47
|
+
### Tools
|
|
48
|
+
|
|
49
|
+
#### `search_discovered_agents`
|
|
50
|
+
|
|
51
|
+
Search for agents discovered on-chain.
|
|
52
|
+
|
|
53
|
+
**Input:**
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"status": "discovered", // optional: "discovered" | "claimed" | "verified"
|
|
57
|
+
"limit": 20 // optional: 1-100
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
**Output:**
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"agents": [
|
|
65
|
+
{
|
|
66
|
+
"ghostAddress": "5eLbn3wj3iScc2fVH8hyNGRBttDTY5rZpeGk1rcjLek2",
|
|
67
|
+
"status": "discovered",
|
|
68
|
+
"discoverySource": "x402_payment",
|
|
69
|
+
"firstSeenTimestamp": 1735862400000,
|
|
70
|
+
"slot": 12345678
|
|
71
|
+
}
|
|
72
|
+
],
|
|
73
|
+
"stats": {
|
|
74
|
+
"total": 52,
|
|
75
|
+
"totalDiscovered": 52,
|
|
76
|
+
"totalClaimed": 0,
|
|
77
|
+
"totalVerified": 0
|
|
78
|
+
},
|
|
79
|
+
"count": 52,
|
|
80
|
+
"timestamp": 1735862400000
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
#### `claim_agent`
|
|
85
|
+
|
|
86
|
+
Claim ownership of a discovered agent.
|
|
87
|
+
|
|
88
|
+
**Security**: The `agentAddress` MUST match `claimedBy` wallet address. Users can only claim agents they own.
|
|
89
|
+
|
|
90
|
+
**Input:**
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"agentAddress": "5eLbn3wj3iScc2fVH8hyNGRBttDTY5rZpeGk1rcjLek2",
|
|
94
|
+
"claimedBy": "5eLbn3wj3iScc2fVH8hyNGRBttDTY5rZpeGk1rcjLek2"
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Output (success):**
|
|
99
|
+
```json
|
|
100
|
+
{
|
|
101
|
+
"success": true,
|
|
102
|
+
"message": "Successfully claimed agent 5eLbn3wj...",
|
|
103
|
+
"agentAddress": "5eLbn3wj3iScc2fVH8hyNGRBttDTY5rZpeGk1rcjLek2",
|
|
104
|
+
"claimedBy": "5eLbn3wj3iScc2fVH8hyNGRBttDTY5rZpeGk1rcjLek2",
|
|
105
|
+
"discoverySource": "x402_payment",
|
|
106
|
+
"firstSeen": 1735862400000,
|
|
107
|
+
"claimedAt": 1735862500000,
|
|
108
|
+
"nextSteps": [
|
|
109
|
+
"Register your agent on-chain",
|
|
110
|
+
"Start building Ghost Score",
|
|
111
|
+
"Enable x402 payments",
|
|
112
|
+
"Earn verifiable credentials"
|
|
113
|
+
]
|
|
114
|
+
}
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
**Output (ownership failure):**
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"success": false,
|
|
121
|
+
"error": "Ownership verification failed",
|
|
122
|
+
"message": "You can only claim agents you own...",
|
|
123
|
+
"agentAddress": "5eLbn3wj...",
|
|
124
|
+
"claimedBy": "7xKXtYZ3..."
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
#### `get_discovery_stats`
|
|
129
|
+
|
|
130
|
+
Get current discovery statistics.
|
|
131
|
+
|
|
132
|
+
**Input:** `{}` (no parameters)
|
|
133
|
+
|
|
134
|
+
**Output:**
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"stats": {
|
|
138
|
+
"total": 52,
|
|
139
|
+
"totalDiscovered": 52,
|
|
140
|
+
"totalClaimed": 0,
|
|
141
|
+
"totalVerified": 0
|
|
142
|
+
},
|
|
143
|
+
"timestamp": 1735862400000
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Resources
|
|
148
|
+
|
|
149
|
+
#### `discovery://stats`
|
|
150
|
+
|
|
151
|
+
Real-time discovery statistics (read-only resource).
|
|
152
|
+
|
|
153
|
+
**Format:** `application/json`
|
|
154
|
+
|
|
155
|
+
**Content:**
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"total": 52,
|
|
159
|
+
"totalDiscovered": 52,
|
|
160
|
+
"totalClaimed": 0,
|
|
161
|
+
"totalVerified": 0
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Integration Examples
|
|
166
|
+
|
|
167
|
+
### ElizaOS Agent
|
|
168
|
+
|
|
169
|
+
Use with `@elizaos/plugin-mcp`:
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
import mcpPlugin from '@elizaos/plugin-mcp'
|
|
173
|
+
|
|
174
|
+
export const ghostspeakPlugin: Plugin = {
|
|
175
|
+
name: 'ghostspeak-plugin',
|
|
176
|
+
plugins: [mcpPlugin],
|
|
177
|
+
|
|
178
|
+
settings: {
|
|
179
|
+
mcp: {
|
|
180
|
+
servers: {
|
|
181
|
+
ghostspeak: {
|
|
182
|
+
command: 'bunx',
|
|
183
|
+
args: ['@ghostspeak/mcp-server'],
|
|
184
|
+
env: {
|
|
185
|
+
NEXT_PUBLIC_CONVEX_URL: process.env.NEXT_PUBLIC_CONVEX_URL,
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Claude Desktop
|
|
195
|
+
|
|
196
|
+
Add to `claude_desktop_config.json`:
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"mcpServers": {
|
|
201
|
+
"ghostspeak": {
|
|
202
|
+
"command": "bunx",
|
|
203
|
+
"args": ["@ghostspeak/mcp-server"],
|
|
204
|
+
"env": {
|
|
205
|
+
"NEXT_PUBLIC_CONVEX_URL": "https://lovely-cobra-639.convex.cloud"
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
### Custom MCP Client
|
|
213
|
+
|
|
214
|
+
```typescript
|
|
215
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js'
|
|
216
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'
|
|
217
|
+
|
|
218
|
+
const client = new Client({
|
|
219
|
+
name: 'my-agent',
|
|
220
|
+
version: '1.0.0'
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
const transport = new StdioClientTransport({
|
|
224
|
+
command: 'bunx',
|
|
225
|
+
args: ['@ghostspeak/mcp-server'],
|
|
226
|
+
env: {
|
|
227
|
+
NEXT_PUBLIC_CONVEX_URL: 'https://lovely-cobra-639.convex.cloud'
|
|
228
|
+
}
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
await client.connect(transport)
|
|
232
|
+
|
|
233
|
+
// Call tools
|
|
234
|
+
const result = await client.callTool({
|
|
235
|
+
name: 'search_discovered_agents',
|
|
236
|
+
arguments: { status: 'discovered', limit: 10 }
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
console.log(result)
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## Testing
|
|
243
|
+
|
|
244
|
+
### Using MCP Inspector
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Install MCP Inspector
|
|
248
|
+
npm install -g @modelcontextprotocol/inspector
|
|
249
|
+
|
|
250
|
+
# Run server with inspector
|
|
251
|
+
bunx @modelcontextprotocol/inspector bunx @ghostspeak/mcp-server
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
Open the inspector UI to interactively test tools and resources.
|
|
255
|
+
|
|
256
|
+
### Manual Testing
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
# Start server
|
|
260
|
+
NEXT_PUBLIC_CONVEX_URL=https://lovely-cobra-639.convex.cloud bun run dev
|
|
261
|
+
|
|
262
|
+
# Server will output to stderr:
|
|
263
|
+
# 🚀 GhostSpeak MCP Server running
|
|
264
|
+
# 📡 Convex URL: https://lovely-cobra-639.convex.cloud
|
|
265
|
+
# 🔧 Available tools: search_discovered_agents, claim_agent, get_discovery_stats
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
## Security Model
|
|
269
|
+
|
|
270
|
+
### Ownership Validation
|
|
271
|
+
|
|
272
|
+
The `claim_agent` tool enforces strict ownership validation:
|
|
273
|
+
|
|
274
|
+
1. **Agent address MUST equal claimed-by address**: Users can only claim agents matching their authenticated wallet
|
|
275
|
+
2. **No cross-wallet claiming**: Cannot claim agents owned by other wallets
|
|
276
|
+
3. **Cryptographic proof**: Frontend authentication uses Ed25519 signature verification (via Convex `signInWithSolana`)
|
|
277
|
+
4. **Session-based auth**: Session tokens issued only after signature verification
|
|
278
|
+
|
|
279
|
+
### Future Enhancements
|
|
280
|
+
|
|
281
|
+
- OAuth-based authorization flow
|
|
282
|
+
- Rate limiting for tool calls
|
|
283
|
+
- Audit logging for claim operations
|
|
284
|
+
- Multi-signature support for enterprise agents
|
|
285
|
+
|
|
286
|
+
## Architecture
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
MCP Client (ElizaOS/Claude/etc.)
|
|
290
|
+
│
|
|
291
|
+
│ JSON-RPC 2.0
|
|
292
|
+
│
|
|
293
|
+
â–¼
|
|
294
|
+
MCP Server (stdio)
|
|
295
|
+
│
|
|
296
|
+
│ ConvexHttpClient
|
|
297
|
+
│
|
|
298
|
+
â–¼
|
|
299
|
+
Convex Database
|
|
300
|
+
(ghostDiscovery)
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
## Development
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
# Install dependencies
|
|
307
|
+
bun install
|
|
308
|
+
|
|
309
|
+
# Type check
|
|
310
|
+
bun run type-check
|
|
311
|
+
|
|
312
|
+
# Build
|
|
313
|
+
bun run build
|
|
314
|
+
|
|
315
|
+
# Run locally
|
|
316
|
+
bun run dev
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
## Contributing
|
|
320
|
+
|
|
321
|
+
This MCP server is part of the GhostSpeak monorepo. See the main repository for contribution guidelines.
|
|
322
|
+
|
|
323
|
+
## License
|
|
324
|
+
|
|
325
|
+
MIT
|
|
326
|
+
|
|
327
|
+
## Links
|
|
328
|
+
|
|
329
|
+
- [Model Context Protocol Specification](https://modelcontextprotocol.io/specification/2025-11-25)
|
|
330
|
+
- [MCP TypeScript SDK](https://github.com/modelcontextprotocol/typescript-sdk)
|
|
331
|
+
- [GhostSpeak Documentation](https://ghostspeak.ai/docs)
|