@yiaany/ghostapi 0.1.4 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +16 -1
- package/README.md +192 -65
- package/dist/rules/aiRules.js +1 -1
- package/dist/rules/aiRules.js.map +1 -1
- package/dist/setup/setupGenerator.js +1 -1
- package/dist/setup/setupGenerator.js.map +1 -1
- package/docs/assets/dashboard.png +0 -0
- package/docs/assets/ghostapi-avatar.png +0 -0
- package/docs/mcp.md +50 -0
- package/docs/usage.md +57 -0
- package/examples/stripe-node/README.md +2 -2
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -4,13 +4,28 @@ All notable changes to GhostAPI will be documented in this file.
|
|
|
4
4
|
|
|
5
5
|
The format follows the spirit of [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project uses semantic versioning once public releases begin.
|
|
6
6
|
|
|
7
|
+
## 0.1.6 - 2026-07-18
|
|
8
|
+
|
|
9
|
+
### Fixed
|
|
10
|
+
|
|
11
|
+
- Updated npm package repository, bugs, and homepage URLs to point to `yiaany/ghostapi` instead of broken legacy links.
|
|
12
|
+
- Replaced custom CI badge with live GitHub Actions workflow status badge (`yiaany/ghostapi/actions/workflows/ci.yml/badge.svg`).
|
|
13
|
+
|
|
14
|
+
## 0.1.5 - 2026-07-18
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Replaced Stripe-looking fake secret examples with `stripe_test_ghostapi` so npm's README secret scanner does not render examples as `***`.
|
|
19
|
+
- Kept the 30 second curl command fully copy-pasteable with closed quotes and explicit fake credentials.
|
|
20
|
+
- Updated generated setup snippets and agent rules to use the same non-redacted fake Stripe key.
|
|
21
|
+
|
|
7
22
|
## 0.1.4 - 2026-07-18
|
|
8
23
|
|
|
9
24
|
### Fixed
|
|
10
25
|
|
|
11
26
|
- Revalidated npm README copy-paste snippets for the 30 second curl flow and OpenAI SDK setup.
|
|
12
27
|
- Updated generated Stripe setup snippets to use local `host`, `port`, and `protocol` options instead of the old `apiBase` example.
|
|
13
|
-
- Kept example keys explicit as
|
|
28
|
+
- Kept example keys explicit as fake local credentials so public docs do not look redacted or broken.
|
|
14
29
|
|
|
15
30
|
## 0.1.3 - 2026-07-18
|
|
16
31
|
|
package/README.md
CHANGED
|
@@ -1,33 +1,92 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
GhostAPI
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/ghostapi-avatar.png" alt="GhostAPI" width="104" height="104">
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">GhostAPI</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>The local internet for AI coding agents.</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
A local API sandbox, dashboard, and MCP control plane for building third-party integrations without touching production.
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://www.npmjs.com/package/@yiaany/ghostapi"><img alt="npm" src="https://img.shields.io/npm/v/@yiaany/ghostapi?color=0f172a&label=npm"></a>
|
|
17
|
+
<a href="https://github.com/yiaany/ghostapi/blob/main/LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-0f172a"></a>
|
|
18
|
+
<a href="https://github.com/yiaany/ghostapi/actions/workflows/ci.yml"><img alt="ci" src="https://github.com/yiaany/ghostapi/actions/workflows/ci.yml/badge.svg"></a>
|
|
19
|
+
<img alt="node" src="https://img.shields.io/badge/node-%3E%3D20-0f172a">
|
|
20
|
+
<img alt="mcp" src="https://img.shields.io/badge/MCP-enabled-0f172a">
|
|
21
|
+
</p>
|
|
22
|
+
|
|
23
|
+
<p align="center">
|
|
24
|
+
<a href="#quickstart">Quickstart</a> ·
|
|
25
|
+
<a href="#mcp-setup">MCP Setup</a> ·
|
|
26
|
+
<a href="#how-it-works">How It Works</a> ·
|
|
27
|
+
<a href="#sdk-recipes">SDK Recipes</a> ·
|
|
28
|
+
<a href="#contributing">Contributing</a>
|
|
29
|
+
</p>
|
|
6
30
|
|
|
7
31
|
```bash
|
|
8
32
|
npx @yiaany/ghostapi start --open
|
|
9
33
|
```
|
|
10
34
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="docs/assets/dashboard.png" alt="GhostAPI dashboard showing local API traffic">
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
## The Problem
|
|
40
|
+
|
|
41
|
+
AI coding agents are now strong enough to write Stripe checkouts, OpenAI workflows, GitHub automations, Twilio messaging, and email integrations. The dangerous part is that they also run the code they write.
|
|
42
|
+
|
|
43
|
+
That creates a bad default loop:
|
|
44
|
+
|
|
45
|
+
| Agent action | Production risk |
|
|
46
|
+
| --- | --- |
|
|
47
|
+
| Tests a Stripe flow | Real money movement or broken payment state. |
|
|
48
|
+
| Tests Twilio or Resend | Real SMS or email sent to real people. |
|
|
49
|
+
| Tests GitHub automation | Real issues, branches, releases, or repo mutations. |
|
|
50
|
+
| Tests OpenAI calls | Real token spend and possible prompt/data leakage. |
|
|
51
|
+
| Logs request/response payloads | Secrets leak into terminals, prompts, screenshots, or cache. |
|
|
52
|
+
|
|
53
|
+
GhostAPI gives agents a local universe where integrations behave like real providers, but every request stays on your machine.
|
|
54
|
+
|
|
55
|
+
## What GhostAPI Does
|
|
14
56
|
|
|
15
|
-
|
|
57
|
+
GhostAPI is a local API control layer for agent-driven development.
|
|
16
58
|
|
|
17
|
-
|
|
59
|
+
<table>
|
|
60
|
+
<tr>
|
|
61
|
+
<td><strong>Local API Sandbox</strong><br>Run provider-shaped APIs on <code>127.0.0.1:8080</code> instead of live Stripe, OpenAI, Twilio, Resend, GitHub, Discord, or random REST services.</td>
|
|
62
|
+
<td><strong>Live Dashboard</strong><br>Watch every request, inspect request and response bodies, replay scenarios, generate setup snippets, and verify what your agent actually did.</td>
|
|
63
|
+
</tr>
|
|
64
|
+
<tr>
|
|
65
|
+
<td><strong>MCP Control Plane</strong><br>Let agents inspect state, read traffic logs, force deterministic responses, and toggle Chaos Mode through MCP tools.</td>
|
|
66
|
+
<td><strong>Safe Failure Testing</strong><br>Force card declines, rate limits, upstream errors, latency, and provider-shaped edge cases without waiting for real APIs to fail.</td>
|
|
67
|
+
</tr>
|
|
68
|
+
<tr>
|
|
69
|
+
<td><strong>Secret Masking</strong><br>Mask secret-looking headers, query params, bodies, cache keys, dashboard payloads, events, and prompt inputs.</td>
|
|
70
|
+
<td><strong>Repo Setup Generator</strong><br>Generate MCP config, agent instructions, environment snippets, and SDK patches for the current project.</td>
|
|
71
|
+
</tr>
|
|
72
|
+
</table>
|
|
73
|
+
|
|
74
|
+
## Quickstart
|
|
75
|
+
|
|
76
|
+
Run GhostAPI instantly:
|
|
18
77
|
|
|
19
78
|
```bash
|
|
20
79
|
npx @yiaany/ghostapi start --open
|
|
21
80
|
```
|
|
22
81
|
|
|
23
|
-
|
|
82
|
+
Install globally:
|
|
24
83
|
|
|
25
84
|
```bash
|
|
26
85
|
npm i -g @yiaany/ghostapi
|
|
27
86
|
ghostapi start --open
|
|
28
87
|
```
|
|
29
88
|
|
|
30
|
-
|
|
89
|
+
Open the dashboard:
|
|
31
90
|
|
|
32
91
|
```text
|
|
33
92
|
http://127.0.0.1:8080/dashboard
|
|
@@ -39,29 +98,47 @@ Health check:
|
|
|
39
98
|
curl http://127.0.0.1:8080/health
|
|
40
99
|
```
|
|
41
100
|
|
|
42
|
-
## 30 Second
|
|
101
|
+
## 30 Second Demo
|
|
43
102
|
|
|
44
|
-
Start
|
|
103
|
+
Start the local API world:
|
|
45
104
|
|
|
46
105
|
```bash
|
|
47
106
|
npx @yiaany/ghostapi start --open
|
|
48
107
|
```
|
|
49
108
|
|
|
50
|
-
Send a
|
|
109
|
+
Send a Stripe-shaped request locally:
|
|
51
110
|
|
|
52
111
|
```bash
|
|
53
112
|
curl -X POST http://127.0.0.1:8080/v1/customers \
|
|
54
113
|
-H "content-type: application/json" \
|
|
55
|
-
-H "authorization: Bearer
|
|
114
|
+
-H "authorization: Bearer stripe_test_ghostapi" \
|
|
56
115
|
-d '{"email":"ada@example.com","name":"Ada Lovelace"}'
|
|
57
116
|
```
|
|
58
117
|
|
|
59
|
-
|
|
118
|
+
Inspect the captured request in the dashboard:
|
|
60
119
|
|
|
61
120
|
```text
|
|
62
121
|
http://127.0.0.1:8080/dashboard
|
|
63
122
|
```
|
|
64
123
|
|
|
124
|
+
## One-Command Repo Setup
|
|
125
|
+
|
|
126
|
+
Run setup inside any project:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npx @yiaany/ghostapi setup --write
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
This generates local setup assets for agent workflows:
|
|
133
|
+
|
|
134
|
+
| Output | Why it matters |
|
|
135
|
+
| --- | --- |
|
|
136
|
+
| Agent instructions | Tell coding agents to keep provider calls local. |
|
|
137
|
+
| MCP snippets | Configure Cursor, Claude, Cline, Aider, Codex, OpenCode, Gemini CLI, Goose, OpenClaw, Hermes, and generic MCP clients. |
|
|
138
|
+
| Environment snippets | Point SDKs at `http://127.0.0.1:8080`. |
|
|
139
|
+
| SDK patches | Show how to route Stripe and OpenAI SDKs into GhostAPI. |
|
|
140
|
+
| Safety guidance | Warn before live providers or live-looking keys enter the loop. |
|
|
141
|
+
|
|
65
142
|
## MCP Setup
|
|
66
143
|
|
|
67
144
|
Start the MCP server:
|
|
@@ -70,7 +147,7 @@ Start the MCP server:
|
|
|
70
147
|
npx @yiaany/ghostapi mcp
|
|
71
148
|
```
|
|
72
149
|
|
|
73
|
-
Universal
|
|
150
|
+
Universal MCP config:
|
|
74
151
|
|
|
75
152
|
```json
|
|
76
153
|
{
|
|
@@ -83,56 +160,62 @@ Universal stdio MCP config:
|
|
|
83
160
|
}
|
|
84
161
|
```
|
|
85
162
|
|
|
86
|
-
|
|
163
|
+
Agent prompt:
|
|
87
164
|
|
|
88
|
-
```
|
|
89
|
-
|
|
165
|
+
```text
|
|
166
|
+
Use the GhostAPI MCP server.
|
|
167
|
+
|
|
168
|
+
Keep all third-party API calls local on http://127.0.0.1:8080.
|
|
169
|
+
Do not call real providers.
|
|
170
|
+
|
|
171
|
+
Use GhostAPI MCP tools to inspect state, read traffic logs, configure deterministic responses, and test failure scenarios.
|
|
90
172
|
```
|
|
91
173
|
|
|
92
|
-
|
|
174
|
+
MCP tools:
|
|
93
175
|
|
|
94
176
|
| Tool | Purpose |
|
|
95
177
|
| --- | --- |
|
|
96
178
|
| `inspect_state` | Read local API objects from `.ghostapi/state.json`. |
|
|
97
179
|
| `get_traffic_logs` | Inspect recent local traffic. |
|
|
98
|
-
| `set_api_behavior` | Force
|
|
99
|
-
| `toggle_chaos_mode` | Enable local latency and
|
|
180
|
+
| `set_api_behavior` | Force deterministic responses for `method + path`. |
|
|
181
|
+
| `toggle_chaos_mode` | Enable local latency and provider-shaped errors. |
|
|
100
182
|
|
|
101
|
-
##
|
|
183
|
+
## How It Works
|
|
102
184
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
185
|
+
```text
|
|
186
|
+
Your app or agent
|
|
187
|
+
-> http://127.0.0.1:8080
|
|
188
|
+
-> GhostAPI proxy
|
|
189
|
+
-> provider detection
|
|
190
|
+
-> local state / scenarios / deterministic behavior
|
|
191
|
+
-> dashboard + MCP inspection
|
|
107
192
|
```
|
|
108
193
|
|
|
109
|
-
|
|
194
|
+
GhostAPI does five things in the loop:
|
|
195
|
+
|
|
196
|
+
| Step | What happens |
|
|
197
|
+
| --- | --- |
|
|
198
|
+
| Detect | It infers the provider from routes, headers, SDK shapes, and request bodies. |
|
|
199
|
+
| Normalize | It converts requests into safe, inspectable local events. |
|
|
200
|
+
| Mask | It strips secret-looking values before logs, cache, dashboard, and prompts. |
|
|
201
|
+
| Respond | It returns provider-shaped mock responses, errors, or saved state. |
|
|
202
|
+
| Control | MCP and dashboard tools let agents force behavior and replay flows. |
|
|
203
|
+
|
|
204
|
+
## SDK Recipes
|
|
205
|
+
|
|
206
|
+
Stripe:
|
|
110
207
|
|
|
111
208
|
```ts
|
|
112
209
|
import Stripe from "stripe";
|
|
113
210
|
|
|
114
|
-
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? "
|
|
211
|
+
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? "stripe_test_ghostapi", {
|
|
115
212
|
host: process.env.GHOSTAPI_HOST ?? "127.0.0.1",
|
|
116
213
|
port: Number(process.env.GHOSTAPI_PORT ?? "8080"),
|
|
117
214
|
protocol: process.env.GHOSTAPI_PROTOCOL ?? "http"
|
|
118
215
|
});
|
|
119
216
|
```
|
|
120
217
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
```text
|
|
124
|
-
POST http://127.0.0.1:8080/v1/payment_intents
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
## OpenAI Locally
|
|
128
|
-
|
|
129
|
-
Install OpenAI:
|
|
130
|
-
|
|
131
|
-
```bash
|
|
132
|
-
npm install openai
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
Point the OpenAI SDK at GhostAPI:
|
|
218
|
+
OpenAI:
|
|
136
219
|
|
|
137
220
|
```ts
|
|
138
221
|
import OpenAI from "openai";
|
|
@@ -143,18 +226,43 @@ export const openai = new OpenAI({
|
|
|
143
226
|
});
|
|
144
227
|
```
|
|
145
228
|
|
|
146
|
-
|
|
229
|
+
Generic REST:
|
|
147
230
|
|
|
148
|
-
```
|
|
149
|
-
|
|
231
|
+
```bash
|
|
232
|
+
curl -X POST http://127.0.0.1:8080/tasks \
|
|
233
|
+
-H "content-type: application/json" \
|
|
234
|
+
-d '{"title":"Write integration tests","status":"open"}'
|
|
235
|
+
```
|
|
150
236
|
|
|
151
|
-
|
|
152
|
-
Do not call real providers.
|
|
237
|
+
## Built For
|
|
153
238
|
|
|
154
|
-
Use GhostAPI
|
|
155
|
-
|
|
239
|
+
| Audience | Use GhostAPI to |
|
|
240
|
+
| --- | --- |
|
|
241
|
+
| AI coding agents | Build integrations without accidentally touching production. |
|
|
242
|
+
| SaaS developers | Test provider happy paths and failure paths locally. |
|
|
243
|
+
| API-heavy teams | Turn captured traffic into repeatable scenarios and tests. |
|
|
244
|
+
| Open-source maintainers | Give contributors safe examples that do not require live provider accounts. |
|
|
156
245
|
|
|
157
|
-
##
|
|
246
|
+
## Safety Model
|
|
247
|
+
|
|
248
|
+
- No real provider calls by default.
|
|
249
|
+
- Keep SDKs pointed at `http://127.0.0.1:8080`.
|
|
250
|
+
- Use fake local keys like `stripe_test_ghostapi` and `sk-ghostapi`.
|
|
251
|
+
- Secrets are masked before logs, cache, dashboard, events, and prompts.
|
|
252
|
+
- Chaos Mode is opt-in.
|
|
253
|
+
- Local state lives under `.ghostapi/` and is gitignored.
|
|
254
|
+
|
|
255
|
+
## Local Files
|
|
256
|
+
|
|
257
|
+
| Path | Purpose |
|
|
258
|
+
| --- | --- |
|
|
259
|
+
| `.ghostapi/config.json` | Local GhostAPI config. |
|
|
260
|
+
| `.ghostapi/state.json` | Simulated API object state. |
|
|
261
|
+
| `.ghostapi/events.jsonl` | Captured local request events. |
|
|
262
|
+
| `.ghostapi/behaviors.json` | Deterministic behavior overrides. |
|
|
263
|
+
| `.ghostapi/cache/` | Local response cache. |
|
|
264
|
+
|
|
265
|
+
## CLI Reference
|
|
158
266
|
|
|
159
267
|
```bash
|
|
160
268
|
npx @yiaany/ghostapi start --open
|
|
@@ -168,23 +276,42 @@ npx @yiaany/ghostapi providers list
|
|
|
168
276
|
npx @yiaany/ghostapi providers inspect stripe
|
|
169
277
|
```
|
|
170
278
|
|
|
171
|
-
##
|
|
279
|
+
## Repository About
|
|
172
280
|
|
|
173
|
-
|
|
281
|
+
Use this for the GitHub repository description:
|
|
174
282
|
|
|
175
|
-
|
|
283
|
+
```text
|
|
284
|
+
The local internet for AI coding agents. Simulate Stripe, OpenAI, Twilio, Resend, GitHub, Discord, and REST APIs locally with a dashboard, MCP tools, scenarios, and secret masking.
|
|
285
|
+
```
|
|
176
286
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
-
|
|
181
|
-
|
|
287
|
+
Recommended topics:
|
|
288
|
+
|
|
289
|
+
```text
|
|
290
|
+
mcp, ai-agents, stripe, openai, mock-server, api-testing, sandbox, proxy, local-development, typescript, cursor
|
|
291
|
+
```
|
|
182
292
|
|
|
183
293
|
## Docs
|
|
184
294
|
|
|
185
|
-
-
|
|
186
|
-
-
|
|
295
|
+
- [MCP setup](docs/mcp.md)
|
|
296
|
+
- [Usage guide](docs/usage.md)
|
|
297
|
+
- [Release checklist](docs/release-checklist.md)
|
|
298
|
+
- [Contributing](CONTRIBUTING.md)
|
|
299
|
+
- [Security policy](SECURITY.md)
|
|
300
|
+
|
|
301
|
+
## Contributing
|
|
302
|
+
|
|
303
|
+
Contributions are welcome. GhostAPI should stay local-first, safe by default, and useful for real agent workflows.
|
|
304
|
+
|
|
305
|
+
Before opening a pull request:
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
npm run typecheck
|
|
309
|
+
npm test
|
|
310
|
+
npm run build
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
Do not add tests or examples that call live providers by default. See [CONTRIBUTING.md](CONTRIBUTING.md) for the full guide.
|
|
187
314
|
|
|
188
315
|
## License
|
|
189
316
|
|
|
190
|
-
MIT
|
|
317
|
+
MIT. See [LICENSE](LICENSE).
|
package/dist/rules/aiRules.js
CHANGED
|
@@ -20,7 +20,7 @@ function buildCursorRules(detected) {
|
|
|
20
20
|
""
|
|
21
21
|
];
|
|
22
22
|
if (detected.includes("stripe")) {
|
|
23
|
-
lines.push("## Stripe", "", "This project depends on `stripe`. Configure the Stripe client to use GhostAPI in local development:", "", "```ts", "import Stripe from \"stripe\";", "", "export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? \"
|
|
23
|
+
lines.push("## Stripe", "", "This project depends on `stripe`. Configure the Stripe client to use GhostAPI in local development:", "", "```ts", "import Stripe from \"stripe\";", "", "export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? \"stripe_test_ghostapi\", {", " host: process.env.GHOSTAPI_HOST ?? \"127.0.0.1\",", " port: Number(process.env.GHOSTAPI_PORT ?? \"8080\"),", " protocol: process.env.GHOSTAPI_PROTOCOL ?? \"http\"", "});", "```", "", "Prefer `GHOSTAPI_HOST=127.0.0.1`, `GHOSTAPI_PORT=8080`, and `GHOSTAPI_PROTOCOL=http` in local env files instead of hard-coding production URLs.", "When writing tests, assert behavior against GhostAPI responses and avoid using live Stripe credentials.", "");
|
|
24
24
|
}
|
|
25
25
|
if (detected.length === 0) {
|
|
26
26
|
lines.push("## No Known SDKs Detected", "", "No first-class provider SDK was found in `package.json`. For raw HTTP clients, set the API base URL to `http://127.0.0.1:8080` during local development.", "");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"aiRules.js","sourceRoot":"","sources":["../../src/rules/aiRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAStE,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;IAC/D,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACzC,OAAO;QACL,QAAQ,EAAE,cAAc;QACxB,WAAW;QACX,QAAQ;QACR,OAAO,EAAE,gBAAgB,CAAC,QAAQ,CAAC;KACpC,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,QAAkB;IAC1C,MAAM,KAAK,GAAG;QACZ,wBAAwB;QACxB,EAAE;QACF,kFAAkF;QAClF,oGAAoG;QACpG,wEAAwE;QACxE,yIAAyI;QACzI,EAAE;KACH,CAAC;IAEF,I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,EACF,0JAA0J,EAC1J,EAAE,CACH,CAAC;IACJ,CAAC;IAED,KAAK,CAAC,IAAI,CACR,kBAAkB,EAClB,EAAE,EACF,4JAA4J,EAC5J,EAAE,CACH,CAAC;IAEF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -137,7 +137,7 @@ function buildPatches(detected) {
|
|
|
137
137
|
content: [
|
|
138
138
|
"import Stripe from \"stripe\";",
|
|
139
139
|
"",
|
|
140
|
-
"export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? \"
|
|
140
|
+
"export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? \"stripe_test_ghostapi\", {",
|
|
141
141
|
" host: process.env.GHOSTAPI_HOST ?? \"127.0.0.1\",",
|
|
142
142
|
" port: Number(process.env.GHOSTAPI_PORT ?? \"8080\"),",
|
|
143
143
|
" protocol: process.env.GHOSTAPI_PROTOCOL ?? \"http\"",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setupGenerator.js","sourceRoot":"","sources":["../../src/setup/setupGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,UAAU,EAAoB,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AA4BtD,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;IACjE,MAAM,WAAW,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,eAAe,CAAC,WAAW,CAAC,CAAC;IACjD,MAAM,SAAS,GAAG,c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C,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,wBAAwB,CAAC;IACrF,OAAO;QACL,+BAA+B;QAC/B,EAAE;QACF,8BAA8B,UAAU,8BAA8B;QACtE,EAAE;QACF,sBAAsB;QACtB,EAAE;QACF,mEAAmE;QACnE,EAAE;QACF,SAAS;QACT,uBAAuB;QACvB,cAAc;QACd,KAAK;QACL,EAAE;QACF,sHAAsH;QACtH,EAAE;QACF,eAAe;QACf,EAAE;QACF,qDAAqD;QACrD,EAAE;QACF,SAAS;QACT,IAAI,CAAC,SAAS,CAAC,EAAE,UAAU,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;QACvE,KAAK;QACL,EAAE;QACF,6HAA6H;QAC7H,EAAE;QACF,kBAAkB;QAClB,EAAE;QACF,aAAa,OAAO,GAAG;QACvB,EAAE;QACF,2FAA2F;KAC5F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC;AAED,SAAS,YAAY,CAAC,QAAuB;IAC3C,MAAM,OAAO,GAAiB;QAC5B;YACE,KAAK,EAAE,wBAAwB;YAC/B,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE;gBACP,yCAAyC;gBACzC,yBAAyB;gBACzB,oBAAoB;gBACpB,wBAAwB;gBACxB,mDAAmD;aACpD,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;IAEF,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,qBAAqB;YAC5B,SAAS,EAAE,8BAA8B;YACzC,OAAO,EAAE;gBACP,gCAAgC;gBAChC,EAAE;gBACF
|
|
1
|
+
{"version":3,"file":"setupGenerator.js","sourceRoot":"","sources":["../../src/setup/setupGenerator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,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AAwB;YAC/B,SAAS,EAAE,YAAY;YACvB,OAAO,EAAE;gBACP,yCAAyC;gBACzC,yBAAyB;gBACzB,oBAAoB;gBACpB,wBAAwB;gBACxB,mDAAmD;aACpD,CAAC,IAAI,CAAC,IAAI,CAAC;SACb;KACF,CAAC;IAEF,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,qBAAqB;YAC5B,SAAS,EAAE,8BAA8B;YACzC,OAAO,EAAE;gBACP,gCAAgC;gBAChC,EAAE;gBACF,+FAA+F;gBAC/F,qDAAqD;gBACrD,wDAAwD;gBACxD,uDAAuD;gBACvD,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC,CAAC;IACL,CAAC;IAED,IAAI,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,IAAI,CAAC;YACX,KAAK,EAAE,qBAAqB;YAC5B,SAAS,EAAE,8BAA8B;YACzC,OAAO,EAAE;gBACP,gCAAgC;gBAChC,EAAE;gBACF,oCAAoC;gBACpC,0DAA0D;gBAC1D,iFAAiF;gBACjF,KAAK;aACN,CAAC,IAAI,CAAC,IAAI,CAAC;SACb,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
Binary file
|
|
Binary file
|
package/docs/mcp.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# GhostAPI MCP Setup
|
|
2
|
+
|
|
3
|
+
GhostAPI ships with a local stdio MCP server so coding agents can inspect and control the local API world.
|
|
4
|
+
|
|
5
|
+
## Start MCP
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx @yiaany/ghostapi mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Universal Config
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"ghostapi": {
|
|
17
|
+
"command": "npx",
|
|
18
|
+
"args": ["-y", "@yiaany/ghostapi", "mcp"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
## Generate Client Snippets
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx @yiaany/ghostapi setup --write
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This writes copy-ready local snippets under `.ghostapi/agent-configs/` and project instructions for supported agent clients.
|
|
31
|
+
|
|
32
|
+
## Tools
|
|
33
|
+
|
|
34
|
+
| Tool | Purpose |
|
|
35
|
+
| --- | --- |
|
|
36
|
+
| `inspect_state` | Read local API objects from `.ghostapi/state.json`. |
|
|
37
|
+
| `get_traffic_logs` | Inspect recent captured API traffic. |
|
|
38
|
+
| `set_api_behavior` | Force a deterministic local response for `method + path`. |
|
|
39
|
+
| `toggle_chaos_mode` | Enable or disable local latency and error injection. |
|
|
40
|
+
|
|
41
|
+
## Agent Prompt
|
|
42
|
+
|
|
43
|
+
```text
|
|
44
|
+
Use the GhostAPI MCP server.
|
|
45
|
+
|
|
46
|
+
Keep all third-party API calls local on http://127.0.0.1:8080.
|
|
47
|
+
Do not call real providers.
|
|
48
|
+
|
|
49
|
+
Use GhostAPI MCP tools to inspect state, read traffic logs, configure deterministic responses, and test failure scenarios.
|
|
50
|
+
```
|
package/docs/usage.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# GhostAPI Usage Guide
|
|
2
|
+
|
|
3
|
+
## Start The Local API
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npx @yiaany/ghostapi start --open
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
GhostAPI listens on:
|
|
10
|
+
|
|
11
|
+
```text
|
|
12
|
+
http://127.0.0.1:8080
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Dashboard:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
http://127.0.0.1:8080/dashboard
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Send A Local Request
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
curl -X POST http://127.0.0.1:8080/v1/customers \
|
|
25
|
+
-H "content-type: application/json" \
|
|
26
|
+
-H "authorization: Bearer stripe_test_ghostapi" \
|
|
27
|
+
-d '{"email":"ada@example.com","name":"Ada Lovelace"}'
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Stripe SDK
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import Stripe from "stripe";
|
|
34
|
+
|
|
35
|
+
export const stripe = new Stripe(process.env.STRIPE_SECRET_KEY ?? "stripe_test_ghostapi", {
|
|
36
|
+
host: process.env.GHOSTAPI_HOST ?? "127.0.0.1",
|
|
37
|
+
port: Number(process.env.GHOSTAPI_PORT ?? "8080"),
|
|
38
|
+
protocol: process.env.GHOSTAPI_PROTOCOL ?? "http"
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## OpenAI SDK
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
import OpenAI from "openai";
|
|
46
|
+
|
|
47
|
+
export const openai = new OpenAI({
|
|
48
|
+
apiKey: process.env.OPENAI_API_KEY ?? "sk-ghostapi",
|
|
49
|
+
baseURL: process.env.GHOSTAPI_OPENAI_BASE_URL ?? "http://127.0.0.1:8080/v1"
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Failure Scenarios
|
|
54
|
+
|
|
55
|
+
Use MCP or the dashboard to force deterministic responses such as Stripe card declines, rate limits, upstream errors, and latency.
|
|
56
|
+
|
|
57
|
+
The goal is to make failure handling repeatable instead of relying on live provider behavior.
|
|
@@ -15,7 +15,7 @@ Create a customer:
|
|
|
15
15
|
```bash
|
|
16
16
|
curl -X POST http://localhost:8080/v1/customers \
|
|
17
17
|
-H "content-type: application/json" \
|
|
18
|
-
-H "authorization: Bearer
|
|
18
|
+
-H "authorization: Bearer stripe_test_local_only" \
|
|
19
19
|
-d '{"email":"ada@example.com","name":"Ada Lovelace","metadata":{"source":"ghostapi-example"}}'
|
|
20
20
|
```
|
|
21
21
|
|
|
@@ -23,7 +23,7 @@ Copy the returned `id`, then fetch it:
|
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
25
|
curl http://localhost:8080/v1/customers/cus_mock_example \
|
|
26
|
-
-H "authorization: Bearer
|
|
26
|
+
-H "authorization: Bearer stripe_test_local_only"
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
GhostAPI detects Stripe from the `/v1/customers` path and keeps the created object in `.ghostapi/state.json`.
|
package/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@yiaany/ghostapi",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "The local internet for AI coding agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
8
|
-
"url": "git+https://github.com/
|
|
8
|
+
"url": "git+https://github.com/yiaany/ghostapi.git"
|
|
9
9
|
},
|
|
10
10
|
"bugs": {
|
|
11
|
-
"url": "https://github.com/
|
|
11
|
+
"url": "https://github.com/yiaany/ghostapi/issues"
|
|
12
12
|
},
|
|
13
|
-
"homepage": "https://github.com/
|
|
13
|
+
"homepage": "https://github.com/yiaany/ghostapi#readme",
|
|
14
14
|
"bin": {
|
|
15
15
|
"ghostapi": "dist/cli/index.js"
|
|
16
16
|
},
|