@enky-yy/fauxmcp 0.0.0-stage → 0.2.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 +236 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/cache.d.ts +39 -0
- package/dist/lib/cache.js +107 -0
- package/dist/lib/cache.js.map +1 -0
- package/dist/lib/env.d.ts +26 -0
- package/dist/lib/env.js +37 -0
- package/dist/lib/env.js.map +1 -0
- package/dist/lib/faker.d.ts +26 -0
- package/dist/lib/faker.js +238 -0
- package/dist/lib/faker.js.map +1 -0
- package/dist/lib/fetch.d.ts +21 -0
- package/dist/lib/fetch.js +131 -0
- package/dist/lib/fetch.js.map +1 -0
- package/dist/lib/format.d.ts +27 -0
- package/dist/lib/format.js +189 -0
- package/dist/lib/format.js.map +1 -0
- package/dist/lib/html.d.ts +14 -0
- package/dist/lib/html.js +78 -0
- package/dist/lib/html.js.map +1 -0
- package/dist/lib/result.d.ts +12 -0
- package/dist/lib/result.js +32 -0
- package/dist/lib/result.js.map +1 -0
- package/dist/lib/security.d.ts +18 -0
- package/dist/lib/security.js +98 -0
- package/dist/lib/security.js.map +1 -0
- package/dist/resources.d.ts +6 -0
- package/dist/resources.js +88 -0
- package/dist/resources.js.map +1 -0
- package/dist/server.d.ts +5 -0
- package/dist/server.js +28 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/generate.d.ts +2 -0
- package/dist/tools/generate.js +256 -0
- package/dist/tools/generate.js.map +1 -0
- package/dist/tools/retrieve.d.ts +8 -0
- package/dist/tools/retrieve.js +541 -0
- package/dist/tools/retrieve.js.map +1 -0
- package/package.json +61 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Enky-yy
|
|
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,237 @@
|
|
|
1
|
-
#
|
|
1
|
+
# fauxmcp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/Enky-yy/fauxmcp/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/@enky-yy/fauxmcp)
|
|
5
|
+
[](LICENSE)
|
|
6
|
+
|
|
7
|
+
> **One MCP for all your data.** Generate realistic fake data, fetch real datasets from any URL,
|
|
8
|
+
> scrape HTML tables, and query public APIs — all cached locally so you never knock on the same
|
|
9
|
+
> website twice.
|
|
10
|
+
|
|
11
|
+
`fauxmcp` is a [Model Context Protocol](https://modelcontextprotocol.io) server for developers,
|
|
12
|
+
data folks, and anyone tired of bouncing between Mockaroo, data.gov, GitHub raw files, and
|
|
13
|
+
one-off scraping scripts just to get a table of data.
|
|
14
|
+
|
|
15
|
+
## Why fauxmcp?
|
|
16
|
+
|
|
17
|
+
| Without fauxmcp | With fauxmcp |
|
|
18
|
+
| --- | --- |
|
|
19
|
+
| Open Mockaroo, click around, copy-paste, reformat | *"Generate 100 fake users as SQL inserts"* |
|
|
20
|
+
| Download CSVs from five different portals | *"Fetch this CSV and show me the columns"* |
|
|
21
|
+
| Write a scraper for a Wikipedia table | *"Scrape table 2 from this page"* |
|
|
22
|
+
| Re-download the same file every session | Datasets are cached and reusable as MCP resources |
|
|
23
|
+
|
|
24
|
+
## Quick start
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx -y @enky-yy/fauxmcp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Or install globally:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g @enky-yy/fauxmcp
|
|
34
|
+
fauxmcp
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Claude Desktop
|
|
38
|
+
|
|
39
|
+
Add to `claude_desktop_config.json`:
|
|
40
|
+
|
|
41
|
+
```json
|
|
42
|
+
{
|
|
43
|
+
"mcpServers": {
|
|
44
|
+
"fauxmcp": {
|
|
45
|
+
"command": "npx",
|
|
46
|
+
"args": ["-y", "@enky-yy/fauxmcp"],
|
|
47
|
+
"env": {
|
|
48
|
+
"FAUX_MAX_ROWS": "5000"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Cursor
|
|
56
|
+
|
|
57
|
+
Add to `.cursor/mcp.json` (project) or the global MCP config:
|
|
58
|
+
|
|
59
|
+
```json
|
|
60
|
+
{
|
|
61
|
+
"mcpServers": {
|
|
62
|
+
"fauxmcp": {
|
|
63
|
+
"command": "npx",
|
|
64
|
+
"args": ["-y", "fauxmcp"]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### VS Code
|
|
71
|
+
|
|
72
|
+
Add to `.vscode/mcp.json`:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"servers": {
|
|
77
|
+
"fauxmcp": {
|
|
78
|
+
"command": "npx",
|
|
79
|
+
"args": ["-y", "fauxmcp"]
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Tools
|
|
86
|
+
|
|
87
|
+
### 🎲 Generate fake data
|
|
88
|
+
|
|
89
|
+
| Tool | What it does |
|
|
90
|
+
| --- | --- |
|
|
91
|
+
| `generate_people` | Realistic people: name, email, phone, job, company, city, country, timestamps |
|
|
92
|
+
| `generate_records` | Schema-driven rows — describe your fields, get data in JSON / CSV / TSV / SQL / Markdown |
|
|
93
|
+
| `generate_json` | Pretty-printed JSON fixtures for API mocks and frontend dev |
|
|
94
|
+
| `generate_csv` | CSV ready for spreadsheets and database imports |
|
|
95
|
+
| `generate_sql` | `CREATE TABLE` + `INSERT` statements with inferred column types |
|
|
96
|
+
| `generate_email` | One or many email addresses, optionally on a fixed domain |
|
|
97
|
+
| `generate_address` | Postal addresses (street, city, state, zip, country) |
|
|
98
|
+
| `generate_phone` | Phone numbers, locale-aware |
|
|
99
|
+
|
|
100
|
+
**Field types include:** `firstName`, `lastName`, `fullName`, `email`, `username`, `phone`,
|
|
101
|
+
`city`, `country`, `streetAddress`, `zipCode`, `latitude`, `longitude`, `company`, `jobTitle`,
|
|
102
|
+
`url`, `domainName`, `ipv4`, `uuid`, `id`, `integer`, `float`, `boolean`, `date`, `datetime`,
|
|
103
|
+
`time`, `price`, `amount`, `currencyCode`, `word`, `sentence`, `paragraph`, `isbn`,
|
|
104
|
+
`creditCardNumber`, `iban`, `enum`, `constant`, and more.
|
|
105
|
+
|
|
106
|
+
Built-in presets: `people`, `products`, `orders`, `companies`.
|
|
107
|
+
|
|
108
|
+
### 🌐 Retrieve real data
|
|
109
|
+
|
|
110
|
+
| Tool | What it does |
|
|
111
|
+
| --- | --- |
|
|
112
|
+
| `fetch_dataset` | Download CSV / TSV / JSON from any http(s) URL, parse it, preview rows, cache the file |
|
|
113
|
+
| `scrape_table` | Extract HTML `<table>` elements from a page into structured rows (and save as CSV) |
|
|
114
|
+
| `query_public_api` | Call a REST API with params / headers / body, preview the JSON, cache the response |
|
|
115
|
+
| `list_saved_datasets` | Browse everything cached locally |
|
|
116
|
+
| `read_saved_dataset` | Page through a cached dataset without re-downloading it |
|
|
117
|
+
|
|
118
|
+
### 📚 Resources
|
|
119
|
+
|
|
120
|
+
Every cached dataset is also exposed as an MCP resource:
|
|
121
|
+
|
|
122
|
+
- `fauxmcp://datasets` — JSON index of all datasets
|
|
123
|
+
- `fauxmcp://datasets/{id}` — the raw dataset file
|
|
124
|
+
|
|
125
|
+
## Example prompts
|
|
126
|
+
|
|
127
|
+
```text
|
|
128
|
+
Generate 50 fake users for my test database, with reproducible data (seed 42).
|
|
129
|
+
|
|
130
|
+
Give me a SQL INSERT script for a `products` table with 20 rows.
|
|
131
|
+
|
|
132
|
+
Create 10 JSON objects shaped like {id, email, status} for my API mock.
|
|
133
|
+
|
|
134
|
+
Fetch https://raw.githubusercontent.com/.../countries.csv and show me the first rows.
|
|
135
|
+
|
|
136
|
+
Scrape the tables from https://en.wikipedia.org/wiki/List_of_countries_by_population_(United_Nations)
|
|
137
|
+
and save the first one as CSV.
|
|
138
|
+
|
|
139
|
+
Query https://api.example.com/v1/items?limit=5 and summarize the response.
|
|
140
|
+
|
|
141
|
+
List my saved datasets, then show me the last 10 rows of `people-csv`.
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Large results & caching
|
|
145
|
+
|
|
146
|
+
Tool responses stay small by design: you get a **preview table** plus a summary. When a result
|
|
147
|
+
is larger than the preview window, the full file is written to the local cache and you get an
|
|
148
|
+
id to page through it later:
|
|
149
|
+
|
|
150
|
+
```text
|
|
151
|
+
📦 Saved as `people` (1000 rows, 142.3 KB) — read it with `read_saved_dataset`
|
|
152
|
+
or `fauxmcp://datasets/people`.
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Cache location: `~/.fauxmcp/datasets` (override with `FAUX_CACHE_DIR`).
|
|
156
|
+
|
|
157
|
+
## Configuration
|
|
158
|
+
|
|
159
|
+
Every guardrail is an environment variable, so the defaults protect you without hard-blocking
|
|
160
|
+
you:
|
|
161
|
+
|
|
162
|
+
| Variable | Default | Purpose |
|
|
163
|
+
| --- | --- | --- |
|
|
164
|
+
| `FAUX_MAX_ROWS` | `1000` | Max rows per generation call |
|
|
165
|
+
| `FAUX_MAX_SIZE_MB` | `10` | Max download size |
|
|
166
|
+
| `FAUX_FETCH_TIMEOUT_MS` | `30000` | Fetch timeout |
|
|
167
|
+
| `FAUX_PREVIEW_ROWS` | `20` | Rows shown inline in responses |
|
|
168
|
+
| `FAUX_PREVIEW_CHARS` | `8000` | Character cap for any inline preview |
|
|
169
|
+
| `FAUX_MAX_CELL_CHARS` | `300` | Character cap per preview table cell |
|
|
170
|
+
| `FAUX_MAX_TABLES` | `10` | Max HTML tables scraped per page |
|
|
171
|
+
| `FAUX_CACHE_DIR` | `~/.fauxmcp/datasets` | Dataset cache directory |
|
|
172
|
+
| `FAUX_ALLOW_METADATA` | unset | Set to `1` to allow fetches to cloud metadata / link-local hosts |
|
|
173
|
+
|
|
174
|
+
## Reproducibility
|
|
175
|
+
|
|
176
|
+
Pass a `seed` to any generation tool and the same seed yields the same data — great for test
|
|
177
|
+
fixtures. Note that seeded timestamps are anchored to a fixed reference date so they stay stable
|
|
178
|
+
across runs; omit the seed to get data relative to *now*.
|
|
179
|
+
|
|
180
|
+
## Safety & limits
|
|
181
|
+
|
|
182
|
+
- **Context protection** — huge tool outputs would flood the model's context, so previews are
|
|
183
|
+
capped by rows, columns, per-cell characters, and total characters. Larger files are written
|
|
184
|
+
to the cache instead of being echoed back.
|
|
185
|
+
- **Memory & disk protection** — downloads are capped at 10 MB (configurable) with streaming
|
|
186
|
+
byte counting; generated rows and schema fields are capped too.
|
|
187
|
+
- **Hang protection** — every request has a timeout, redirects are limited to 5 hops, and stdio
|
|
188
|
+
MCP calls are serialized.
|
|
189
|
+
- **SSRF protection** — only `http://` and `https://` are allowed (including after every
|
|
190
|
+
redirect), and cloud metadata / link-local hosts (`169.254.169.254`, `metadata.google.internal`,
|
|
191
|
+
`fd00:ec2::254`, `fe80::/10`, …) are blocked by default. Loopback and private ranges stay
|
|
192
|
+
allowed so local dev servers work. Set `FAUX_ALLOW_METADATA=1` to opt out.
|
|
193
|
+
- **CSV formula injection** — scraped HTML tables are saved with leading `=`, `+`, `-`, and `@`
|
|
194
|
+
characters neutralized so opening the CSV in a spreadsheet cannot execute formulas. Fetched
|
|
195
|
+
files are stored byte-for-byte and are *not* rewritten; treat downloaded CSV/TSV as untrusted.
|
|
196
|
+
- **Cache isolation** — GET and non-GET API responses use distinct cache keys; only GET
|
|
197
|
+
responses are ever served from the cache. Cache files are created with `0600` permissions in a
|
|
198
|
+
`0700` directory, and index entries cannot point outside the cache directory.
|
|
199
|
+
- **Prompt-injection surface** — caps turn a malicious "download 10 GB" instruction into a
|
|
200
|
+
harmless error, and URLs in error messages are stripped of embedded credentials.
|
|
201
|
+
- **Synthetic data only** — generated credit-card, IBAN, and phone values look realistic and may
|
|
202
|
+
pass format validators. They are not real and must never be used as actual payment or identity
|
|
203
|
+
data.
|
|
204
|
+
- **Scraping** works on server-rendered HTML only. Pages that build tables with JavaScript are
|
|
205
|
+
not supported (no headless browser). Respect each site's terms of service.
|
|
206
|
+
|
|
207
|
+
## Development
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
npm install
|
|
211
|
+
npm run build # compile to dist/
|
|
212
|
+
npm test # unit tests (vitest)
|
|
213
|
+
npm run smoke # end-to-end test against local CSV/JSON/HTML/REST fixtures
|
|
214
|
+
npm run inspector # open the MCP Inspector against the built server
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Project layout:
|
|
218
|
+
|
|
219
|
+
```text
|
|
220
|
+
src/
|
|
221
|
+
├── index.ts # stdio entry point
|
|
222
|
+
├── server.ts # server factory + instructions
|
|
223
|
+
├── resources.ts # fauxmcp:// resources
|
|
224
|
+
├── lib/ # env, faker, format, fetch, cache, html, result
|
|
225
|
+
└── tools/
|
|
226
|
+
├── generate.ts # generation tools
|
|
227
|
+
└── retrieve.ts # fetch / scrape / query / cache tools
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
CI (`.github/workflows/ci.yml`) runs typecheck + unit tests on Node 22/24/26, the end-to-end
|
|
231
|
+
smoke test, and a publishable-tarball check on every push and pull request.
|
|
232
|
+
|
|
233
|
+
## License
|
|
234
|
+
|
|
235
|
+
MIT
|
|
236
|
+
|
|
237
|
+
Security issues: please follow [SECURITY.md](SECURITY.md) and report privately.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { serverInfo } from "./lib/env.js";
|
|
2
|
+
import { runServer } from "./server.js";
|
|
3
|
+
const args = process.argv.slice(2);
|
|
4
|
+
if (args.includes("--version") || args.includes("-v")) {
|
|
5
|
+
console.log(serverInfo.version);
|
|
6
|
+
process.exit(0);
|
|
7
|
+
}
|
|
8
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
9
|
+
console.log([
|
|
10
|
+
`fauxmcp v${serverInfo.version} — fake and real data for MCP clients`,
|
|
11
|
+
"",
|
|
12
|
+
"Usage: fauxmcp start the MCP server on stdio",
|
|
13
|
+
" fauxmcp --help show this help",
|
|
14
|
+
" fauxmcp --version print the version",
|
|
15
|
+
"",
|
|
16
|
+
"Configure it in your MCP client (Claude Desktop, Cursor, VS Code, …)",
|
|
17
|
+
"with command \"npx\" and args [\"-y\", \"@enky-yy/fauxmcp\"].",
|
|
18
|
+
"",
|
|
19
|
+
"Docs: https://github.com/Enky-yy/fauxmcp",
|
|
20
|
+
].join("\n"));
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
23
|
+
runServer().catch((error) => {
|
|
24
|
+
console.error("fauxmcp failed to start:", error);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAEnC,IAAI,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACtD,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;IACnD,OAAO,CAAC,GAAG,CACT;QACE,YAAY,UAAU,CAAC,OAAO,uCAAuC;QACrE,EAAE;QACF,yDAAyD;QACzD,0CAA0C;QAC1C,6CAA6C;QAC7C,EAAE;QACF,sEAAsE;QACtE,+DAA+D;QAC/D,EAAE;QACF,0CAA0C;KAC3C,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACnC,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAC;IACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export type DatasetKind = "fetch" | "scrape" | "api" | "generated";
|
|
2
|
+
export interface DatasetMeta {
|
|
3
|
+
/** Stable slug used in resource URIs and tool calls. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** Human-friendly name. */
|
|
6
|
+
name: string;
|
|
7
|
+
/** File name inside the cache directory. */
|
|
8
|
+
file: string;
|
|
9
|
+
/** Data format, e.g. csv, json, sql, md. */
|
|
10
|
+
format: string;
|
|
11
|
+
kind: DatasetKind;
|
|
12
|
+
sourceUrl?: string;
|
|
13
|
+
rows?: number;
|
|
14
|
+
bytes: number;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
}
|
|
18
|
+
export declare function slugify(name: string): string;
|
|
19
|
+
export declare function loadIndex(): Promise<DatasetMeta[]>;
|
|
20
|
+
export interface SaveDatasetInput {
|
|
21
|
+
name: string;
|
|
22
|
+
content: string;
|
|
23
|
+
format: string;
|
|
24
|
+
kind: DatasetKind;
|
|
25
|
+
sourceUrl?: string;
|
|
26
|
+
rows?: number;
|
|
27
|
+
}
|
|
28
|
+
/** Persist a dataset and return its metadata (overwrites same-named datasets). */
|
|
29
|
+
export declare function saveDataset(input: SaveDatasetInput): Promise<DatasetMeta>;
|
|
30
|
+
export interface LoadedDataset {
|
|
31
|
+
meta: DatasetMeta;
|
|
32
|
+
content: string;
|
|
33
|
+
}
|
|
34
|
+
/** Read a cached dataset by id (or file name). */
|
|
35
|
+
export declare function getDataset(id: string): Promise<LoadedDataset | null>;
|
|
36
|
+
/** Find a cached dataset previously downloaded from the same URL. */
|
|
37
|
+
export declare function findByUrl(url: string): Promise<DatasetMeta | undefined>;
|
|
38
|
+
/** List cached datasets, most recently updated first. */
|
|
39
|
+
export declare function listDatasets(): Promise<DatasetMeta[]>;
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { promises as fs } from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { config } from "./env.js";
|
|
4
|
+
import { extensionFor } from "./format.js";
|
|
5
|
+
const INDEX_FILE = "index.json";
|
|
6
|
+
async function ensureDir() {
|
|
7
|
+
await fs.mkdir(config.cacheDir, { recursive: true, mode: 0o700 });
|
|
8
|
+
}
|
|
9
|
+
/** Resolve a cache file name, rejecting anything that escapes the cache dir. */
|
|
10
|
+
function resolveCacheFile(file) {
|
|
11
|
+
const base = path.resolve(config.cacheDir);
|
|
12
|
+
const name = path.basename(file);
|
|
13
|
+
if (name !== file) {
|
|
14
|
+
throw new Error(`Unsafe cache file name: ${file}`);
|
|
15
|
+
}
|
|
16
|
+
const target = path.resolve(base, name);
|
|
17
|
+
if (!target.startsWith(`${base}${path.sep}`)) {
|
|
18
|
+
throw new Error(`Unsafe cache file path: ${file}`);
|
|
19
|
+
}
|
|
20
|
+
return target;
|
|
21
|
+
}
|
|
22
|
+
export function slugify(name) {
|
|
23
|
+
const slug = name
|
|
24
|
+
.toLowerCase()
|
|
25
|
+
.normalize("NFKD")
|
|
26
|
+
.replace(/\p{M}/gu, "")
|
|
27
|
+
.replace(/[^a-z0-9]+/g, "-")
|
|
28
|
+
.replace(/^-+|-+$/g, "")
|
|
29
|
+
.slice(0, 60);
|
|
30
|
+
return slug || "dataset";
|
|
31
|
+
}
|
|
32
|
+
export async function loadIndex() {
|
|
33
|
+
try {
|
|
34
|
+
const raw = await fs.readFile(path.join(config.cacheDir, INDEX_FILE), "utf8");
|
|
35
|
+
const parsed = JSON.parse(raw);
|
|
36
|
+
if (!Array.isArray(parsed))
|
|
37
|
+
return [];
|
|
38
|
+
return parsed.filter((entry) => {
|
|
39
|
+
return (typeof entry === "object" &&
|
|
40
|
+
entry !== null &&
|
|
41
|
+
typeof entry.id === "string" &&
|
|
42
|
+
typeof entry.file === "string");
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async function saveIndex(entries) {
|
|
50
|
+
await ensureDir();
|
|
51
|
+
const sorted = [...entries].sort((a, b) => a.name.localeCompare(b.name));
|
|
52
|
+
await fs.writeFile(path.join(config.cacheDir, INDEX_FILE), JSON.stringify(sorted, null, 2), { encoding: "utf8", mode: 0o600 });
|
|
53
|
+
}
|
|
54
|
+
/** Persist a dataset and return its metadata (overwrites same-named datasets). */
|
|
55
|
+
export async function saveDataset(input) {
|
|
56
|
+
await ensureDir();
|
|
57
|
+
const entries = await loadIndex();
|
|
58
|
+
const id = slugify(input.name);
|
|
59
|
+
const existing = entries.find((entry) => entry.id === id);
|
|
60
|
+
const file = `${id}.${extensionFor(input.format)}`;
|
|
61
|
+
await fs.writeFile(resolveCacheFile(file), input.content, {
|
|
62
|
+
encoding: "utf8",
|
|
63
|
+
mode: 0o600,
|
|
64
|
+
});
|
|
65
|
+
const now = new Date().toISOString();
|
|
66
|
+
const meta = {
|
|
67
|
+
id,
|
|
68
|
+
name: input.name,
|
|
69
|
+
file,
|
|
70
|
+
format: input.format,
|
|
71
|
+
kind: input.kind,
|
|
72
|
+
sourceUrl: input.sourceUrl,
|
|
73
|
+
rows: input.rows,
|
|
74
|
+
bytes: Buffer.byteLength(input.content, "utf8"),
|
|
75
|
+
createdAt: existing?.createdAt ?? now,
|
|
76
|
+
updatedAt: now,
|
|
77
|
+
};
|
|
78
|
+
const next = entries.filter((entry) => entry.id !== id);
|
|
79
|
+
next.push(meta);
|
|
80
|
+
await saveIndex(next);
|
|
81
|
+
return meta;
|
|
82
|
+
}
|
|
83
|
+
/** Read a cached dataset by id (or file name). */
|
|
84
|
+
export async function getDataset(id) {
|
|
85
|
+
const entries = await loadIndex();
|
|
86
|
+
const meta = entries.find((entry) => entry.id === id || entry.file === id);
|
|
87
|
+
if (!meta)
|
|
88
|
+
return null;
|
|
89
|
+
try {
|
|
90
|
+
const content = await fs.readFile(resolveCacheFile(meta.file), "utf8");
|
|
91
|
+
return { meta, content };
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/** Find a cached dataset previously downloaded from the same URL. */
|
|
98
|
+
export async function findByUrl(url) {
|
|
99
|
+
const entries = await loadIndex();
|
|
100
|
+
return entries.find((entry) => entry.sourceUrl === url);
|
|
101
|
+
}
|
|
102
|
+
/** List cached datasets, most recently updated first. */
|
|
103
|
+
export async function listDatasets() {
|
|
104
|
+
const entries = await loadIndex();
|
|
105
|
+
return entries.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../../src/lib/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,IAAI,EAAE,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAqB3C,MAAM,UAAU,GAAG,YAAY,CAAC;AAEhC,KAAK,UAAU,SAAS;IACtB,MAAM,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;AACpE,CAAC;AAED,gFAAgF;AAChF,SAAS,gBAAgB,CAAC,IAAY;IACpC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjC,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,2BAA2B,IA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,qEAAqE;AACrE,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,GAAW;IACzC,MAAM,OAAO,GAAG,MAAM,SAAS,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,KAAK,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED,yDAAyD;AACzD,MAAM,CAAC,KAAK,UAAU,YAAY;IAChC,MAAM,OAAO,GAAG,MAAM,SAAS,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime configuration. Every guardrail is overridable through environment
|
|
3
|
+
* variables so that the defaults protect you without ever hard-blocking you.
|
|
4
|
+
*/
|
|
5
|
+
export declare const config: {
|
|
6
|
+
/** Maximum number of generated rows a single call may request. */
|
|
7
|
+
readonly maxRows: number;
|
|
8
|
+
/** Maximum download size in megabytes. */
|
|
9
|
+
readonly maxSizeMb: number;
|
|
10
|
+
/** Fetch timeout in milliseconds. */
|
|
11
|
+
readonly fetchTimeoutMs: number;
|
|
12
|
+
/** Number of rows shown inline in tool responses. */
|
|
13
|
+
readonly previewRows: number;
|
|
14
|
+
/** Maximum characters in any single inline preview. */
|
|
15
|
+
readonly previewChars: number;
|
|
16
|
+
/** Maximum characters per table cell in inline previews. */
|
|
17
|
+
readonly maxCellChars: number;
|
|
18
|
+
/** Maximum number of HTML tables scraped from one page. */
|
|
19
|
+
readonly maxTables: number;
|
|
20
|
+
/** Where downloaded and generated datasets are cached. */
|
|
21
|
+
readonly cacheDir: string;
|
|
22
|
+
};
|
|
23
|
+
export declare const serverInfo: {
|
|
24
|
+
readonly name: "fauxmcp";
|
|
25
|
+
readonly version: "0.1.0";
|
|
26
|
+
};
|
package/dist/lib/env.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import os from "node:os";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
function intEnv(name, fallback) {
|
|
4
|
+
const raw = process.env[name];
|
|
5
|
+
if (!raw)
|
|
6
|
+
return fallback;
|
|
7
|
+
const value = Number.parseInt(raw, 10);
|
|
8
|
+
return Number.isFinite(value) && value > 0 ? value : fallback;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Runtime configuration. Every guardrail is overridable through environment
|
|
12
|
+
* variables so that the defaults protect you without ever hard-blocking you.
|
|
13
|
+
*/
|
|
14
|
+
export const config = {
|
|
15
|
+
/** Maximum number of generated rows a single call may request. */
|
|
16
|
+
maxRows: intEnv("FAUX_MAX_ROWS", 1000),
|
|
17
|
+
/** Maximum download size in megabytes. */
|
|
18
|
+
maxSizeMb: intEnv("FAUX_MAX_SIZE_MB", 10),
|
|
19
|
+
/** Fetch timeout in milliseconds. */
|
|
20
|
+
fetchTimeoutMs: intEnv("FAUX_FETCH_TIMEOUT_MS", 30_000),
|
|
21
|
+
/** Number of rows shown inline in tool responses. */
|
|
22
|
+
previewRows: intEnv("FAUX_PREVIEW_ROWS", 20),
|
|
23
|
+
/** Maximum characters in any single inline preview. */
|
|
24
|
+
previewChars: intEnv("FAUX_PREVIEW_CHARS", 8000),
|
|
25
|
+
/** Maximum characters per table cell in inline previews. */
|
|
26
|
+
maxCellChars: intEnv("FAUX_MAX_CELL_CHARS", 300),
|
|
27
|
+
/** Maximum number of HTML tables scraped from one page. */
|
|
28
|
+
maxTables: intEnv("FAUX_MAX_TABLES", 10),
|
|
29
|
+
/** Where downloaded and generated datasets are cached. */
|
|
30
|
+
cacheDir: process.env.FAUX_CACHE_DIR?.trim() ||
|
|
31
|
+
path.join(os.homedir(), ".fauxmcp", "datasets"),
|
|
32
|
+
};
|
|
33
|
+
export const serverInfo = {
|
|
34
|
+
name: "fauxmc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,cAAc,EAAE,IAAI,EAAE;QAClC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,UAAU,CAAC;CACzC,CAAC;AAEX,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,SAAS;IACf,OAAO,EAAE,OAAO;CACR,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Faker } from "@faker-js/faker";
|
|
2
|
+
export declare const SUPPORTED_LOCALES: string[];
|
|
3
|
+
export declare const FIELD_TYPES: readonly ["id", "uuid", "firstName", "lastName", "fullName", "username", "email", "phone", "avatar", "city", "country", "countryCode", "streetAddress", "zipCode", "latitude", "longitude", "company", "jobTitle", "department", "url", "domainName", "ipv4", "emoji", "color", "productName", "integer", "float", "boolean", "date", "datetime", "time", "price", "amount", "currencyCode", "word", "sentence", "paragraph", "isbn", "creditCardNumber", "iban", "enum", "constant"];
|
|
4
|
+
export type FieldType = (typeof FIELD_TYPES)[number];
|
|
5
|
+
export interface FieldSpec {
|
|
6
|
+
name: string;
|
|
7
|
+
type: FieldType;
|
|
8
|
+
/** Values to pick from when `type` is `enum` (required for enums). */
|
|
9
|
+
values?: Array<string | number | boolean>;
|
|
10
|
+
/** Fixed value when `type` is `constant` (required for constants). */
|
|
11
|
+
value?: string | number | boolean;
|
|
12
|
+
/** Inclusive lower bound for numeric field types. */
|
|
13
|
+
min?: number;
|
|
14
|
+
/** Inclusive upper bound for numeric field types. */
|
|
15
|
+
max?: number;
|
|
16
|
+
}
|
|
17
|
+
export type Row = Record<string, string | number | boolean>;
|
|
18
|
+
export declare const PRESETS: Record<string, FieldSpec[]>;
|
|
19
|
+
export declare const PRESET_NAMES: readonly ["people", "products", "orders", "companies"];
|
|
20
|
+
export type PresetName = (typeof PRESET_NAMES)[number];
|
|
21
|
+
/** Resolve a locale name to a Faker instance, falling back to English. */
|
|
22
|
+
export declare function getFaker(locale?: string, seed?: number): Faker;
|
|
23
|
+
/** Generate a single field value for the given row index. */
|
|
24
|
+
export declare function generateField(faker: Faker, spec: FieldSpec, index: number, reference?: Date): string | number | boolean;
|
|
25
|
+
/** Generate `count` rows for the given field specs. */
|
|
26
|
+
export declare function generateRows(fields: FieldSpec[], count: number, locale?: string, seed?: number): Row[];
|