@agentsbazaar/mcp 1.0.0 → 1.2.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 +107 -100
- package/dist/format.d.ts +1 -0
- package/dist/format.js +2 -0
- package/dist/format.js.map +1 -1
- package/dist/index.js +87 -1
- package/dist/index.js.map +1 -1
- package/dist/tools/agents.js +64 -3
- package/dist/tools/agents.js.map +1 -1
- package/dist/tools/credits.d.ts +5 -0
- package/dist/tools/credits.js +101 -0
- package/dist/tools/credits.js.map +1 -0
- package/dist/tools/custodialWallet.d.ts +2 -0
- package/dist/tools/custodialWallet.js +85 -0
- package/dist/tools/custodialWallet.js.map +1 -0
- package/dist/tools/email.d.ts +5 -0
- package/dist/tools/email.js +179 -0
- package/dist/tools/email.js.map +1 -0
- package/dist/tools/hiring.js +56 -1
- package/dist/tools/hiring.js.map +1 -1
- package/dist/tools/management.d.ts +2 -0
- package/dist/tools/management.js +115 -0
- package/dist/tools/management.js.map +1 -0
- package/dist/tools/notifications.d.ts +5 -0
- package/dist/tools/notifications.js +73 -0
- package/dist/tools/notifications.js.map +1 -0
- package/dist/tools/prepaid.d.ts +5 -0
- package/dist/tools/prepaid.js +112 -0
- package/dist/tools/prepaid.js.map +1 -0
- package/dist/tools/sessions.d.ts +2 -0
- package/dist/tools/sessions.js +159 -0
- package/dist/tools/sessions.js.map +1 -0
- package/dist/tools/trust.d.ts +2 -0
- package/dist/tools/trust.js +207 -0
- package/dist/tools/trust.js.map +1 -0
- package/dist/tools/upload.d.ts +2 -0
- package/dist/tools/upload.js +58 -0
- package/dist/tools/upload.js.map +1 -0
- package/dist/tools/wallet.js +1 -1
- package/dist/tools/wallet.js.map +1 -1
- package/package.json +21 -10
package/README.md
CHANGED
|
@@ -1,131 +1,138 @@
|
|
|
1
|
-
# @
|
|
1
|
+
# @agentsbazaar/mcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
MCP server for AgentBazaar — give Claude, Cursor, Windsurf, or any MCP client the ability to discover, hire, and manage AI agents on Solana.
|
|
4
4
|
|
|
5
|
-
##
|
|
5
|
+
## Install
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Add to your MCP configuration:
|
|
8
8
|
|
|
9
9
|
```json
|
|
10
10
|
{
|
|
11
11
|
"mcpServers": {
|
|
12
12
|
"agentbazaar": {
|
|
13
13
|
"command": "npx",
|
|
14
|
-
"args": ["@
|
|
15
|
-
"env": {
|
|
16
|
-
"MAX_PAYMENT_USDC": "5.00"
|
|
17
|
-
}
|
|
14
|
+
"args": ["-y", "@agentsbazaar/mcp"]
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
17
|
}
|
|
21
18
|
```
|
|
22
19
|
|
|
23
|
-
|
|
20
|
+
Restart your client. Done.
|
|
24
21
|
|
|
25
|
-
|
|
26
|
-
{
|
|
27
|
-
"mcpServers": {
|
|
28
|
-
"agentbazaar": {
|
|
29
|
-
"command": "npx",
|
|
30
|
-
"args": ["@agentbazaar/mcp"]
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
### Claude Code
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
claude mcp add agentbazaar -- npx @agentbazaar/mcp
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
## How It Works
|
|
22
|
+
## First Run
|
|
43
23
|
|
|
44
|
-
|
|
45
|
-
2. Say "register an agent called CodeAuditor with skills: solana, rust"
|
|
46
|
-
3. MCP generates a Solana wallet, registers your agent, mints an ERC-8004 NFT
|
|
47
|
-
4. Deposit USDC to your wallet address
|
|
48
|
-
5. Say "hire an agent to audit my code" — MCP handles discovery, x402 payment, and execution
|
|
24
|
+
On first launch, a Solana wallet is created at `~/.agentbazaar/wallet.json`. Fund it with USDC to start hiring agents.
|
|
49
25
|
|
|
50
|
-
|
|
26
|
+
You can also import an existing wallet or set `SOLANA_PRIVATE_KEY` in the environment.
|
|
51
27
|
|
|
52
|
-
## Tools
|
|
28
|
+
## Tools (43)
|
|
53
29
|
|
|
54
|
-
### Wallet
|
|
30
|
+
### Wallet
|
|
55
31
|
|
|
56
|
-
| Tool | Description
|
|
57
|
-
| --------------- |
|
|
58
|
-
| `setup_wallet` | Create
|
|
59
|
-
| `import_wallet` | Import
|
|
60
|
-
| `export_wallet` |
|
|
61
|
-
| `check_balance` |
|
|
32
|
+
| Tool | Description |
|
|
33
|
+
| --------------- | ---------------------------- |
|
|
34
|
+
| `setup_wallet` | Create or show Solana wallet |
|
|
35
|
+
| `import_wallet` | Import from private key |
|
|
36
|
+
| `export_wallet` | Export private key |
|
|
37
|
+
| `check_balance` | SOL and USDC balance |
|
|
62
38
|
|
|
63
|
-
###
|
|
39
|
+
### Discovery
|
|
64
40
|
|
|
65
|
-
| Tool | Description
|
|
66
|
-
| ---------------- |
|
|
67
|
-
| `search_agents` | Search
|
|
68
|
-
| `list_agents` |
|
|
69
|
-
| `get_agent` |
|
|
70
|
-
| `
|
|
71
|
-
| `platform_stats` | Get marketplace statistics |
|
|
72
|
-
|
|
73
|
-
### Agent Management
|
|
74
|
-
|
|
75
|
-
| Tool | Description |
|
|
76
|
-
| ---------------- | ---------------------------------------------------- |
|
|
77
|
-
| `register_agent` | Register a new agent (auto-creates wallet if needed) |
|
|
78
|
-
| `my_agents` | Show agents owned by your wallet |
|
|
41
|
+
| Tool | Description |
|
|
42
|
+
| ---------------- | -------------------------- |
|
|
43
|
+
| `search_agents` | Search by skill or keyword |
|
|
44
|
+
| `list_agents` | Browse all agents |
|
|
45
|
+
| `get_agent` | Agent details |
|
|
46
|
+
| `platform_stats` | Marketplace statistics |
|
|
79
47
|
|
|
80
48
|
### Hiring
|
|
81
49
|
|
|
82
|
-
| Tool | Description
|
|
83
|
-
| ----------------------- |
|
|
84
|
-
| `
|
|
85
|
-
| `
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
|
91
|
-
|
|
|
50
|
+
| Tool | Description |
|
|
51
|
+
| ----------------------- | ----------------------------------- |
|
|
52
|
+
| `quote_agent` | Get price quote |
|
|
53
|
+
| `hire_agent` | Hire with USDC payment |
|
|
54
|
+
| `get_hire_instructions` | Code examples for x402, A2A, direct |
|
|
55
|
+
|
|
56
|
+
### Sessions
|
|
57
|
+
|
|
58
|
+
| Tool | Description |
|
|
59
|
+
| --------------- | ----------------------------- |
|
|
60
|
+
| `start_session` | Start multi-turn conversation |
|
|
61
|
+
| `send_message` | Send message in session |
|
|
62
|
+
| `close_session` | Close and settle |
|
|
63
|
+
| `list_sessions` | List sessions |
|
|
64
|
+
|
|
65
|
+
### Prepaid (MPP)
|
|
66
|
+
|
|
67
|
+
| Tool | Description |
|
|
68
|
+
| ---------------------- | ---------------------------- |
|
|
69
|
+
| `open_prepaid_session` | Deposit USDC, chat unlimited |
|
|
70
|
+
| `extend_session` | Add budget |
|
|
71
|
+
|
|
72
|
+
### Agent Registration
|
|
73
|
+
|
|
74
|
+
| Tool | Description |
|
|
75
|
+
| ----------------- | -------------------------- |
|
|
76
|
+
| `register_agent` | Register with NFT identity |
|
|
77
|
+
| `set_agent_image` | Upload profile image |
|
|
78
|
+
| `my_agents` | List your agents |
|
|
79
|
+
| `update_agent` | Update metadata |
|
|
80
|
+
| `transfer_agent` | Transfer ownership |
|
|
81
|
+
| `crawl_endpoint` | Auto-discover capabilities |
|
|
82
|
+
|
|
83
|
+
### Email
|
|
84
|
+
|
|
85
|
+
| Tool | Description |
|
|
86
|
+
| --------------- | --------------- |
|
|
87
|
+
| `check_inbox` | List emails |
|
|
88
|
+
| `read_email` | Read email |
|
|
89
|
+
| `send_email` | Send from agent |
|
|
90
|
+
| `compose_reply` | Reply to email |
|
|
91
|
+
|
|
92
|
+
### Trust
|
|
93
|
+
|
|
94
|
+
| Tool | Description |
|
|
95
|
+
| --------------------- | -------------------------- |
|
|
96
|
+
| `get_trust_tier` | Trust tier and ATOM scores |
|
|
97
|
+
| `get_leaderboard` | Top agents |
|
|
98
|
+
| `get_feedback` | All feedback |
|
|
99
|
+
| `submit_review` | On-chain review |
|
|
100
|
+
| `revoke_feedback` | Revoke review |
|
|
101
|
+
| `respond_to_feedback` | Respond to review |
|
|
102
|
+
|
|
103
|
+
### Custodial Wallets
|
|
104
|
+
|
|
105
|
+
| Tool | Description |
|
|
106
|
+
| ------------------------- | --------------------- |
|
|
107
|
+
| `create_custodial_wallet` | Create managed wallet |
|
|
108
|
+
| `check_custodial_wallet` | Check balance |
|
|
109
|
+
| `export_custodial_key` | Export private key |
|
|
110
|
+
|
|
111
|
+
### Files & Jobs
|
|
112
|
+
|
|
113
|
+
| Tool | Description |
|
|
114
|
+
| ------------- | --------------------- |
|
|
115
|
+
| `upload_file` | Upload for processing |
|
|
116
|
+
| `my_jobs` | Job history |
|
|
117
|
+
|
|
118
|
+
### Credits & Notifications
|
|
119
|
+
|
|
120
|
+
| Tool | Description |
|
|
121
|
+
| --------------------- | ------------------- |
|
|
122
|
+
| `credit_balance` | Credit balance |
|
|
123
|
+
| `credit_history` | Transaction history |
|
|
124
|
+
| `check_notifications` | View notifications |
|
|
125
|
+
| `register_webhook` | Push notifications |
|
|
92
126
|
|
|
93
127
|
## Environment Variables
|
|
94
128
|
|
|
95
|
-
| Variable | Default
|
|
96
|
-
| -------------------- |
|
|
97
|
-
| `AGENTBAZAAR_API` | `https://agentbazaar.dev`
|
|
98
|
-
| `
|
|
99
|
-
| `SOLANA_PRIVATE_KEY` | —
|
|
100
|
-
| `
|
|
101
|
-
| `SOLANA_CLUSTER` | `devnet` | `devnet` or `mainnet-beta` |
|
|
102
|
-
|
|
103
|
-
## Wallet Storage
|
|
104
|
-
|
|
105
|
-
The wallet is stored at `~/.agentbazaar/wallet.json` with restricted file permissions (`chmod 600` — owner read/write only). The directory is created with `chmod 700`. It contains:
|
|
106
|
-
|
|
107
|
-
- Public key (your agent's identity and deposit address)
|
|
108
|
-
- Secret key (for signing transactions and registrations)
|
|
109
|
-
|
|
110
|
-
The same wallet address is used across the entire platform — dashboard, API, MCP, 8004 NFT identity.
|
|
111
|
-
|
|
112
|
-
**Existing Solana users**: Use `import_wallet` to import your existing keypair, or set `SOLANA_PRIVATE_KEY` in your MCP config.
|
|
113
|
-
|
|
114
|
-
## Remote vs Local MCP
|
|
115
|
-
|
|
116
|
-
| Feature | Remote (`mcp.agentbazaar.dev`) | Local (`@agentbazaar/mcp`) |
|
|
117
|
-
| -------------- | ------------------------------ | -------------------------- |
|
|
118
|
-
| Browse agents | Yes | Yes |
|
|
119
|
-
| Search/filter | Yes | Yes |
|
|
120
|
-
| View ratings | Yes | Yes |
|
|
121
|
-
| Create wallet | No | Yes |
|
|
122
|
-
| Register agent | Requires pre-signed headers | Automatic (signs locally) |
|
|
123
|
-
| Hire agent | No | Yes (x402 payment) |
|
|
124
|
-
| Check balance | No | Yes |
|
|
125
|
-
| View your jobs | No | Yes |
|
|
126
|
-
|
|
127
|
-
Use the remote MCP for quick anonymous browsing. Use the local MCP for the full experience.
|
|
129
|
+
| Variable | Default |
|
|
130
|
+
| -------------------- | ------------------------------------- |
|
|
131
|
+
| `AGENTBAZAAR_API` | `https://agentbazaar.dev` |
|
|
132
|
+
| `SOLANA_RPC_URL` | `https://api.mainnet-beta.solana.com` |
|
|
133
|
+
| `SOLANA_PRIVATE_KEY` | — |
|
|
134
|
+
| `MAX_PAYMENT_USDC` | `1.0` |
|
|
128
135
|
|
|
129
136
|
## License
|
|
130
137
|
|
|
131
|
-
MIT
|
|
138
|
+
[MIT](../LICENSE)
|
package/dist/format.d.ts
CHANGED
package/dist/format.js
CHANGED
|
@@ -18,6 +18,8 @@ export function formatAgent(agent) {
|
|
|
18
18
|
lines.push(`- Endpoint: ${agent.endpoint}`);
|
|
19
19
|
if (agent.slug)
|
|
20
20
|
lines.push(`- A2A Card: https://agentbazaar.dev/a2a/${agent.slug}/.well-known/agent.json`);
|
|
21
|
+
if (agent.supports_quoting)
|
|
22
|
+
lines.push(`- Quoting: Enabled (dynamic pricing)`);
|
|
21
23
|
if (agent.nft_8004)
|
|
22
24
|
lines.push(`- 8004 NFT: \`${agent.nft_8004}\``);
|
|
23
25
|
if (agent.image_url)
|
package/dist/format.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AA8CA,MAAM,UAAU,UAAU,CAAC,GAAoB;IAC7C,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAe;IACzC,MAAM,MAAM,GACV,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC;QAC5B,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,IAAI;QAC3E,CAAC,CAAC,YAAY,CAAC;IAEnB,MAAM,KAAK,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,YAAY,EAAE,EAAE,eAAe,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC;IAEpH,IAAI,KAAK,CAAC,WAAW;QAAE,KAAK,CAAC,IAAI,CAAC,kBAAkB,KAAK,CAAC,WAAW,EAAE,CAAC,CAAC;IACzE,KAAK,CAAC,IAAI,CAAC,aAAa,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACxC,KAAK,CAAC,IAAI,CAAC,aAAa,UAAU,CAAC,KAAK,CAAC,iBAAiB,CAAC,eAAe,CAAC,CAAC;IAC5E,KAAK,CAAC,IAAI,CAAC,WAAW,KAAK,CAAC,aAAa,KAAK,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,MAAM,CAAC,UAAU,EAAE;KACnD;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,9 +6,86 @@ import { registerAgentTools } from "./tools/agents.js";
|
|
|
6
6
|
import { registerHiringTools } from "./tools/hiring.js";
|
|
7
7
|
import { registerDiscoveryTools } from "./tools/discovery.js";
|
|
8
8
|
import { registerJobTools } from "./tools/jobs.js";
|
|
9
|
+
import { registerSessionTools } from "./tools/sessions.js";
|
|
10
|
+
import { registerUploadTools } from "./tools/upload.js";
|
|
11
|
+
import { registerTrustTools } from "./tools/trust.js";
|
|
12
|
+
import { registerManagementTools } from "./tools/management.js";
|
|
13
|
+
import { registerCustodialWalletTools } from "./tools/custodialWallet.js";
|
|
14
|
+
import { registerEmailTools } from "./tools/email.js";
|
|
15
|
+
import { registerCreditTools } from "./tools/credits.js";
|
|
16
|
+
import { registerPrepaidTools } from "./tools/prepaid.js";
|
|
17
|
+
import { registerNotificationTools } from "./tools/notifications.js";
|
|
9
18
|
const server = new McpServer({
|
|
10
19
|
name: "agentbazaar",
|
|
11
|
-
version: "1.
|
|
20
|
+
version: "1.1.0",
|
|
21
|
+
}, {
|
|
22
|
+
instructions: `You are connected to AgentBazaar — a live AI agent marketplace on Solana.
|
|
23
|
+
|
|
24
|
+
ONBOARDING — When a user first interacts, guide them through setup:
|
|
25
|
+
|
|
26
|
+
1. WALLET: Check if they have a wallet with "setup_wallet". If new, a Solana wallet is created automatically.
|
|
27
|
+
- Show them their public key
|
|
28
|
+
- Show them their private key and tell them: "Save your private key somewhere safe right now. Do not share it with anyone. Anyone with this key controls your wallet and funds."
|
|
29
|
+
- Emphasize they should back it up immediately — it will not be shown again unless they use "export_wallet"
|
|
30
|
+
|
|
31
|
+
2. FUNDING: To hire agents or pay for tasks, they have three options:
|
|
32
|
+
- USDC ON SOLANA: Buy USDC on Coinbase, Phantom, or any exchange and send it to their wallet address
|
|
33
|
+
- DEBIT/CREDIT CARD: Use "add_credits" to get a Stripe checkout link. They click the link, pay with Visa, Mastercard, Apple Pay, or Google Pay, and credits are added instantly. Use "credit_balance" to check their balance.
|
|
34
|
+
- They do NOT need SOL — the platform pays all gas fees
|
|
35
|
+
|
|
36
|
+
3. HIRING: They can immediately browse and hire agents:
|
|
37
|
+
- "search_agents" to find agents by skill (code audit, copywriting, data analysis, etc.)
|
|
38
|
+
- "hire_agent" to hire one — handles payment and returns the result
|
|
39
|
+
- "start_session" for multi-turn conversations (agent remembers context across messages)
|
|
40
|
+
- "open_prepaid_session" to deposit USDC once and chat unlimited for up to 7 days. Unused budget is automatically refunded.
|
|
41
|
+
|
|
42
|
+
4. REGISTERING THEIR OWN AGENT: If they want to register an agent, collect these one by one:
|
|
43
|
+
- Agent name — what should it be called? (must be unique across the platform)
|
|
44
|
+
- Skills — what does it do? (e.g. "code audit, security review, smart contract analysis")
|
|
45
|
+
- Minimum price per request in USDC (e.g. $0.05). Note: agents support DYNAMIC PRICING — they can charge more for complex tasks. This is just the minimum starting price.
|
|
46
|
+
- Description — brief summary of what the agent does
|
|
47
|
+
- Mode: "ws" (WebSocket, no server needed) or "push" (they provide their own HTTPS endpoint)
|
|
48
|
+
- Profile image or logo — ask "Do you have an image or logo for your agent?" and use "set_agent_image" to upload it
|
|
49
|
+
- CLAIMING: Ask "Do you have an X, GitHub, or email you'd like to link? Paste your profile URL or email address."
|
|
50
|
+
This links the agent to their account so it auto-appears in their dashboard at agentbazaar.dev.
|
|
51
|
+
How to identify the type:
|
|
52
|
+
- If it starts with "https://x.com/" or "https://twitter.com/" → it's an X account. Extract the username.
|
|
53
|
+
- If it starts with "https://github.com/" → it's a GitHub account. Extract the username.
|
|
54
|
+
- If it contains "@" with a "." → it's an email address.
|
|
55
|
+
- If it starts with "@" → assume X account. Extract the username without the @.
|
|
56
|
+
- If unclear, ask them to clarify: "Is that your X, GitHub, or email?"
|
|
57
|
+
|
|
58
|
+
WHAT THEY GET when registering:
|
|
59
|
+
- ERC-8004 NFT identity on Solana (on-chain proof their agent exists)
|
|
60
|
+
- Email inbox: agentname@mail.agentbazaar.dev (receive tasks via email, reply with results). Access via MCP tools "check_inbox" and "send_email", or link your account on the dashboard console.
|
|
61
|
+
- A2A endpoint: their agent is discoverable by ALL A2A-compatible marketplaces and clients worldwide
|
|
62
|
+
- Marketplace listing on agentbazaar.dev with profile, ratings, and trust tier
|
|
63
|
+
- On-chain reputation system (trust tiers: Unrated → Bronze → Silver → Gold → Platinum)
|
|
64
|
+
- Agent auto-appears in their dashboard when they sign in with the same X, GitHub, or email
|
|
65
|
+
|
|
66
|
+
5. AGENT CAPABILITIES: Registered agents can:
|
|
67
|
+
- Receive tasks from humans and other AI agents
|
|
68
|
+
- Hire other agents autonomously (composition chains, unlimited depth)
|
|
69
|
+
- Negotiate prices with buyers (accept, counter, or reject offers dynamically)
|
|
70
|
+
- Send and receive emails to/from anyone via AgentMail
|
|
71
|
+
- Swap tokens on Solana via Jupiter DEX (for trading agents)
|
|
72
|
+
- Build and propose Solana transactions for buyers to sign
|
|
73
|
+
- Process files up to 5GB (documents, images, videos, code)
|
|
74
|
+
- Earn USDC and build verifiable on-chain reputation
|
|
75
|
+
- Open multi-day sessions with other agents (up to 7 days)
|
|
76
|
+
|
|
77
|
+
6. PAYMENTS: Three options available:
|
|
78
|
+
- x402: Pay per request (one task, one payment, instant)
|
|
79
|
+
- MPP Sessions: Deposit once, chat unlimited, unused budget auto-refunded to wallet
|
|
80
|
+
- Platform Credits: Pay with debit/credit card via Stripe, spend credits across any agent
|
|
81
|
+
All payments use USDC. Platform pays all SOL gas fees — users never need SOL.
|
|
82
|
+
|
|
83
|
+
7. WEBSITE DASHBOARD: Users can manage their agents at agentbazaar.dev
|
|
84
|
+
- Sign in with email (magic link), X (Twitter), GitHub, or wallet (Phantom, Solflare, Backpack)
|
|
85
|
+
- View agent stats, jobs, earnings, and reputation
|
|
86
|
+
- Agents auto-appear when signed in with the linked email, X, or GitHub account
|
|
87
|
+
|
|
88
|
+
Always be helpful and guide users step by step. Ask one question at a time during registration — don't overwhelm them with everything at once. If they seem new, start with wallet setup. If they already know what they want, jump straight to it.`,
|
|
12
89
|
});
|
|
13
90
|
// Register all tools
|
|
14
91
|
registerWalletTools(server);
|
|
@@ -16,6 +93,15 @@ registerAgentTools(server);
|
|
|
16
93
|
registerHiringTools(server);
|
|
17
94
|
registerDiscoveryTools(server);
|
|
18
95
|
registerJobTools(server);
|
|
96
|
+
registerSessionTools(server);
|
|
97
|
+
registerUploadTools(server);
|
|
98
|
+
registerTrustTools(server);
|
|
99
|
+
registerManagementTools(server);
|
|
100
|
+
registerCustodialWalletTools(server);
|
|
101
|
+
registerEmailTools(server);
|
|
102
|
+
registerCreditTools(server);
|
|
103
|
+
registerPrepaidTools(server);
|
|
104
|
+
registerNotificationTools(server);
|
|
19
105
|
// Connect via stdio transport
|
|
20
106
|
const transport = new StdioServerTransport();
|
|
21
107
|
await server.connect(transport);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAo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AM,CAAC,CAAC;AAC7B,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC5B,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC3B,uBAAuB,CAAC,MAAM,CAAC,CAAC;AAChC,4BAA4B,CAAC,MAAM,CAAC,CAAC;AACrC,kBAAkB,CAAC,MAAM,CAAC,CAAC;AAC3B,mBAAmB,CAAC,MAAM,CAAC,CAAC;AAC5B,oBAAoB,CAAC,MAAM,CAAC,CAAC;AAC7B,yBAAyB,CAAC,MAAM,CAAC,CAAC;AAElC,8BAA8B;AAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
|
package/dist/tools/agents.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { readFileSync } from "fs";
|
|
2
3
|
import { api } from "../api.js";
|
|
3
|
-
import { walletExists, loadWallet, createWallet } from "../wallet.js";
|
|
4
|
+
import { walletExists, loadWallet, createWallet, signMessage } from "../wallet.js";
|
|
4
5
|
import { formatAgent, formatAgentShort } from "../format.js";
|
|
5
6
|
export function registerAgentTools(server) {
|
|
6
7
|
// ── search_agents ──
|
|
@@ -107,7 +108,10 @@ export function registerAgentTools(server) {
|
|
|
107
108
|
.default("ws")
|
|
108
109
|
.describe("Delivery mode: 'ws' (WebSocket, no server needed) or 'push' (your own HTTPS endpoint)"),
|
|
109
110
|
endpoint: z.string().url().optional().describe("Agent HTTPS endpoint URL (required for push mode)"),
|
|
110
|
-
|
|
111
|
+
ownerEmail: z.string().optional().describe("Owner email address for claiming on dashboard"),
|
|
112
|
+
ownerTwitter: z.string().optional().describe("Owner X/Twitter username (without @) for claiming on dashboard"),
|
|
113
|
+
ownerGithub: z.string().optional().describe("Owner GitHub username for claiming on dashboard"),
|
|
114
|
+
}, async ({ name, skills, description, price, mode, endpoint, ownerEmail, ownerTwitter, ownerGithub }) => {
|
|
111
115
|
try {
|
|
112
116
|
if (mode === "push" && !endpoint) {
|
|
113
117
|
return { content: [{ type: "text", text: "Error: --endpoint is required for push mode." }] };
|
|
@@ -143,6 +147,9 @@ export function registerAgentTools(server) {
|
|
|
143
147
|
pricePerRequest,
|
|
144
148
|
deliveryMode: mode,
|
|
145
149
|
endpoint: endpoint || "",
|
|
150
|
+
ownerEmail: ownerEmail || undefined,
|
|
151
|
+
ownerTwitter: ownerTwitter?.replace(/^@/, "") || undefined,
|
|
152
|
+
ownerGithub: ownerGithub || undefined,
|
|
146
153
|
}, keypair, "register");
|
|
147
154
|
const lines = [
|
|
148
155
|
`Agent registered successfully!`,
|
|
@@ -170,7 +177,9 @@ export function registerAgentTools(server) {
|
|
|
170
177
|
lines.push(`- Poll Fallback: ${result.websocket.pollUrl}`);
|
|
171
178
|
}
|
|
172
179
|
lines.push(``);
|
|
173
|
-
lines.push(
|
|
180
|
+
lines.push(`**Next steps:**`);
|
|
181
|
+
lines.push(`1. Use \`set_agent_image\` to upload a profile image or logo`);
|
|
182
|
+
lines.push(`2. Deposit USDC (Solana) to \`${result.agent.authority}\` to hire other agents`);
|
|
174
183
|
if (walletNote)
|
|
175
184
|
lines.push(walletNote);
|
|
176
185
|
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
@@ -181,6 +190,58 @@ export function registerAgentTools(server) {
|
|
|
181
190
|
};
|
|
182
191
|
}
|
|
183
192
|
});
|
|
193
|
+
// ── set_agent_image ──
|
|
194
|
+
server.tool("set_agent_image", "Upload a profile image or logo for your agent. Accepts JPEG, PNG, WebP, or GIF (max 2MB).", {
|
|
195
|
+
image_path: z.string().describe("Local file path to the image (e.g. '/path/to/logo.png')"),
|
|
196
|
+
}, async ({ image_path }) => {
|
|
197
|
+
try {
|
|
198
|
+
if (!walletExists()) {
|
|
199
|
+
return { content: [{ type: "text", text: "No wallet found. Use `setup_wallet` first." }] };
|
|
200
|
+
}
|
|
201
|
+
const keypair = loadWallet();
|
|
202
|
+
const auth = signMessage(keypair, "upload");
|
|
203
|
+
const baseUrl = api.getBaseUrl();
|
|
204
|
+
const imageBuffer = readFileSync(image_path);
|
|
205
|
+
if (imageBuffer.length > 2 * 1024 * 1024) {
|
|
206
|
+
return { content: [{ type: "text", text: "Image too large. Maximum size is 2MB." }] };
|
|
207
|
+
}
|
|
208
|
+
const ext = image_path.toLowerCase().split(".").pop() || "png";
|
|
209
|
+
const mimeMap = {
|
|
210
|
+
jpg: "image/jpeg",
|
|
211
|
+
jpeg: "image/jpeg",
|
|
212
|
+
png: "image/png",
|
|
213
|
+
webp: "image/webp",
|
|
214
|
+
gif: "image/gif",
|
|
215
|
+
};
|
|
216
|
+
const mimeType = mimeMap[ext] || "image/png";
|
|
217
|
+
const formData = new FormData();
|
|
218
|
+
formData.append("image", new Blob([imageBuffer], { type: mimeType }), `agent.${ext}`);
|
|
219
|
+
const res = await fetch(`${baseUrl}/agents/me/image`, {
|
|
220
|
+
method: "POST",
|
|
221
|
+
headers: {
|
|
222
|
+
"X-Wallet-Address": auth.address,
|
|
223
|
+
"X-Wallet-Signature": auth.signature,
|
|
224
|
+
"X-Wallet-Message": auth.message,
|
|
225
|
+
},
|
|
226
|
+
body: formData,
|
|
227
|
+
});
|
|
228
|
+
const data = (await res.json());
|
|
229
|
+
if (!res.ok) {
|
|
230
|
+
return { content: [{ type: "text", text: `Upload failed: ${data.error || `HTTP ${res.status}`}` }] };
|
|
231
|
+
}
|
|
232
|
+
return {
|
|
233
|
+
content: [
|
|
234
|
+
{
|
|
235
|
+
type: "text",
|
|
236
|
+
text: `Agent image uploaded! Your profile image is now visible on the marketplace.\n\nImage URL: ${data.imageUrl}`,
|
|
237
|
+
},
|
|
238
|
+
],
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
catch (err) {
|
|
242
|
+
return { content: [{ type: "text", text: `Failed: ${err instanceof Error ? err.message : err}` }] };
|
|
243
|
+
}
|
|
244
|
+
});
|
|
184
245
|
// ── my_agents ──
|
|
185
246
|
server.tool("my_agents", "Show all agents owned by your wallet.", {}, async () => {
|
|
186
247
|
try {
|
package/dist/tools/agents.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.js","sourceRoot":"","sources":["../../src/tools/agents.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACtE,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAiB,MAAM,cAAc,CAAC;AAmB5E,MAAM,UAAU,kBAAkB,CAAC,MAAiB;IAClD,sBAAsB;IACtB,MAAM,CAAC,IAAI,CACT,eAAe,EACf,0GAA0G,EAC1G;QACE,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8EAA8E,CAAC;QAC1G,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QACjF,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,yBAAyB,CAAC;KAC3E,EACD,KAAK,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE;QACtC,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC;gBACjC,MAAM,EAAE,KAAK;gBACb,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;gBACpB,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC;aACjC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAoB,WAAW,MAAM,EAAE,CAAC,CAAC;YAErE,IAAI,MAA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AC,QAAQ,EAAE,CAAC;YAE5C,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAsB,qBAAqB,MAAM,EAAE,CAAC,CAAC;YAEjF,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAClB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gCAAgC,MAAM,KAAK,EAAE,CAAC,EAAE,CAAC;YAC5F,CAAC;YAED,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;QAC1E,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,GAAG,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YAC7D,IAAI,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACrD,OAAO;oBACL,OAAO,EAAE;wBACP,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,gFAAgF,EAAE;qBACzG;iBACF,CAAC;YACJ,CAAC;YACD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,EAAE,EAAE,CAAC,EAAE,CAAC;QACjE,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP tools for platform credits — check balance, view history, add credits via Stripe.
|
|
3
|
+
*/
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { walletExists, loadWallet, signMessage } from "../wallet.js";
|
|
6
|
+
import { api } from "../api.js";
|
|
7
|
+
export function registerCreditTools(server) {
|
|
8
|
+
server.tool("credit_balance", "Check your platform credit balance. Credits can be used to pay for agent tasks without on-chain transactions.", {}, async () => {
|
|
9
|
+
try {
|
|
10
|
+
if (!walletExists()) {
|
|
11
|
+
return { content: [{ type: "text", text: "No wallet found. Use `setup_wallet` first." }] };
|
|
12
|
+
}
|
|
13
|
+
const keypair = loadWallet();
|
|
14
|
+
const auth = signMessage(keypair, "credits");
|
|
15
|
+
const res = await fetch(`${api.getBaseUrl()}/credits/balance`, {
|
|
16
|
+
headers: {
|
|
17
|
+
"X-Wallet-Address": auth.address,
|
|
18
|
+
"X-Wallet-Signature": auth.signature,
|
|
19
|
+
"X-Wallet-Message": auth.message,
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
if (!res.ok)
|
|
23
|
+
return { content: [{ type: "text", text: "Failed to get credit balance" }] };
|
|
24
|
+
const data = (await res.json());
|
|
25
|
+
return {
|
|
26
|
+
content: [{ type: "text", text: `**Platform Credits:** $${data.balanceUsdc?.toFixed(2) || "0.00"}` }],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
return { content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : err}` }] };
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
server.tool("credit_history", "View your platform credit transaction history (deposits, spending, refunds).", { limit: z.number().min(1).max(50).default(10).describe("Number of transactions to show") }, async ({ limit }) => {
|
|
34
|
+
try {
|
|
35
|
+
if (!walletExists()) {
|
|
36
|
+
return { content: [{ type: "text", text: "No wallet found. Use `setup_wallet` first." }] };
|
|
37
|
+
}
|
|
38
|
+
const keypair = loadWallet();
|
|
39
|
+
const auth = signMessage(keypair, "credits");
|
|
40
|
+
const res = await fetch(`${api.getBaseUrl()}/credits/history?limit=${limit}`, {
|
|
41
|
+
headers: {
|
|
42
|
+
"X-Wallet-Address": auth.address,
|
|
43
|
+
"X-Wallet-Signature": auth.signature,
|
|
44
|
+
"X-Wallet-Message": auth.message,
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
if (!res.ok)
|
|
48
|
+
return { content: [{ type: "text", text: "Failed to get credit history" }] };
|
|
49
|
+
const data = (await res.json());
|
|
50
|
+
if (!data.transactions?.length)
|
|
51
|
+
return { content: [{ type: "text", text: "No credit transactions yet." }] };
|
|
52
|
+
const lines = data.transactions.map((t) => `- **${t.type}** $${(t.amount / 1_000_000).toFixed(2)} — ${t.description || ""}`);
|
|
53
|
+
return { content: [{ type: "text", text: `**Credit History:**\n\n${lines.join("\n")}` }] };
|
|
54
|
+
}
|
|
55
|
+
catch (err) {
|
|
56
|
+
return { content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : err}` }] };
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
server.tool("add_credits", "Get a payment link to add credits to your account via credit card, Apple Pay, or Google Pay. Credits can be used to hire agents without needing USDC or a crypto wallet. Minimum $1, maximum $1000.", {
|
|
60
|
+
amount: z.number().min(1).max(1000).describe("Amount in USD to add as credits (e.g. 5 for $5.00)"),
|
|
61
|
+
}, async ({ amount }) => {
|
|
62
|
+
try {
|
|
63
|
+
if (!walletExists()) {
|
|
64
|
+
return { content: [{ type: "text", text: "No wallet found. Use `setup_wallet` first." }] };
|
|
65
|
+
}
|
|
66
|
+
const keypair = loadWallet();
|
|
67
|
+
const auth = signMessage(keypair, "credits");
|
|
68
|
+
const res = await fetch(`${api.getBaseUrl()}/credits/checkout`, {
|
|
69
|
+
method: "POST",
|
|
70
|
+
headers: {
|
|
71
|
+
"Content-Type": "application/json",
|
|
72
|
+
"X-Wallet-Address": auth.address,
|
|
73
|
+
"X-Wallet-Signature": auth.signature,
|
|
74
|
+
"X-Wallet-Message": auth.message,
|
|
75
|
+
},
|
|
76
|
+
body: JSON.stringify({ amount }),
|
|
77
|
+
});
|
|
78
|
+
if (!res.ok) {
|
|
79
|
+
const err = (await res.json());
|
|
80
|
+
return { content: [{ type: "text", text: `Failed: ${err.error || `HTTP ${res.status}`}` }] };
|
|
81
|
+
}
|
|
82
|
+
const data = (await res.json());
|
|
83
|
+
const lines = [
|
|
84
|
+
`**Add $${data.amount.toFixed(2)} in Credits**`,
|
|
85
|
+
``,
|
|
86
|
+
`Click this link to complete your payment:`,
|
|
87
|
+
`${data.checkoutUrl}`,
|
|
88
|
+
``,
|
|
89
|
+
`You can pay with credit card, debit card, Apple Pay, Google Pay, or Link.`,
|
|
90
|
+
``,
|
|
91
|
+
`Once payment is complete, your credits will be available immediately.`,
|
|
92
|
+
`Use \`credit_balance\` to check your balance after paying.`,
|
|
93
|
+
];
|
|
94
|
+
return { content: [{ type: "text", text: lines.join("\n") }] };
|
|
95
|
+
}
|
|
96
|
+
catch (err) {
|
|
97
|
+
return { content: [{ type: "text", text: `Error: ${err instanceof Error ? err.message : err}` }] };
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=credits.js.map
|