@proxylayer/cli 0.0.0-stage → 0.1.1
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 +70 -2
- package/dist/cli.d.ts +10 -0
- package/dist/cli.js +640 -0
- package/dist/client.d.ts +264 -0
- package/dist/client.js +173 -0
- package/dist/config.d.ts +21 -0
- package/dist/config.js +69 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp.d.ts +9 -0
- package/dist/mcp.js +127 -0
- package/package.json +40 -4
package/README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @proxylayer/cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Official zero-dependency CLI, local `stdio` MCP server, and TypeScript/JavaScript SDK for [ProxyLayer](https://proxy-layer.com).
|
|
4
|
+
|
|
5
|
+
## Local MCP Server (Claude Desktop, Cursor, Windsurf, Cline)
|
|
6
|
+
|
|
7
|
+
Connect without any pre-existing API key:
|
|
8
|
+
|
|
9
|
+
```json
|
|
10
|
+
{
|
|
11
|
+
"mcpServers": {
|
|
12
|
+
"proxylayer": {
|
|
13
|
+
"command": "npx",
|
|
14
|
+
"args": ["-y", "@proxylayer/cli", "mcp"]
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
When an AI agent calls `auth_request_otp` and `auth_verify_otp`, the local `@proxylayer/cli` MCP bridge automatically saves your `pl_live_...` API key to `~/.config/proxylayer/config.json` (`0600`) so subsequent tool calls (`create_checkout`, `list_static_proxies`, `get_residential_proxies`) work immediately in the same session.
|
|
21
|
+
|
|
22
|
+
## CLI Usage
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# Public catalog & pricing quote (install globally for `pl` shorthand: npm i -g @proxylayer/cli)
|
|
26
|
+
npx @proxylayer/cli catalog residential
|
|
27
|
+
npx @proxylayer/cli quote residential 10gb
|
|
28
|
+
npx @proxylayer/cli quote isp US 2 30d
|
|
29
|
+
|
|
30
|
+
# Email OTP sign-up / login (prompts step-by-step for Email and 6-digit code; or pass email directly if known)
|
|
31
|
+
npx @proxylayer/cli login
|
|
32
|
+
|
|
33
|
+
# Create checkout (stripe hosted link, crypto invoice, or prepaid balance)
|
|
34
|
+
npx @proxylayer/cli buy residential 10gb --method stripe
|
|
35
|
+
npx @proxylayer/cli buy isp US 1 30d --method balance
|
|
36
|
+
|
|
37
|
+
# Poll checkout status & output ready-to-use proxy strings
|
|
38
|
+
npx @proxylayer/cli checkout <checkoutSessionId>
|
|
39
|
+
npx @proxylayer/cli proxies isp --raw
|
|
40
|
+
npx @proxylayer/cli residential --country us --session sticky --qty 5 --raw
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## TypeScript / JavaScript SDK
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
npm install @proxylayer/cli
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
import { ProxyLayer } from "@proxylayer/cli"
|
|
51
|
+
|
|
52
|
+
const client = new ProxyLayer({ apiKey: process.env.PROXYLAYER_API_KEY })
|
|
53
|
+
|
|
54
|
+
const quote = await client.quote({
|
|
55
|
+
productSlug: "isp",
|
|
56
|
+
durationDays: 30,
|
|
57
|
+
items: [{ countryCode: "US", quantity: 2 }],
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const checkout = await client.createCheckout({
|
|
61
|
+
purchase: { productSlug: "residential", trafficGb: 10 },
|
|
62
|
+
paymentMethod: "stripe",
|
|
63
|
+
})
|
|
64
|
+
console.log("Pay here:", checkout.paymentUrl)
|
|
65
|
+
|
|
66
|
+
const { proxies } = await client.getResidentialProxies({
|
|
67
|
+
country: "us",
|
|
68
|
+
session: "sticky",
|
|
69
|
+
quantity: 5,
|
|
70
|
+
})
|
|
71
|
+
```
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
export type CliDeps = {
|
|
3
|
+
fetch?: typeof globalThis.fetch;
|
|
4
|
+
stdout?: NodeJS.WritableStream;
|
|
5
|
+
stderr?: NodeJS.WritableStream;
|
|
6
|
+
stdin?: NodeJS.ReadableStream;
|
|
7
|
+
isTTY?: boolean;
|
|
8
|
+
configPath?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function runCli(argv: string[], deps?: CliDeps): Promise<number>;
|