rappi-mcp-unofficial 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/AGENTS.md +17 -0
- package/CHANGELOG.md +10 -0
- package/CONTRIBUTING.md +6 -0
- package/LICENSE +21 -0
- package/README.md +72 -0
- package/SECURITY.md +30 -0
- package/dist/cli/commands.d.ts +1 -0
- package/dist/cli/commands.js +88 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/constants.d.ts +23 -0
- package/dist/constants.js +34 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +85 -0
- package/dist/index.js.map +1 -0
- package/dist/schemas/common.d.ts +105 -0
- package/dist/schemas/common.js +61 -0
- package/dist/schemas/common.js.map +1 -0
- package/dist/services/audit.d.ts +10 -0
- package/dist/services/audit.js +15 -0
- package/dist/services/audit.js.map +1 -0
- package/dist/services/capabilities.d.ts +25 -0
- package/dist/services/capabilities.js +32 -0
- package/dist/services/capabilities.js.map +1 -0
- package/dist/services/config.d.ts +6 -0
- package/dist/services/config.js +44 -0
- package/dist/services/config.js.map +1 -0
- package/dist/services/connection-status.d.ts +23 -0
- package/dist/services/connection-status.js +51 -0
- package/dist/services/connection-status.js.map +1 -0
- package/dist/services/format.d.ts +4 -0
- package/dist/services/format.js +32 -0
- package/dist/services/format.js.map +1 -0
- package/dist/services/handlers.d.ts +91 -0
- package/dist/services/handlers.js +224 -0
- package/dist/services/handlers.js.map +1 -0
- package/dist/services/mutation-gate.d.ts +17 -0
- package/dist/services/mutation-gate.js +45 -0
- package/dist/services/mutation-gate.js.map +1 -0
- package/dist/services/privacy.d.ts +2 -0
- package/dist/services/privacy.js +40 -0
- package/dist/services/privacy.js.map +1 -0
- package/dist/services/rappi-client.d.ts +46 -0
- package/dist/services/rappi-client.js +175 -0
- package/dist/services/rappi-client.js.map +1 -0
- package/dist/services/redaction.d.ts +5 -0
- package/dist/services/redaction.js +44 -0
- package/dist/services/redaction.js.map +1 -0
- package/dist/services/token-store.d.ts +10 -0
- package/dist/services/token-store.js +67 -0
- package/dist/services/token-store.js.map +1 -0
- package/dist/tools/rappi-tools.d.ts +2 -0
- package/dist/tools/rappi-tools.js +103 -0
- package/dist/tools/rappi-tools.js.map +1 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/examples/claude-desktop.json +8 -0
- package/examples/grok-bot.md +18 -0
- package/llms.txt +11 -0
- package/package.json +72 -0
- package/server.json +50 -0
package/AGENTS.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Agent notes
|
|
2
|
+
|
|
3
|
+
Unofficial local-first Rappi MCP. Personal grocery cart for David / Life / Grok Bot.
|
|
4
|
+
|
|
5
|
+
## Commands
|
|
6
|
+
|
|
7
|
+
- `npm ci`
|
|
8
|
+
- `npm test` (typecheck, build, smoke, mutation gate, redaction, handlers, secret-scan)
|
|
9
|
+
- `npx rappi-mcp-unofficial doctor`
|
|
10
|
+
|
|
11
|
+
## Rules
|
|
12
|
+
|
|
13
|
+
- Never commit tokens or `~/.rappi-mcp/`.
|
|
14
|
+
- Never enable `RAPPI_ALLOW_MUTATIONS` in default examples.
|
|
15
|
+
- `rappi_place_order` must stay fail-closed in tests without both gates.
|
|
16
|
+
- Do not add this connector to the Delx Wellness registry (grocery, not wellness).
|
|
17
|
+
- Live Rappi login is not required for CI.
|
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
## 0.1.0 - 2026-08-26
|
|
2
|
+
|
|
3
|
+
### Added
|
|
4
|
+
|
|
5
|
+
- Unofficial local-first Rappi MCP (stdio, optional loopback HTTP).
|
|
6
|
+
- Read tools: store/product search, cart, addresses, orders (identity redacted by default).
|
|
7
|
+
- Cart writes and place-order / payment writes fail-closed unless `RAPPI_ALLOW_MUTATIONS` and `explicit_user_intent` are both true.
|
|
8
|
+
- Logout and address selection require `explicit_user_intent`.
|
|
9
|
+
- Guest tokens cannot charge.
|
|
10
|
+
- Token file `~/.rappi-mcp/tokens.json` mode 0600.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
1. Keep the default read-only. Money tools stay behind `RAPPI_ALLOW_MUTATIONS` **and** `explicit_user_intent`.
|
|
4
|
+
2. Tests must import shipped handlers from `dist/services/handlers.js`, not a reimplementation.
|
|
5
|
+
3. Do not add live Rappi credentials to fixtures.
|
|
6
|
+
4. Run `npm test` before opening a PR.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 David Mosiah
|
|
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,72 @@
|
|
|
1
|
+
# Rappi MCP (unofficial)
|
|
2
|
+
|
|
3
|
+
Local-first MCP for **your** Rappi cart: search nearby stores and products, inspect the cart, list saved addresses, list and track orders.
|
|
4
|
+
|
|
5
|
+
**This is unofficial.** Not affiliated with, endorsed by, or supported by Rappi. Rappi does not publish a stable consumer cart API. This server talks to the same undocumented web/app endpoints (`services.rappi.com.br` by default). They can change without notice.
|
|
6
|
+
|
|
7
|
+
This is **not** the Rappi Partners / restaurant-integrations OAuth API.
|
|
8
|
+
|
|
9
|
+
## Never pays by default
|
|
10
|
+
|
|
11
|
+
Checkout, place-order, and payment-method writes **do not run** unless **both** are true:
|
|
12
|
+
|
|
13
|
+
1. `RAPPI_ALLOW_MUTATIONS=true`
|
|
14
|
+
2. the tool argument `explicit_user_intent: true`
|
|
15
|
+
|
|
16
|
+
Logout and address selection require `explicit_user_intent` only. Guest tokens cannot charge.
|
|
17
|
+
|
|
18
|
+
Default privacy mode (`structured`) redacts **street, phone, email, last-four**. Tokens live in `~/.rappi-mcp/tokens.json` (mode 0600). They are not in the npm tarball.
|
|
19
|
+
|
|
20
|
+
## Install (stdio)
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
npx -y rappi-mcp-unofficial setup
|
|
24
|
+
npx -y rappi-mcp-unofficial auth --token <personal-access-token>
|
|
25
|
+
npx -y rappi-mcp-unofficial doctor
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Local agent / Claude Desktop / Cursor / Grok Bot:
|
|
29
|
+
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"rappi": {
|
|
34
|
+
"command": "npx",
|
|
35
|
+
"args": ["-y", "rappi-mcp-unofficial"]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
See [examples/grok-bot.md](examples/grok-bot.md). Do **not** put `RAPPI_ALLOW_MUTATIONS` in that snippet.
|
|
42
|
+
|
|
43
|
+
Optional loopback HTTP: `npx -y rappi-mcp-unofficial --http` → `POST http://127.0.0.1:3000/mcp`.
|
|
44
|
+
|
|
45
|
+
## Tools
|
|
46
|
+
|
|
47
|
+
Read: `rappi_search_stores`, `rappi_search_products`, `rappi_get_cart`, `rappi_list_addresses`, `rappi_list_orders`, `rappi_get_order`, `rappi_connection_status`, `rappi_capabilities`, `rappi_privacy_audit`.
|
|
48
|
+
|
|
49
|
+
Gated cart: `rappi_add_to_cart`, `rappi_update_cart_item`, `rappi_clear_cart`.
|
|
50
|
+
|
|
51
|
+
Gated pay: `rappi_place_order`, `rappi_set_payment_method`.
|
|
52
|
+
|
|
53
|
+
Intent-only: `rappi_logout`, `rappi_set_active_address`.
|
|
54
|
+
|
|
55
|
+
## Tests
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm test
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
No live Rappi session is required. Gates and redaction run against shipped handlers and stdio smoke.
|
|
62
|
+
|
|
63
|
+
## Env
|
|
64
|
+
|
|
65
|
+
| Name | Default |
|
|
66
|
+
| --- | --- |
|
|
67
|
+
| `RAPPI_COUNTRY` | `BR` |
|
|
68
|
+
| `RAPPI_API_BASE` | `https://services.rappi.com.br` |
|
|
69
|
+
| `RAPPI_TOKEN_PATH` | `~/.rappi-mcp/tokens.json` |
|
|
70
|
+
| `RAPPI_PRIVACY_MODE` | `structured` |
|
|
71
|
+
| `RAPPI_ALLOW_MUTATIONS` | unset / false |
|
|
72
|
+
| `RAPPI_LAT` / `RAPPI_LNG` | optional nearby search |
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Reporting
|
|
4
|
+
|
|
5
|
+
Report vulnerabilities privately. Never paste Rappi tokens, addresses, phone numbers, card last-four, or order dumps in public issues.
|
|
6
|
+
|
|
7
|
+
## Data this server may touch
|
|
8
|
+
|
|
9
|
+
- Personal Rappi access token in `RAPPI_ACCESS_TOKEN` or `~/.rappi-mcp/tokens.json` (0600).
|
|
10
|
+
- Cart, saved addresses, payment-method metadata, and order history from the unofficial consumer surface.
|
|
11
|
+
|
|
12
|
+
## Fail-closed money rules
|
|
13
|
+
|
|
14
|
+
- Default is read-only. Checkout does **not** run.
|
|
15
|
+
- `rappi_place_order` and `rappi_set_payment_method` require **both** `RAPPI_ALLOW_MUTATIONS=true` and `explicit_user_intent=true`.
|
|
16
|
+
- Cart writes require the same two gates.
|
|
17
|
+
- Logout and address selection require `explicit_user_intent` only.
|
|
18
|
+
- Guest tokens cannot place orders or change payment methods.
|
|
19
|
+
- Default privacy mode redacts street, phone, email, and last-four.
|
|
20
|
+
|
|
21
|
+
## Local hardening
|
|
22
|
+
|
|
23
|
+
- Store tokens on a trusted machine only, outside iCloud/Dropbox.
|
|
24
|
+
- Do not put `RAPPI_ACCESS_TOKEN` in a committed MCP config; prefer `rappi-mcp-unofficial auth --token`.
|
|
25
|
+
- Keep `RAPPI_ALLOW_MUTATIONS` unset unless you intentionally want an agent to be able to charge you.
|
|
26
|
+
- The npm tarball does not include `~/.rappi-mcp`, `.env`, or fixtures with live credentials.
|
|
27
|
+
|
|
28
|
+
## Unofficial surface
|
|
29
|
+
|
|
30
|
+
Rappi does not publish a consumer cart API. This package talks to the same undocumented web/app endpoints (`services.rappi.com.br` by default). They can change without notice. This is **not** the Rappi Partners restaurant OAuth API.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function runCliCommand(args: string[]): Promise<number | undefined>;
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
import { SERVER_VERSION } from "../constants.js";
|
|
4
|
+
import { peekConfig } from "../services/config.js";
|
|
5
|
+
import { buildConnectionStatus } from "../services/connection-status.js";
|
|
6
|
+
import { TokenStore } from "../services/token-store.js";
|
|
7
|
+
export async function runCliCommand(args) {
|
|
8
|
+
const [command, ...rest] = args;
|
|
9
|
+
if (!command || command === "--http")
|
|
10
|
+
return undefined;
|
|
11
|
+
if (command === "setup")
|
|
12
|
+
return runSetup(rest);
|
|
13
|
+
if (command === "auth" || command === "login")
|
|
14
|
+
return runAuth(rest);
|
|
15
|
+
if (command === "doctor" || command === "status")
|
|
16
|
+
return runDoctor(rest);
|
|
17
|
+
if (command === "version" || command === "--version" || command === "-v") {
|
|
18
|
+
console.log(SERVER_VERSION);
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
if (command === "help" || command === "--help" || command === "-h") {
|
|
22
|
+
printHelp();
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
if (!command.startsWith("--")) {
|
|
26
|
+
console.error(`Unknown command: ${command}`);
|
|
27
|
+
printHelp();
|
|
28
|
+
return 1;
|
|
29
|
+
}
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
async function runSetup(args) {
|
|
33
|
+
const allow = args.includes("--allow-mutations");
|
|
34
|
+
const config = peekConfig();
|
|
35
|
+
mkdirSync(dirname(config.configPath), { recursive: true, mode: 0o700 });
|
|
36
|
+
writeFileSync(config.configPath, JSON.stringify({
|
|
37
|
+
unofficial: true,
|
|
38
|
+
country: config.country,
|
|
39
|
+
api_base: config.apiBase,
|
|
40
|
+
allow_mutations: allow,
|
|
41
|
+
never_pays_by_default: !allow
|
|
42
|
+
}, null, 2), { mode: 0o600 });
|
|
43
|
+
console.log(`Wrote ${config.configPath} (0600). Mutations ${allow ? "ENABLED — you can be charged" : "disabled (default)"}.`);
|
|
44
|
+
console.log("Next: rappi-mcp-unofficial auth --token <personal-access-token>");
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
async function runAuth(args) {
|
|
48
|
+
const idx = args.indexOf("--token");
|
|
49
|
+
const token = idx >= 0 ? args[idx + 1] : process.env.RAPPI_ACCESS_TOKEN;
|
|
50
|
+
if (!token || token.startsWith("--")) {
|
|
51
|
+
console.error("Pass --token <access_token> or set RAPPI_ACCESS_TOKEN. Do not paste tokens into git.");
|
|
52
|
+
return 1;
|
|
53
|
+
}
|
|
54
|
+
const config = peekConfig();
|
|
55
|
+
const store = new TokenStore(config.tokenPath);
|
|
56
|
+
await store.write({ access_token: token, source: "user", token_type: "Bearer" });
|
|
57
|
+
console.log(`Stored personal token at ${config.tokenPath} (0600).`);
|
|
58
|
+
return 0;
|
|
59
|
+
}
|
|
60
|
+
async function runDoctor(args) {
|
|
61
|
+
const status = await buildConnectionStatus();
|
|
62
|
+
if (args.includes("--json")) {
|
|
63
|
+
console.log(JSON.stringify(status, null, 2));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.log(`Rappi MCP · Doctor ${status.ok ? "READY" : "NEEDS AUTH"}`);
|
|
67
|
+
console.log(`Unofficial: yes Mutations: ${status.mutations_enabled} Privacy: ${status.privacy_mode}`);
|
|
68
|
+
console.log(`Token file: ${status.token.path} exists=${status.token.exists}`);
|
|
69
|
+
if (status.missing_env.length)
|
|
70
|
+
console.log(`Missing: ${status.missing_env.join(", ")}`);
|
|
71
|
+
for (const step of status.next_steps)
|
|
72
|
+
console.log(`- ${step}`);
|
|
73
|
+
}
|
|
74
|
+
return args.includes("--strict") && !status.ok ? 1 : 0;
|
|
75
|
+
}
|
|
76
|
+
function printHelp() {
|
|
77
|
+
console.log(`rappi-mcp-unofficial ${SERVER_VERSION}
|
|
78
|
+
Unofficial local-first Rappi MCP. Never pays unless RAPPI_ALLOW_MUTATIONS and explicit_user_intent.
|
|
79
|
+
|
|
80
|
+
Commands:
|
|
81
|
+
setup [--allow-mutations] write ~/.rappi-mcp/config.json (0600)
|
|
82
|
+
auth --token <token> store personal access token (0600)
|
|
83
|
+
doctor [--json] [--strict]
|
|
84
|
+
version
|
|
85
|
+
|
|
86
|
+
Default transport: stdio. Optional: --http (loopback only).`);
|
|
87
|
+
}
|
|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CAAC,GAAG,CAAC,YAAY,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACxF,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,UAAU;YAAE,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,SAAS;IAChB,OAAO,CAAC,GAAG,CAAC,wBAAwB,cAAc;;;;;;;;;4DASQ,CAAC,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const SERVER_NAME = "rappi-mcp-server";
|
|
2
|
+
export declare const SERVER_VERSION = "0.1.0";
|
|
3
|
+
export declare const NPM_PACKAGE_NAME = "rappi-mcp-unofficial";
|
|
4
|
+
export declare const PINNED_NPM_PACKAGE = "rappi-mcp-unofficial@0.1.0";
|
|
5
|
+
/** Default Brazil consumer surface. Override with RAPPI_API_BASE. Unofficial / unstable. */
|
|
6
|
+
export declare const DEFAULT_API_BASE = "https://services.rappi.com.br";
|
|
7
|
+
export declare const COUNTRY_BASES: Record<string, string>;
|
|
8
|
+
/** Unofficial consumer paths (web/app). Not Rappi Partners restaurant OAuth. */
|
|
9
|
+
export declare const PATHS: {
|
|
10
|
+
readonly guest: "/api/rocket/v2/guest";
|
|
11
|
+
readonly search: "/api/ms/web-proxy/dynamic-list/cpgs/";
|
|
12
|
+
readonly stores: "/api/ms/web-home/v1/home";
|
|
13
|
+
readonly products: "/api/ms/search-proxy/search";
|
|
14
|
+
readonly cart: "/api/ms/cart/v1/carts/current";
|
|
15
|
+
readonly cartProducts: "/api/ms/cart/v1/carts/current/products";
|
|
16
|
+
readonly addresses: "/api/ms/user-addresses";
|
|
17
|
+
readonly orders: "/api/ms/user-orders";
|
|
18
|
+
readonly checkout: "/api/ms/checkout/v1/orders";
|
|
19
|
+
readonly paymentMethods: "/api/ms/payments/v1/payment-methods";
|
|
20
|
+
};
|
|
21
|
+
export declare const DEFAULT_USER_AGENT = "rappi-mcp-server/0.1.0";
|
|
22
|
+
export declare const REQUEST_TIMEOUT_MS = 20000;
|
|
23
|
+
export declare const TOKEN_DIR_NAME = ".rappi-mcp";
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
export const SERVER_NAME = "rappi-mcp-server";
|
|
2
|
+
export const SERVER_VERSION = "0.1.0";
|
|
3
|
+
export const NPM_PACKAGE_NAME = "rappi-mcp-unofficial";
|
|
4
|
+
export const PINNED_NPM_PACKAGE = `${NPM_PACKAGE_NAME}@${SERVER_VERSION}`;
|
|
5
|
+
/** Default Brazil consumer surface. Override with RAPPI_API_BASE. Unofficial / unstable. */
|
|
6
|
+
export const DEFAULT_API_BASE = "https://services.rappi.com.br";
|
|
7
|
+
export const COUNTRY_BASES = {
|
|
8
|
+
BR: "https://services.rappi.com.br",
|
|
9
|
+
CO: "https://services.rappi.com",
|
|
10
|
+
MX: "https://services.mxgrability.rappi.com",
|
|
11
|
+
AR: "https://services.rappi.com.ar",
|
|
12
|
+
CL: "https://services.rappi.cl",
|
|
13
|
+
PE: "https://services.rappi.pe",
|
|
14
|
+
UY: "https://services.rappi.com.uy",
|
|
15
|
+
EC: "https://services.rappi.com.ec",
|
|
16
|
+
CR: "https://services.rappi.co.cr"
|
|
17
|
+
};
|
|
18
|
+
/** Unofficial consumer paths (web/app). Not Rappi Partners restaurant OAuth. */
|
|
19
|
+
export const PATHS = {
|
|
20
|
+
guest: "/api/rocket/v2/guest",
|
|
21
|
+
search: "/api/ms/web-proxy/dynamic-list/cpgs/",
|
|
22
|
+
stores: "/api/ms/web-home/v1/home",
|
|
23
|
+
products: "/api/ms/search-proxy/search",
|
|
24
|
+
cart: "/api/ms/cart/v1/carts/current",
|
|
25
|
+
cartProducts: "/api/ms/cart/v1/carts/current/products",
|
|
26
|
+
addresses: "/api/ms/user-addresses",
|
|
27
|
+
orders: "/api/ms/user-orders",
|
|
28
|
+
checkout: "/api/ms/checkout/v1/orders",
|
|
29
|
+
paymentMethods: "/api/ms/payments/v1/payment-methods"
|
|
30
|
+
};
|
|
31
|
+
export const DEFAULT_USER_AGENT = `${SERVER_NAME}/${SERVER_VERSION}`;
|
|
32
|
+
export const REQUEST_TIMEOUT_MS = 20_000;
|
|
33
|
+
export const TOKEN_DIR_NAME = ".rappi-mcp";
|
|
34
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,kBAAkB,CAAC;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,OAAO,CAAC;AACtC,MAAM,CAAC,MAAM,gBAAgB,GAAG,sBAAsB,CAAC;AACvD,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,gBAAgB,IAAI,cAAc,EAAE,CAAC;AAE1E,4FAA4F;AAC5F,MAAM,CAAC,MAAM,gBAAgB,GAAG,+BAA+B,CAAC;AAEhE,MAAM,CAAC,MAAM,aAAa,GAA2B;IACnD,EAAE,EAAE,+BAA+B;IACnC,EAAE,EAAE,4BAA4B;IAChC,EAAE,EAAE,wCAAwC;IAC5C,EAAE,EAAE,+BAA+B;IACnC,EAAE,EAAE,2BAA2B;IAC/B,EAAE,EAAE,2BAA2B;IAC/B,EAAE,EAAE,+BAA+B;IACnC,EAAE,EAAE,+BAA+B;IACnC,EAAE,EAAE,8BAA8B;CACnC,CAAC;AAEF,gFAAgF;AAChF,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,KAAK,EAAE,sBAAsB;IAC7B,MAAM,EAAE,sCAAsC;IAC9C,MAAM,EAAE,0BAA0B;IAClC,QAAQ,EAAE,6BAA6B;IACvC,IAAI,EAAE,+BAA+B;IACrC,YAAY,EAAE,wCAAwC;IACtD,SAAS,EAAE,wBAAwB;IACnC,MAAM,EAAE,qBAAqB;IAC7B,QAAQ,EAAE,4BAA4B;IACtC,cAAc,EAAE,qCAAqC;CAC7C,CAAC;AAEX,MAAM,CAAC,MAAM,kBAAkB,GAAG,GAAG,WAAW,IAAI,cAAc,EAAE,CAAC;AACrE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACzC,MAAM,CAAC,MAAM,cAAc,GAAG,YAAY,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { createServer as createHttpServer } from "node:http";
|
|
3
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
4
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
5
|
+
import { StreamableHTTPServerTransport } from "@modelcontextprotocol/sdk/server/streamableHttp.js";
|
|
6
|
+
import { SERVER_NAME, SERVER_VERSION } from "./constants.js";
|
|
7
|
+
import { runCliCommand } from "./cli/commands.js";
|
|
8
|
+
import { registerRappiTools } from "./tools/rappi-tools.js";
|
|
9
|
+
export function createServer() {
|
|
10
|
+
const server = new McpServer({
|
|
11
|
+
name: SERVER_NAME,
|
|
12
|
+
version: SERVER_VERSION
|
|
13
|
+
});
|
|
14
|
+
registerRappiTools(server);
|
|
15
|
+
return server;
|
|
16
|
+
}
|
|
17
|
+
async function runStdio() {
|
|
18
|
+
const server = createServer();
|
|
19
|
+
const transport = new StdioServerTransport();
|
|
20
|
+
await server.connect(transport);
|
|
21
|
+
}
|
|
22
|
+
async function runHttp() {
|
|
23
|
+
const host = process.env.RAPPI_MCP_HOST ?? "127.0.0.1";
|
|
24
|
+
const port = Number(process.env.RAPPI_MCP_PORT ?? 3000);
|
|
25
|
+
const http = createHttpServer(async (req, res) => {
|
|
26
|
+
if (req.method === "GET" && req.url === "/health") {
|
|
27
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
28
|
+
res.end(JSON.stringify({ ok: true, name: SERVER_NAME, version: SERVER_VERSION }));
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (req.method !== "POST" || req.url !== "/mcp") {
|
|
32
|
+
res.writeHead(404);
|
|
33
|
+
res.end();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const chunks = [];
|
|
37
|
+
for await (const chunk of req)
|
|
38
|
+
chunks.push(chunk);
|
|
39
|
+
const body = JSON.parse(Buffer.concat(chunks).toString("utf8") || "{}");
|
|
40
|
+
const server = createServer();
|
|
41
|
+
const transport = new StreamableHTTPServerTransport({
|
|
42
|
+
sessionIdGenerator: undefined,
|
|
43
|
+
enableJsonResponse: true
|
|
44
|
+
});
|
|
45
|
+
res.on("close", () => {
|
|
46
|
+
transport.close().catch(() => undefined);
|
|
47
|
+
server.close().catch(() => undefined);
|
|
48
|
+
});
|
|
49
|
+
try {
|
|
50
|
+
await server.connect(transport);
|
|
51
|
+
await transport.handleRequest(req, res, body);
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
if (!res.headersSent) {
|
|
55
|
+
res.writeHead(500, { "content-type": "application/json" });
|
|
56
|
+
res.end(JSON.stringify({ jsonrpc: "2.0", error: { code: -32603, message: "Internal server error" }, id: null }));
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
http.listen(port, host, () => {
|
|
61
|
+
console.error(`${SERVER_NAME} HTTP transport listening on http://${host}:${port}/mcp`);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
const args = new Set(process.argv.slice(2));
|
|
65
|
+
let cliResult;
|
|
66
|
+
try {
|
|
67
|
+
cliResult = await runCliCommand(process.argv.slice(2));
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
console.error(`Error: ${error.message}`);
|
|
71
|
+
process.exitCode = 1;
|
|
72
|
+
}
|
|
73
|
+
if (cliResult !== undefined) {
|
|
74
|
+
process.exitCode = cliResult;
|
|
75
|
+
}
|
|
76
|
+
else if (process.exitCode === undefined) {
|
|
77
|
+
const transport = process.env.RAPPI_MCP_TRANSPORT ?? (args.has("--http") ? "http" : "stdio");
|
|
78
|
+
if (transport === "http") {
|
|
79
|
+
await runHttp();
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
await runStdio();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,YAAY,IAAI,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,6BAA6B,EAAE,MAAM,oDAAoD,CAAC;AACnG,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAE5D,MAAM,UAAU,YAAY;IAC1B,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,cAAc;KACxB,CAAC,CAAC;IACH,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,KAAK,UAAU,QAAQ;IACrB,MAAM,MAAM,GAAG,YAAY,EAAE,CAAC;IAC9B,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,KAAK,UAAU,OAAO;IACpB,MAAM,IA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AAAC,OAAO,KAAK,EAAE,CAAC;IACf,OAAO,CAAC,KAAK,CAAC,UAAW,KAAe,CAAC,OAAO,EAAE,CAAC,CAAC;IACpD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;IAC5B,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC;AAC/B,CAAC;KAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;IAC1C,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC7F,IAAI,SAAS,KAAK,MAAM,EAAE,CAAC;QACzB,MAAM,OAAO,EAAE,CAAC;IAClB,CAAC;SAAM,CAAC;QACN,MAAM,QAAQ,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const ResponseFormatSchema: z.ZodDefault<z.ZodEnum<{
|
|
3
|
+
markdown: "markdown";
|
|
4
|
+
json: "json";
|
|
5
|
+
}>>;
|
|
6
|
+
export declare const PrivacyModeSchema: z.ZodOptional<z.ZodEnum<{
|
|
7
|
+
summary: "summary";
|
|
8
|
+
structured: "structured";
|
|
9
|
+
raw: "raw";
|
|
10
|
+
}>>;
|
|
11
|
+
export declare const ResponseOnlyInputSchema: z.ZodObject<{
|
|
12
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
13
|
+
markdown: "markdown";
|
|
14
|
+
json: "json";
|
|
15
|
+
}>>;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
export declare const ReadInputSchema: z.ZodObject<{
|
|
18
|
+
privacy_mode: z.ZodOptional<z.ZodEnum<{
|
|
19
|
+
summary: "summary";
|
|
20
|
+
structured: "structured";
|
|
21
|
+
raw: "raw";
|
|
22
|
+
}>>;
|
|
23
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
24
|
+
markdown: "markdown";
|
|
25
|
+
json: "json";
|
|
26
|
+
}>>;
|
|
27
|
+
}, z.core.$strict>;
|
|
28
|
+
export declare const SearchInputSchema: z.ZodObject<{
|
|
29
|
+
query: z.ZodOptional<z.ZodString>;
|
|
30
|
+
latitude: z.ZodOptional<z.ZodNumber>;
|
|
31
|
+
longitude: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
33
|
+
privacy_mode: z.ZodOptional<z.ZodEnum<{
|
|
34
|
+
summary: "summary";
|
|
35
|
+
structured: "structured";
|
|
36
|
+
raw: "raw";
|
|
37
|
+
}>>;
|
|
38
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
39
|
+
markdown: "markdown";
|
|
40
|
+
json: "json";
|
|
41
|
+
}>>;
|
|
42
|
+
}, z.core.$strict>;
|
|
43
|
+
export declare const OrderIdInputSchema: z.ZodObject<{
|
|
44
|
+
order_id: z.ZodString;
|
|
45
|
+
privacy_mode: z.ZodOptional<z.ZodEnum<{
|
|
46
|
+
summary: "summary";
|
|
47
|
+
structured: "structured";
|
|
48
|
+
raw: "raw";
|
|
49
|
+
}>>;
|
|
50
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
51
|
+
markdown: "markdown";
|
|
52
|
+
json: "json";
|
|
53
|
+
}>>;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
export declare const LogoutInputSchema: z.ZodObject<{
|
|
56
|
+
explicit_user_intent: z.ZodDefault<z.ZodBoolean>;
|
|
57
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
58
|
+
markdown: "markdown";
|
|
59
|
+
json: "json";
|
|
60
|
+
}>>;
|
|
61
|
+
}, z.core.$strict>;
|
|
62
|
+
export declare const CartWriteInputSchema: z.ZodObject<{
|
|
63
|
+
product_id: z.ZodString;
|
|
64
|
+
store_id: z.ZodOptional<z.ZodString>;
|
|
65
|
+
quantity: z.ZodDefault<z.ZodNumber>;
|
|
66
|
+
explicit_user_intent: z.ZodDefault<z.ZodBoolean>;
|
|
67
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
68
|
+
markdown: "markdown";
|
|
69
|
+
json: "json";
|
|
70
|
+
}>>;
|
|
71
|
+
}, z.core.$strict>;
|
|
72
|
+
export declare const ClearCartInputSchema: z.ZodObject<{
|
|
73
|
+
explicit_user_intent: z.ZodDefault<z.ZodBoolean>;
|
|
74
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
75
|
+
markdown: "markdown";
|
|
76
|
+
json: "json";
|
|
77
|
+
}>>;
|
|
78
|
+
}, z.core.$strict>;
|
|
79
|
+
export declare const AddressWriteInputSchema: z.ZodObject<{
|
|
80
|
+
address_id: z.ZodString;
|
|
81
|
+
explicit_user_intent: z.ZodDefault<z.ZodBoolean>;
|
|
82
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
83
|
+
markdown: "markdown";
|
|
84
|
+
json: "json";
|
|
85
|
+
}>>;
|
|
86
|
+
}, z.core.$strict>;
|
|
87
|
+
export declare const PaymentWriteInputSchema: z.ZodObject<{
|
|
88
|
+
payment_method_id: z.ZodString;
|
|
89
|
+
explicit_user_intent: z.ZodDefault<z.ZodBoolean>;
|
|
90
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
91
|
+
markdown: "markdown";
|
|
92
|
+
json: "json";
|
|
93
|
+
}>>;
|
|
94
|
+
}, z.core.$strict>;
|
|
95
|
+
export declare const PlaceOrderInputSchema: z.ZodObject<{
|
|
96
|
+
address_id: z.ZodString;
|
|
97
|
+
payment_method_id: z.ZodString;
|
|
98
|
+
store_id: z.ZodOptional<z.ZodString>;
|
|
99
|
+
notes: z.ZodOptional<z.ZodString>;
|
|
100
|
+
explicit_user_intent: z.ZodDefault<z.ZodBoolean>;
|
|
101
|
+
response_format: z.ZodDefault<z.ZodEnum<{
|
|
102
|
+
markdown: "markdown";
|
|
103
|
+
json: "json";
|
|
104
|
+
}>>;
|
|
105
|
+
}, z.core.$strict>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const ResponseFormatSchema = z.enum(["markdown", "json"]).default("markdown");
|
|
3
|
+
export const PrivacyModeSchema = z.enum(["summary", "structured", "raw"]).optional();
|
|
4
|
+
const Intent = z
|
|
5
|
+
.boolean()
|
|
6
|
+
.default(false)
|
|
7
|
+
.describe("Must be true after the user explicitly asked for this write.");
|
|
8
|
+
export const ResponseOnlyInputSchema = z.object({
|
|
9
|
+
response_format: ResponseFormatSchema
|
|
10
|
+
}).strict();
|
|
11
|
+
export const ReadInputSchema = z.object({
|
|
12
|
+
privacy_mode: PrivacyModeSchema,
|
|
13
|
+
response_format: ResponseFormatSchema
|
|
14
|
+
}).strict();
|
|
15
|
+
export const SearchInputSchema = z.object({
|
|
16
|
+
query: z.string().max(200).optional(),
|
|
17
|
+
latitude: z.number().optional(),
|
|
18
|
+
longitude: z.number().optional(),
|
|
19
|
+
limit: z.number().int().min(1).max(50).optional(),
|
|
20
|
+
privacy_mode: PrivacyModeSchema,
|
|
21
|
+
response_format: ResponseFormatSchema
|
|
22
|
+
}).strict();
|
|
23
|
+
export const OrderIdInputSchema = z.object({
|
|
24
|
+
order_id: z.string().min(1),
|
|
25
|
+
privacy_mode: PrivacyModeSchema,
|
|
26
|
+
response_format: ResponseFormatSchema
|
|
27
|
+
}).strict();
|
|
28
|
+
export const LogoutInputSchema = z.object({
|
|
29
|
+
explicit_user_intent: Intent,
|
|
30
|
+
response_format: ResponseFormatSchema
|
|
31
|
+
}).strict();
|
|
32
|
+
export const CartWriteInputSchema = z.object({
|
|
33
|
+
product_id: z.string().min(1),
|
|
34
|
+
store_id: z.string().min(1).optional(),
|
|
35
|
+
quantity: z.number().int().min(1).max(99).default(1),
|
|
36
|
+
explicit_user_intent: Intent,
|
|
37
|
+
response_format: ResponseFormatSchema
|
|
38
|
+
}).strict();
|
|
39
|
+
export const ClearCartInputSchema = z.object({
|
|
40
|
+
explicit_user_intent: Intent,
|
|
41
|
+
response_format: ResponseFormatSchema
|
|
42
|
+
}).strict();
|
|
43
|
+
export const AddressWriteInputSchema = z.object({
|
|
44
|
+
address_id: z.string().min(1),
|
|
45
|
+
explicit_user_intent: Intent,
|
|
46
|
+
response_format: ResponseFormatSchema
|
|
47
|
+
}).strict();
|
|
48
|
+
export const PaymentWriteInputSchema = z.object({
|
|
49
|
+
payment_method_id: z.string().min(1),
|
|
50
|
+
explicit_user_intent: Intent,
|
|
51
|
+
response_format: ResponseFormatSchema
|
|
52
|
+
}).strict();
|
|
53
|
+
export const PlaceOrderInputSchema = z.object({
|
|
54
|
+
address_id: z.string().min(1),
|
|
55
|
+
payment_method_id: z.string().min(1),
|
|
56
|
+
store_id: z.string().min(1).optional(),
|
|
57
|
+
notes: z.string().max(280).optional(),
|
|
58
|
+
explicit_user_intent: Intent,
|
|
59
|
+
response_format: ResponseFormatSchema
|
|
60
|
+
}).strict();
|
|
61
|
+
//# sourceMappingURL=common.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/schemas/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;AACrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,YAAY,EAAE,KAAK,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;AAErF,MAAM,MAAM,GAAG,CAAC;KACb,OAAO,EAAE;KACT,OAAO,CAAC,KAAK,CAAC;KACd,QAAQ,CAAC,8DAA8D,CAAC,CA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AAC,CAAC;IACpC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE;IACtC,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACrC,oBAAoB,EAAE,MAAM;IAC5B,eAAe,EAAE,oBAAoB;CACtC,CAAC,CAAC,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function buildPrivacyAudit(): {
|
|
2
|
+
unofficial: true;
|
|
3
|
+
privacy_mode: import("../types.js").PrivacyMode;
|
|
4
|
+
mutations_enabled: boolean;
|
|
5
|
+
secret_env_vars: string[];
|
|
6
|
+
token_path: string;
|
|
7
|
+
redacts_by_default: string[];
|
|
8
|
+
tarball_excludes: string[];
|
|
9
|
+
never_pays_by_default: boolean;
|
|
10
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { peekConfig } from "./config.js";
|
|
2
|
+
export function buildPrivacyAudit() {
|
|
3
|
+
const config = peekConfig();
|
|
4
|
+
return {
|
|
5
|
+
unofficial: true,
|
|
6
|
+
privacy_mode: config.privacyMode,
|
|
7
|
+
mutations_enabled: config.allowMutations,
|
|
8
|
+
secret_env_vars: ["RAPPI_ACCESS_TOKEN"],
|
|
9
|
+
token_path: config.tokenPath,
|
|
10
|
+
redacts_by_default: ["street", "address", "phone", "email", "last_four"],
|
|
11
|
+
tarball_excludes: [".rappi-mcp/", ".env", "tokens.json"],
|
|
12
|
+
never_pays_by_default: true
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=audit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audit.js","sourceRoot":"","sources":["../../src/services/audit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC,MAAM,UAAU,iBAAiB;IAC/B,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAC5B,OAAO;QACL,UAAU,EAAE,IAAa;QACzB,YAAY,EAAE,MAAM,CAAC,WAAW;QAChC,iBAAiB,EAAE,MAAM,CAAC,cAAc;QACxC,eAAe,EAAE,CAAC,oBAAoB,CAAC;QACvC,UAAU,EAAE,MAAM,CAAC,SAAS;QAC5B,kBAAkB,EAAE,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC;QACxE,gBAAgB,EAAE,CAAC,aAAa,EAAE,MAAM,EAAE,aAAa,CAAC;QACxD,qBAAqB,EAAE,IAAI;KAC5B,CAAC;AACJ,CAAC"}
|