@one-source/mcp 4.0.1 → 4.0.4
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 +55 -4
- package/README.npm.md +55 -4
- package/README.repo.md +34 -4
- package/dist/analytics.d.ts +1 -1
- package/dist/analytics.d.ts.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +12 -2
- package/dist/cli.js.map +1 -1
- package/dist/create-server.d.ts +4 -2
- package/dist/create-server.d.ts.map +1 -1
- package/dist/create-server.js +10 -3
- package/dist/create-server.js.map +1 -1
- package/dist/register-bug-report-tool.d.ts +21 -0
- package/dist/register-bug-report-tool.d.ts.map +1 -0
- package/dist/register-bug-report-tool.js +113 -0
- package/dist/register-bug-report-tool.js.map +1 -0
- package/dist/register-docs-tools.d.ts.map +1 -1
- package/dist/register-docs-tools.js +65 -55
- package/dist/register-docs-tools.js.map +1 -1
- package/package.json +3 -3
- package/skills/onesource-mcp-setup/SKILL.md +256 -0
- package/SKILL.md +0 -169
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Register the 1s_report_bug tool onto a shared McpServer.
|
|
3
|
+
*
|
|
4
|
+
* Sends structured bug reports to the OneSource bug report endpoint,
|
|
5
|
+
* which forwards them to Slack. Works out of the box — no configuration
|
|
6
|
+
* needed. The endpoint URL defaults to the analytics dashboard.
|
|
7
|
+
*/
|
|
8
|
+
import { createHash } from 'node:crypto';
|
|
9
|
+
import { z } from 'zod';
|
|
10
|
+
import { VERSION } from './version.js';
|
|
11
|
+
/** Default bug report endpoint (analytics dashboard). */
|
|
12
|
+
const DEFAULT_BUG_REPORT_URL = 'https://1s-analytics.vercel.app/api/bugs';
|
|
13
|
+
function hashSession(sessionId) {
|
|
14
|
+
if (!sessionId)
|
|
15
|
+
return undefined;
|
|
16
|
+
return createHash('sha256').update(sessionId).digest('hex').slice(0, 16);
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Register the bug report tool and return the tool count (1).
|
|
20
|
+
*/
|
|
21
|
+
export function registerBugReportTool(opts) {
|
|
22
|
+
const { server, analytics, transport } = opts;
|
|
23
|
+
const bugReportUrl = opts.bugReportUrl ?? DEFAULT_BUG_REPORT_URL;
|
|
24
|
+
server.tool('1s_report_bug', 'Report a bug or issue to the OneSource team. Use when a tool returns an unexpected error or when the user asks to report a problem. Free, no payment required.', z.object({
|
|
25
|
+
description: z.string().describe('What went wrong — describe the bug, what you expected, and what actually happened.'),
|
|
26
|
+
tool_name: z.string().optional().describe('The MCP tool that produced the error (e.g. 1s_network_info, search_docs).'),
|
|
27
|
+
error_message: z.string().optional().describe('The error message or relevant output from the failed tool call.'),
|
|
28
|
+
severity: z.enum(['low', 'medium', 'high', 'critical']).optional().describe('Bug severity: low (cosmetic), medium (degraded function), high (feature broken), critical (server crash or data loss).'),
|
|
29
|
+
network: z.string().optional().describe('The blockchain network involved, if applicable (e.g. ethereum, sepolia, avax).'),
|
|
30
|
+
steps_to_reproduce: z.string().optional().describe('Steps to reproduce the issue, if known.'),
|
|
31
|
+
}).shape, async (input, extra) => {
|
|
32
|
+
const start = performance.now();
|
|
33
|
+
const inputKeys = Object.keys(input);
|
|
34
|
+
const sessionHash = hashSession(extra.sessionId);
|
|
35
|
+
const clientInfo = server.server.getClientVersion();
|
|
36
|
+
const base = {
|
|
37
|
+
type: 'tool_call',
|
|
38
|
+
service: 'onesource-ops',
|
|
39
|
+
tool: '1s_report_bug',
|
|
40
|
+
category: 'ops',
|
|
41
|
+
timestamp: new Date().toISOString(),
|
|
42
|
+
input_params: inputKeys,
|
|
43
|
+
version: VERSION,
|
|
44
|
+
auth_method: 'none',
|
|
45
|
+
client_name: clientInfo?.name,
|
|
46
|
+
client_version: clientInfo?.version,
|
|
47
|
+
session_id: sessionHash,
|
|
48
|
+
transport,
|
|
49
|
+
source: 'unified',
|
|
50
|
+
};
|
|
51
|
+
try {
|
|
52
|
+
// Validate: description is required and non-empty
|
|
53
|
+
if (!input.description?.trim()) {
|
|
54
|
+
return {
|
|
55
|
+
content: [{ type: 'text', text: 'Bug report requires a description. Please describe what went wrong.' }],
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
// Build the payload — structured JSON, backend handles formatting
|
|
59
|
+
const payload = {
|
|
60
|
+
description: input.description.slice(0, 3000),
|
|
61
|
+
tool_name: input.tool_name,
|
|
62
|
+
error_message: input.error_message?.slice(0, 1000),
|
|
63
|
+
severity: input.severity ?? 'medium',
|
|
64
|
+
network: input.network,
|
|
65
|
+
steps_to_reproduce: input.steps_to_reproduce?.slice(0, 2000),
|
|
66
|
+
context: {
|
|
67
|
+
mcp_version: VERSION,
|
|
68
|
+
transport: transport ?? 'unknown',
|
|
69
|
+
timestamp: new Date().toISOString(),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
const res = await fetch(bugReportUrl, {
|
|
73
|
+
method: 'POST',
|
|
74
|
+
headers: { 'Content-Type': 'application/json' },
|
|
75
|
+
body: JSON.stringify(payload),
|
|
76
|
+
signal: AbortSignal.timeout(10_000),
|
|
77
|
+
});
|
|
78
|
+
if (!res.ok) {
|
|
79
|
+
const body = await res.text().catch(() => '');
|
|
80
|
+
throw new Error(`Bug report endpoint returned ${res.status}: ${body.slice(0, 200)}`);
|
|
81
|
+
}
|
|
82
|
+
const durationMs = Math.round(performance.now() - start);
|
|
83
|
+
const successText = 'Bug report sent to the OneSource team. Thank you for reporting this issue.';
|
|
84
|
+
analytics.trackTool({
|
|
85
|
+
...base,
|
|
86
|
+
duration_ms: durationMs,
|
|
87
|
+
success: true,
|
|
88
|
+
response_size: successText.length,
|
|
89
|
+
});
|
|
90
|
+
return { content: [{ type: 'text', text: successText }] };
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
const durationMs = Math.round(performance.now() - start);
|
|
94
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
95
|
+
analytics.trackTool({
|
|
96
|
+
...base,
|
|
97
|
+
duration_ms: durationMs,
|
|
98
|
+
success: false,
|
|
99
|
+
error_category: message.slice(0, 100).replace(/0x[a-fA-F0-9]+/g, '0x***'),
|
|
100
|
+
response_size: 0,
|
|
101
|
+
});
|
|
102
|
+
return {
|
|
103
|
+
isError: true,
|
|
104
|
+
content: [{
|
|
105
|
+
type: 'text',
|
|
106
|
+
text: `Failed to send bug report: ${message.slice(0, 500)}\n\nPlease report the bug manually at: https://github.com/blockparty-global/1s-mcp/issues`,
|
|
107
|
+
}],
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
//# sourceMappingURL=register-bug-report-tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-bug-report-tool.js","sourceRoot":"","sources":["../src/register-bug-report-tool.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,yDAAyD;AACzD,MAAM,sBAAsB,GAAG,0CAA0C,CAAC;AAE1E,SAAS,WAAW,CAAC,SAA6B;IAChD,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AAC3E,CAAC;AAmBD;;GAEG;AACH,MAAM,UAAU,qBAAqB,CAAC,IAAkC;IACtE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC;IAC9C,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,IAAI,sBAAsB,CAAC;IAEjE,MAAM,CAAC,IAAI,CACT,eAAe,EACf,gKAAgK,EAChK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AAI,EAAE,MAAe;wBACrB,IAAI,EAAE,8BAA8B,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,2FAA2F;qBACrJ,CAAC;aACH,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;IAEF,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-docs-tools.d.ts","sourceRoot":"","sources":["../src/register-docs-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKzE,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAYjE,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAgF/D,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"register-docs-tools.d.ts","sourceRoot":"","sources":["../src/register-docs-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAKzE,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAYjE,OAAO,KAAK,EAAE,SAAS,EAAiB,MAAM,gBAAgB,CAAC;AAgF/D,MAAM,WAAW,wBAAwB;IACvC,MAAM,EAAE,SAAS,CAAC;IAClB,SAAS,EAAE,SAAS,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC7B,+EAA+E;IAC/E,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,8DAA8D;IAC9D,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,wBAAwB,GAAG,MAAM,CAoMxE;AAED,OAAO,EAAE,QAAQ,EAAE,KAAK,UAAU,EAAE,CAAC"}
|
|
@@ -102,10 +102,10 @@ export function registerDocsTools(opts) {
|
|
|
102
102
|
const x402Enabled = opts.x402Enabled;
|
|
103
103
|
const x402Address = opts.x402Address;
|
|
104
104
|
instrumentedTool(server, analytics, transport, '1s_setup_check', 'Check OneSource MCP server health — version (current vs latest), x402 payment status, wallet address, API connectivity, and setup instructions if anything is missing. Free, no payment required. Call this first when troubleshooting.', {}, async () => {
|
|
105
|
-
const
|
|
105
|
+
const parts = [];
|
|
106
106
|
// 1. Server version
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
parts.push('## Server Version\n');
|
|
108
|
+
parts.push(`Current: ${VERSION}`);
|
|
109
109
|
let latestVersion = 'unknown';
|
|
110
110
|
try {
|
|
111
111
|
const res = await fetch('https://registry.npmjs.org/@one-source/mcp/latest', {
|
|
@@ -117,86 +117,96 @@ export function registerDocsTools(opts) {
|
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
catch { /* network error — skip */ }
|
|
120
|
-
|
|
120
|
+
parts.push(`Latest: ${latestVersion}`);
|
|
121
121
|
if (latestVersion !== 'unknown' && latestVersion !== VERSION) {
|
|
122
|
-
|
|
122
|
+
parts.push('\n**Update available!** Run: `npx -y @one-source/mcp@latest`');
|
|
123
123
|
}
|
|
124
124
|
else if (latestVersion === VERSION) {
|
|
125
|
-
|
|
125
|
+
parts.push('\nYou are on the latest version.');
|
|
126
126
|
}
|
|
127
127
|
// 2. x402 payment status
|
|
128
|
-
|
|
128
|
+
parts.push('\n## x402 Payment Status\n');
|
|
129
129
|
const enabled = x402Enabled ?? !!process.env.X402_PRIVATE_KEY;
|
|
130
130
|
if (enabled && x402Address) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
131
|
+
parts.push('Status: **Configured**');
|
|
132
|
+
parts.push(`Wallet: \`${x402Address}\``);
|
|
133
|
+
parts.push('\nThis wallet must hold USDC on the **Base** network to pay for API calls.');
|
|
134
134
|
}
|
|
135
135
|
else if (enabled) {
|
|
136
|
-
|
|
136
|
+
parts.push('Status: **Configured** (wallet address not available)');
|
|
137
137
|
}
|
|
138
138
|
else {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
139
|
+
parts.push('Status: **Not configured**');
|
|
140
|
+
parts.push('\nBlockchain API tools require x402 payment. Without a key, paid endpoints return HTTP 402 errors.\n');
|
|
141
|
+
parts.push('### How to configure x402\n');
|
|
142
|
+
parts.push('1. **Get an EVM private key** — export from MetaMask, Coinbase Wallet, or generate one.');
|
|
143
|
+
parts.push(' The key must start with `0x` followed by 64 hex characters. Some wallets export without the `0x` prefix — if so, add `0x` to the beginning yourself.');
|
|
144
|
+
parts.push(' ```');
|
|
145
|
+
parts.push(' # Generate a new key (macOS/Linux, or Git Bash on Windows)');
|
|
146
|
+
parts.push(' echo "0x$(openssl rand -hex 32)"');
|
|
147
|
+
parts.push(' ```\n');
|
|
148
|
+
parts.push('2. **Fund the wallet** with USDC on the **Base** network (not Ethereum mainnet). A few dollars is enough for hundreds of queries.\n');
|
|
149
|
+
parts.push('3. **Set the key** for your MCP client:\n');
|
|
150
|
+
parts.push(' **Claude Code:**');
|
|
151
|
+
parts.push(' ```');
|
|
152
|
+
parts.push(' claude mcp remove onesource');
|
|
153
|
+
parts.push(' claude mcp add onesource -e X402_PRIVATE_KEY=0x... -- npx -y @one-source/mcp@latest');
|
|
154
|
+
parts.push(' ```\n');
|
|
155
|
+
parts.push(' **Claude Desktop / Cursor** — add an `env` block to your MCP config:');
|
|
156
|
+
parts.push(' ```json');
|
|
157
|
+
parts.push(' {');
|
|
158
|
+
parts.push(' "mcpServers": {');
|
|
159
|
+
parts.push(' "onesource": {');
|
|
160
|
+
parts.push(' "command": "npx",');
|
|
161
|
+
parts.push(' "args": ["-y", "@one-source/mcp@latest"],');
|
|
162
|
+
parts.push(' "env": { "X402_PRIVATE_KEY": "0x..." }');
|
|
163
|
+
parts.push(' }');
|
|
164
|
+
parts.push(' }');
|
|
165
|
+
parts.push(' }');
|
|
166
|
+
parts.push(' ```\n');
|
|
167
|
+
parts.push(' **Any MCP client (stdio):**');
|
|
168
|
+
parts.push(' ```');
|
|
169
|
+
parts.push(' X402_PRIVATE_KEY=0x... npx -y @one-source/mcp@latest');
|
|
170
|
+
parts.push(' ```\n');
|
|
171
|
+
parts.push(' **Alternative — set `X402_PRIVATE_KEY` as a shell or system environment variable:**');
|
|
172
|
+
parts.push(' ```');
|
|
173
|
+
parts.push(' # bash/zsh: export X402_PRIVATE_KEY=0x...');
|
|
174
|
+
parts.push(' # PowerShell: $env:X402_PRIVATE_KEY = "0x..."');
|
|
175
|
+
parts.push(' ```\n');
|
|
176
|
+
parts.push('4. **Reload the MCP server** after setting the key — run `/reload-plugins` in Claude Code, or restart Claude Desktop / Cursor.\n');
|
|
177
|
+
parts.push('**Security:** Never commit your private key to source control. Use environment variables or a secrets manager.\n');
|
|
178
|
+
parts.push('For detailed setup instructions, call the `get_mcp_setup_guide` tool.');
|
|
172
179
|
}
|
|
173
180
|
// 3. API connectivity
|
|
174
|
-
|
|
181
|
+
parts.push('\n## API Connectivity\n');
|
|
175
182
|
const baseUrl = process.env.ONESOURCE_BASE_URL ?? 'https://skills.onesource.io';
|
|
176
183
|
try {
|
|
177
184
|
const res = await fetch(baseUrl, { method: 'HEAD', signal: AbortSignal.timeout(5000) });
|
|
178
|
-
|
|
185
|
+
parts.push(`Backend: **Reachable** (${baseUrl})`);
|
|
179
186
|
}
|
|
180
187
|
catch (err) {
|
|
181
188
|
const msg = err instanceof Error ? err.message : String(err);
|
|
182
|
-
|
|
189
|
+
parts.push(`Backend: **Unreachable** — ${msg}`);
|
|
183
190
|
}
|
|
184
191
|
// 4. Transport
|
|
185
|
-
|
|
186
|
-
|
|
192
|
+
parts.push('\n## Transport\n');
|
|
193
|
+
parts.push(`Mode: ${transport ?? 'unknown'}`);
|
|
194
|
+
// 4.5 Bug reporting
|
|
195
|
+
parts.push('\n## Bug Reporting\n');
|
|
196
|
+
parts.push('Status: **Enabled** — call `1s_report_bug` to report issues to the OneSource team.');
|
|
187
197
|
// 5. Next steps
|
|
188
|
-
|
|
198
|
+
parts.push('\n## Next Steps\n');
|
|
189
199
|
if (!enabled) {
|
|
190
|
-
|
|
200
|
+
parts.push('- Configure x402 payments to use blockchain API tools (see instructions above)');
|
|
191
201
|
}
|
|
192
202
|
if (latestVersion !== 'unknown' && latestVersion !== VERSION) {
|
|
193
|
-
|
|
203
|
+
parts.push('- Update to the latest version: `npx -y @one-source/mcp@latest`');
|
|
194
204
|
}
|
|
195
|
-
|
|
205
|
+
parts.push('- Documentation tools are free — try `search_docs` or `list_supported_chains`');
|
|
196
206
|
if (enabled) {
|
|
197
|
-
|
|
207
|
+
parts.push('- Try a paid API tool: `1s_network_info` (returns chain ID, block number, gas price)');
|
|
198
208
|
}
|
|
199
|
-
return
|
|
209
|
+
return parts.join('\n');
|
|
200
210
|
});
|
|
201
211
|
return 11;
|
|
202
212
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register-docs-tools.js","sourceRoot":"","sources":["../src/register-docs-tools.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAmB,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,wCAAwC,CAAC;AAC5F,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAClH,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAClH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,0CAA0C,CAAC;AAClG,OAAO,EAAE,yBAAyB,EAAE,yBAAyB,EAAE,MAAM,kDAAkD,CAAC;AACxH,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AACrH,OAAO,EAAE,wBAAwB,EAAE,wBAAwB,EAAE,MAAM,iDAAiD,CAAC;AACrH,OAAO,EAAE,uBAAuB,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AAClH,OAAO,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACjI,OAAO,EAAE,sBAAsB,EAAE,sBAAsB,EAAE,MAAM,gDAAgD,CAAC;AAGhH,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,SAAS,WAAW,CAAC,SAA6B;IAChD,IAAI,CAAC,SAAS;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,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9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@one-source/mcp",
|
|
3
3
|
"mcpName": "io.onesource/mcp",
|
|
4
|
-
"version": "4.0.
|
|
4
|
+
"version": "4.0.4",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "Unified MCP server for OneSource —
|
|
6
|
+
"description": "Unified MCP server for OneSource — 34 tools for blockchain data and API documentation",
|
|
7
7
|
"bin": {
|
|
8
8
|
"onesource-mcp": "./dist/cli.js"
|
|
9
9
|
},
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"files": [
|
|
19
19
|
"dist/",
|
|
20
20
|
"README.md",
|
|
21
|
-
"
|
|
21
|
+
"skills/",
|
|
22
22
|
"LICENSE"
|
|
23
23
|
],
|
|
24
24
|
"scripts": {
|
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: onesource-mcp-setup
|
|
3
|
+
description: >-
|
|
4
|
+
Guide for installing and configuring the OneSource MCP server with x402
|
|
5
|
+
payments. Covers installation, version checking, wallet setup, USDC
|
|
6
|
+
funding on Base, and verification. Use when a user needs help setting up
|
|
7
|
+
OneSource MCP or configuring x402 payments.
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# OneSource MCP Setup Guide
|
|
11
|
+
|
|
12
|
+
OneSource MCP provides 34 tools for blockchain data, live chain queries, and API documentation. Documentation tools are free. Blockchain API tools require x402 micropayments in USDC on the Base network.
|
|
13
|
+
|
|
14
|
+
## Before You Start
|
|
15
|
+
|
|
16
|
+
**Always call `1s_setup_check` before using any other OneSource tools.** This checks the installed version against the latest release and reports x402 payment status.
|
|
17
|
+
|
|
18
|
+
- **If an update is available:** Tell the user and help them update before proceeding. Run `npx -y @one-source/mcp@latest` to get the latest version. The update takes effect on the next session — the user will need to restart their MCP client.
|
|
19
|
+
- **If `1s_setup_check` is not available:** The MCP is either not installed or running a version before this tool existed. Help the user install or update using the instructions in Step 2 below.
|
|
20
|
+
- **If x402 is not configured:** The tool will include setup instructions. Walk the user through them before attempting paid API calls.
|
|
21
|
+
|
|
22
|
+
Do not skip this step — outdated versions may be missing tools, fixes, or protocol changes.
|
|
23
|
+
|
|
24
|
+
> **Note:** The `get_mcp_setup_guide` tool also provides setup documentation and can be used as a reference alongside this guide.
|
|
25
|
+
|
|
26
|
+
## Step 1: Check Current Installation
|
|
27
|
+
|
|
28
|
+
Call the `1s_setup_check` tool. It reports:
|
|
29
|
+
- Server version (current vs latest)
|
|
30
|
+
- Whether x402 payments are configured
|
|
31
|
+
- Wallet address (if configured)
|
|
32
|
+
- API backend connectivity
|
|
33
|
+
|
|
34
|
+
If the tool is not available, the MCP is not installed — go to Step 2.
|
|
35
|
+
|
|
36
|
+
## Step 2: Install or Update
|
|
37
|
+
|
|
38
|
+
### Claude Code
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
claude mcp add onesource -- npx -y @one-source/mcp@latest
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### Claude Desktop / Cursor
|
|
45
|
+
|
|
46
|
+
Add to your MCP configuration file:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"mcpServers": {
|
|
51
|
+
"onesource": {
|
|
52
|
+
"command": "npx",
|
|
53
|
+
"args": ["-y", "@one-source/mcp@latest"]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Any MCP Client (stdio)
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx -y @one-source/mcp@latest
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Check for Updates
|
|
66
|
+
|
|
67
|
+
Compare the installed version (shown in `1s_setup_check` output) against the latest:
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
npm view @one-source/mcp version
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
To update, reinstall with `@latest` or clear the npx cache: `npx -y @one-source/mcp@latest`.
|
|
74
|
+
|
|
75
|
+
## Step 3: Get an EVM Private Key
|
|
76
|
+
|
|
77
|
+
The `X402_PRIVATE_KEY` is an EVM wallet private key — the same kind used by MetaMask, Coinbase Wallet, or Foundry. It must start with `0x` followed by 64 hex characters (e.g. `0x4c08...7e3d`).
|
|
78
|
+
|
|
79
|
+
> **Important:** Some wallets (including MetaMask) export the private key **without** the `0x` prefix — it will look like just a long string of letters and numbers. If the key you copied doesn't start with `0x`, you need to add `0x` to the beginning yourself before using it as `X402_PRIVATE_KEY`.
|
|
80
|
+
|
|
81
|
+
### Option A: Export from MetaMask
|
|
82
|
+
|
|
83
|
+
1. Open MetaMask
|
|
84
|
+
2. Click the three dots next to the account name
|
|
85
|
+
3. Go to **Account details** > **Show private key**
|
|
86
|
+
4. Enter your MetaMask password
|
|
87
|
+
5. Copy the key — if it doesn't already start with `0x`, add `0x` to the beginning
|
|
88
|
+
|
|
89
|
+
### Option B: Export from Coinbase Wallet
|
|
90
|
+
|
|
91
|
+
1. Open Coinbase Wallet > Settings > Developer settings
|
|
92
|
+
2. Export your private key
|
|
93
|
+
|
|
94
|
+
### Option C: Generate a New Wallet
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
# Using OpenSSL (macOS/Linux, or Git Bash on Windows)
|
|
98
|
+
echo "0x$(openssl rand -hex 32)"
|
|
99
|
+
|
|
100
|
+
# Using Foundry (if installed)
|
|
101
|
+
cast wallet new
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```powershell
|
|
105
|
+
# PowerShell (Windows)
|
|
106
|
+
"0x" + -join ((1..32) | ForEach-Object { "{0:x2}" -f (Get-Random -Max 256) })
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Important:** Use a dedicated wallet for MCP payments — do not use your primary wallet with large holdings. Transfer only what you need.
|
|
110
|
+
|
|
111
|
+
## Step 4: Set the Private Key
|
|
112
|
+
|
|
113
|
+
### Claude Code
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
claude mcp remove onesource
|
|
117
|
+
claude mcp add onesource -e X402_PRIVATE_KEY=0x... -- npx -y @one-source/mcp@latest
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
> **Scope tip:** Claude Code stores MCP configs at three levels — `user`, `project`, and `local`. Use `local` scope (the default for `claude mcp add`) for faster debugging and testing. You can check which scope your config is in by looking at `.claude/settings.local.json` (local), `.claude/settings.json` (project), or `~/.claude/settings.json` (user).
|
|
121
|
+
|
|
122
|
+
### Claude Desktop / Cursor
|
|
123
|
+
|
|
124
|
+
Add the `env` block to your MCP config:
|
|
125
|
+
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"mcpServers": {
|
|
129
|
+
"onesource": {
|
|
130
|
+
"command": "npx",
|
|
131
|
+
"args": ["-y", "@one-source/mcp@latest"],
|
|
132
|
+
"env": {
|
|
133
|
+
"X402_PRIVATE_KEY": "0x..."
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
### Any MCP Client (stdio)
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
X402_PRIVATE_KEY=0x... npx -y @one-source/mcp@latest
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Manual Setup (Editing the Config File Directly)
|
|
147
|
+
|
|
148
|
+
The CLI commands above write to a JSON config file. You can also edit this file directly — this is useful for debugging or if you want to understand what the setup actually does.
|
|
149
|
+
|
|
150
|
+
**Claude Code** — Find which file your config is in by running `claude mcp get onesource`. Depending on the scope:
|
|
151
|
+
- **Local:** `.claude/settings.local.json` in your project directory
|
|
152
|
+
- **Project:** `.claude/settings.json` in your project directory
|
|
153
|
+
- **User:** `~/.claude/settings.json` (macOS/Linux) or `%USERPROFILE%\.claude\settings.json` (Windows)
|
|
154
|
+
|
|
155
|
+
**Claude Desktop:**
|
|
156
|
+
- **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
157
|
+
- **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
158
|
+
|
|
159
|
+
**Cursor:**
|
|
160
|
+
- **macOS:** `~/.cursor/mcp.json`
|
|
161
|
+
- **Windows:** `%USERPROFILE%\.cursor\mcp.json`
|
|
162
|
+
|
|
163
|
+
Open the config file and add (or update) the `onesource` entry inside `"mcpServers"`:
|
|
164
|
+
|
|
165
|
+
```json
|
|
166
|
+
{
|
|
167
|
+
"mcpServers": {
|
|
168
|
+
"onesource": {
|
|
169
|
+
"command": "npx",
|
|
170
|
+
"args": ["-y", "@one-source/mcp@latest"],
|
|
171
|
+
"env": {
|
|
172
|
+
"X402_PRIVATE_KEY": "0xYOUR_PRIVATE_KEY_HERE"
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
Save the file, then reload (see below).
|
|
180
|
+
|
|
181
|
+
### Important: Reload After Config Changes
|
|
182
|
+
|
|
183
|
+
Changing the config file (via `claude mcp add` or manual edit) does **not** automatically restart the running MCP server. You must reload:
|
|
184
|
+
|
|
185
|
+
- **Claude Code:** Run `/reload-plugins` (preferred — no restart needed), or restart Claude Code entirely.
|
|
186
|
+
- **Claude Desktop / Cursor:** Restart the app — close it completely and reopen.
|
|
187
|
+
|
|
188
|
+
Without reloading, the old server process keeps running with the old config, and `1s_setup_check` will still show "Not configured" even though the key is in the file.
|
|
189
|
+
|
|
190
|
+
### Alternative: Set the Key as an Environment Variable
|
|
191
|
+
|
|
192
|
+
If the `env` block in the config isn't reaching the server after reloading, you can set the key as an environment variable directly instead:
|
|
193
|
+
|
|
194
|
+
**bash / zsh (macOS / Linux):**
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
export X402_PRIVATE_KEY=0x...
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
To make it persistent, add the line to your `~/.bashrc`, `~/.zshrc`, or `~/.profile`.
|
|
201
|
+
|
|
202
|
+
**PowerShell (Windows):**
|
|
203
|
+
|
|
204
|
+
```powershell
|
|
205
|
+
$env:X402_PRIVATE_KEY = "0x..."
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
This only lasts for the current session. To make it persistent, either:
|
|
209
|
+
- Add it to your PowerShell profile (`notepad $PROFILE`, add the line, restart PowerShell)
|
|
210
|
+
- Or set it as a system environment variable: **Settings > System > About > Advanced system settings > Environment Variables > User variables > New** — name: `X402_PRIVATE_KEY`, value: `0x...`
|
|
211
|
+
|
|
212
|
+
After setting the variable, restart your MCP client and run `1s_setup_check` to confirm.
|
|
213
|
+
|
|
214
|
+
> **Windows note:** Claude Code's `/doctor` command may warn that Windows requires a `cmd /c` wrapper to execute `npx`. If you encounter issues, update the config to use `"command": "cmd"` with `"args": ["/c", "npx", "-y", "@one-source/mcp@latest"]`.
|
|
215
|
+
|
|
216
|
+
### Security
|
|
217
|
+
|
|
218
|
+
- **Never** commit your private key to source control.
|
|
219
|
+
- Use environment variables, a `.env` file (excluded from git), or a secrets manager.
|
|
220
|
+
- Use a dedicated wallet with minimal funds — only what you need for API calls.
|
|
221
|
+
|
|
222
|
+
## Step 5: Fund the Wallet with USDC on Base
|
|
223
|
+
|
|
224
|
+
The wallet must hold **USDC on the Base network** (not Ethereum mainnet, not other tokens).
|
|
225
|
+
|
|
226
|
+
1. Get the wallet address — call `1s_setup_check` (it shows the address after you set the key), or import the key into MetaMask to see it.
|
|
227
|
+
2. Send USDC to that address **on the Base network**.
|
|
228
|
+
3. A few dollars ($1–5 USDC) is enough for hundreds of API calls.
|
|
229
|
+
|
|
230
|
+
If you have USDC on Ethereum mainnet, bridge it to Base using the [Base Bridge](https://bridge.base.org) or any cross-chain bridge that supports Base.
|
|
231
|
+
|
|
232
|
+
## Step 6: Verify
|
|
233
|
+
|
|
234
|
+
After setting the key, reload and verify:
|
|
235
|
+
|
|
236
|
+
1. **Reload the MCP server** — In Claude Code, run `/reload-plugins` to pick up config changes without restarting the session.
|
|
237
|
+
2. **Check MCP connection** — Run `/mcp` to confirm the `onesource` server is connected.
|
|
238
|
+
3. **Run `1s_setup_check`** — You should see:
|
|
239
|
+
- **x402 status:** Configured
|
|
240
|
+
- **Wallet address:** Your wallet address
|
|
241
|
+
- **API backend:** Reachable
|
|
242
|
+
4. **Test a paid tool** — Try `1s_network_info` to confirm payments work end-to-end.
|
|
243
|
+
|
|
244
|
+
> **Tip:** If you edited the config file manually (instead of using `claude mcp add`), you must run `/reload-plugins` for changes to take effect. Restarting Claude Code also works.
|
|
245
|
+
|
|
246
|
+
## Troubleshooting
|
|
247
|
+
|
|
248
|
+
| Problem | Solution |
|
|
249
|
+
|---------|----------|
|
|
250
|
+
| `1s_setup_check` shows "Not configured" | Most common cause: config was changed but the MCP server wasn't reloaded. Run `/reload-plugins` in Claude Code, or restart Claude Desktop / Cursor. If the key still isn't reaching the server, try setting it as an environment variable directly — see **Alternative: Set the Key as an Environment Variable** above. |
|
|
251
|
+
| "MCP server onesource already exists" error | Run `claude mcp remove onesource` first, then re-add it with your updated config. |
|
|
252
|
+
| Config changed but nothing happened | Run `/reload-plugins` in Claude Code to reload MCP servers, then `/mcp` to check connection status. |
|
|
253
|
+
| Tool returns HTTP 402 error | x402 is not configured, or the wallet has insufficient USDC on Base. |
|
|
254
|
+
| "x402 setup failed" in server logs | The private key format is wrong. It must be a 64-character hex string prefixed with `0x`. |
|
|
255
|
+
| Key is set but wallet shows 0 USDC | Make sure USDC is on the **Base** network, not Ethereum mainnet or another chain. |
|
|
256
|
+
| Tools work but results seem stale | Check `1s_setup_check` for version — you may need to update to the latest. |
|