@three-ws/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.
package/LICENSE ADDED
@@ -0,0 +1,180 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other transformations
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or contributory
82
+ patent infringement, then any patent licenses granted to You under
83
+ this License for that Work shall terminate as of the date such
84
+ litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or in addition to the
115
+ NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the License.
117
+
118
+ You may add Your own license statement for Your modifications and
119
+ may provide additional grant of rights to use, copy, modify, merge,
120
+ publish, distribute, sublicense, and/or sell copies of the
121
+ Derivative Works, and to permit persons to whom the Derivative Works
122
+ are furnished to do so.
123
+
124
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
125
+ any Contribution intentionally submitted for inclusion in the Work
126
+ by You to the Licensor shall be under the terms and conditions of
127
+ this License, without any additional terms or conditions.
128
+ Notwithstanding the above, nothing herein shall supersede or modify
129
+ the terms of any separate license agreement you may have executed
130
+ with Licensor regarding such Contributions.
131
+
132
+ 6. Trademarks. This License does not grant permission to use the trade
133
+ names, trademarks, service marks, or product names of the Licensor,
134
+ except as required for reasonable and customary use in describing the
135
+ origin of the Work and reproducing the content of the NOTICE file.
136
+
137
+ 7. Disclaimer of Warranty. Unless required by applicable law or
138
+ agreed to in writing, Licensor provides the Work (and each
139
+ Contributor provides its Contributions) on an "AS IS" BASIS,
140
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
141
+ implied, including, without limitation, any warranties or conditions
142
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
143
+ PARTICULAR PURPOSE. You are solely responsible for determining the
144
+ appropriateness of using or reproducing the Work and assume any
145
+ risks associated with Your exercise of permissions under this License.
146
+
147
+ 8. Limitation of Liability. In no event and under no legal theory,
148
+ whether in tort (including negligence), contract, or otherwise,
149
+ unless required by applicable law (such as deliberate and grossly
150
+ negligent acts) or agreed to in writing, shall any Contributor be
151
+ liable to You for damages, including any direct, indirect, special,
152
+ incidental, or exemplary damages of any character arising as a
153
+ result of this License or out of the use or inability to use the
154
+ Work (including but not limited to damages for loss of goodwill,
155
+ work stoppage, computer failure or malfunction, or all other
156
+ commercial damages or losses), even if such Contributor has been
157
+ advised of the possibility of such damages.
158
+
159
+ 9. Accepting Warranty or Additional Liability. While redistributing
160
+ the Work or Derivative Works thereof, You may choose to offer,
161
+ and charge a fee for, acceptance of support, warranty, indemnity,
162
+ or other liability obligations and/or rights consistent with this
163
+ License. However, in accepting such obligations, You may offer only
164
+ conditions consistent with this License.
165
+
166
+ END OF TERMS AND CONDITIONS
167
+
168
+ Copyright 2026 nirholas
169
+
170
+ Licensed under the Apache License, Version 2.0 (the "License");
171
+ you may not use this file except in compliance with the License.
172
+ You may obtain a copy of the License at
173
+
174
+ http://www.apache.org/licenses/LICENSE-2.0
175
+
176
+ Unless required by applicable law or agreed to in writing, software
177
+ distributed under the License is distributed on an "AS IS" BASIS,
178
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
179
+ See the License for the specific language governing permissions and
180
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,304 @@
1
+ <p align="center">
2
+ <a href="https://three.ws"><img src="https://three.ws/three-ws-mcp-icon.svg" alt="three.ws" width="88" height="88"></a>
3
+ </p>
4
+
5
+ <h1 align="center">@three-ws/mcp-server</h1>
6
+
7
+ <p align="center"><strong>Paid x402 MCP tools from three.ws — text/image→3D, avatars, rigging, agent reputation, and more. Settled per call in USDC.</strong></p>
8
+
9
+ <p align="center">
10
+ <a href="https://www.npmjs.com/package/@three-ws/mcp-server"><img alt="npm" src="https://img.shields.io/npm/v/@three-ws/mcp-server?logo=npm&color=cb3837"></a>
11
+ <a href="https://www.npmjs.com/package/@three-ws/mcp-server"><img alt="downloads" src="https://img.shields.io/npm/dm/@three-ws/mcp-server?color=cb3837"></a>
12
+ <img alt="license" src="https://img.shields.io/npm/l/@three-ws/mcp-server?color=3b82f6">
13
+ <a href="https://registry.modelcontextprotocol.io/?q=io.github.nirholas"><img alt="MCP Registry" src="https://img.shields.io/badge/MCP%20Registry-io.github.nirholas-7c3aed"></a>
14
+ <img alt="node" src="https://img.shields.io/node/v/@three-ws/mcp-server?color=339933&logo=node.js">
15
+ <a href="https://three.ws"><img alt="three.ws" src="https://img.shields.io/badge/built%20by-three.ws-000"></a>
16
+ </p>
17
+
18
+ <p align="center">
19
+ <a href="#quickstart-30-seconds">Quickstart</a> ·
20
+ <a href="#tools">Tools</a> ·
21
+ <a href="#environment-variables">Config</a> ·
22
+ <a href="#programmatic-client">Programmatic</a> ·
23
+ <a href="#payment-flow">Payments</a> ·
24
+ <a href="https://three.ws">three.ws</a>
25
+ </p>
26
+
27
+ ---
28
+
29
+ > Fifteen paid MCP tools from [three.ws](https://three.ws) — text/image→3D mesh generation, 3D avatars, GLB auto-rigging, pose seeds, pump.fun snapshots, ERC-8004 agent reputation, ENS/SNS resolution, agent-to-agent delegation, token sentiment, AgenC coordination reads, aixbt market intel, and a Solana vanity grinder. Each call is settled in USDC via the [x402](https://x402.org) payment protocol on Solana mainnet (`exact` scheme). No subscription, no API key — pay per call, and failed calls never bill the caller.
30
+
31
+ ---
32
+
33
+ ## Quickstart (30 seconds)
34
+
35
+ ### Claude Code
36
+
37
+ ```bash
38
+ claude mcp add 3d-agent -- npx -y @three-ws/mcp-server
39
+ ```
40
+
41
+ To also receive payments (server operators), pass the payout address as env: `claude mcp add 3d-agent -e MCP_SVM_PAYMENT_ADDRESS=YourSolanaWallet -- npx -y @three-ws/mcp-server`. Alternatively, run `/setup-mcp` in any project that includes this repo and Claude will detect your OS, collect your wallet addresses, and write the config for you.
42
+
43
+ ### Claude Desktop
44
+
45
+ Paste this into your **Claude Desktop** config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "3d-agent": {
51
+ "command": "npx",
52
+ "args": ["-y", "@three-ws/mcp-server"],
53
+ "env": {
54
+ "MCP_SVM_PAYMENT_ADDRESS": "YourSolanaWallet"
55
+ }
56
+ }
57
+ }
58
+ }
59
+ ```
60
+
61
+ Restart Claude Desktop. All tools appear immediately — no install step required.
62
+
63
+ ---
64
+
65
+ ## Tools
66
+
67
+ Every tool quotes a fixed USDC price and settles `exact` on Solana mainnet. Prices below come straight from each tool's source. Every tool also declares MCP tool annotations (`readOnlyHint`, `destructiveHint`, `idempotentHint`, `openWorldHint`) so clients can scope confirmation prompts correctly — none of these tools are destructive.
68
+
69
+ ### 3D generation
70
+
71
+ | Tool | Price | What it returns |
72
+ | ---------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
73
+ | `mesh_forge` | $0.25 | Textured 3D GLB from a **text prompt or a reference image**. Text mode runs a chain of specialist models — an IBM Granite "prompt director" rewrites the prompt into an optimized single-subject 3D spec, FLUX renders a reference image, and Microsoft TRELLIS / Tencent Hunyuan3D reconstruct the mesh. Image mode (`image_url`) reconstructs directly. Returns the durable `glbUrl`, a three.ws viewer `preview`, the `directedPrompt`, and timing. |
74
+ | `rig_mesh` | $0.20 | Auto-rig a static GLB into an animation-ready model — humanoid skeleton + per-vertex skin weights via VAST-AI UniRig. Takes a `glb_url` (e.g. `mesh_forge`'s output), returns the `riggedGlbUrl` and a three.ws pose-studio link. |
75
+ | `text_to_avatar` | $0.15 | Textured 3D GLB avatar from a text prompt or reference image URLs, driving Replicate (Hunyuan-3D 3.1 by default). Returns the GLB URL, model version, prediction id, and timing. |
76
+ | `get_pose_seed` | $0.001 | Deterministic seed + full Euler-rotation pose map (radians) for the three.ws pose-studio mannequin, matched from the in-repo preset library. Includes a `previewUrl` at `https://three.ws/pose?seed=…&preset=…`. |
77
+
78
+ ### Solana & markets
79
+
80
+ | Tool | Price | What it returns |
81
+ | ----------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
82
+ | `pump_snapshot` | $0.005 | Live token snapshot — USD price (Jupiter), 24h volume + pair (Dexscreener), mint metadata + image (pump.fun frontend-api-v3), and on-chain top-holder distribution (Solana RPC). Adds Helius DAS data when `HELIUS_API_KEY` is set. |
83
+ | `sentiment_pulse` | $0.003 | Sentiment for a Solana token: scores recent pump.fun comments (plus optional caller-supplied snippets) with the three.ws deterministic lexicon. Returns overall + per-source breakdown with examples. Pairs with `pump_snapshot`. |
84
+ | `vanity_grinder` | $0.05 | Solana keypair whose base58 address starts with `prefix` (and optionally ends with `suffix`). Returns the full base58 secret key — treat as a secret. Flat price (override with `MCP_VANITY_PRICE_USD`); a difficulty guard rejects prefixes too long to mine within the iteration cap. |
85
+ | `aixbt_intel` | $0.01 | aixbt narrative intelligence feed — recent intel items across crypto with category, description, observation count, official-source flag, and the project/ticker concerned. Optional category/chain filter. Live aixbt REST API. |
86
+ | `aixbt_projects` | $0.01 | aixbt momentum scan — projects ranked by spiking/climbing/active scores, with ticker, chain, market metrics (price, mcap, 24h volume + change), and recent intel. Filter by names or chain. Live aixbt REST API. |
87
+
88
+ ### Agents & identity
89
+
90
+ | Tool | Price | What it returns |
91
+ | ----------------------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
92
+ | `agent_reputation` | $0.01 | ERC-8004 reputation: `getReputation`, `getTotalStake`, and the latest `ReputationSubmitted` / `ReputationStaked` events from the canonical ReputationRegistry on the requested chain (default Base). Resolves `agentId` from a wallet address automatically. |
93
+ | `agent_delegate_action` | $0.01 | Send a message to a three.ws-registered agent and receive its response (it uses its configured Claude model + system prompt). Agents opted out of MCP delegation are refused. For agent-to-agent collaboration and tool composition. |
94
+ | `ens_sns_resolve` | $0.0005 | Resolve a human-readable name across **ENS** (`.eth` → Ethereum address via ethers) and **SNS** (`.sol` → Solana owner wallet via Bonfida, plus the wallet's other owned `.sol` domains). Suffix-less names are tried against both. |
95
+ | `agenc_list_tasks` | $0.001 | List every public AgenC task created by a Solana wallet — task PDA, state, reward, deadline, worker counts, reward mint. AgenC (agenc.tech, Tetsuo Corp) is a Solana task-coordination protocol. `cluster` defaults to mainnet. |
96
+ | `agenc_get_task` | $0.001 | On-chain state + lifecycle timeline of a single AgenC task. Pass `taskPda` or `{creator, taskId}` (hex or any UTF-8 label). Returns state, reward, deadline, worker counts, lifecycle events, reward mint. |
97
+ | `agenc_get_agent` | $0.001 | An AgenC agent's on-chain registration. Pass `agentPda` or `agentId` (hex or UTF-8 label). Returns authority wallet, capability bitmask, endpoint URL, status, reputation, stake, and active task count. |
98
+
99
+ ---
100
+
101
+ ## Installation
102
+
103
+ The server runs locally on your machine and speaks stdio JSON-RPC — your MCP client spawns it automatically via the `npx` command above. You do not need to `npm install` globally.
104
+
105
+ If you prefer a global install:
106
+
107
+ ```bash
108
+ npm install -g @three-ws/mcp-server
109
+ ```
110
+
111
+ Then replace `"command": "npx", "args": ["-y", "@three-ws/mcp-server"]` with `"command": "3d-agent-mcp"` in your config.
112
+
113
+ ---
114
+
115
+ ## Environment variables
116
+
117
+ ### Required
118
+
119
+ | Var | Description |
120
+ | ------------------------- | -------------------------------------------------------------------------------------------------------------------- |
121
+ | `MCP_SVM_PAYMENT_ADDRESS` | Solana USDC payout address (base58) where tools receive payment. Falls back to `X402_PAY_TO_SOLANA` / `X402_PAY_TO`. |
122
+
123
+ ### Optional
124
+
125
+ | Var | Default | Description |
126
+ | ------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------------------------ |
127
+ | `HELIUS_API_KEY` | unset | Adds Helius DAS enrichment to `pump_snapshot` |
128
+ | `SOLANA_RPC_URL` | `https://api.mainnet-beta.solana.com` | Primary Solana RPC for `pump_snapshot` / AgenC reads |
129
+ | `SOLANA_RPC_URLS` | built-in public set | **Failover** — comma-separated Solana RPCs tried in order; first healthy one answers |
130
+ | `MCP_EVM_RPC_<chainId>` | built-in public set | **Failover** — comma-separated EVM RPCs for that chain (`agent_reputation`, ENS uses chain 1) |
131
+ | `X402_FACILITATOR_URL_SOLANA` | `https://facilitator.payai.network` | Primary PayAI Solana facilitator that verifies + settles payments |
132
+ | `X402_FACILITATOR_URLS_SOLANA` | unset | **Failover** — comma-separated facilitators; earlier entries take precedence at init, a later one covers an outage |
133
+ | `X402_FACILITATOR_TOKEN_SOLANA` | unset | Bearer token for the Solana facilitator, if required |
134
+ | `X402_FEE_PAYER_SOLANA` | three.ws default | Fee payer for the settlement transaction |
135
+ | `MCP_VANITY_PRICE_USD` | `$0.05` | Flat price for `vanity_grinder` |
136
+ | `MCP_POSE_PREVIEW_BASE` | `https://three.ws/pose` | Base URL for `get_pose_seed` preview links |
137
+ | `MCP_AGENT_REP_RPC_<chainId>` | public RPC | Per-chain RPC override for `agent_reputation` (tried before the failover set) |
138
+ | `MCP_AGENT_REP_LOG_WINDOW` | `200000` | Block window for `agent_reputation` event scan |
139
+
140
+ ---
141
+
142
+ ## Claude Code slash commands
143
+
144
+ This repo ships three slash commands in `.claude/commands/` that work in any project that references this repo:
145
+
146
+ | Command | What it does |
147
+ | ------------------------ | --------------------------------------------------------------------------------------- |
148
+ | `/setup-mcp` | Detects your OS, collects wallet addresses, and writes the MCP config to the right file |
149
+ | `/scaffold-agent` | Scaffolds a new three.ws agent in the current project with MCP client wiring |
150
+ | `/use-tools [tool_name]` | Produces a complete, runnable code example for a specific paid tool |
151
+
152
+ ---
153
+
154
+ ## Programmatic client
155
+
156
+ Use `@x402/mcp`'s `wrapMCPClientWithPayment` to call these tools from another Node service. The wrapper auto-handles 402 retries:
157
+
158
+ ```js
159
+ import { Client } from '@modelcontextprotocol/sdk/client/index.js';
160
+ import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
161
+ import { wrapMCPClientWithPayment } from '@x402/mcp';
162
+ import { x402Client } from '@x402/core/client';
163
+ import { registerExactSvmScheme } from '@x402/svm/exact/client';
164
+ import { Keypair } from '@solana/web3.js';
165
+ import bs58 from 'bs58';
166
+
167
+ const transport = new StdioClientTransport({
168
+ command: 'npx',
169
+ args: ['-y', '@three-ws/mcp-server'],
170
+ env: {
171
+ // Where the server receives USDC. Your client funds payments from the
172
+ // Solana keypair below.
173
+ MCP_SVM_PAYMENT_ADDRESS: process.env.MCP_SVM_PAYMENT_ADDRESS,
174
+ },
175
+ });
176
+
177
+ const mcp = new Client({ name: 'agent', version: '1.0.0' });
178
+ await mcp.connect(transport);
179
+
180
+ // Solana mainnet, `exact` scheme — the only network/scheme these tools accept.
181
+ const payer = Keypair.fromSecretKey(bs58.decode(process.env.AGENT_SOLANA_SECRET_KEY));
182
+ const x402 = new x402Client();
183
+ registerExactSvmScheme(x402, { signer: payer });
184
+ const paid = wrapMCPClientWithPayment(mcp, x402, { autoPayment: true });
185
+
186
+ const result = await paid.callTool('get_pose_seed', { prompt: 'warrior stance' });
187
+ // Prefer MCP structured output; fall back to the text mirror for older servers.
188
+ console.log(result.structuredContent ?? JSON.parse(result.content[0].text));
189
+ ```
190
+
191
+ ---
192
+
193
+ ## Cursor
194
+
195
+ In Cursor's MCP settings (`Cursor > Settings > Features > MCP`):
196
+
197
+ ```json
198
+ {
199
+ "mcpServers": {
200
+ "3d-agent": {
201
+ "command": "npx",
202
+ "args": ["-y", "@three-ws/mcp-server"],
203
+ "env": {
204
+ "MCP_SVM_PAYMENT_ADDRESS": "YourSolanaWallet"
205
+ }
206
+ }
207
+ }
208
+ }
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Run from source
214
+
215
+ From the monorepo root:
216
+
217
+ ```bash
218
+ npm install
219
+ node mcp-server/src/index.js
220
+ ```
221
+
222
+ Inspect tools interactively:
223
+
224
+ ```bash
225
+ npm run inspect --prefix mcp-server
226
+ ```
227
+
228
+ ---
229
+
230
+ ## Payment flow
231
+
232
+ The server is the x402 **resource server**. On each tool call:
233
+
234
+ 1. Client sends a `tools/call` request (no payment yet).
235
+ 2. Server returns `PaymentRequired` (v2 MCP transport spec) with the USDC amount and payment address.
236
+ 3. A payment-aware client (or `wrapMCPClientWithPayment`) signs and submits the on-chain payment.
237
+ 4. Client retries the `tools/call` with `_meta["x402/payment"]` attached.
238
+ 5. Server verifies + settles via the configured facilitator, runs the tool, and returns the result with `_meta["x402/payment-response"]`.
239
+
240
+ Every tool settles in USDC on **Solana mainnet** with the `exact` scheme (`@x402/svm` ships no `upto`/metered scheme). Each tool quotes a fixed price; there is no post-hoc metering.
241
+
242
+ A successful result carries the tool's JSON in two forms: `content[0].text` (for text-only clients) and `structuredContent` (MCP 2025-06-18 structured output — a ready-to-use object). A tool-level error sets `isError: true`, and the x402 wrapper **cancels rather than settles** the payment, so failed calls do not bill the caller.
243
+
244
+ ---
245
+
246
+ ## Reliability & failover
247
+
248
+ Every external dependency has a backup path, so a single provider blip doesn't take a tool down — and no call can hang a paid request indefinitely.
249
+
250
+ - **Every outbound HTTP call** runs through a shared resilient layer (`src/lib/resilient-fetch.js`): a hard per-attempt timeout plus jittered exponential-backoff retries on transient `429`/`5xx`/network errors, honoring `Retry-After`. Retries are restricted to idempotent reads by default — a non-idempotent action like `agent_delegate_action` gets the timeout but is **never** silently replayed.
251
+ - **Solana RPC** (`src/lib/solana-rpc.js`) fails over across an ordered endpoint list (`SOLANA_RPC_URLS`, else the primary, else a built-in public set). A throttling or down endpoint rotates to the back and the next one answers.
252
+ - **EVM RPC** (`src/lib/evm-rpc.js`) uses an ethers `FallbackProvider` (quorum 1) over multiple endpoints per chain (`MCP_EVM_RPC_<chainId>` or built-in redundancy), each request timeout-bounded.
253
+ - **The x402 facilitator** accepts a comma-separated `X402_FACILITATOR_URLS_SOLANA`: earlier entries take precedence at init, and a later facilitator covers the Solana `exact` kind if the primary's `/supported` is unreachable.
254
+ - **Data fallback:** `pump_snapshot` cross-fills its USD price from Dexscreener when Jupiter is unavailable, and each upstream fails soft to a `null`/`{ error }` field rather than failing the whole snapshot.
255
+
256
+ For maximum redundancy, set dedicated endpoints rather than relying on the public defaults:
257
+
258
+ ```bash
259
+ SOLANA_RPC_URLS="https://your-primary-rpc,https://your-secondary-rpc"
260
+ MCP_EVM_RPC_8453="https://your-base-rpc,https://base-rpc.publicnode.com"
261
+ X402_FACILITATOR_URLS_SOLANA="https://facilitator.payai.network,https://your-backup-facilitator"
262
+ ```
263
+
264
+ ---
265
+
266
+ ## Architecture
267
+
268
+ ```
269
+ ┌─────────────────┐ ┌─────────────────────┐ ┌──────────────────────┐
270
+ │ Claude Desktop │────▶│ @three-ws/mcp │────▶│ x402 facilitator │
271
+ │ / Cursor / │ │ (stdio transport) │ │ (PayAI — Solana │
272
+ │ your agent │ │ │ │ USDC, exact) │
273
+ └─────────────────┘ └─────────────────────┘ └──────────────────────┘
274
+ ```
275
+
276
+ Source: [`mcp-server/`](https://github.com/nirholas/three.ws/tree/main/mcp-server)
277
+
278
+ ---
279
+
280
+ ## Requirements
281
+
282
+ - Node.js **>= 20** (from `engines`).
283
+ - A Solana USDC payout address in `MCP_SVM_PAYMENT_ADDRESS` (or `X402_PAY_TO_SOLANA` / `X402_PAY_TO`) to settle paid calls — see [Environment variables](#environment-variables). Tool registration (names/schemas) needs no env; only an actual paid invocation does.
284
+ - A payment-aware MCP client (or `@x402/mcp`'s `wrapMCPClientWithPayment`) funding payments from a Solana keypair.
285
+
286
+ ## Related
287
+
288
+ - [`@three-ws/pumpfun-mcp`](https://www.npmjs.com/package/@three-ws/pumpfun-mcp) — the free, read-only pump.fun + Solana MCP (token discovery, on-chain analysis, live 3D snapshots; no keys).
289
+
290
+ ## Links
291
+
292
+ - Homepage: https://three.ws
293
+ - Changelog: https://three.ws/changelog
294
+ - Issues: https://github.com/nirholas/three.ws/issues
295
+ - License: Apache-2.0 — see [LICENSE](./LICENSE)
296
+
297
+ ---
298
+
299
+ <p align="center">
300
+ <sub>
301
+ Part of the <a href="https://three.ws">three.ws</a> SDK suite — 3D AI agents, on-chain identity, and agent payments.<br/>
302
+ <a href="https://three.ws">Website</a> · <a href="https://three.ws/changelog">Changelog</a> · <a href="https://github.com/nirholas/three.ws">GitHub</a>
303
+ </sub>
304
+ </p>
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "@three-ws/mcp-server",
3
+ "version": "1.1.0",
4
+ "mcpName": "io.github.nirholas/3d-agent-mcp",
5
+ "description": "Paid MCP tools for the 3d-agent stack — pose generation, pump.fun snapshots, ERC-8004 agent reputation, Solana vanity grinder. Settled in USDC via x402.",
6
+ "type": "module",
7
+ "author": "nirholas",
8
+ "license": "Apache-2.0",
9
+ "homepage": "https://three.ws",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/nirholas/three.ws.git",
13
+ "directory": "mcp-server"
14
+ },
15
+ "keywords": [
16
+ "mcp",
17
+ "model-context-protocol",
18
+ "3d-agent",
19
+ "three.ws",
20
+ "x402",
21
+ "usdc",
22
+ "solana",
23
+ "pump.fun",
24
+ "erc-8004",
25
+ "ai-agent",
26
+ "pose-generation",
27
+ "vanity-address"
28
+ ],
29
+ "publishConfig": {
30
+ "access": "public"
31
+ },
32
+ "files": [
33
+ "src",
34
+ "server.json",
35
+ "README.md",
36
+ "LICENSE"
37
+ ],
38
+ "bin": {
39
+ "3d-agent-mcp": "src/index.js"
40
+ },
41
+ "main": "./src/index.js",
42
+ "exports": {
43
+ ".": "./src/index.js"
44
+ },
45
+ "engines": {
46
+ "node": ">=20"
47
+ },
48
+ "scripts": {
49
+ "start": "node src/index.js",
50
+ "inspect": "npx -y @modelcontextprotocol/inspector node src/index.js",
51
+ "prepublishOnly": "node -e \"import('./src/index.js').catch(e => { if (!e.message.includes('facilitator')) throw e })\" 2>/dev/null; echo 'package check ok'"
52
+ },
53
+ "dependencies": {
54
+ "@bonfida/spl-name-service": "0.1.67",
55
+ "@coinbase/x402": "^2.1.0",
56
+ "@coral-xyz/anchor": "^0.32.1",
57
+ "@ethereum-attestation-service/eas-sdk": "0.29.1",
58
+ "@metaplex-foundation/js": "^0.20.1",
59
+ "@modelcontextprotocol/sdk": "^1.29.0",
60
+ "@solana/web3.js": "^1.98.4",
61
+ "@tetsuo-ai/protocol": "^0.2.0",
62
+ "@tetsuo-ai/sdk": "^1.4.0",
63
+ "@x402/core": "^2.13.0",
64
+ "@x402/evm": "^2.13.0",
65
+ "@x402/extensions": "^2.12.0",
66
+ "@x402/mcp": "^2.13.0",
67
+ "@x402/svm": "^2.13.0",
68
+ "agent0-sdk": "^1.7.1",
69
+ "bs58": "^6.0.0",
70
+ "colyseus": "0.17.10",
71
+ "ethers": "^6.16.0",
72
+ "short-uuid": "6.0.3",
73
+ "zod": "^3.23.8",
74
+ "zod-to-json-schema": "3.25.2"
75
+ },
76
+ "bugs": {
77
+ "url": "https://github.com/nirholas/three.ws/issues"
78
+ }
79
+ }
package/server.json ADDED
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.nirholas/3d-agent-mcp",
4
+ "title": "three.ws 3D Agent Tools",
5
+ "description": "Paid x402 MCP tools from three.ws: text-to-3D generation, rigging, agent reputation, market intel.",
6
+ "websiteUrl": "https://three.ws",
7
+ "icons": [
8
+ {
9
+ "src": "https://three.ws/three-ws-mcp-icon.svg",
10
+ "mimeType": "image/svg+xml",
11
+ "sizes": [
12
+ "any"
13
+ ]
14
+ }
15
+ ],
16
+ "repository": {
17
+ "url": "https://github.com/nirholas/three.ws",
18
+ "source": "github",
19
+ "subfolder": "mcp-server"
20
+ },
21
+ "version": "1.1.0",
22
+ "packages": [
23
+ {
24
+ "registryType": "npm",
25
+ "identifier": "@three-ws/mcp-server",
26
+ "version": "1.1.0",
27
+ "runtimeHint": "npx",
28
+ "transport": {
29
+ "type": "stdio"
30
+ },
31
+ "environmentVariables": [
32
+ {
33
+ "name": "MCP_SVM_PAYMENT_ADDRESS",
34
+ "description": "Solana address that receives USDC when a client pays for a tool call (falls back to X402_PAY_TO_SOLANA / X402_PAY_TO). Required to settle paid tools.",
35
+ "format": "string",
36
+ "isRequired": false
37
+ },
38
+ {
39
+ "name": "SOLANA_RPC_URL",
40
+ "description": "Solana mainnet RPC endpoint. Defaults to the public cluster — bring your own (Helius / QuickNode / Triton) for production traffic.",
41
+ "format": "string",
42
+ "isRequired": false
43
+ },
44
+ {
45
+ "name": "HELIUS_API_KEY",
46
+ "description": "Optional Helius API key — enables exact supply and richer DAS data in pump.fun snapshots.",
47
+ "format": "string",
48
+ "isRequired": false,
49
+ "isSecret": true
50
+ }
51
+ ]
52
+ }
53
+ ]
54
+ }