proxy302-mcp 0.0.0-stage → 0.3.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 +21 -0
- package/README.md +182 -2
- package/README.zh-CN.md +118 -0
- package/dist/client.js +102 -0
- package/dist/fetchPage.js +53 -0
- package/dist/format.js +40 -0
- package/dist/index.js +7 -0
- package/dist/server.js +9 -0
- package/dist/tools.js +355 -0
- package/dist/version.js +1 -0
- package/package.json +55 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Proxy302
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,183 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/proxy302/proxy302-mcp/main/docs/images/hero.svg" alt="proxy302-mcp: residential proxies as tools for your AI assistant" width="100%"></p>
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
# proxy302-mcp
|
|
4
|
+
|
|
5
|
+
> **Official Proxy302 MCP server**, built and maintained by the Proxy302 team. For account, billing or connection questions contact [Proxy302 support](https://proxy302.com); for bugs in this server, open a [GitHub issue](https://github.com/proxy302/proxy302-mcp/issues).
|
|
6
|
+
|
|
7
|
+
Give your AI assistant a real residential-proxy toolbox. `proxy302-mcp` is a [Model Context Protocol](https://modelcontextprotocol.io) server for [Proxy302](https://proxy302.com): check your traffic and usage, browse countries and plans, get a rotating residential proxy URL for any country, list your proxies and static IPs, and fetch a web page through a proxy, all from Claude Code, Claude Desktop, Cursor or any MCP client.
|
|
8
|
+
|
|
9
|
+
[中文说明](README.zh-CN.md)
|
|
10
|
+
|
|
11
|
+
[](https://glama.ai/mcp/servers/proxy302/proxy302-mcp) [](https://glama.ai/mcp/connectors/io.github.proxy302/proxy302-mcp)
|
|
12
|
+
|
|
13
|
+
<p align="center"><img src="https://raw.githubusercontent.com/proxy302/proxy302-mcp/main/docs/images/how-it-works.svg" alt="How it works: your AI assistant talks to proxy302-mcp on your machine, which calls the Proxy302 API with your key and fetches pages through a residential IP" width="100%"></p>
|
|
14
|
+
|
|
15
|
+
> v1 is deliberately **read-only and spend-free**: it never buys, renews or tops up anything. The one write it can do (creating a dynamic proxy credential) is free and only bills traffic when you actually use it: `get_dynamic_proxy` creates one only with `create_if_missing=true`; `fetch_url` with a country creates one on the budget line when you have none (pass `create_if_missing=false` to stop that).
|
|
16
|
+
|
|
17
|
+
## Hosted server (no install)
|
|
18
|
+
|
|
19
|
+
Proxy302 also runs this server for you. Create an API key in the [Proxy302 console](https://proxy302.com/api-keys) first.
|
|
20
|
+
|
|
21
|
+
[](https://cursor.com/en/install-mcp?name=proxy302&config=eyJ1cmwiOiJodHRwczovL21jcC5wcm94eTMwMi5jb20vbWNwIn0%3D)
|
|
22
|
+
[](https://insiders.vscode.dev/redirect/mcp/install?name=proxy302&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.proxy302.com%2Fmcp%22%7D)
|
|
23
|
+
[](https://insiders.vscode.dev/redirect/mcp/install?name=proxy302&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.proxy302.com%2Fmcp%22%7D&quality=insiders)
|
|
24
|
+
|
|
25
|
+
One click adds `https://mcp.proxy302.com/mcp`; the app then opens the Proxy302 sign-in window, where you paste your API key once (`key id:secret`). Deleting the key in the console disconnects it.
|
|
26
|
+
|
|
27
|
+
- **Claude** (claude.ai, Claude Desktop): Settings → Connectors → Add custom connector, URL `https://mcp.proxy302.com/mcp`.
|
|
28
|
+
- **ChatGPT** (developer mode): create a connector with the same URL and OAuth.
|
|
29
|
+
- **Cursor, VS Code, Windsurf and other MCP clients:** the same URL, no headers needed.
|
|
30
|
+
|
|
31
|
+
**Sign in with OAuth:** add `https://mcp.proxy302.com/mcp` as a custom connector in Claude, ChatGPT or any client that supports MCP sign-in, and paste your API key once in the sign-in window. In Claude Code:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
claude mcp add --transport http proxy302 https://mcp.proxy302.com/mcp
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Then run `/mcp` in Claude Code to sign in.
|
|
38
|
+
|
|
39
|
+
**Or send the key as a header:** use `https://proxy302.com/v1/mcp` with `Authorization: Bearer <key id>:<secret>`.
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
claude mcp add --transport http proxy302 https://proxy302.com/v1/mcp --header "Authorization: Bearer <key id>:<secret>"
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Cursor (`~/.cursor/mcp.json`):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"proxy302": {
|
|
51
|
+
"url": "https://proxy302.com/v1/mcp",
|
|
52
|
+
"headers": { "Authorization": "Bearer <key id>:<secret>" }
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The hosted server has the same tools except `fetch_url`, plus `check_ip_purity` (blocklist score of your static IPs, or of the IPs a location would hand out next) and `estimate_cost` (quote a plan against your wallet). It never spends money either.
|
|
59
|
+
|
|
60
|
+
## Run it locally
|
|
61
|
+
|
|
62
|
+
1. Create an API key in the Proxy302 console and note its key id and secret.
|
|
63
|
+
2. Install:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
claude mcp add proxy302 -e PROXY302_API_KEY="<key id>:<secret>" -- npx -y github:proxy302/proxy302-mcp
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Requires Node.js 20+.
|
|
70
|
+
|
|
71
|
+
Bonus: Proxy302 credits **1 PTC** to paid accounts the first time a call through proxy302-mcp succeeds (once per account).
|
|
72
|
+
|
|
73
|
+
### Claude Desktop
|
|
74
|
+
|
|
75
|
+
`claude_desktop_config.json`:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"proxy302": {
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": ["-y", "github:proxy302/proxy302-mcp"],
|
|
83
|
+
"env": { "PROXY302_API_KEY": "<key id>:<secret>" }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Cursor
|
|
90
|
+
|
|
91
|
+
`~/.cursor/mcp.json` (or `.cursor/mcp.json` in a project):
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"mcpServers": {
|
|
96
|
+
"proxy302": {
|
|
97
|
+
"command": "npx",
|
|
98
|
+
"args": ["-y", "github:proxy302/proxy302-mcp"],
|
|
99
|
+
"env": { "PROXY302_API_KEY": "<key id>:<secret>" }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Tools
|
|
106
|
+
|
|
107
|
+
| Tool | What it does |
|
|
108
|
+
|---|---|
|
|
109
|
+
| `get_account_usage` | Account, wallet (PTC) balance, remaining prepaid traffic, per-pool balance and daily usage for the last N days |
|
|
110
|
+
| `list_countries` | Countries you can target, with ids and ISO codes (name filter) |
|
|
111
|
+
| `list_regions` | States of a country, or cities of a state |
|
|
112
|
+
| `list_products` | Product lines and static IP plans (data center and residential) |
|
|
113
|
+
| `get_dynamic_proxy` | A ready `http://user:pass@host:port` residential URL for a country (premium line: also state, city and ISP). `session_mode=rotate` gives a new IP on every connection, `sticky` (default) keeps one IP; `session_minutes` 10–120 on the budget line. Reuses an existing proxy of the same line and place; `create_if_missing=true` creates one, billed from a traffic package or else the wallet |
|
|
114
|
+
| `list_isps` | ISPs the premium line can target in a country |
|
|
115
|
+
| `rotate_ip` | New exit IP for sticky proxies: returns a fresh-session URL that switches at once |
|
|
116
|
+
| `list_my_proxies` | Your dynamic proxies and static IPs, passwords masked unless asked |
|
|
117
|
+
| `fetch_url` | Fetch a URL through a residential IP in a given country and return Markdown, text or raw, in one call (creates a budget-line proxy for that country if you have none) |
|
|
118
|
+
|
|
119
|
+
Not in v1, on purpose: purchases, renewals, top-ups.
|
|
120
|
+
|
|
121
|
+
## Examples
|
|
122
|
+
|
|
123
|
+
<p align="center"><img src="https://raw.githubusercontent.com/proxy302/proxy302-mcp/main/docs/images/demo.svg" alt="Example session: checking remaining traffic, getting a Germany proxy and fetching a page through it" width="100%"></p>
|
|
124
|
+
|
|
125
|
+
Ask your assistant:
|
|
126
|
+
|
|
127
|
+
- "How much proxy traffic do I have left, and what did I use this week?"
|
|
128
|
+
- "Which countries can I use? Get me a Germany proxy."
|
|
129
|
+
- "Fetch https://example.com/pricing from a US exit and summarise it."
|
|
130
|
+
- "List my static IPs that expire in the next 7 days."
|
|
131
|
+
|
|
132
|
+
### Use the proxy in Playwright
|
|
133
|
+
|
|
134
|
+
`get_dynamic_proxy` returns host, port, username and password:
|
|
135
|
+
|
|
136
|
+
```ts
|
|
137
|
+
import { chromium } from 'playwright';
|
|
138
|
+
|
|
139
|
+
const browser = await chromium.launch({
|
|
140
|
+
proxy: { server: 'http://HOST:PORT', username: 'USERNAME', password: 'PASSWORD' },
|
|
141
|
+
});
|
|
142
|
+
const page = await browser.newPage();
|
|
143
|
+
await page.goto('https://ipinfo.io/json');
|
|
144
|
+
console.log(await page.textContent('body'));
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Use the proxy in browser-use
|
|
148
|
+
|
|
149
|
+
```python
|
|
150
|
+
from browser_use import Agent, Browser, BrowserConfig
|
|
151
|
+
|
|
152
|
+
browser = Browser(config=BrowserConfig(
|
|
153
|
+
proxy={"server": "http://HOST:PORT", "username": "USERNAME", "password": "PASSWORD"},
|
|
154
|
+
))
|
|
155
|
+
agent = Agent(task="Open ipinfo.io and tell me the country", llm=llm, browser=browser)
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
`fetch_url` is a plain HTTP request without JavaScript rendering. For JavaScript-heavy sites, hand the proxy URL to a browser as above.
|
|
159
|
+
|
|
160
|
+
Not sure which proxy type a task needs (static ISP or rotating residential, TikTok, anti-detect browsers, Claude and ChatGPT)? See the [Proxy302 guides](https://github.com/proxy302/proxy-guides).
|
|
161
|
+
|
|
162
|
+
## Configuration
|
|
163
|
+
|
|
164
|
+
| Variable | Meaning |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `PROXY302_API_KEY` | Required. `<key id>:<secret>`, or a `Basic ...` token |
|
|
167
|
+
| `PROXY302_API_SECRET` | Optional; use with `PROXY302_API_KEY` holding only the key id |
|
|
168
|
+
| `PROXY302_BASE_URL` | Optional; default `https://proxy302.com` |
|
|
169
|
+
|
|
170
|
+
Credentials are read from the environment only. Never commit them. Requests identify themselves with `User-Agent: proxy302-mcp/<version>` and `X-Proxy302-Client`.
|
|
171
|
+
|
|
172
|
+
## Development
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npm install
|
|
176
|
+
npm run build
|
|
177
|
+
npm test
|
|
178
|
+
PROXY302_API_KEY="<id>:<secret>" npm run smoke # read-only checks against the live API
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
MIT
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
<p align="center"><img src="https://raw.githubusercontent.com/proxy302/proxy302-mcp/main/docs/images/hero.svg" alt="proxy302-mcp:给 AI 助手用的住宅代理工具" width="100%"></p>
|
|
2
|
+
|
|
3
|
+
# proxy302-mcp
|
|
4
|
+
|
|
5
|
+
> **Proxy302 官方 MCP 服务器**,由 Proxy302 团队开发和维护。账户、计费、连接问题请联系 [Proxy302 客服](https://proxy302.com/zh/);这个服务器本身的 bug 请提 [GitHub issue](https://github.com/proxy302/proxy302-mcp/issues)。
|
|
6
|
+
|
|
7
|
+
给你的 AI 助手一套真正的住宅代理工具。`proxy302-mcp` 是 [Proxy302](https://proxy302.com) 的 [MCP](https://modelcontextprotocol.io) 服务器:在 Claude Code、Claude Desktop、Cursor 等工具里查流量和用量、看可用国家和套餐、按国家拿动态住宅代理连接串、列出你的代理和静态 IP,还能通过代理抓取网页。
|
|
8
|
+
|
|
9
|
+
[English](README.md)
|
|
10
|
+
|
|
11
|
+
<p align="center"><img src="https://raw.githubusercontent.com/proxy302/proxy302-mcp/main/docs/images/how-it-works.svg" alt="工作原理:AI 助手调用你电脑上的 proxy302-mcp,它用你的密钥调用 Proxy302 接口,并通过住宅 IP 抓取网页" width="100%"></p>
|
|
12
|
+
|
|
13
|
+
> v1 只做只读、不花钱的功能:不购买、不续费、不充值。唯一的写操作(创建动态代理凭证)免费,只在你真正使用时才按流量计费:`get_dynamic_proxy` 只在 `create_if_missing=true` 时创建;`fetch_url` 指定国家且你还没有该国代理时,会在低价线自动建一条(传 `create_if_missing=false` 可关掉)。
|
|
14
|
+
|
|
15
|
+
## 不用安装:直接连官方托管的服务器
|
|
16
|
+
|
|
17
|
+
Proxy302 托管了同一套服务。先在 [Proxy302 控制台](https://proxy302.com/api-keys) 创建 API 密钥。
|
|
18
|
+
|
|
19
|
+
[](https://cursor.com/en/install-mcp?name=proxy302&config=eyJ1cmwiOiJodHRwczovL21jcC5wcm94eTMwMi5jb20vbWNwIn0%3D)
|
|
20
|
+
[](https://insiders.vscode.dev/redirect/mcp/install?name=proxy302&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.proxy302.com%2Fmcp%22%7D)
|
|
21
|
+
[](https://insiders.vscode.dev/redirect/mcp/install?name=proxy302&config=%7B%22type%22%3A%22http%22%2C%22url%22%3A%22https%3A%2F%2Fmcp.proxy302.com%2Fmcp%22%7D&quality=insiders)
|
|
22
|
+
|
|
23
|
+
点一下就会添加 `https://mcp.proxy302.com/mcp`,应用随后打开 Proxy302 登录窗口,贴一次 API 密钥(`key id:secret`)就连上了。在控制台删掉密钥,连接就断开。
|
|
24
|
+
|
|
25
|
+
- **Claude**(claude.ai、Claude 桌面版):设置 → 连接器 → 添加自定义连接器,地址填 `https://mcp.proxy302.com/mcp`。
|
|
26
|
+
- **ChatGPT**(开发者模式):用同一个地址新建连接器,认证选 OAuth。
|
|
27
|
+
- **Cursor、VS Code、Windsurf 等其他 MCP 客户端:** 同一个地址,不用填请求头。
|
|
28
|
+
|
|
29
|
+
**用 OAuth 登录:** 在 Claude、ChatGPT 等支持 MCP 登录的客户端里,把 `https://mcp.proxy302.com/mcp` 添加为自定义连接器,在弹出的登录窗口里贴一次 API 密钥即可。Claude Code:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
claude mcp add --transport http proxy302 https://mcp.proxy302.com/mcp
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
然后在 Claude Code 里运行 `/mcp` 完成登录。
|
|
36
|
+
|
|
37
|
+
**或者用请求头带密钥:** 地址 `https://proxy302.com/v1/mcp`,请求头 `Authorization: Bearer <key id>:<secret>`。
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
claude mcp add --transport http proxy302 https://proxy302.com/v1/mcp --header "Authorization: Bearer <key id>:<secret>"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Cursor(`~/.cursor/mcp.json`):
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"proxy302": {
|
|
49
|
+
"url": "https://proxy302.com/v1/mcp",
|
|
50
|
+
"headers": { "Authorization": "Bearer <key id>:<secret>" }
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
托管版的工具和本地版一样,不含 `fetch_url`,另外多了 `check_ip_purity`(查你的静态 IP 或某个地区下一批 IP 的黑名单评分)、`estimate_cost`(按你的账户报价、看钱包够不够)。同样不会花钱。
|
|
57
|
+
|
|
58
|
+
## 在本机运行:一条命令安装
|
|
59
|
+
|
|
60
|
+
先在 Proxy302 控制台创建 API 密钥,记下 key id 和 secret。需要 Node.js 20+。
|
|
61
|
+
|
|
62
|
+
福利:付费账户第一次通过 proxy302-mcp 调用成功,Proxy302 会送 **1 PTC**(每个账户一次)。
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
claude mcp add proxy302 -e PROXY302_API_KEY="<key id>:<secret>" -- npx -y github:proxy302/proxy302-mcp
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Claude Desktop
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"proxy302": {
|
|
74
|
+
"command": "npx",
|
|
75
|
+
"args": ["-y", "github:proxy302/proxy302-mcp"],
|
|
76
|
+
"env": { "PROXY302_API_KEY": "<key id>:<secret>" }
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Cursor
|
|
83
|
+
|
|
84
|
+
把同样的片段放进 `~/.cursor/mcp.json`。
|
|
85
|
+
|
|
86
|
+
## 工具
|
|
87
|
+
|
|
88
|
+
| 工具 | 作用 |
|
|
89
|
+
|---|---|
|
|
90
|
+
| `get_account_usage` | 账号、钱包 PTC 余额、剩余预付流量、各流量包余额、最近 N 天用量 |
|
|
91
|
+
| `list_countries` | 可定向的国家(含 id 和 ISO 代码) |
|
|
92
|
+
| `list_regions` | 某国的州,或某州的城市 |
|
|
93
|
+
| `list_products` | 产品线与静态 IP 套餐 |
|
|
94
|
+
| `get_dynamic_proxy` | 按国家返回可直接使用的动态住宅代理 URL(优质线路还能到州、城市、运营商)。`session_mode=rotate` 每个新连接换 IP,`sticky`(默认)保持一个 IP;低价线路可用 `session_minutes` 设 10–120 分钟。优先复用同线路同地区的已有代理,`create_if_missing=true` 时才创建,有流量包扣流量包、没有就按量扣钱包 |
|
|
95
|
+
| `list_isps` | 某国优质线路可指定的运营商 |
|
|
96
|
+
| `rotate_ip` | 粘性代理换出口 IP:返回一个新会话的地址,立即生效 |
|
|
97
|
+
| `list_my_proxies` | 你的动态代理和静态 IP,密码默认打码 |
|
|
98
|
+
| `fetch_url` | 用指定国家的住宅 IP 请求网址,一步返回 Markdown、纯文本或原文(没有该国代理时自动在低价线建一条) |
|
|
99
|
+
|
|
100
|
+
## 示例
|
|
101
|
+
|
|
102
|
+
<p align="center"><img src="https://raw.githubusercontent.com/proxy302/proxy302-mcp/main/docs/images/demo.svg" alt="示例:查剩余流量、拿德国代理、通过代理抓网页" width="100%"></p>
|
|
103
|
+
|
|
104
|
+
直接问助手:「我还剩多少流量?」「给我一个德国代理」「用美国出口抓一下这个页面并总结」。
|
|
105
|
+
|
|
106
|
+
Playwright 与 browser-use 的用法见英文版 README:把 `get_dynamic_proxy` 返回的 host、port、用户名、密码填入浏览器的 proxy 配置即可。`fetch_url` 不执行 JavaScript,重度前端渲染的网站请把代理交给浏览器。
|
|
107
|
+
|
|
108
|
+
## 配置
|
|
109
|
+
|
|
110
|
+
- `PROXY302_API_KEY`:必填,`<key id>:<secret>`
|
|
111
|
+
- `PROXY302_API_SECRET`:可选
|
|
112
|
+
- `PROXY302_BASE_URL`:可选,默认 `https://proxy302.com`
|
|
113
|
+
|
|
114
|
+
密钥只从环境变量读取,不要提交到仓库。
|
|
115
|
+
|
|
116
|
+
## 许可证
|
|
117
|
+
|
|
118
|
+
MIT
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/** Thin client for the Proxy302 open API (/open_api/v3). Every response is HTTP 200; success is envelope code 0. */
|
|
2
|
+
import { VERSION } from './version.js';
|
|
3
|
+
/** Identifies MCP traffic to the backend (User-Agent and X-Proxy302-Client). */
|
|
4
|
+
export const CLIENT_ID = `proxy302-mcp/${VERSION}`;
|
|
5
|
+
export class Proxy302Error extends Error {
|
|
6
|
+
code;
|
|
7
|
+
constructor(message, code) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.code = code;
|
|
10
|
+
this.name = 'Proxy302Error';
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export function buildAuthorization(apiKey, apiSecret) {
|
|
14
|
+
const key = (apiKey ?? '').trim();
|
|
15
|
+
if (!key)
|
|
16
|
+
throw new Proxy302Error('PROXY302_API_KEY is not set. Create an API key in the Proxy302 console and set PROXY302_API_KEY="<key id>:<secret>".');
|
|
17
|
+
if (/^basic\s+/i.test(key))
|
|
18
|
+
return key;
|
|
19
|
+
if (apiSecret)
|
|
20
|
+
return `Basic ${Buffer.from(`${key}:${apiSecret}`).toString('base64')}`;
|
|
21
|
+
if (key.includes(':'))
|
|
22
|
+
return `Basic ${Buffer.from(key).toString('base64')}`;
|
|
23
|
+
if (/^[A-Za-z0-9+/]+={0,2}$/.test(key) && key.length >= 16)
|
|
24
|
+
return `Basic ${key}`;
|
|
25
|
+
throw new Proxy302Error('PROXY302_API_KEY must look like "<key id>:<secret>" (or set PROXY302_API_SECRET too).');
|
|
26
|
+
}
|
|
27
|
+
export class Proxy302Client {
|
|
28
|
+
options;
|
|
29
|
+
baseUrl;
|
|
30
|
+
fetchImpl;
|
|
31
|
+
timeoutMs;
|
|
32
|
+
constructor(options = {}) {
|
|
33
|
+
this.options = options;
|
|
34
|
+
this.baseUrl = (options.baseUrl ?? 'https://proxy302.com').replace(/\/+$/, '');
|
|
35
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
36
|
+
this.timeoutMs = options.timeoutMs ?? 20000;
|
|
37
|
+
}
|
|
38
|
+
static fromEnv(env = process.env) {
|
|
39
|
+
return new Proxy302Client({ apiKey: env.PROXY302_API_KEY, apiSecret: env.PROXY302_API_SECRET, baseUrl: env.PROXY302_BASE_URL });
|
|
40
|
+
}
|
|
41
|
+
async request(method, path, query, body, extraHeaders = {}) {
|
|
42
|
+
const authorization = buildAuthorization(this.options.apiKey, this.options.apiSecret);
|
|
43
|
+
const url = new URL(`${this.baseUrl}/open_api/v3/${path.replace(/^\/+/, '')}`);
|
|
44
|
+
for (const [k, v] of Object.entries(query ?? {}))
|
|
45
|
+
if (v !== undefined && v !== '')
|
|
46
|
+
url.searchParams.set(k, String(v));
|
|
47
|
+
let res;
|
|
48
|
+
try {
|
|
49
|
+
res = await this.fetchImpl(url, {
|
|
50
|
+
method,
|
|
51
|
+
headers: { authorization, accept: 'application/json', ...(body !== undefined ? { 'content-type': 'application/json' } : {}), 'user-agent': CLIENT_ID, 'x-proxy302-client': CLIENT_ID, ...extraHeaders },
|
|
52
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
53
|
+
signal: AbortSignal.timeout(this.timeoutMs),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
throw new Proxy302Error(`Could not reach Proxy302 (${e.message})`);
|
|
58
|
+
}
|
|
59
|
+
if (res.status === 401)
|
|
60
|
+
throw new Proxy302Error('Proxy302 rejected the API key (401).', 401);
|
|
61
|
+
let json;
|
|
62
|
+
try {
|
|
63
|
+
json = await res.json();
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
throw new Proxy302Error(`Unexpected response from Proxy302 (HTTP ${res.status}).`);
|
|
67
|
+
}
|
|
68
|
+
if (json.code !== 0)
|
|
69
|
+
throw new Proxy302Error(json.msg || `Proxy302 error code ${json.code}`, json.code);
|
|
70
|
+
return json.data;
|
|
71
|
+
}
|
|
72
|
+
me() { return this.request('GET', 'user/users/me'); }
|
|
73
|
+
wallet() { return this.request('GET', 'user/users/wallet'); }
|
|
74
|
+
areas(type, pid, name) {
|
|
75
|
+
return this.request('GET', `proxy/area/${type}`, { pid, name });
|
|
76
|
+
}
|
|
77
|
+
payways(name) {
|
|
78
|
+
return this.request('GET', `proxy/payway/${name}`);
|
|
79
|
+
}
|
|
80
|
+
trafficPool() {
|
|
81
|
+
return this.request('GET', 'proxy/traffic/pool/remaining');
|
|
82
|
+
}
|
|
83
|
+
consumeSummary(startTime, endTime) {
|
|
84
|
+
return this.request('GET', 'proxy/traffic/consume/log/summary', { start_time: startTime, end_time: endTime });
|
|
85
|
+
}
|
|
86
|
+
costSummary(kind) { return this.request('GET', `proxy/summary/cost/${kind}`); }
|
|
87
|
+
tokens(generate, proxyType, query = {}) {
|
|
88
|
+
return this.request('GET', `proxy/tokens/${generate}/${proxyType}`, query);
|
|
89
|
+
}
|
|
90
|
+
/** Creates a dynamic proxy credential (no charge at creation; traffic is billed on use). */
|
|
91
|
+
generateDynamic(body) {
|
|
92
|
+
return this.request('POST', 'proxy/api/proxy/dynamic/traffic', undefined, body);
|
|
93
|
+
}
|
|
94
|
+
/** Sticky-session reset: the next gateway snapshot gives each token a new sticky IP (within apply_within_seconds). */
|
|
95
|
+
resetSessions(tokenIds) {
|
|
96
|
+
return this.request('POST', 'proxy/sessions', undefined, { token_ids: tokenIds }, { 'x-http-method-override': 'DELETE' });
|
|
97
|
+
}
|
|
98
|
+
/** ISPs the premium line can target in a country (keys for generateDynamic isp). */
|
|
99
|
+
ispCatalog(countryId) {
|
|
100
|
+
return this.request('GET', 'proxy/isp/catalog', { country_id: countryId });
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { ProxyAgent, fetch as undiciFetch } from 'undici';
|
|
2
|
+
import { htmlToMarkdown, htmlToText, truncate } from './format.js';
|
|
3
|
+
import { Proxy302Error } from './client.js';
|
|
4
|
+
export function assertHttpUrl(raw) {
|
|
5
|
+
let u;
|
|
6
|
+
try {
|
|
7
|
+
u = new URL(raw);
|
|
8
|
+
}
|
|
9
|
+
catch {
|
|
10
|
+
throw new Proxy302Error(`Not a valid URL: ${raw}`);
|
|
11
|
+
}
|
|
12
|
+
if (u.protocol !== 'http:' && u.protocol !== 'https:')
|
|
13
|
+
throw new Proxy302Error('Only http and https URLs can be fetched.');
|
|
14
|
+
return u;
|
|
15
|
+
}
|
|
16
|
+
export async function fetchThroughProxy(rawUrl, proxy, opts = {}) {
|
|
17
|
+
const url = assertHttpUrl(rawUrl);
|
|
18
|
+
const format = opts.format ?? 'markdown';
|
|
19
|
+
const maxChars = Math.min(Math.max(opts.maxChars ?? 20000, 500), 200000);
|
|
20
|
+
const token = `Basic ${Buffer.from(`${proxy.username}:${proxy.password}`).toString('base64')}`;
|
|
21
|
+
const agent = new ProxyAgent({ uri: `http://${proxy.host}:${proxy.port}`, token });
|
|
22
|
+
try {
|
|
23
|
+
const res = await (opts.fetchImpl ?? undiciFetch)(url, {
|
|
24
|
+
dispatcher: agent,
|
|
25
|
+
redirect: 'follow',
|
|
26
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 30000),
|
|
27
|
+
headers: {
|
|
28
|
+
'user-agent': 'Mozilla/5.0 (compatible; proxy302-mcp/0.1; +https://proxy302.com)',
|
|
29
|
+
accept: 'text/html,application/xhtml+xml,application/json;q=0.9,text/plain;q=0.8,*/*;q=0.5',
|
|
30
|
+
'accept-language': 'en-US,en;q=0.8',
|
|
31
|
+
},
|
|
32
|
+
});
|
|
33
|
+
const contentType = res.headers.get('content-type') ?? '';
|
|
34
|
+
// Cap the download before decoding so a huge page cannot exhaust memory.
|
|
35
|
+
const buf = Buffer.from(await res.arrayBuffer()).subarray(0, 5_000_000);
|
|
36
|
+
const body = buf.toString('utf8');
|
|
37
|
+
const isHtml = /html|xml/i.test(contentType) || /^\s*<(!doctype|html)/i.test(body);
|
|
38
|
+
const converted = format === 'raw' || !isHtml ? body : format === 'text' ? htmlToText(body) : htmlToMarkdown(body);
|
|
39
|
+
const { text, truncated } = truncate(converted, maxChars);
|
|
40
|
+
return { url: rawUrl, finalUrl: res.url || rawUrl, status: res.status, contentType, format, truncated, content: text };
|
|
41
|
+
}
|
|
42
|
+
catch (e) {
|
|
43
|
+
if (e instanceof Proxy302Error)
|
|
44
|
+
throw e;
|
|
45
|
+
// undici says only "fetch failed"; the reason (a 407 from the proxy, a reset, a timeout) is in the cause.
|
|
46
|
+
const cause = e.cause;
|
|
47
|
+
const why = [cause?.code, cause?.message].filter(Boolean).join(' ');
|
|
48
|
+
throw new Proxy302Error(`Request through the proxy failed: ${e.message}${why ? ` (${why})` : ''}`);
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
await agent.close().catch(() => undefined);
|
|
52
|
+
}
|
|
53
|
+
}
|
package/dist/format.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import TurndownService from 'turndown';
|
|
2
|
+
export function formatBytes(value) {
|
|
3
|
+
const n = Number(value ?? 0);
|
|
4
|
+
if (!Number.isFinite(n))
|
|
5
|
+
return String(value);
|
|
6
|
+
const units = ['B', 'KB', 'MB', 'GB', 'TB'];
|
|
7
|
+
let v = n, i = 0;
|
|
8
|
+
while (v >= 1024 && i < units.length - 1) {
|
|
9
|
+
v /= 1024;
|
|
10
|
+
i++;
|
|
11
|
+
}
|
|
12
|
+
return `${v.toFixed(i === 0 ? 0 : 2)} ${units[i]}`;
|
|
13
|
+
}
|
|
14
|
+
export function mask(secret) {
|
|
15
|
+
if (!secret)
|
|
16
|
+
return '';
|
|
17
|
+
return secret.length <= 4 ? '****' : `${secret.slice(0, 2)}****${secret.slice(-2)}`;
|
|
18
|
+
}
|
|
19
|
+
export function proxyUrl(protocol, user, pass, host, port) {
|
|
20
|
+
const scheme = protocol === 'socks5' ? 'socks5' : 'http';
|
|
21
|
+
return `${scheme}://${encodeURIComponent(user)}:${encodeURIComponent(pass)}@${host}:${port}`;
|
|
22
|
+
}
|
|
23
|
+
const turndown = new TurndownService({ headingStyle: 'atx', codeBlockStyle: 'fenced', bulletListMarker: '-' });
|
|
24
|
+
turndown.remove(['script', 'style', 'noscript', 'iframe', 'svg', 'template']);
|
|
25
|
+
export function htmlToMarkdown(html) {
|
|
26
|
+
const body = /<body[^>]*>([\s\S]*)<\/body>/i.exec(html)?.[1] ?? html;
|
|
27
|
+
return turndown.turndown(body).replace(/\n{3,}/g, '\n\n').trim();
|
|
28
|
+
}
|
|
29
|
+
export function htmlToText(html) {
|
|
30
|
+
return html
|
|
31
|
+
.replace(/<(script|style|noscript|svg|template)[\s\S]*?<\/\1>/gi, ' ')
|
|
32
|
+
.replace(/<!--[\s\S]*?-->/g, ' ')
|
|
33
|
+
.replace(/<\/(p|div|li|h[1-6]|tr|br)>|<br\s*\/?>/gi, '\n')
|
|
34
|
+
.replace(/<[^>]+>/g, ' ')
|
|
35
|
+
.replace(/ /g, ' ').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/"/g, '"').replace(/'/g, "'")
|
|
36
|
+
.replace(/[ \t]+/g, ' ').replace(/ *\n */g, '\n').replace(/\n{3,}/g, '\n\n').trim();
|
|
37
|
+
}
|
|
38
|
+
export function truncate(text, max) {
|
|
39
|
+
return text.length > max ? { text: text.slice(0, max), truncated: true } : { text, truncated: false };
|
|
40
|
+
}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
+
import { createServer } from './server.js';
|
|
4
|
+
// stdout is the protocol channel; log to stderr only.
|
|
5
|
+
createServer().connect(new StdioServerTransport()).then(() => {
|
|
6
|
+
console.error('proxy302-mcp ready' + (process.env.PROXY302_API_KEY ? '' : ' (PROXY302_API_KEY is not set: tools will report an error)'));
|
|
7
|
+
}).catch((e) => { console.error(e); process.exit(1); });
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import { Proxy302Client } from './client.js';
|
|
3
|
+
import { VERSION } from './version.js';
|
|
4
|
+
import { registerTools } from './tools.js';
|
|
5
|
+
export function createServer(client = Proxy302Client.fromEnv()) {
|
|
6
|
+
const server = new McpServer({ name: 'proxy302', version: VERSION });
|
|
7
|
+
registerTools(server, client);
|
|
8
|
+
return server;
|
|
9
|
+
}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { Proxy302Error } from './client.js';
|
|
4
|
+
import { fetchThroughProxy } from './fetchPage.js';
|
|
5
|
+
import { formatBytes, mask, proxyUrl } from './format.js';
|
|
6
|
+
const ok = (value) => ({ content: [{ type: 'text', text: typeof value === 'string' ? value : JSON.stringify(value, null, 2) }] });
|
|
7
|
+
const fail = (e) => ({ isError: true, content: [{ type: 'text', text: e instanceof Error ? e.message : String(e) }] });
|
|
8
|
+
const safe = (fn) => async (args) => { try {
|
|
9
|
+
return await fn(args);
|
|
10
|
+
}
|
|
11
|
+
catch (e) {
|
|
12
|
+
return fail(e);
|
|
13
|
+
} };
|
|
14
|
+
export async function resolveArea(client, type, input, pid) {
|
|
15
|
+
if (/^\d+$/.test(input.trim()))
|
|
16
|
+
return { id: Number(input), name: input };
|
|
17
|
+
const rows = (await client.areas(type, pid, input.trim())).data;
|
|
18
|
+
const q = input.trim().toLowerCase();
|
|
19
|
+
let exact = rows.filter(r => r.name.toLowerCase() === q || r.code?.toLowerCase() === q);
|
|
20
|
+
// The API filters on the name, so a code like "US" finds Australia and Russia but not United States: look codes up in the full list.
|
|
21
|
+
if (!exact.length && /^[a-z]{2,3}$/i.test(input.trim()))
|
|
22
|
+
exact = (await client.areas(type, pid)).data.filter(r => r.code?.toLowerCase() === q);
|
|
23
|
+
const pick = exact.length === 1 ? exact : !exact.length && rows.length === 1 ? rows : [];
|
|
24
|
+
if (pick.length === 1)
|
|
25
|
+
return pick[0];
|
|
26
|
+
if (!rows.length)
|
|
27
|
+
throw new Proxy302Error(`No ${type} matches "${input}". Use list_countries / list_regions to see valid names.`);
|
|
28
|
+
throw new Proxy302Error(`"${input}" matches several ${type}s: ${rows.slice(0, 10).map(r => `${r.name} (id ${r.id})`).join(', ')}. Pass the exact name or id.`);
|
|
29
|
+
}
|
|
30
|
+
function toEndpoint(row) {
|
|
31
|
+
if (!row.username || !row.passwd || !row.host || !row.port)
|
|
32
|
+
return null;
|
|
33
|
+
return { host: row.host, port: Number(row.port), username: row.username, password: row.passwd };
|
|
34
|
+
}
|
|
35
|
+
function describeToken(row, includeCredentials) {
|
|
36
|
+
const endpoint = toEndpoint(row);
|
|
37
|
+
return {
|
|
38
|
+
token_id: row.token_id ?? row.id, kind: `${row.generate ?? ''}/${row.proxy_type ?? ''}`, area: row.proxy_area || 'any',
|
|
39
|
+
protocol: row.network ?? 'http', status: row.status, connection_state: row.connection_state,
|
|
40
|
+
expires_at: row.expired_on ? new Date(row.expired_on * 1000).toISOString() : null,
|
|
41
|
+
traffic_used: row.traffic_usage !== undefined ? formatBytes(row.traffic_usage) : undefined,
|
|
42
|
+
host: row.host, port: row.port, username: row.username,
|
|
43
|
+
password: includeCredentials ? row.passwd : mask(row.passwd),
|
|
44
|
+
...(includeCredentials && endpoint ? { connection_url: proxyUrl(row.network ?? 'http', endpoint.username, endpoint.password, endpoint.host, endpoint.port) } : {}),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function matchesCountry(row, countryName) {
|
|
48
|
+
return (row.proxy_area ?? '').split(' - ')[0].trim().toLowerCase() === countryName.toLowerCase();
|
|
49
|
+
}
|
|
50
|
+
/** Exactly this place: a city proxy does not answer a country request. */
|
|
51
|
+
const sameArea = (row, label) => (row.proxy_area ?? '').split(' - ').map(part => part.trim().toLowerCase()).filter(part => part && part !== '-').join(' - ') === label.toLowerCase();
|
|
52
|
+
/** s 1/2 = premium line, 3/4 = budget line. */
|
|
53
|
+
function lineOf(row) {
|
|
54
|
+
const s = Number(row.s);
|
|
55
|
+
return s === 1 || s === 2 ? 'premium' : s === 3 || s === 4 ? 'budget' : null;
|
|
56
|
+
}
|
|
57
|
+
const newSessionId = () => randomBytes(6).toString('hex');
|
|
58
|
+
async function countryCode(client, c) {
|
|
59
|
+
const code = c.code ?? (await client.areas('country')).data.find(row => row.id === c.id)?.code;
|
|
60
|
+
return code && /^[A-Za-z]{2}$/.test(code) ? code.toLowerCase() : null;
|
|
61
|
+
}
|
|
62
|
+
/** Username parameters (proxy302.com docs): -country-<cc> without a session = a new IP on every new connection;
|
|
63
|
+
* -session-<id> keeps one IP, -sessTime-<minutes> sets how long on the budget line. */
|
|
64
|
+
function withSession(proxy, protocol, code, mode, minutes) {
|
|
65
|
+
let tail = '';
|
|
66
|
+
if (mode === 'rotate') {
|
|
67
|
+
if (!code)
|
|
68
|
+
throw new Proxy302Error('Rotating needs the country code of this proxy; pass the country as a two-letter code.');
|
|
69
|
+
tail = `-country-${code}`;
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
// A reused proxy may have been created rotating: sticky always pins its own session in the username.
|
|
73
|
+
tail = `-session-${newSessionId()}${minutes ? `-sessTime-${minutes}` : ''}`;
|
|
74
|
+
}
|
|
75
|
+
const how_to_rotate = mode === 'rotate' ? 'Every new connection already gets a new IP.'
|
|
76
|
+
: 'For a new IP now, change the value after -session- in the username (any letters and digits), or call rotate_ip.';
|
|
77
|
+
if (!tail || !proxy.username || !proxy.password || !proxy.host || !proxy.port)
|
|
78
|
+
return { ...proxy, session_mode: mode, how_to_rotate };
|
|
79
|
+
const username = proxy.username + tail;
|
|
80
|
+
return { ...proxy, username, connection_url: proxyUrl(protocol, username, proxy.password, proxy.host, Number(proxy.port)), session_mode: mode, how_to_rotate };
|
|
81
|
+
}
|
|
82
|
+
const usable = (row) => row.status === 1 || row.status === 5;
|
|
83
|
+
/** The API's texts for "no traffic package on this line" (proxy302-backend generation-failure.ts, no_traffic_package). */
|
|
84
|
+
const NO_TRAFFIC_PACKAGE = new Set([
|
|
85
|
+
'A matching prepaid traffic package is required for the bridge',
|
|
86
|
+
'No matching traffic package for this line; purchase a same-config traffic package or enable auto-refill',
|
|
87
|
+
'No unexpired traffic pool matches the selected provider configuration',
|
|
88
|
+
]);
|
|
89
|
+
/** Create a dynamic proxy (free; traffic billed per GB on use). Same idempotency key as before, so a retry never makes a second one.
|
|
90
|
+
* Like the Proxy302 console: with no traffic package for this line the wallet pays per GB (the API refuses a wallet that cannot
|
|
91
|
+
* cover the pay-as-you-go hold). */
|
|
92
|
+
async function createDynamic(client, o) {
|
|
93
|
+
const key = `mcp-${o.c.id}-${o.s?.id ?? 0}-${o.ci?.id ?? 0}-${o.protocol}-${o.line}${o.isp ? `-${o.isp}` : ''}`;
|
|
94
|
+
const body = { s: o.line === 'premium' ? 1 : 3, protocol: o.protocol, country_id: o.c.id, state_id: o.s?.id ?? 0, city_id: o.ci?.id ?? 0, ...(o.isp ? { isp: o.isp } : {}) };
|
|
95
|
+
let billedFrom = 'traffic_package';
|
|
96
|
+
const out = await client.generateDynamic({ ...body, idempotency_key: key }).catch((e) => {
|
|
97
|
+
if (!(e instanceof Proxy302Error && NO_TRAFFIC_PACKAGE.has(e.message)))
|
|
98
|
+
throw e;
|
|
99
|
+
billedFrom = 'wallet';
|
|
100
|
+
return client.generateDynamic({ ...body, billing_mode: 'payg_wallet', idempotency_key: `${key}-payg` });
|
|
101
|
+
});
|
|
102
|
+
return { out, billedFrom };
|
|
103
|
+
}
|
|
104
|
+
/** A proxy created a moment ago can be refused (407) or not answer until the gateway has picked it up: retry a few times. */
|
|
105
|
+
async function fetchFresh(url, endpoint, opts, fresh, waitMs = 3000) {
|
|
106
|
+
for (let attempt = 0;; attempt += 1) {
|
|
107
|
+
try {
|
|
108
|
+
const result = await fetchThroughProxy(url, endpoint, opts);
|
|
109
|
+
if (!fresh || result.status !== 407 || attempt >= 3)
|
|
110
|
+
return result;
|
|
111
|
+
}
|
|
112
|
+
catch (e) {
|
|
113
|
+
// An https tunnel refused by the proxy throws "Proxy response (407) …"; a timeout to the site is not retried.
|
|
114
|
+
if (!fresh || attempt >= 3 || !/\b407\b|ECONNRESET|other side closed|socket hang up/i.test(e.message))
|
|
115
|
+
throw e;
|
|
116
|
+
}
|
|
117
|
+
await new Promise(resolve => setTimeout(resolve, waitMs));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
export function registerTools(server, client) {
|
|
121
|
+
server.registerTool('get_account_usage', {
|
|
122
|
+
title: 'Account, traffic balance and usage',
|
|
123
|
+
description: 'Show the account tied to the API key, wallet balance (PTC), remaining prepaid traffic, and traffic used per day for the last N days. Read-only.',
|
|
124
|
+
inputSchema: { days: z.number().int().min(1).max(90).default(7).describe('How many past days of usage to include') },
|
|
125
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
126
|
+
}, safe(async ({ days }) => {
|
|
127
|
+
const end = Math.floor(Date.now() / 1000);
|
|
128
|
+
const [me, pool, usage, wallet] = await Promise.all([client.me(), client.trafficPool(), client.consumeSummary(end - days * 86400, end),
|
|
129
|
+
// Older servers do not have the wallet endpoint yet: degrade gracefully instead of failing the whole call.
|
|
130
|
+
client.wallet().catch(() => null)]);
|
|
131
|
+
return ok({
|
|
132
|
+
account: { name: me.name, email: me.email, uid: me.uid, active: me.is_use === 1 },
|
|
133
|
+
wallet_balance_ptc: wallet ? wallet.balance : 'unavailable',
|
|
134
|
+
traffic_remaining: formatBytes(pool.remaining_traffic),
|
|
135
|
+
traffic_pools: pool.traffic_pools.map(p => ({
|
|
136
|
+
id: p.id, name: p.en_name ?? p.name, used: formatBytes(p.current_cost_traffic), total: formatBytes(p.total_traffic),
|
|
137
|
+
expires_at: p.expired_on ? new Date(Number(p.expired_on) * 1000).toISOString() : 'never',
|
|
138
|
+
})),
|
|
139
|
+
usage_last_days: { days, by_category_total: Object.fromEntries(Object.entries(usage.summary).map(([k, v]) => [k, formatBytes(v)])), day_keys: usage.keys },
|
|
140
|
+
});
|
|
141
|
+
}));
|
|
142
|
+
server.registerTool('list_countries', {
|
|
143
|
+
title: 'List countries',
|
|
144
|
+
description: 'List countries Proxy302 can target. Optional name filter (substring). Returns ids usable in other tools. Read-only.',
|
|
145
|
+
inputSchema: { name: z.string().max(100).optional().describe('Filter, e.g. "ger"') },
|
|
146
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
147
|
+
}, safe(async ({ name }) => {
|
|
148
|
+
const rows = (await client.areas('country', undefined, name)).data;
|
|
149
|
+
return ok({ count: rows.length, countries: rows.map(r => ({ id: r.id, name: r.name, code: r.code })) });
|
|
150
|
+
}));
|
|
151
|
+
server.registerTool('list_regions', {
|
|
152
|
+
title: 'List states or cities',
|
|
153
|
+
description: 'List states of a country, or cities of a state. Pass either country (name/code/id) or state_id. Read-only.',
|
|
154
|
+
inputSchema: {
|
|
155
|
+
country: z.string().optional().describe('Country name, ISO code or id; lists its states'),
|
|
156
|
+
state_id: z.number().int().positive().optional().describe('State id; lists its cities'),
|
|
157
|
+
name: z.string().max(100).optional(),
|
|
158
|
+
},
|
|
159
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
160
|
+
}, safe(async ({ country, state_id, name }) => {
|
|
161
|
+
if (state_id)
|
|
162
|
+
return ok((await client.areas('city', String(state_id), name)).data);
|
|
163
|
+
if (!country)
|
|
164
|
+
throw new Proxy302Error('Pass country (to list states) or state_id (to list cities).');
|
|
165
|
+
const c = await resolveArea(client, 'country', country);
|
|
166
|
+
return ok({ country: c, states: (await client.areas('state', String(c.id), name)).data });
|
|
167
|
+
}));
|
|
168
|
+
server.registerTool('list_products', {
|
|
169
|
+
title: 'List products and plans',
|
|
170
|
+
description: 'Describe the proxy products and list the static IP plans (data center and residential) with their plan ids. Read-only; prices are shown on proxy302.com.',
|
|
171
|
+
inputSchema: {},
|
|
172
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
173
|
+
}, safe(async () => {
|
|
174
|
+
const [dc, res] = await Promise.all([client.payways('static_data_center'), client.payways('static_residential')]);
|
|
175
|
+
return ok({
|
|
176
|
+
dynamic_residential: { billing: 'per GB of traffic', lines: { premium: 'higher-quality line: country, state, city and ISP', budget: 'lower-cost line: country' }, rotation: 'new IP on every new connection, or sticky sessions', concurrency: 'no limit on concurrent connections', tools: ['get_dynamic_proxy', 'rotate_ip', 'list_isps'] },
|
|
177
|
+
static_data_center_plans: dc.data.map(p => ({ id: p.id, name: p.en_name || p.name })),
|
|
178
|
+
static_residential_plans: res.data.map(p => ({ id: p.id, name: p.en_name || p.name })),
|
|
179
|
+
note: 'This MCP server does not buy, renew or top up. Do that in the Proxy302 console.',
|
|
180
|
+
});
|
|
181
|
+
}));
|
|
182
|
+
server.registerTool('get_dynamic_proxy', {
|
|
183
|
+
title: 'Get a dynamic residential proxy connection string',
|
|
184
|
+
description: 'Return a ready-to-use residential proxy URL for a country (optionally state and city, and on the premium line an ISP). '
|
|
185
|
+
+ 'session_mode="rotate": every new connection exits through a new IP. session_mode="sticky" (default): one IP across connections '
|
|
186
|
+
+ '(premium: usually 5-10 minutes, not adjustable; budget: 10 minutes, or session_minutes up to 120). '
|
|
187
|
+
+ 'Reuses a matching proxy of the same line you already have; with create_if_missing=true it creates one if none exists. '
|
|
188
|
+
+ 'Creating is free; traffic is billed per GB when used, from a traffic package for that line if you have one, otherwise from the wallet. '
|
|
189
|
+
+ 'No limit on concurrent connections.',
|
|
190
|
+
inputSchema: {
|
|
191
|
+
country: z.string().describe('Country name, ISO code or id, e.g. "United States" or "US"'),
|
|
192
|
+
state: z.string().optional(), city: z.string().optional(),
|
|
193
|
+
isp: z.string().max(32).optional().describe('Premium line only: ISP key from list_isps, e.g. "comcast"'),
|
|
194
|
+
protocol: z.enum(['http', 'socks5']).default('http'),
|
|
195
|
+
line: z.enum(['budget', 'premium']).default('budget').describe('budget = lower price per GB, country only; premium = higher-quality line with state, city and ISP'),
|
|
196
|
+
session_mode: z.enum(['sticky', 'rotate']).default('sticky').describe('rotate = new IP on every new connection; sticky = keep one IP'),
|
|
197
|
+
session_minutes: z.union([z.literal(10), z.literal(30), z.literal(60), z.literal(120)]).optional().describe('Budget line, sticky only: minutes to keep one IP'),
|
|
198
|
+
create_if_missing: z.boolean().default(false),
|
|
199
|
+
},
|
|
200
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: false },
|
|
201
|
+
}, safe(async ({ country, state, city, isp, protocol, line, session_mode, session_minutes, create_if_missing }) => {
|
|
202
|
+
if (isp && line !== 'premium')
|
|
203
|
+
throw new Proxy302Error('ISP targeting is on the premium line only: pass line="premium".');
|
|
204
|
+
if (session_minutes && session_mode === 'rotate')
|
|
205
|
+
throw new Proxy302Error('session_minutes applies to sticky sessions only.');
|
|
206
|
+
if (session_minutes && line === 'premium')
|
|
207
|
+
throw new Proxy302Error('A premium sticky IP usually holds 5-10 minutes and the length is not adjustable; session_minutes is for the budget line.');
|
|
208
|
+
const c = await resolveArea(client, 'country', country);
|
|
209
|
+
let ispOption;
|
|
210
|
+
if (isp) {
|
|
211
|
+
const options = (await client.ispCatalog(c.id)).data;
|
|
212
|
+
ispOption = options.find(option => option.key === isp.trim().toLowerCase());
|
|
213
|
+
if (!ispOption)
|
|
214
|
+
throw new Proxy302Error(options.length ? `"${isp}" is not an ISP we can target in ${c.name}. Choose one of: ${options.map(o => o.key).join(', ')}.` : `ISP targeting is not available in ${c.name}.`);
|
|
215
|
+
}
|
|
216
|
+
const s = state ? await resolveArea(client, 'state', state, String(c.id)) : undefined;
|
|
217
|
+
const ci = city ? await resolveArea(client, 'city', city, String(s?.id ?? '')) : undefined;
|
|
218
|
+
if (ci && !s)
|
|
219
|
+
throw new Proxy302Error('Give the state as well when targeting a city.');
|
|
220
|
+
const label = [c.name, s?.name, ci?.name].filter(Boolean).join(' - ');
|
|
221
|
+
// Only a proxy of the requested line and exactly this place; an ISP proxy is found again by its idempotency key.
|
|
222
|
+
if (!ispOption) {
|
|
223
|
+
const rows = (await client.tokens('dynamic', 'traffic', { page_size: 200 })).data;
|
|
224
|
+
const hit = rows.find(r => usable(r) && lineOf(r) === line && sameArea(r, label) && (r.network ?? 'http') === protocol && toEndpoint(r));
|
|
225
|
+
if (hit)
|
|
226
|
+
return ok({ reused: true, ...withSession(describeToken(hit, true), hit.network ?? 'http', await countryCode(client, c), session_mode, session_minutes) });
|
|
227
|
+
}
|
|
228
|
+
if (!create_if_missing) {
|
|
229
|
+
throw new Proxy302Error(`No existing ${protocol} ${line} dynamic proxy for ${label}${ispOption ? ` on ${ispOption.label}` : ''}. Call again with create_if_missing=true to create one (free to create; billed per GB on use).`);
|
|
230
|
+
}
|
|
231
|
+
const { out, billedFrom } = await createDynamic(client, { c, s, ci, protocol, line, isp: ispOption?.key });
|
|
232
|
+
return ok(withSession({
|
|
233
|
+
reused: false, token_id: out.token_id, billed_from: billedFrom, line, area: [label, ispOption?.label].filter(Boolean).join(' - '), protocol: out.protocol,
|
|
234
|
+
host: out.host, port: out.port, username: out.username, password: out.password,
|
|
235
|
+
connection_url: proxyUrl(out.protocol, out.username, out.password, out.host, out.port),
|
|
236
|
+
}, out.protocol, await countryCode(client, c), session_mode, session_minutes));
|
|
237
|
+
}));
|
|
238
|
+
server.registerTool('list_isps', {
|
|
239
|
+
title: 'List ISPs for premium targeting',
|
|
240
|
+
description: 'ISPs (carriers) the premium line can target in a country, for get_dynamic_proxy isp=. Read-only.',
|
|
241
|
+
inputSchema: { country: z.string().describe('Country name, ISO code or id') },
|
|
242
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
243
|
+
}, safe(async ({ country }) => {
|
|
244
|
+
const c = await resolveArea(client, 'country', country);
|
|
245
|
+
const isps = (await client.ispCatalog(c.id)).data.map(option => ({ isp: option.key, name: option.label }));
|
|
246
|
+
return ok({ country: c.name, isps, ...(isps.length ? {} : { note: `ISP targeting is not available in ${c.name}; choose by country, state or city instead.` }) });
|
|
247
|
+
}));
|
|
248
|
+
server.registerTool('rotate_ip', {
|
|
249
|
+
title: 'Rotate sticky proxies to a new IP',
|
|
250
|
+
description: 'Get a new IP for sticky dynamic proxies. Each proxy comes back with a connection_url carrying a fresh session: use it and the next '
|
|
251
|
+
+ 'connection exits through a new IP right away. The plain username, password and billing stay the same; its own sticky IP also changes '
|
|
252
|
+
+ 'within about 2.5 minutes. Free. Token ids come from list_my_proxies or get_dynamic_proxy.',
|
|
253
|
+
inputSchema: { token_ids: z.array(z.number().int().positive()).min(1).max(100).describe('Token ids of your sticky dynamic proxies') },
|
|
254
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false },
|
|
255
|
+
}, safe(async ({ token_ids }) => {
|
|
256
|
+
const ids = [...new Set(token_ids)];
|
|
257
|
+
const rows = (await client.tokens('dynamic', 'traffic', { page_size: 200 })).data;
|
|
258
|
+
const new_ip_now = ids.map(id => rows.find(row => Number(row.token_id ?? row.id) === id)).filter((row) => !!row && !!toEndpoint(row))
|
|
259
|
+
.map(row => {
|
|
260
|
+
const e = toEndpoint(row);
|
|
261
|
+
const username = `${e.username}-session-${newSessionId()}`;
|
|
262
|
+
return { token_id: Number(row.token_id ?? row.id), username, connection_url: proxyUrl(row.network ?? 'http', username, e.password, e.host, e.port) };
|
|
263
|
+
});
|
|
264
|
+
// The reset is all-or-nothing and a rotating proxy has no sticky session to reset: on a refusal reset one by one.
|
|
265
|
+
const out = await client.resetSessions(ids).catch(async (error) => {
|
|
266
|
+
if (!(error instanceof Proxy302Error) || ids.length === 1 && !/no sticky session/i.test(error.message))
|
|
267
|
+
throw error;
|
|
268
|
+
let applyWithin = 0;
|
|
269
|
+
const results = await Promise.all(ids.map(id => client.resetSessions([id]).then(one => {
|
|
270
|
+
applyWithin = Math.max(applyWithin, one.apply_within_seconds);
|
|
271
|
+
return one.results[0] ?? { token_id: String(id), rotated_sessions: 0 };
|
|
272
|
+
}, (each) => ({ token_id: String(id), rotated_sessions: 0, note: each instanceof Error ? each.message : 'not reset' }))));
|
|
273
|
+
return { results, apply_within_seconds: applyWithin };
|
|
274
|
+
});
|
|
275
|
+
return ok({ new_ip_now, rotated: out.results, apply_within_seconds: out.apply_within_seconds });
|
|
276
|
+
}));
|
|
277
|
+
server.registerTool('list_my_proxies', {
|
|
278
|
+
title: 'List my proxies and static IPs',
|
|
279
|
+
description: 'List proxies on the account: dynamic or static, billed by traffic or by IP. Passwords are masked unless include_credentials=true. Read-only.',
|
|
280
|
+
inputSchema: {
|
|
281
|
+
kind: z.enum(['dynamic', 'static']).default('static'),
|
|
282
|
+
billing: z.enum(['ip', 'traffic']).optional().describe('Defaults to traffic for dynamic proxies and ip for static ones'),
|
|
283
|
+
page_size: z.number().int().min(1).max(100).default(20),
|
|
284
|
+
page: z.number().int().min(1).default(1),
|
|
285
|
+
active_only: z.boolean().default(true),
|
|
286
|
+
include_credentials: z.boolean().default(false),
|
|
287
|
+
},
|
|
288
|
+
annotations: { readOnlyHint: true, openWorldHint: false },
|
|
289
|
+
}, safe(async ({ kind, billing: chosen, page_size, page, active_only, include_credentials }) => {
|
|
290
|
+
const billing = chosen ?? (kind === 'dynamic' ? 'traffic' : 'ip');
|
|
291
|
+
// The API's active state is 5 for traffic-billed proxies and 1 for IP-billed ones.
|
|
292
|
+
const r = await client.tokens(kind, billing, { page, page_size, ...(active_only ? { status: billing === 'traffic' ? 5 : 1 } : {}) });
|
|
293
|
+
return ok({ total: r.total, page: r.page, has_more: r.has_more, proxies: r.data.map(row => describeToken(row, include_credentials)) });
|
|
294
|
+
}));
|
|
295
|
+
server.registerTool('fetch_url', {
|
|
296
|
+
title: 'Fetch a web page through a Proxy302 proxy',
|
|
297
|
+
description: 'Request a URL from your machine through a Proxy302 residential IP in a given country and return the page as Markdown, plain text or raw, in one call. '
|
|
298
|
+
+ 'Uses one of your dynamic proxies for that country; if you have none, it creates one on the budget line (free to create, like get_dynamic_proxy) unless create_if_missing=false. '
|
|
299
|
+
+ 'Traffic is billed per GB from a traffic package for that line if you have one, otherwise from the wallet. '
|
|
300
|
+
+ 'A plain HTTP request without JavaScript rendering: for JS-heavy sites use a browser with the proxy URL from get_dynamic_proxy.',
|
|
301
|
+
inputSchema: {
|
|
302
|
+
url: z.string().url(),
|
|
303
|
+
country: z.string().optional().describe('Exit country (name, ISO code or id), e.g. "DE"'),
|
|
304
|
+
token_id: z.union([z.number(), z.string()]).optional().describe('Use a specific proxy from list_my_proxies instead'),
|
|
305
|
+
create_if_missing: z.boolean().default(true).describe('With a country and no proxy for it yet: create one on the budget line (free to create). false = only use existing proxies'),
|
|
306
|
+
format: z.enum(['markdown', 'text', 'raw']).default('markdown'),
|
|
307
|
+
max_chars: z.number().int().min(500).max(200000).default(20000),
|
|
308
|
+
},
|
|
309
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
310
|
+
}, safe(async ({ url, country, token_id, create_if_missing, format, max_chars }) => {
|
|
311
|
+
const rows = (await client.tokens('dynamic', 'traffic', { page_size: 200 })).data.filter(r => usable(r) && (r.network ?? 'http') !== 'socks5' && toEndpoint(r));
|
|
312
|
+
let via;
|
|
313
|
+
let endpoint;
|
|
314
|
+
if (token_id !== undefined) {
|
|
315
|
+
let row = rows.find(r => String(r.token_id ?? r.id) === String(token_id));
|
|
316
|
+
if (!row) {
|
|
317
|
+
const statics = (await client.tokens('static', 'ip', { page_size: 200 })).data.filter(r => usable(r) && toEndpoint(r));
|
|
318
|
+
row = statics.find(r => String(r.token_id ?? r.id) === String(token_id));
|
|
319
|
+
}
|
|
320
|
+
if (!row)
|
|
321
|
+
throw new Proxy302Error(`Proxy ${token_id} not found, inactive or not an HTTP proxy.`);
|
|
322
|
+
via = { token_id: row.token_id ?? row.id, area: row.proxy_area || 'any' };
|
|
323
|
+
endpoint = toEndpoint(row);
|
|
324
|
+
}
|
|
325
|
+
else if (country) {
|
|
326
|
+
const c = await resolveArea(client, 'country', country);
|
|
327
|
+
const row = rows.find(r => matchesCountry(r, c.name));
|
|
328
|
+
if (row) {
|
|
329
|
+
via = { token_id: row.token_id ?? row.id, area: row.proxy_area || 'any' };
|
|
330
|
+
endpoint = toEndpoint(row);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
if (!create_if_missing)
|
|
334
|
+
throw new Proxy302Error(`You have no active HTTP dynamic proxy for ${c.name}. Call again with create_if_missing=true (free to create; billed per GB on use).`);
|
|
335
|
+
const { out, billedFrom } = await createDynamic(client, { c, protocol: 'http', line: 'budget' });
|
|
336
|
+
via = { token_id: out.token_id, area: c.name, created: true, billed_from: billedFrom };
|
|
337
|
+
endpoint = { host: out.host, port: Number(out.port), username: out.username, password: out.password };
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
else {
|
|
341
|
+
const row = rows[0];
|
|
342
|
+
if (!row)
|
|
343
|
+
throw new Proxy302Error('You have no active dynamic proxy yet. Pass a country (one is created for it), or run get_dynamic_proxy first.');
|
|
344
|
+
via = { token_id: row.token_id ?? row.id, area: row.proxy_area || 'any' };
|
|
345
|
+
endpoint = toEndpoint(row);
|
|
346
|
+
}
|
|
347
|
+
const result = await fetchFresh(url, endpoint, { format, maxChars: max_chars }, via.created === true);
|
|
348
|
+
return {
|
|
349
|
+
content: [
|
|
350
|
+
{ type: 'text', text: JSON.stringify({ via, status: result.status, final_url: result.finalUrl, content_type: result.contentType, truncated: result.truncated }) },
|
|
351
|
+
{ type: 'text', text: result.content },
|
|
352
|
+
],
|
|
353
|
+
};
|
|
354
|
+
}));
|
|
355
|
+
}
|
package/dist/version.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const VERSION = '0.3.0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,57 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "proxy302-mcp",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.3.0",
|
|
4
|
+
"description": "Official Proxy302 MCP server: check usage, browse locations, get residential proxy credentials and fetch pages through a proxy from Claude, Cursor and other AI tools.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"bin": {
|
|
8
|
+
"proxy302-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"README.zh-CN.md",
|
|
15
|
+
"LICENSE"
|
|
16
|
+
],
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=20"
|
|
19
|
+
},
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc -p tsconfig.json && node -e \"require('fs').chmodSync('dist/index.js',0o755)\"",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"smoke": "node scripts/smoke.mjs",
|
|
24
|
+
"prepublishOnly": "npm run build && npm test",
|
|
25
|
+
"prepare": "npm run build"
|
|
26
|
+
},
|
|
27
|
+
"keywords": [
|
|
28
|
+
"mcp",
|
|
29
|
+
"model-context-protocol",
|
|
30
|
+
"proxy",
|
|
31
|
+
"residential-proxy",
|
|
32
|
+
"web-scraping",
|
|
33
|
+
"claude",
|
|
34
|
+
"cursor",
|
|
35
|
+
"ai-agent"
|
|
36
|
+
],
|
|
37
|
+
"homepage": "https://github.com/proxy302/proxy302-mcp#readme",
|
|
38
|
+
"dependencies": {
|
|
39
|
+
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
40
|
+
"turndown": "^7.2.4",
|
|
41
|
+
"undici": "^8.12.3",
|
|
42
|
+
"zod": "^4.6.7"
|
|
43
|
+
},
|
|
44
|
+
"devDependencies": {
|
|
45
|
+
"@types/node": "^26.6.5",
|
|
46
|
+
"@types/turndown": "^5.0.6",
|
|
47
|
+
"typescript": "^7.0.2",
|
|
48
|
+
"vitest": "^5.0.5"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/proxy302/proxy302-mcp.git"
|
|
53
|
+
},
|
|
54
|
+
"bugs": {
|
|
55
|
+
"url": "https://github.com/proxy302/proxy302-mcp/issues"
|
|
56
|
+
}
|
|
57
|
+
}
|