@floppydata/mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +168 -0
- package/dist/api.d.ts +53 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +197 -0
- package/dist/api.js.map +1 -0
- package/dist/constants.d.ts +4 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +4 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +12 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +62 -0
- package/dist/server.js.map +1 -0
- package/dist/tool-definitions.d.ts +93 -0
- package/dist/tool-definitions.d.ts.map +1 -0
- package/dist/tool-definitions.js +260 -0
- package/dist/tool-definitions.js.map +1 -0
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Floppydata
|
|
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
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Floppydata MCP
|
|
2
|
+
|
|
3
|
+
Floppydata MCP lets agents use the Floppydata Client API v2 directly from an MCP-compatible client.
|
|
4
|
+
|
|
5
|
+
It is intentionally small: install it with `npx`, provide `FLOPPYDATA_API_KEY`, and the server talks to `https://api.floppydata.net`.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Create a Client API key in the Floppydata dashboard:
|
|
10
|
+
|
|
11
|
+
https://app.floppydata.com/api-keys
|
|
12
|
+
|
|
13
|
+
Add this server to your MCP client:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
{
|
|
17
|
+
"mcpServers": {
|
|
18
|
+
"floppydata": {
|
|
19
|
+
"command": "npx",
|
|
20
|
+
"args": ["-y", "@floppydata/mcp"],
|
|
21
|
+
"env": {
|
|
22
|
+
"FLOPPYDATA_API_KEY": "YOUR_API_KEY"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
That is the whole setup. There is no hosted service, no extra CLI, and no base URL configuration.
|
|
30
|
+
|
|
31
|
+
## Tools
|
|
32
|
+
|
|
33
|
+
### `fetch_web_data`
|
|
34
|
+
|
|
35
|
+
Fetch a public page through Web Data.
|
|
36
|
+
|
|
37
|
+
Useful when an agent needs page HTML and the target site should be fetched through Floppydata infrastructure.
|
|
38
|
+
|
|
39
|
+
Required input:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"url": "https://example.com"
|
|
44
|
+
}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Optional inputs: `countryCode`, `city`, `difficulty`, `cacheMaxAgeDays`.
|
|
48
|
+
|
|
49
|
+
### `create_rotating_proxy_connection`
|
|
50
|
+
|
|
51
|
+
Build one rotating proxy connection.
|
|
52
|
+
|
|
53
|
+
The most important value in the response is:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
connection.connectionString
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Example input:
|
|
60
|
+
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"type": "residential",
|
|
64
|
+
"country": "US",
|
|
65
|
+
"city": "New York",
|
|
66
|
+
"rotation": 15,
|
|
67
|
+
"protocol": "http"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### `list_rotating_proxy_locations`
|
|
72
|
+
|
|
73
|
+
List available rotating proxy countries, cities, and states for a proxy type.
|
|
74
|
+
|
|
75
|
+
Example input:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"type": "residential"
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### `check_proxy`
|
|
84
|
+
|
|
85
|
+
Check the exit IP and location for a proxy.
|
|
86
|
+
|
|
87
|
+
Example input:
|
|
88
|
+
|
|
89
|
+
```json
|
|
90
|
+
{
|
|
91
|
+
"connectionString": "http://USERNAME:PASSWORD@geo.g-w.info:10080"
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The response shape is:
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"ip": "123.45.67.89",
|
|
100
|
+
"location": {
|
|
101
|
+
"countryCode": "US",
|
|
102
|
+
"country": "United States",
|
|
103
|
+
"state": "California",
|
|
104
|
+
"city": "San Francisco"
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### `list_static_proxies`
|
|
110
|
+
|
|
111
|
+
List static proxies on the account.
|
|
112
|
+
|
|
113
|
+
Use `items[n].connection.connectionString` as the copy-paste proxy URL.
|
|
114
|
+
|
|
115
|
+
### `get_account_balances`
|
|
116
|
+
|
|
117
|
+
Check account balances across Web Data, rotating proxy traffic, and static proxies.
|
|
118
|
+
|
|
119
|
+
Optional input:
|
|
120
|
+
|
|
121
|
+
```json
|
|
122
|
+
{
|
|
123
|
+
"product": "proxy-rotating"
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Allowed products: `web-data`, `proxy-rotating`, `proxy-static`.
|
|
128
|
+
|
|
129
|
+
### `get_account_usage`
|
|
130
|
+
|
|
131
|
+
Check account usage rollups.
|
|
132
|
+
|
|
133
|
+
Responses include:
|
|
134
|
+
|
|
135
|
+
- `yesterday`
|
|
136
|
+
- `last7Days`
|
|
137
|
+
- `last30Days`
|
|
138
|
+
- optional `requestedRange` when `from` or `to` is provided
|
|
139
|
+
- `lastUpdatedAt`
|
|
140
|
+
|
|
141
|
+
Example input:
|
|
142
|
+
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"product": "proxy-rotating",
|
|
146
|
+
"from": "2026-06-01T00:00:00Z",
|
|
147
|
+
"to": "2026-06-26T23:59:59Z",
|
|
148
|
+
"countryCode": "US",
|
|
149
|
+
"proxyType": "residential"
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Security
|
|
154
|
+
|
|
155
|
+
The server reads the API key from `FLOPPYDATA_API_KEY` and sends it as `X-Api-Key`.
|
|
156
|
+
|
|
157
|
+
API keys and passwords are redacted from errors and logs. Proxy passwords are still returned in successful proxy connection responses because those credentials are the output customers need to use.
|
|
158
|
+
|
|
159
|
+
## Development
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
pnpm install
|
|
163
|
+
pnpm test
|
|
164
|
+
pnpm typecheck
|
|
165
|
+
pnpm lint
|
|
166
|
+
pnpm build
|
|
167
|
+
npm pack --dry-run
|
|
168
|
+
```
|
package/dist/api.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { FetchLike, JsonObject } from "./types.js";
|
|
2
|
+
type QueryValue = string | number | boolean | null | undefined;
|
|
3
|
+
export declare class FloppydataApiError extends Error {
|
|
4
|
+
readonly status?: number;
|
|
5
|
+
readonly code?: string;
|
|
6
|
+
readonly details?: unknown;
|
|
7
|
+
constructor(message: string, options?: {
|
|
8
|
+
status?: number;
|
|
9
|
+
code?: string;
|
|
10
|
+
details?: unknown;
|
|
11
|
+
cause?: unknown;
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
export interface FloppydataApiClientOptions {
|
|
15
|
+
apiKey: string;
|
|
16
|
+
fetcher?: FetchLike;
|
|
17
|
+
timeoutMs?: number;
|
|
18
|
+
}
|
|
19
|
+
export interface RequestOptions {
|
|
20
|
+
query?: Record<string, QueryValue>;
|
|
21
|
+
body?: unknown;
|
|
22
|
+
}
|
|
23
|
+
export declare class FloppydataApiClient {
|
|
24
|
+
private readonly apiKey;
|
|
25
|
+
private readonly fetcher;
|
|
26
|
+
private readonly timeoutMs;
|
|
27
|
+
constructor(options: FloppydataApiClientOptions);
|
|
28
|
+
fetchWebData(input: unknown): Promise<JsonObject>;
|
|
29
|
+
createRotatingProxyConnection(input: unknown): Promise<JsonObject>;
|
|
30
|
+
listRotatingProxyLocations(input: {
|
|
31
|
+
type: string;
|
|
32
|
+
}): Promise<JsonObject>;
|
|
33
|
+
checkProxy(input: unknown): Promise<JsonObject>;
|
|
34
|
+
listStaticProxies(): Promise<JsonObject>;
|
|
35
|
+
getAccountBalances(input: {
|
|
36
|
+
product?: string;
|
|
37
|
+
}): Promise<JsonObject>;
|
|
38
|
+
getAccountUsage(input: {
|
|
39
|
+
product?: string;
|
|
40
|
+
from?: string;
|
|
41
|
+
to?: string;
|
|
42
|
+
poolId?: number;
|
|
43
|
+
countryCode?: string;
|
|
44
|
+
proxyType?: string;
|
|
45
|
+
}): Promise<JsonObject>;
|
|
46
|
+
private request;
|
|
47
|
+
private toNetworkError;
|
|
48
|
+
private toApiError;
|
|
49
|
+
}
|
|
50
|
+
export declare function getApiKeyFromEnv(env?: NodeJS.ProcessEnv): string;
|
|
51
|
+
export declare function redactSecrets(value: unknown, apiKey?: string): string;
|
|
52
|
+
export {};
|
|
53
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD,KAAK,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAE/D,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,OAAO,GAAE;QACP,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,OAAO,CAAC;KACZ;CAQT;AAED,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CA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DED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { DEFAULT_TIMEOUT_MS, FLOPPYDATA_API_BASE_URL, FLOPPYDATA_API_KEY_ENV } from "./constants.js";
|
|
2
|
+
export class FloppydataApiError extends Error {
|
|
3
|
+
status;
|
|
4
|
+
code;
|
|
5
|
+
details;
|
|
6
|
+
constructor(message, options = {}) {
|
|
7
|
+
super(message, { cause: options.cause });
|
|
8
|
+
this.name = "FloppydataApiError";
|
|
9
|
+
this.status = options.status;
|
|
10
|
+
this.code = options.code;
|
|
11
|
+
this.details = options.details;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
export class FloppydataApiClient {
|
|
15
|
+
apiKey;
|
|
16
|
+
fetcher;
|
|
17
|
+
timeoutMs;
|
|
18
|
+
constructor(options) {
|
|
19
|
+
this.apiKey = options.apiKey;
|
|
20
|
+
this.fetcher = options.fetcher ?? fetch;
|
|
21
|
+
this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
22
|
+
}
|
|
23
|
+
async fetchWebData(input) {
|
|
24
|
+
return this.request("POST", "/v2/web-data/fetch", { body: input });
|
|
25
|
+
}
|
|
26
|
+
async createRotatingProxyConnection(input) {
|
|
27
|
+
return this.request("POST", "/v2/proxy/rotating/connections", { body: input });
|
|
28
|
+
}
|
|
29
|
+
async listRotatingProxyLocations(input) {
|
|
30
|
+
return this.request("GET", "/v2/proxy/rotating/locations", {
|
|
31
|
+
query: { type: input.type }
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async checkProxy(input) {
|
|
35
|
+
return this.request("POST", "/v2/proxy/check", { body: input });
|
|
36
|
+
}
|
|
37
|
+
async listStaticProxies() {
|
|
38
|
+
return this.request("GET", "/v2/proxy/static");
|
|
39
|
+
}
|
|
40
|
+
async getAccountBalances(input) {
|
|
41
|
+
return this.request("GET", "/v2/account/balances", {
|
|
42
|
+
query: { product: input.product }
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async getAccountUsage(input) {
|
|
46
|
+
return this.request("GET", "/v2/account/usage", {
|
|
47
|
+
query: {
|
|
48
|
+
product: input.product,
|
|
49
|
+
from: input.from,
|
|
50
|
+
to: input.to,
|
|
51
|
+
poolId: input.poolId,
|
|
52
|
+
countryCode: input.countryCode,
|
|
53
|
+
proxyType: input.proxyType
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
async request(method, path, options = {}) {
|
|
58
|
+
const url = new URL(path, FLOPPYDATA_API_BASE_URL);
|
|
59
|
+
appendQuery(url, options.query);
|
|
60
|
+
const controller = new AbortController();
|
|
61
|
+
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
62
|
+
let response;
|
|
63
|
+
try {
|
|
64
|
+
response = await this.fetcher(url.toString(), {
|
|
65
|
+
method,
|
|
66
|
+
headers: buildHeaders(this.apiKey, options.body !== undefined),
|
|
67
|
+
body: options.body === undefined ? undefined : JSON.stringify(options.body),
|
|
68
|
+
signal: controller.signal
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
throw this.toNetworkError(error);
|
|
73
|
+
}
|
|
74
|
+
finally {
|
|
75
|
+
clearTimeout(timeout);
|
|
76
|
+
}
|
|
77
|
+
const payload = await parseJsonPayload(response);
|
|
78
|
+
if (!response.ok) {
|
|
79
|
+
throw this.toApiError(response.status, payload);
|
|
80
|
+
}
|
|
81
|
+
return payload ?? {};
|
|
82
|
+
}
|
|
83
|
+
toNetworkError(error) {
|
|
84
|
+
const message = error instanceof Error && error.name === "AbortError"
|
|
85
|
+
? "Floppydata API request timed out"
|
|
86
|
+
: `Floppydata API request failed: ${errorMessage(error)}`;
|
|
87
|
+
return new FloppydataApiError(redactSecrets(message, this.apiKey), {
|
|
88
|
+
cause: error
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
toApiError(status, payload) {
|
|
92
|
+
const errorPayload = readErrorPayload(payload);
|
|
93
|
+
const message = errorPayload.message ?? `Floppydata API request failed with status ${status}`;
|
|
94
|
+
return new FloppydataApiError(redactSecrets(message, this.apiKey), {
|
|
95
|
+
status,
|
|
96
|
+
code: errorPayload.code,
|
|
97
|
+
details: errorPayload.details === undefined
|
|
98
|
+
? undefined
|
|
99
|
+
: redactUnknown(errorPayload.details, this.apiKey)
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
export function getApiKeyFromEnv(env = process.env) {
|
|
104
|
+
const apiKey = env[FLOPPYDATA_API_KEY_ENV]?.trim();
|
|
105
|
+
if (!apiKey) {
|
|
106
|
+
throw new Error(`${FLOPPYDATA_API_KEY_ENV} is required. Create an API key at https://app.floppydata.com/api-keys and pass it as an environment variable.`);
|
|
107
|
+
}
|
|
108
|
+
return apiKey;
|
|
109
|
+
}
|
|
110
|
+
export function redactSecrets(value, apiKey) {
|
|
111
|
+
if (typeof value === "string") {
|
|
112
|
+
return redactString(value, apiKey);
|
|
113
|
+
}
|
|
114
|
+
return redactString(JSON.stringify(redactUnknown(value, apiKey)), apiKey);
|
|
115
|
+
}
|
|
116
|
+
function appendQuery(url, query) {
|
|
117
|
+
if (!query) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
for (const [key, value] of Object.entries(query)) {
|
|
121
|
+
if (value !== undefined && value !== null) {
|
|
122
|
+
url.searchParams.set(key, String(value));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function buildHeaders(apiKey, hasBody) {
|
|
127
|
+
const headers = {
|
|
128
|
+
Accept: "application/json",
|
|
129
|
+
"X-Api-Key": apiKey
|
|
130
|
+
};
|
|
131
|
+
if (hasBody) {
|
|
132
|
+
headers["Content-Type"] = "application/json";
|
|
133
|
+
}
|
|
134
|
+
return headers;
|
|
135
|
+
}
|
|
136
|
+
async function parseJsonPayload(response) {
|
|
137
|
+
const text = await response.text();
|
|
138
|
+
if (!text) {
|
|
139
|
+
return null;
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
const payload = JSON.parse(text);
|
|
143
|
+
return isRecord(payload) ? payload : null;
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function readErrorPayload(payload) {
|
|
150
|
+
if (!isRecord(payload)) {
|
|
151
|
+
return {};
|
|
152
|
+
}
|
|
153
|
+
const nestedError = isRecord(payload.error) ? payload.error : undefined;
|
|
154
|
+
const source = nestedError ?? payload;
|
|
155
|
+
return {
|
|
156
|
+
message: readString(source.message),
|
|
157
|
+
code: readString(source.code),
|
|
158
|
+
details: source.details
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
function readString(value) {
|
|
162
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
163
|
+
}
|
|
164
|
+
function errorMessage(error) {
|
|
165
|
+
return error instanceof Error ? error.message : String(error);
|
|
166
|
+
}
|
|
167
|
+
function redactUnknown(value, apiKey) {
|
|
168
|
+
if (typeof value === "string") {
|
|
169
|
+
return redactString(value, apiKey);
|
|
170
|
+
}
|
|
171
|
+
if (Array.isArray(value)) {
|
|
172
|
+
return value.map((item) => redactUnknown(item, apiKey));
|
|
173
|
+
}
|
|
174
|
+
if (!isRecord(value)) {
|
|
175
|
+
return value;
|
|
176
|
+
}
|
|
177
|
+
return Object.fromEntries(Object.entries(value).map(([key, entry]) => {
|
|
178
|
+
if (isSecretField(key)) {
|
|
179
|
+
return [key, "[REDACTED]"];
|
|
180
|
+
}
|
|
181
|
+
return [key, redactUnknown(entry, apiKey)];
|
|
182
|
+
}));
|
|
183
|
+
}
|
|
184
|
+
function redactString(value, apiKey) {
|
|
185
|
+
let output = value;
|
|
186
|
+
if (apiKey) {
|
|
187
|
+
output = output.split(apiKey).join("[REDACTED_API_KEY]");
|
|
188
|
+
}
|
|
189
|
+
return output.replace(/([a-z][a-z0-9+.-]*:\/\/[^:\s/@]+:)([^@\s/]+)(@)/gi, "$1[REDACTED_PASSWORD]$3");
|
|
190
|
+
}
|
|
191
|
+
function isSecretField(key) {
|
|
192
|
+
return /^(api[-_]?key|authorization|password|pass|token|secret)$/i.test(key);
|
|
193
|
+
}
|
|
194
|
+
function isRecord(value) {
|
|
195
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
196
|
+
}
|
|
197
|
+
//# sourceMappingURL=api.js.map
|
package/dist/api.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,uBAAuB,EACvB,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAKxB,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,MAAM,CAAU;IAChB,IAAI,CAAU;IACd,OAAO,CAAW;IAE3B,YACE,OAAe,EACf,UAKI,EAAE;QAEN,KAAK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC;QACzC,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACjC,CAAC;CACF;AAaD,MAAM,OAAO,mBAAmB;IACb,MAAM,CAAS;IACf,OAAO,CAAY;IACnB,SAAS,CAAS;IAEnC,YAAY,OAAmC;QAC7C,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,KAAK,CAAC;QACxC,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,kBAAkB,CAAC;IAC3D,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,KAAc;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,M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C;IAED,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACzC,IAAI,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,OAAO,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC7B,CAAC;QAED,OAAO,CAAC,GAAG,EAAE,aAAa,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC,CAAC,CACH,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,KAAa,EAAE,MAAe;IAClD,IAAI,MAAM,GAAG,KAAK,CAAC;IAEnB,IAAI,MAAM,EAAE,CAAC;QACX,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;IAC3D,CAAC;IAED,OAAO,MAAM,CAAC,OAAO,CACnB,mDAAmD,EACnD,yBAAyB,CAC1B,CAAC;AACJ,CAAC;AAED,SAAS,aAAa,CAAC,GAAW;IAChC,OAAO,2DAA2D,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,uBAAuB,+BAA+B,CAAC;AACpE,eAAO,MAAM,sBAAsB,uBAAuB,CAAC;AAC3D,eAAO,MAAM,kBAAkB,QAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,4BAA4B,CAAC;AACpE,MAAM,CAAC,MAAM,sBAAsB,GAAG,oBAAoB,CAAC;AAC3D,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { createFloppydataMcpServer } from "./server.js";
|
|
4
|
+
async function main() {
|
|
5
|
+
const server = createFloppydataMcpServer();
|
|
6
|
+
await server.connect(new StdioServerTransport());
|
|
7
|
+
}
|
|
8
|
+
main().catch((error) => {
|
|
9
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
10
|
+
console.error(message);
|
|
11
|
+
process.exit(1);
|
|
12
|
+
});
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAC3C,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,oBAAoB,EAAE,CAAC,CAAC;AACnD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC9B,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/sdk/types.js";
|
|
3
|
+
import type { FetchLike, JsonObject } from "./types.js";
|
|
4
|
+
export interface CreateFloppydataMcpServerOptions {
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
fetcher?: FetchLike;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function createFloppydataMcpServer(options?: CreateFloppydataMcpServerOptions): McpServer;
|
|
10
|
+
export declare function formatToolResult(summary: string, output: JsonObject): CallToolResult;
|
|
11
|
+
export declare function toSafeToolError(error: unknown, apiKey?: string): Error;
|
|
12
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AASzE,OAAO,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAExD,MAAM,WAAW,gCAAgC;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,yBAAyB,CACvC,OAAO,GAAE,gCAAqC,GAC7C,SAAS,CAkCX;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,UAAU,GACjB,cAAc,CAUhB;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,KAAK,CAqBtE"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { ZodError } from "zod";
|
|
3
|
+
import { FloppydataApiClient, FloppydataApiError, getApiKeyFromEnv, redactSecrets } from "./api.js";
|
|
4
|
+
import { toolDefinitions } from "./tool-definitions.js";
|
|
5
|
+
export function createFloppydataMcpServer(options = {}) {
|
|
6
|
+
const apiKey = options.apiKey ?? getApiKeyFromEnv();
|
|
7
|
+
const client = new FloppydataApiClient({
|
|
8
|
+
apiKey,
|
|
9
|
+
fetcher: options.fetcher,
|
|
10
|
+
timeoutMs: options.timeoutMs
|
|
11
|
+
});
|
|
12
|
+
const server = new McpServer({
|
|
13
|
+
name: "floppydata",
|
|
14
|
+
version: "0.1.0"
|
|
15
|
+
});
|
|
16
|
+
for (const definition of toolDefinitions) {
|
|
17
|
+
server.registerTool(definition.name, {
|
|
18
|
+
description: definition.description,
|
|
19
|
+
inputSchema: definition.inputShape
|
|
20
|
+
}, async (rawInput) => {
|
|
21
|
+
try {
|
|
22
|
+
const input = definition.inputSchema.parse(rawInput);
|
|
23
|
+
const output = await definition.execute(client, input);
|
|
24
|
+
const summary = definition.summarize(output);
|
|
25
|
+
return formatToolResult(summary, output);
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw toSafeToolError(error, apiKey);
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return server;
|
|
33
|
+
}
|
|
34
|
+
export function formatToolResult(summary, output) {
|
|
35
|
+
return {
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: "text",
|
|
39
|
+
text: `${summary}\n\n${JSON.stringify(output, null, 2)}`
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
structuredContent: output
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function toSafeToolError(error, apiKey) {
|
|
46
|
+
if (error instanceof ZodError) {
|
|
47
|
+
return new Error(`Invalid tool input: ${error.issues.map((issue) => issue.message).join("; ")}`);
|
|
48
|
+
}
|
|
49
|
+
if (error instanceof FloppydataApiError) {
|
|
50
|
+
const context = [
|
|
51
|
+
error.status ? `status ${error.status}` : undefined,
|
|
52
|
+
error.code ? `code ${error.code}` : undefined
|
|
53
|
+
]
|
|
54
|
+
.filter(Boolean)
|
|
55
|
+
.join(", ");
|
|
56
|
+
const suffix = context ? ` (${context})` : "";
|
|
57
|
+
return new Error(`${error.message}${suffix}`);
|
|
58
|
+
}
|
|
59
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
60
|
+
return new Error(redactSecrets(message, apiKey));
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAC/B,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AASxD,MAAM,UAAU,yBAAyB,CACvC,UAA4C,EAAE;IAE9C,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,gBAAgB,EAAE,CAAC;IACpD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC;QACrC,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,OAAO;QACxB,SAAS,EAAE,OAAO,CAAC,SAAS;KAC7B,CAAC,CAAC;IACH,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,OAAO;KACjB,CAA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,EAAE,CAC/E,CAAC;IACJ,CAAC;IAED,IAAI,KAAK,YAAY,kBAAkB,EAAE,CAAC;QACxC,MAAM,OAAO,GAAG;YACd,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,SAAS;YACnD,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;SAC9C;aACE,MAAM,CAAC,OAAO,CAAC;aACf,IAAI,CAAC,IAAI,CAAC,CAAC;QAEd,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,KAAK,OAAO,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;QAC9C,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,CAAC,OAAO,GAAG,MAAM,EAAE,CAAC,CAAC;IAChD,CAAC;IAED,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IACvE,OAAO,IAAI,KAAK,CAAC,aAAa,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { FloppydataApiClient } from "./api.js";
|
|
3
|
+
import type { JsonObject } from "./types.js";
|
|
4
|
+
export declare const fetchWebDataInputSchema: z.ZodObject<{
|
|
5
|
+
url: z.ZodString;
|
|
6
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
7
|
+
city: z.ZodOptional<z.ZodString>;
|
|
8
|
+
difficulty: z.ZodOptional<z.ZodEnum<{
|
|
9
|
+
low: "low";
|
|
10
|
+
medium: "medium";
|
|
11
|
+
}>>;
|
|
12
|
+
cacheMaxAgeDays: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
}, z.core.$strict>;
|
|
14
|
+
export declare const rotatingConnectionInputSchema: z.ZodObject<{
|
|
15
|
+
type: z.ZodEnum<{
|
|
16
|
+
residential: "residential";
|
|
17
|
+
mobile: "mobile";
|
|
18
|
+
datacenter: "datacenter";
|
|
19
|
+
}>;
|
|
20
|
+
country: z.ZodString;
|
|
21
|
+
city: z.ZodOptional<z.ZodString>;
|
|
22
|
+
state: z.ZodOptional<z.ZodString>;
|
|
23
|
+
asn: z.ZodOptional<z.ZodString>;
|
|
24
|
+
rotation: z.ZodOptional<z.ZodUnion<readonly [z.ZodLiteral<-1>, z.ZodLiteral<0>, z.ZodLiteral<5>, z.ZodLiteral<10>, z.ZodLiteral<15>, z.ZodLiteral<20>, z.ZodLiteral<60>]>>;
|
|
25
|
+
session: z.ZodOptional<z.ZodString>;
|
|
26
|
+
protocol: z.ZodOptional<z.ZodEnum<{
|
|
27
|
+
http: "http";
|
|
28
|
+
https: "https";
|
|
29
|
+
socks5: "socks5";
|
|
30
|
+
}>>;
|
|
31
|
+
}, z.core.$strict>;
|
|
32
|
+
export declare const rotatingLocationsInputSchema: z.ZodObject<{
|
|
33
|
+
type: z.ZodEnum<{
|
|
34
|
+
residential: "residential";
|
|
35
|
+
mobile: "mobile";
|
|
36
|
+
datacenter: "datacenter";
|
|
37
|
+
}>;
|
|
38
|
+
}, z.core.$strict>;
|
|
39
|
+
export declare const checkProxyInputSchema: z.ZodObject<{
|
|
40
|
+
connectionString: z.ZodOptional<z.ZodString>;
|
|
41
|
+
host: z.ZodOptional<z.ZodString>;
|
|
42
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
43
|
+
username: z.ZodOptional<z.ZodString>;
|
|
44
|
+
password: z.ZodOptional<z.ZodString>;
|
|
45
|
+
protocol: z.ZodOptional<z.ZodEnum<{
|
|
46
|
+
http: "http";
|
|
47
|
+
https: "https";
|
|
48
|
+
socks5: "socks5";
|
|
49
|
+
}>>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export declare const accountBalancesInputSchema: z.ZodObject<{
|
|
52
|
+
product: z.ZodOptional<z.ZodEnum<{
|
|
53
|
+
"web-data": "web-data";
|
|
54
|
+
"proxy-rotating": "proxy-rotating";
|
|
55
|
+
"proxy-static": "proxy-static";
|
|
56
|
+
}>>;
|
|
57
|
+
}, z.core.$strict>;
|
|
58
|
+
export declare const accountUsageInputSchema: z.ZodObject<{
|
|
59
|
+
product: z.ZodOptional<z.ZodEnum<{
|
|
60
|
+
"web-data": "web-data";
|
|
61
|
+
"proxy-rotating": "proxy-rotating";
|
|
62
|
+
}>>;
|
|
63
|
+
from: z.ZodOptional<z.ZodString>;
|
|
64
|
+
to: z.ZodOptional<z.ZodString>;
|
|
65
|
+
poolId: z.ZodOptional<z.ZodNumber>;
|
|
66
|
+
countryCode: z.ZodOptional<z.ZodString>;
|
|
67
|
+
proxyType: z.ZodOptional<z.ZodEnum<{
|
|
68
|
+
residential: "residential";
|
|
69
|
+
mobile: "mobile";
|
|
70
|
+
datacenter: "datacenter";
|
|
71
|
+
}>>;
|
|
72
|
+
}, z.core.$strict>;
|
|
73
|
+
export interface ToolDefinition<Input> {
|
|
74
|
+
readonly name: string;
|
|
75
|
+
readonly description: string;
|
|
76
|
+
readonly inputShape: z.ZodRawShape;
|
|
77
|
+
readonly inputSchema: z.ZodType<Input>;
|
|
78
|
+
readonly execute: (client: FloppydataApiClient, input: Input) => Promise<JsonObject>;
|
|
79
|
+
readonly summarize: (output: JsonObject) => string;
|
|
80
|
+
}
|
|
81
|
+
export interface RuntimeToolDefinition {
|
|
82
|
+
readonly name: string;
|
|
83
|
+
readonly description: string;
|
|
84
|
+
readonly inputShape: z.ZodRawShape;
|
|
85
|
+
readonly inputSchema: z.ZodType<unknown>;
|
|
86
|
+
readonly execute: (client: FloppydataApiClient, input: unknown) => Promise<JsonObject>;
|
|
87
|
+
readonly summarize: (output: JsonObject) => string;
|
|
88
|
+
}
|
|
89
|
+
export declare const toolDefinitions: RuntimeToolDefinition[];
|
|
90
|
+
export type ToolName = (typeof toolDefinitions)[number]["name"];
|
|
91
|
+
export declare function runFloppydataTool(client: FloppydataApiClient, name: ToolName, input: unknown): Promise<JsonObject>;
|
|
92
|
+
export declare function getToolSummary(name: ToolName, output: JsonObject): string;
|
|
93
|
+
//# sourceMappingURL=tool-definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-definitions.d.ts","sourceRoot":"","sources":["../src/tool-definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAiH7C,eAAO,MAAM,uBAAuB;;;;;;;;;kBAAuC,CAAC;AAC5E,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;kBAE/B,CAAC;AACZ,eAAO,MAAM,4BAA4B;;;;;;kBAE9B,CAAC;AACZ,eAAO,MAAM,qBAAqB;;;;;;;;;;;kBAkB9B,CAAC;AACL,eAAO,MAAM,0BAA0B;;;;;;kBAA0C,CAAC;AAClF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;kBAAuC,CAAC;AAE5E,MAAM,WAAW,cAAc,CAAC,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,WAAW,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,QAAQ,CAAC,OAAO,EAAE,CAChB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,KAAK,KACT,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,MAAM,CAAC;CACpD;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,UAAU,EAAE,CAAC,CAAC,WAAW,CAAC;IACnC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,QAAQ,CAAC,OAAO,EAAE,CAChB,MAAM,EAAE,mBAAmB,EAC3B,KAAK,EAAE,OAAO,KACX,OAAO,CAAC,UAAU,CAAC,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,MAAM,CAAC;CACpD;AAYD,eAAO,MAAM,eAAe,yBAgE3B,CAAC;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,UAAU,CAAC,CASrB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAGzE"}
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
const proxyTypeSchema = z.enum(["residential", "mobile", "datacenter"]);
|
|
3
|
+
const protocolSchema = z.enum(["http", "https", "socks5"]);
|
|
4
|
+
const rotationSchema = z.union([
|
|
5
|
+
z.literal(-1),
|
|
6
|
+
z.literal(0),
|
|
7
|
+
z.literal(5),
|
|
8
|
+
z.literal(10),
|
|
9
|
+
z.literal(15),
|
|
10
|
+
z.literal(20),
|
|
11
|
+
z.literal(60)
|
|
12
|
+
]);
|
|
13
|
+
const accountBalanceProductSchema = z.enum([
|
|
14
|
+
"web-data",
|
|
15
|
+
"proxy-rotating",
|
|
16
|
+
"proxy-static"
|
|
17
|
+
]);
|
|
18
|
+
const accountUsageProductSchema = z.enum(["web-data", "proxy-rotating"]);
|
|
19
|
+
const fetchWebDataShape = {
|
|
20
|
+
url: z.string().url().describe("Target page URL to fetch through Web Data."),
|
|
21
|
+
countryCode: z
|
|
22
|
+
.string()
|
|
23
|
+
.regex(/^[a-zA-Z]{2}$/)
|
|
24
|
+
.optional()
|
|
25
|
+
.describe("Optional 2-letter exit country code, for example US."),
|
|
26
|
+
city: z.string().min(1).optional().describe("Optional exit city."),
|
|
27
|
+
difficulty: z
|
|
28
|
+
.enum(["low", "medium"])
|
|
29
|
+
.optional()
|
|
30
|
+
.describe("Optional access difficulty pool."),
|
|
31
|
+
cacheMaxAgeDays: z
|
|
32
|
+
.number()
|
|
33
|
+
.int()
|
|
34
|
+
.min(0)
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Optional maximum age of cached content in days.")
|
|
37
|
+
};
|
|
38
|
+
const rotatingConnectionShape = {
|
|
39
|
+
type: proxyTypeSchema.describe("Proxy type."),
|
|
40
|
+
country: z
|
|
41
|
+
.string()
|
|
42
|
+
.regex(/^[a-zA-Z]{2}$/)
|
|
43
|
+
.describe("2-letter country code, for example US."),
|
|
44
|
+
city: z
|
|
45
|
+
.string()
|
|
46
|
+
.min(1)
|
|
47
|
+
.optional()
|
|
48
|
+
.describe("City from list_rotating_proxy_locations. Ignored when state is supplied."),
|
|
49
|
+
state: z
|
|
50
|
+
.string()
|
|
51
|
+
.min(1)
|
|
52
|
+
.optional()
|
|
53
|
+
.describe("State or subdivision from list_rotating_proxy_locations. Wins over city."),
|
|
54
|
+
asn: z.string().regex(/^\d+$/).optional().describe("Optional target ASN."),
|
|
55
|
+
rotation: rotationSchema
|
|
56
|
+
.optional()
|
|
57
|
+
.describe("-1 for each request, 0 for sticky, or interval minutes."),
|
|
58
|
+
session: z
|
|
59
|
+
.string()
|
|
60
|
+
.min(1)
|
|
61
|
+
.max(128)
|
|
62
|
+
.optional()
|
|
63
|
+
.describe("Optional sticky session id."),
|
|
64
|
+
protocol: protocolSchema.optional().describe("Proxy protocol. Defaults to http.")
|
|
65
|
+
};
|
|
66
|
+
const rotatingLocationsShape = {
|
|
67
|
+
type: proxyTypeSchema.describe("Proxy type to list locations for.")
|
|
68
|
+
};
|
|
69
|
+
const checkProxyShape = {
|
|
70
|
+
connectionString: z
|
|
71
|
+
.string()
|
|
72
|
+
.url()
|
|
73
|
+
.optional()
|
|
74
|
+
.describe("Proxy URL to check, for example http://user:pass@host:10080."),
|
|
75
|
+
host: z.string().min(1).optional().describe("Proxy host."),
|
|
76
|
+
port: z.number().int().optional().describe("Proxy port."),
|
|
77
|
+
username: z.string().min(1).optional().describe("Proxy username."),
|
|
78
|
+
password: z.string().min(1).optional().describe("Proxy password."),
|
|
79
|
+
protocol: protocolSchema.optional().describe("Proxy protocol. Defaults to http.")
|
|
80
|
+
};
|
|
81
|
+
const accountBalancesShape = {
|
|
82
|
+
product: accountBalanceProductSchema
|
|
83
|
+
.optional()
|
|
84
|
+
.describe("Optional product filter.")
|
|
85
|
+
};
|
|
86
|
+
const accountUsageShape = {
|
|
87
|
+
product: accountUsageProductSchema.optional().describe("Optional product filter."),
|
|
88
|
+
from: z
|
|
89
|
+
.string()
|
|
90
|
+
.min(1)
|
|
91
|
+
.optional()
|
|
92
|
+
.describe("Optional start date or UTC date-time."),
|
|
93
|
+
to: z
|
|
94
|
+
.string()
|
|
95
|
+
.min(1)
|
|
96
|
+
.optional()
|
|
97
|
+
.describe("Optional end date or UTC date-time."),
|
|
98
|
+
poolId: z.number().int().positive().optional().describe("Optional pool id filter."),
|
|
99
|
+
countryCode: z
|
|
100
|
+
.string()
|
|
101
|
+
.regex(/^[a-zA-Z]{2}$/)
|
|
102
|
+
.optional()
|
|
103
|
+
.describe("Optional 2-letter country code filter."),
|
|
104
|
+
proxyType: proxyTypeSchema.optional().describe("Optional rotating proxy type filter.")
|
|
105
|
+
};
|
|
106
|
+
export const fetchWebDataInputSchema = z.object(fetchWebDataShape).strict();
|
|
107
|
+
export const rotatingConnectionInputSchema = z
|
|
108
|
+
.object(rotatingConnectionShape)
|
|
109
|
+
.strict();
|
|
110
|
+
export const rotatingLocationsInputSchema = z
|
|
111
|
+
.object(rotatingLocationsShape)
|
|
112
|
+
.strict();
|
|
113
|
+
export const checkProxyInputSchema = z
|
|
114
|
+
.object(checkProxyShape)
|
|
115
|
+
.strict()
|
|
116
|
+
.superRefine((input, context) => {
|
|
117
|
+
if (input.connectionString) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
const hasStructuredProxy = input.host && input.port !== undefined && input.username && input.password;
|
|
121
|
+
if (!hasStructuredProxy) {
|
|
122
|
+
context.addIssue({
|
|
123
|
+
code: "custom",
|
|
124
|
+
message: "Provide connectionString, or provide host, port, username, and password."
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
export const accountBalancesInputSchema = z.object(accountBalancesShape).strict();
|
|
129
|
+
export const accountUsageInputSchema = z.object(accountUsageShape).strict();
|
|
130
|
+
function defineTool(definition) {
|
|
131
|
+
return {
|
|
132
|
+
...definition,
|
|
133
|
+
inputSchema: definition.inputSchema,
|
|
134
|
+
execute: (client, input) => definition.execute(client, input)
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
export const toolDefinitions = [
|
|
138
|
+
defineTool({
|
|
139
|
+
name: "fetch_web_data",
|
|
140
|
+
description: "Fetch a public web page through Floppydata Web Data. Use this when the agent needs the HTML of a URL.",
|
|
141
|
+
inputShape: fetchWebDataShape,
|
|
142
|
+
inputSchema: fetchWebDataInputSchema,
|
|
143
|
+
execute: (client, input) => client.fetchWebData(input),
|
|
144
|
+
summarize: (output) => summarizeFetchWebData(output)
|
|
145
|
+
}),
|
|
146
|
+
defineTool({
|
|
147
|
+
name: "create_rotating_proxy_connection",
|
|
148
|
+
description: "Build one copy-paste rotating proxy connection string for a country, state, city, ASN, session, and rotation.",
|
|
149
|
+
inputShape: rotatingConnectionShape,
|
|
150
|
+
inputSchema: rotatingConnectionInputSchema,
|
|
151
|
+
execute: (client, input) => client.createRotatingProxyConnection(input),
|
|
152
|
+
summarize: (output) => summarizeConnection(output)
|
|
153
|
+
}),
|
|
154
|
+
defineTool({
|
|
155
|
+
name: "list_rotating_proxy_locations",
|
|
156
|
+
description: "List countries, cities, and states available for rotating proxy connection generation.",
|
|
157
|
+
inputShape: rotatingLocationsShape,
|
|
158
|
+
inputSchema: rotatingLocationsInputSchema,
|
|
159
|
+
execute: (client, input) => client.listRotatingProxyLocations(input),
|
|
160
|
+
summarize: (output) => summarizeLocations(output)
|
|
161
|
+
}),
|
|
162
|
+
defineTool({
|
|
163
|
+
name: "check_proxy",
|
|
164
|
+
description: "Check a proxy connection and return the exit IP and location seen through that proxy.",
|
|
165
|
+
inputShape: checkProxyShape,
|
|
166
|
+
inputSchema: checkProxyInputSchema,
|
|
167
|
+
execute: (client, input) => client.checkProxy(input),
|
|
168
|
+
summarize: (output) => summarizeProxyCheck(output)
|
|
169
|
+
}),
|
|
170
|
+
defineTool({
|
|
171
|
+
name: "list_static_proxies",
|
|
172
|
+
description: "List static proxies owned by the account, including each proxy connectionString.",
|
|
173
|
+
inputShape: {},
|
|
174
|
+
inputSchema: z.object({}).strict(),
|
|
175
|
+
execute: (client) => client.listStaticProxies(),
|
|
176
|
+
summarize: (output) => summarizeStaticProxies(output)
|
|
177
|
+
}),
|
|
178
|
+
defineTool({
|
|
179
|
+
name: "get_account_balances",
|
|
180
|
+
description: "Get account balances for Web Data, rotating proxy traffic, and static proxies.",
|
|
181
|
+
inputShape: accountBalancesShape,
|
|
182
|
+
inputSchema: accountBalancesInputSchema,
|
|
183
|
+
execute: (client, input) => client.getAccountBalances(input),
|
|
184
|
+
summarize: () => "Fetched account balances."
|
|
185
|
+
}),
|
|
186
|
+
defineTool({
|
|
187
|
+
name: "get_account_usage",
|
|
188
|
+
description: "Get account usage rollups. Responses include yesterday, last7Days, last30Days, optional requestedRange, and lastUpdatedAt.",
|
|
189
|
+
inputShape: accountUsageShape,
|
|
190
|
+
inputSchema: accountUsageInputSchema,
|
|
191
|
+
execute: (client, input) => client.getAccountUsage(input),
|
|
192
|
+
summarize: () => "Fetched account usage."
|
|
193
|
+
})
|
|
194
|
+
];
|
|
195
|
+
export async function runFloppydataTool(client, name, input) {
|
|
196
|
+
const definition = toolDefinitions.find((tool) => tool.name === name);
|
|
197
|
+
if (!definition) {
|
|
198
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
199
|
+
}
|
|
200
|
+
const parsedInput = definition.inputSchema.parse(input);
|
|
201
|
+
return definition.execute(client, parsedInput);
|
|
202
|
+
}
|
|
203
|
+
export function getToolSummary(name, output) {
|
|
204
|
+
const definition = toolDefinitions.find((tool) => tool.name === name);
|
|
205
|
+
return definition?.summarize(output) ?? "Floppydata tool completed.";
|
|
206
|
+
}
|
|
207
|
+
function summarizeFetchWebData(output) {
|
|
208
|
+
if (isRecord(output)) {
|
|
209
|
+
const sourceUrl = readString(output.sourceUrl);
|
|
210
|
+
const html = readString(output.html);
|
|
211
|
+
const fetchedAt = readString(output.fetchedAt);
|
|
212
|
+
if (sourceUrl && html && fetchedAt) {
|
|
213
|
+
return `Fetched ${sourceUrl} at ${fetchedAt}. HTML length: ${html.length} characters.`;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return "Fetched Web Data.";
|
|
217
|
+
}
|
|
218
|
+
function summarizeConnection(output) {
|
|
219
|
+
const connection = isRecord(output) && isRecord(output.connection)
|
|
220
|
+
? output.connection
|
|
221
|
+
: undefined;
|
|
222
|
+
const connectionString = connection
|
|
223
|
+
? readString(connection.connectionString)
|
|
224
|
+
: undefined;
|
|
225
|
+
return connectionString
|
|
226
|
+
? `Created rotating proxy connection: ${connectionString}`
|
|
227
|
+
: "Created rotating proxy connection.";
|
|
228
|
+
}
|
|
229
|
+
function summarizeLocations(output) {
|
|
230
|
+
if (isRecord(output) && Array.isArray(output.items)) {
|
|
231
|
+
return `Found ${output.items.length} rotating proxy countries for ${readString(output.type) ?? "the requested type"}.`;
|
|
232
|
+
}
|
|
233
|
+
return "Fetched rotating proxy locations.";
|
|
234
|
+
}
|
|
235
|
+
function summarizeProxyCheck(output) {
|
|
236
|
+
if (isRecord(output)) {
|
|
237
|
+
const ip = readString(output.ip);
|
|
238
|
+
const location = isRecord(output.location) ? output.location : undefined;
|
|
239
|
+
const city = location ? readString(location.city) : undefined;
|
|
240
|
+
const countryCode = location ? readString(location.countryCode) : undefined;
|
|
241
|
+
if (ip && countryCode) {
|
|
242
|
+
return `Proxy exit IP is ${ip}${city ? ` in ${city}` : ""}, ${countryCode}.`;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
return "Checked proxy.";
|
|
246
|
+
}
|
|
247
|
+
function summarizeStaticProxies(output) {
|
|
248
|
+
if (isRecord(output) && Array.isArray(output.items)) {
|
|
249
|
+
const pendingCount = typeof output.pendingCount === "number" ? output.pendingCount : 0;
|
|
250
|
+
return `Found ${output.items.length} static proxies and ${pendingCount} pending proxies.`;
|
|
251
|
+
}
|
|
252
|
+
return "Fetched static proxies.";
|
|
253
|
+
}
|
|
254
|
+
function readString(value) {
|
|
255
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
256
|
+
}
|
|
257
|
+
function isRecord(value) {
|
|
258
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=tool-definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tool-definitions.js","sourceRoot":"","sources":["../src/tool-definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,MAAM,eAAe,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,QAAQ,EAAE,YAAY,CAAC,CAAC,CAAC;AACxE,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,C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,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;QACpD,MAAM,YAAY,GAChB,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,CAAC;QAEpE,OAAO,SAAS,MAAM,CAAC,KAAK,CAAC,MAAM,uBAAuB,YAAY,mBAAmB,CAAC;IAC5F,CAAC;IAED,OAAO,yBAAyB,CAAC;AACnC,CAAC;AAED,SAAS,UAAU,CAAC,KAAc;IAChC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAC3E,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export type JsonValue = string | number | boolean | null | JsonValue[] | JsonObject;
|
|
2
|
+
export interface JsonObject {
|
|
3
|
+
[key: string]: JsonValue;
|
|
4
|
+
}
|
|
5
|
+
export type FetchLike = (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
|
|
6
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GACjB,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,SAAS,EAAE,GACX,UAAU,CAAC;AAEf,MAAM,WAAW,UAAU;IACzB,CAAC,GAAG,EAAE,MAAM,GAAG,SAAS,CAAC;CAC1B;AAED,MAAM,MAAM,SAAS,GAAG,CACtB,KAAK,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,EAC7B,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@floppydata/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for the Floppydata Client API v2.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"packageManager": "pnpm@11.8.0",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/Floppydata/floppydata-mcp.git"
|
|
10
|
+
},
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/Floppydata/floppydata-mcp/issues"
|
|
13
|
+
},
|
|
14
|
+
"homepage": "https://github.com/Floppydata/floppydata-mcp#readme",
|
|
15
|
+
"bin": {
|
|
16
|
+
"floppydata-mcp": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"main": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"README.md",
|
|
23
|
+
"LICENSE"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "tsc -p tsconfig.json",
|
|
27
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
28
|
+
"lint": "eslint .",
|
|
29
|
+
"test": "vitest run",
|
|
30
|
+
"prepack": "pnpm build"
|
|
31
|
+
},
|
|
32
|
+
"keywords": [
|
|
33
|
+
"floppydata",
|
|
34
|
+
"mcp",
|
|
35
|
+
"proxy",
|
|
36
|
+
"web-data"
|
|
37
|
+
],
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=18"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
44
|
+
"zod": "^4.3.6"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@eslint/js": "^9.39.2",
|
|
48
|
+
"@types/node": "^25.0.3",
|
|
49
|
+
"eslint": "^9.39.2",
|
|
50
|
+
"typescript": "^6.0.3",
|
|
51
|
+
"typescript-eslint": "^8.50.0",
|
|
52
|
+
"vitest": "^4.0.16"
|
|
53
|
+
},
|
|
54
|
+
"publishConfig": {
|
|
55
|
+
"access": "public"
|
|
56
|
+
}
|
|
57
|
+
}
|