nanoparse-mcp 1.0.4 → 1.0.6
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 +3 -18
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetch.js +2 -9
- package/dist/fetch.js.map +1 -1
- package/dist/index.js +30 -120
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/session.d.ts +0 -2
- package/dist/session.d.ts.map +0 -1
- package/dist/session.js +0 -34
- package/dist/session.js.map +0 -1
- package/dist/status.d.ts +0 -18
- package/dist/status.d.ts.map +0 -1
- package/dist/status.js +0 -14
- package/dist/status.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
# NanoParse MCP
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/nanoparse-mcp)
|
|
3
4
|
[](./LICENSE)
|
|
4
5
|
|
|
5
|
-
> ⚠️ **npm package not published yet** — coming soon. Until then, use the hosted MCP server at `https://nanoparse.app/mcp` (add it to your MCP client config, no install needed) or run this repo from source. See [github.com/NanoParse/nanoparse-mcp](https://github.com/NanoParse/nanoparse-mcp).
|
|
6
|
-
|
|
7
6
|
MCP client for [NanoParse](https://nanoparse.app) — pay-per-parse web content extraction for AI agents. No accounts, no API keys. Just paste a URL and get clean, structured Markdown back.
|
|
8
7
|
|
|
9
8
|
## What this is
|
|
@@ -18,8 +17,6 @@ The browser rendering, content scoring, and Markdown conversion stay on NanoPars
|
|
|
18
17
|
|
|
19
18
|
## Install
|
|
20
19
|
|
|
21
|
-
Coming soon to npm. Once published:
|
|
22
|
-
|
|
23
20
|
```bash
|
|
24
21
|
npx nanoparse-mcp
|
|
25
22
|
```
|
|
@@ -30,22 +27,10 @@ Or install globally:
|
|
|
30
27
|
npm install -g nanoparse-mcp
|
|
31
28
|
```
|
|
32
29
|
|
|
33
|
-
**Meanwhile:** point your MCP client at the hosted server instead:
|
|
34
|
-
|
|
35
|
-
```json
|
|
36
|
-
{
|
|
37
|
-
"mcpServers": {
|
|
38
|
-
"nanoparse": {
|
|
39
|
-
"url": "https://nanoparse.app/mcp"
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
```
|
|
44
|
-
|
|
45
30
|
### Prerequisites
|
|
46
31
|
|
|
47
32
|
- Node.js 18+
|
|
48
|
-
- A Base wallet with USDC (after your first
|
|
33
|
+
- A Base wallet with USDC (after your first 10 free parses)
|
|
49
34
|
- Set `NANOPARSE_WALLET_KEY` in your environment
|
|
50
35
|
|
|
51
36
|
## Getting a wallet
|
|
@@ -99,7 +84,7 @@ See [`examples/basic-usage.md`](./examples/basic-usage.md) for a full copy-paste
|
|
|
99
84
|
|
|
100
85
|
### Pricing
|
|
101
86
|
|
|
102
|
-
First
|
|
87
|
+
First 10 parses per device are free. After that, **$0.0175 per parse** via x402 micropayment in USDC on Base. See [nanoparse.app](https://nanoparse.app) for current pricing and API docs.
|
|
103
88
|
|
|
104
89
|
## Security
|
|
105
90
|
|
package/dist/fetch.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAeA,UAAU,iBAAiB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE;QACR,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;KACnB,CAAC;IACF,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACxC,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,KAAK,CAAC,EAAE;QACN,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,EAAE;YAAE,aAAa,EAAE,MAAM,CAAC;YAAC,UAAU,EAAE,MAAM,CAAA;SAAE,CAAC;QACzD,MAAM,CAAC,EAAE;YAAE,eAAe,EAAE,MAAM,CAAC;YAAC,eAAe,EAAE,MAAM,CAAA;SAAE,CAAC;KAC/D,CAAC;CACH;AAED,wBAAsB,SAAS,CAC7B,GAAG,EAAE,MAAM,EACX,KAAK,UAAQ,GACZ,OAAO,CAAC,iBAAiB,CAAC,CA2C5B"}
|
package/dist/fetch.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { signPayment } from "./payment.js";
|
|
2
|
-
import { getSessionId } from "./session.js";
|
|
3
2
|
const FETCH_ENDPOINT = "https://nanoparse.app/fetch";
|
|
4
3
|
export async function fetchPage(url, debug = false) {
|
|
5
4
|
const body = { url };
|
|
@@ -8,19 +7,14 @@ export async function fetchPage(url, debug = false) {
|
|
|
8
7
|
// First attempt — may return 402 if payment is required
|
|
9
8
|
let res = await fetch(FETCH_ENDPOINT, {
|
|
10
9
|
method: "POST",
|
|
11
|
-
headers: {
|
|
12
|
-
"Content-Type": "application/json",
|
|
13
|
-
"X-NanoParse-Session": getSessionId(),
|
|
14
|
-
},
|
|
10
|
+
headers: { "Content-Type": "application/json" },
|
|
15
11
|
body: JSON.stringify(body),
|
|
16
12
|
});
|
|
17
13
|
// Handle x402 payment flow
|
|
18
14
|
if (res.status === 402) {
|
|
19
15
|
const paymentTerms = await res.json();
|
|
20
16
|
if (paymentTerms.error !== "payment_required") {
|
|
21
|
-
|
|
22
|
-
const guidance = paymentTerms.message || paymentTerms.next_step || "";
|
|
23
|
-
throw new Error(`Payment failed: ${paymentTerms.error_code || paymentTerms.error}. ${guidance}`.trim());
|
|
17
|
+
throw new Error(`Unexpected 402 response: ${JSON.stringify(paymentTerms)}`);
|
|
24
18
|
}
|
|
25
19
|
const signature = await signPayment(paymentTerms);
|
|
26
20
|
// Retry with payment signature
|
|
@@ -29,7 +23,6 @@ export async function fetchPage(url, debug = false) {
|
|
|
29
23
|
headers: {
|
|
30
24
|
"Content-Type": "application/json",
|
|
31
25
|
"Payment-Signature": signature,
|
|
32
|
-
"X-NanoParse-Session": getSessionId(),
|
|
33
26
|
},
|
|
34
27
|
body: JSON.stringify(body),
|
|
35
28
|
});
|
package/dist/fetch.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../src/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,cAAc,GAAG,6BAA6B,CAAC;AAuCrD,MAAM,CAAC,KAAK,UAAU,SAAS,CAC7B,GAAW,EACX,KAAK,GAAG,KAAK;IAEb,MAAM,IAAI,GAA4B,EAAE,GAAG,EAAE,CAAC;IAC9C,IAAI,KAAK;QAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IAE7B,wDAAwD;IACxD,IAAI,GAAG,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE;QACpC,MAAM,EAAE,MAAM;QACd,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;QAC/C,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;KAC3B,CAAC,CAAC;IAEH,2BAA2B;IAC3B,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;QACvB,MAAM,YAAY,GAAqB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;QAExD,IAAI,YAAY,CAAC,KAAK,KAAK,kBAAkB,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CACb,4BAA4B,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,EAAE,CAC3D,CAAC;QACJ,CAAC;QAED,MAAM,SAAS,GAAG,MAAM,WAAW,CAAC,YAAY,CAAC,CAAC;QAElD,+BAA+B;QAC/B,GAAG,GAAG,MAAM,KAAK,CAAC,cAAc,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,cAAc,EAAE,kBAAkB;gBAClC,mBAAmB,EAAE,SAAS;aAC/B;YACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;QAChE,MAAM,IAAI,KAAK,CACb,0BAA0B,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CACrD,CAAC;IACJ,CAAC;IAED,MAAM,IAAI,GAAsB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IACjD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -3,14 +3,9 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
3
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
4
|
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
5
5
|
import { fetchPage } from "./fetch.js";
|
|
6
|
-
import { getStatus } from "./status.js";
|
|
7
|
-
const PKG_VERSION = "1.0.4";
|
|
8
|
-
const FETCH_DESC = "Fetch a web page and return clean, structured Markdown with metadata. " +
|
|
9
|
-
"First 10 parses free per IP. After that, pay $0.0175 USDC on Base via x402. " +
|
|
10
|
-
"No account or API key required.";
|
|
11
6
|
const server = new Server({
|
|
12
7
|
name: "nanoparse-mcp",
|
|
13
|
-
version:
|
|
8
|
+
version: "1.0.2",
|
|
14
9
|
}, {
|
|
15
10
|
capabilities: {
|
|
16
11
|
tools: {},
|
|
@@ -20,7 +15,9 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
20
15
|
tools: [
|
|
21
16
|
{
|
|
22
17
|
name: "nanoparse_fetch",
|
|
23
|
-
description:
|
|
18
|
+
description: "Fetch a web page and return clean, structured Markdown with metadata. " +
|
|
19
|
+
"First 50 parses free per IP. After that, pay $0.0175 USDC on Base via x402. " +
|
|
20
|
+
"No account or API key required.",
|
|
24
21
|
inputSchema: {
|
|
25
22
|
type: "object",
|
|
26
23
|
properties: {
|
|
@@ -37,129 +34,42 @@ server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
|
37
34
|
required: ["url"],
|
|
38
35
|
},
|
|
39
36
|
},
|
|
40
|
-
{
|
|
41
|
-
name: "nanoparse_status",
|
|
42
|
-
description: "Check wallet balance, USDC balance, quota state, and whether the next /fetch call will succeed without payment. " +
|
|
43
|
-
"Use before spending — tells the agent exactly how much to fund. " +
|
|
44
|
-
"Provide the wallet address to query (0x...).",
|
|
45
|
-
inputSchema: {
|
|
46
|
-
type: "object",
|
|
47
|
-
properties: {
|
|
48
|
-
address: {
|
|
49
|
-
type: "string",
|
|
50
|
-
description: "The Ethereum wallet address to check (0x...)",
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
required: ["address"],
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
37
|
],
|
|
57
38
|
}));
|
|
58
39
|
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
59
|
-
|
|
40
|
+
if (request.params.name !== "nanoparse_fetch") {
|
|
41
|
+
throw new Error(`Unknown tool: ${request.params.name}`);
|
|
42
|
+
}
|
|
60
43
|
const args = request.params.arguments;
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
if (!url || typeof url !== "string") {
|
|
64
|
-
throw new Error('Missing required parameter: "url"');
|
|
65
|
-
}
|
|
66
|
-
try {
|
|
67
|
-
const result = await fetchPage(url, args.debug ?? false);
|
|
68
|
-
return {
|
|
69
|
-
content: [
|
|
70
|
-
{
|
|
71
|
-
type: "text",
|
|
72
|
-
text: result.markdown,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
structuredContent: result,
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
catch (err) {
|
|
79
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
80
|
-
return {
|
|
81
|
-
content: [
|
|
82
|
-
{
|
|
83
|
-
type: "text",
|
|
84
|
-
text: `NanoParse error: ${message}`,
|
|
85
|
-
},
|
|
86
|
-
],
|
|
87
|
-
isError: true,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
44
|
+
if (!args.url || typeof args.url !== "string") {
|
|
45
|
+
throw new Error('Missing required parameter: "url"');
|
|
90
46
|
}
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
`Estimated parses from balance: ${status.estimated_parses_remaining}`,
|
|
103
|
-
`Free tier: ${status.quota.free_calls_used}/${status.quota.free_calls_limit} used — ${status.quota.is_free_available ? "AVAILABLE" : "EXHAUSTED"}`,
|
|
104
|
-
`Next call will succeed: ${status.next_call_will_succeed ? "YES" : "NO — fund wallet or wait for free tier reset"}`,
|
|
105
|
-
`To fund: send USDC on Base to ${status.wallet_address}`,
|
|
106
|
-
`Funding URI: ${status.funding_uri}`,
|
|
107
|
-
];
|
|
108
|
-
return {
|
|
109
|
-
content: [
|
|
110
|
-
{
|
|
111
|
-
type: "text",
|
|
112
|
-
text: lines.join("\n"),
|
|
113
|
-
},
|
|
114
|
-
],
|
|
115
|
-
structuredContent: status,
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
catch (err) {
|
|
119
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
120
|
-
return {
|
|
121
|
-
content: [
|
|
122
|
-
{
|
|
123
|
-
type: "text",
|
|
124
|
-
text: `NanoParse status error: ${message}`,
|
|
125
|
-
},
|
|
126
|
-
],
|
|
127
|
-
isError: true,
|
|
128
|
-
};
|
|
129
|
-
}
|
|
47
|
+
try {
|
|
48
|
+
const result = await fetchPage(args.url, args.debug ?? false);
|
|
49
|
+
return {
|
|
50
|
+
content: [
|
|
51
|
+
{
|
|
52
|
+
type: "text",
|
|
53
|
+
text: result.markdown,
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
structuredContent: result,
|
|
57
|
+
};
|
|
130
58
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
// ── Startup self-check ──
|
|
134
|
-
function startupCheck() {
|
|
135
|
-
const key = process.env.NANOPARSE_WALLET_KEY;
|
|
136
|
-
if (key) {
|
|
137
|
-
const truncated = key.startsWith("0x") ? key.slice(0, 10) + "..." : "0x" + key.slice(0, 8) + "...";
|
|
59
|
+
catch (err) {
|
|
60
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
138
61
|
return {
|
|
139
|
-
|
|
140
|
-
|
|
62
|
+
content: [
|
|
63
|
+
{
|
|
64
|
+
type: "text",
|
|
65
|
+
text: `NanoParse error: ${message}`,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
isError: true,
|
|
141
69
|
};
|
|
142
70
|
}
|
|
143
|
-
|
|
144
|
-
ok: false,
|
|
145
|
-
message: [
|
|
146
|
-
"❌ NANOPARSE_WALLET_KEY not set.",
|
|
147
|
-
"",
|
|
148
|
-
"One-command setup:",
|
|
149
|
-
" npx nanoparse-mcp-setup",
|
|
150
|
-
"",
|
|
151
|
-
"Or manually:",
|
|
152
|
-
" 1. Generate a Base wallet (use your coding agent with the prompt at https://github.com/NanoParse/agent-wallet-prompt)",
|
|
153
|
-
" 2. Copy the private key to .env: NANOPARSE_WALLET_KEY=0x...",
|
|
154
|
-
" 3. Fund the wallet with USDC on Base (scan QR at https://nanoparse.app/#wallet)",
|
|
155
|
-
" 4. Restart the MCP server",
|
|
156
|
-
].join("\n"),
|
|
157
|
-
};
|
|
158
|
-
}
|
|
71
|
+
});
|
|
159
72
|
async function main() {
|
|
160
|
-
// Startup self-check — always print, never block startup
|
|
161
|
-
const check = startupCheck();
|
|
162
|
-
console.error(check.message);
|
|
163
73
|
const transport = new StdioServerTransport();
|
|
164
74
|
await server.connect(transport);
|
|
165
75
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;IACE,IAAI,EAAE,eAAe;IACrB,OAAO,EAAE,OAAO;CACjB,EACD;IACE,YAAY,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QAAQ;iBACtB;aACF;YACD,iBAAiB,EAAE,MAAM;SAC1B,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,OAAO,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACjE,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,oBAAoB,OAAO,EAAE;iBACpC;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;IACpE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nanoparse-mcp",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "MCP client for NanoParse — pay-per-parse web content extraction for AI agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
],
|
|
27
27
|
"repository": {
|
|
28
28
|
"type": "git",
|
|
29
|
-
"url": "https://github.com/nanoparse/nanoparse-mcp"
|
|
29
|
+
"url": "https://github.com/nanoparse-dev/nanoparse-mcp"
|
|
30
30
|
},
|
|
31
31
|
"license": "MIT",
|
|
32
32
|
"dependencies": {
|
package/dist/session.d.ts
DELETED
package/dist/session.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.d.ts","sourceRoot":"","sources":["../src/session.ts"],"names":[],"mappings":"AAUA,wBAAgB,YAAY,IAAI,MAAM,CAwBrC"}
|
package/dist/session.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from "node:crypto";
|
|
2
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { homedir } from "node:os";
|
|
4
|
-
import { join } from "node:path";
|
|
5
|
-
const SESSION_DIR = join(homedir(), ".nanoparse");
|
|
6
|
-
const SESSION_FILE = join(SESSION_DIR, "session");
|
|
7
|
-
let cachedSessionId = null;
|
|
8
|
-
export function getSessionId() {
|
|
9
|
-
if (cachedSessionId)
|
|
10
|
-
return cachedSessionId;
|
|
11
|
-
try {
|
|
12
|
-
if (existsSync(SESSION_FILE)) {
|
|
13
|
-
cachedSessionId = readFileSync(SESSION_FILE, "utf-8").trim();
|
|
14
|
-
if (cachedSessionId && cachedSessionId.length >= 8) {
|
|
15
|
-
return cachedSessionId;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
// File missing or unreadable — generate new
|
|
21
|
-
}
|
|
22
|
-
// Generate and persist
|
|
23
|
-
cachedSessionId = randomUUID();
|
|
24
|
-
try {
|
|
25
|
-
if (!existsSync(SESSION_DIR))
|
|
26
|
-
mkdirSync(SESSION_DIR, { recursive: true });
|
|
27
|
-
writeFileSync(SESSION_FILE, cachedSessionId, "utf-8");
|
|
28
|
-
}
|
|
29
|
-
catch {
|
|
30
|
-
// Non-fatal — session just won't persist across restarts
|
|
31
|
-
}
|
|
32
|
-
return cachedSessionId;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=session.js.map
|
package/dist/session.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"session.js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AccountStatus {
|
|
2
|
-
wallet_address: string;
|
|
3
|
-
usdc_balance: string;
|
|
4
|
-
usdc_balance_raw: string;
|
|
5
|
-
balance_error: string | null;
|
|
6
|
-
estimated_parses_remaining: number;
|
|
7
|
-
price_per_parse: string;
|
|
8
|
-
quota: {
|
|
9
|
-
free_calls_used: number;
|
|
10
|
-
free_calls_limit: number;
|
|
11
|
-
is_free_available: boolean;
|
|
12
|
-
};
|
|
13
|
-
next_call_will_succeed: boolean;
|
|
14
|
-
funding_uri: string;
|
|
15
|
-
docs_url?: string;
|
|
16
|
-
}
|
|
17
|
-
export declare function getStatus(address: string): Promise<AccountStatus>;
|
|
18
|
-
//# sourceMappingURL=status.d.ts.map
|
package/dist/status.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,aAAa;IAC5B,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0BAA0B,EAAE,MAAM,CAAC;IACnC,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE;QACL,eAAe,EAAE,MAAM,CAAC;QACxB,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,OAAO,CAAC;KAC5B,CAAC;IACF,sBAAsB,EAAE,OAAO,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,wBAAsB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,CAavE"}
|
package/dist/status.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const STATUS_ENDPOINT = "https://nanoparse.app/status/account";
|
|
2
|
-
export async function getStatus(address) {
|
|
3
|
-
const res = await fetch(`${STATUS_ENDPOINT}?address=${encodeURIComponent(address)}`, {
|
|
4
|
-
method: "GET",
|
|
5
|
-
headers: { "Content-Type": "application/json" },
|
|
6
|
-
});
|
|
7
|
-
if (!res.ok) {
|
|
8
|
-
const errorText = await res.text().catch(() => "Unknown error");
|
|
9
|
-
throw new Error(`Status endpoint returned ${res.status}: ${errorText}`);
|
|
10
|
-
}
|
|
11
|
-
const data = await res.json();
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=status.js.map
|
package/dist/status.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../src/status.ts"],"names":[],"mappings":"AAAA,MAAM,eAAe,GAAG,sCAAsC,CAAC;AAmB/D,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,OAAe;IAC7C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,eAAe,YAAY,kBAAkB,CAAC,OAAO,CAAC,EAAE,EAAE;QACnF,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE;KAChD,CAAC,CAAC;IAEH,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,4BAA4B,GAAG,CAAC,MAAM,KAAK,SAAS,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,MAAM,IAAI,GAAkB,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC;AACd,CAAC"}
|