@layers/amba-mcp 1.0.1 → 4.0.2
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/README.md +17 -19
- package/dist/api-client.d.ts +42 -4
- package/dist/categories.d.ts +48 -0
- package/dist/expo-build-prompt.js +641 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4443 -718
- package/dist/lib/aliases.d.ts +36 -0
- package/dist/lib/tool-result.d.ts +51 -0
- package/dist/lib/with-pat.d.ts +125 -0
- package/dist/resources/amba-setup-economy.d.ts +14 -0
- package/dist/resources/amba-setup-engagement.d.ts +16 -0
- package/dist/resources/amba-setup-gamification.d.ts +15 -0
- package/dist/resources/amba-setup-identity.d.ts +20 -0
- package/dist/resources/amba-setup-infrastructure.d.ts +18 -0
- package/dist/resources/amba-setup-social.d.ts +15 -0
- package/dist/resources/amba-setup.d.ts +56 -0
- package/dist/resources/expo-build-prompt.d.ts +35 -0
- package/dist/resources/index.d.ts +108 -0
- package/dist/resources/prompts.d.ts +13 -0
- package/dist/resources/prompts.js +2 -0
- package/dist/tools/__test-fixtures__/rename-map.d.ts +19 -0
- package/dist/tools/_pat.d.ts +64 -0
- package/dist/tools/ai-prompts-admin.d.ts +35 -0
- package/dist/tools/auth.d.ts +32 -9
- package/dist/tools/billing.d.ts +29 -0
- package/dist/tools/collections.d.ts +37 -0
- package/dist/tools/functions.d.ts +34 -0
- package/dist/tools/invites.d.ts +21 -0
- package/dist/tools/secrets.d.ts +31 -0
- package/dist/tools/setup.d.ts +1 -1
- package/dist/tools/sites.d.ts +37 -0
- package/package.json +10 -4
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-deployment MCP tools (#38).
|
|
3
|
+
*
|
|
4
|
+
* Surfaces every operation `amba functions ...` exposes through the CLI:
|
|
5
|
+
* deploy a bundled script, list deployments, describe one, delete a
|
|
6
|
+
* function (cascade), and full schedule lifecycle (create, pause,
|
|
7
|
+
* resume, trigger now). Logs read is the last operation in the set —
|
|
8
|
+
* Workers Logpush events for a single function over a bounded time
|
|
9
|
+
* range.
|
|
10
|
+
*
|
|
11
|
+
* Wire details:
|
|
12
|
+
* - All routes mount under `/projects/:projectId/functions/*` on the
|
|
13
|
+
* admin API. The `ApiClient` base already includes `/admin`. Every
|
|
14
|
+
* interpolation goes through `encodeURIComponent` so a malformed
|
|
15
|
+
* `project_id`, function `name`, etc. cannot escape the path
|
|
16
|
+
* segment.
|
|
17
|
+
* - `amba_functions_deploy` hits the server-side dispatch upload
|
|
18
|
+
* route (`POST /functions/deploy`, multipart). The CLI used to
|
|
19
|
+
* POST direct to the CDN with the customer's API token; the
|
|
20
|
+
* server-side route landed in UNBURY-10 / S-301 so amba owns the
|
|
21
|
+
* upstream credential. Same upload here from MCP. Client-side
|
|
22
|
+
* bundle size guard mirrors the API's 10 MiB cap to fail fast
|
|
23
|
+
* instead of wasting an upload.
|
|
24
|
+
* - `amba_functions_delete` requires `?confirm=<name>` per the API's
|
|
25
|
+
* guard against typo'd deletes. The tool sets it automatically
|
|
26
|
+
* from the validated input.
|
|
27
|
+
*
|
|
28
|
+
* Authentication: every tool accepts an optional inline `pat` arg.
|
|
29
|
+
* Resolution order is `args.pat ?? inbound-Authorization-Bearer`
|
|
30
|
+
* (see `_pat.ts`).
|
|
31
|
+
*/
|
|
32
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
33
|
+
import type { ApiClient } from '../api-client.js';
|
|
34
|
+
export declare function registerTools(server: McpServer, apiClient: ApiClient): void;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project membership + invite tools — agentic collaboration.
|
|
3
|
+
*
|
|
4
|
+
* Per the wave-2 schema (`infra/neon/control/027_project_billing.sql`),
|
|
5
|
+
* a project is owned by one developer (the existing `projects.developer_id`
|
|
6
|
+
* column) but can have additional members invited by email. Roles:
|
|
7
|
+
*
|
|
8
|
+
* - admin: manage members + integrations
|
|
9
|
+
* - member: write data
|
|
10
|
+
* - viewer: read-only
|
|
11
|
+
*
|
|
12
|
+
* Owners cannot be removed; transfer ownership first (transfer-owner tool
|
|
13
|
+
* not yet implemented). Members can remove themselves.
|
|
14
|
+
*
|
|
15
|
+
* The REST endpoints these tools call are shipped by W2-C in parallel
|
|
16
|
+
* (`/v1/admin/projects/:id/invites`, `.../members`, `.../members/:dev_id`).
|
|
17
|
+
* If those aren't live yet, calls surface as 404 via `AmbaApiError`.
|
|
18
|
+
*/
|
|
19
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
20
|
+
import type { ApiClient } from '../api-client.js';
|
|
21
|
+
export declare function registerTools(server: McpServer, apiClient: ApiClient): void;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Function-secret MCP tools (#38).
|
|
3
|
+
*
|
|
4
|
+
* Wraps the customer-function secrets proxy (UNBURY-10 / S-401). Every
|
|
5
|
+
* secret is scoped to a single function — the API enforces this with
|
|
6
|
+
* the `function` field on POST and the `?function=` query param on
|
|
7
|
+
* DELETE. The previous customer-shoes dogfood hit
|
|
8
|
+
* `INVALID_FUNCTION: function must match …` because the CLI initially
|
|
9
|
+
* didn't pass `function`; this tool surfaces the constraint clearly in
|
|
10
|
+
* the description + makes the `function` arg required.
|
|
11
|
+
*
|
|
12
|
+
* Naming:
|
|
13
|
+
* - Secret name: /^[A-Z][A-Z0-9_]{0,62}$/ (uppercase env-var shape).
|
|
14
|
+
* - Function name: /^[a-z][a-z0-9_-]{0,57}$/ (matches the function
|
|
15
|
+
* deploy validator one-for-one).
|
|
16
|
+
*
|
|
17
|
+
* Reserved binding names (AMBA_INTERNAL_TOKEN, EDGE_HEADER_SIGNING_SECRET,
|
|
18
|
+
* STORAGE, EDGE_DB_PROXY, AMBA_API_URL, AMBA_AI_GATEWAY_URL,
|
|
19
|
+
* AMBA_PROJECT_ID) are blocked at the API layer — the proxy returns
|
|
20
|
+
* 400 RESERVED_BINDING. Don't try to shadow them.
|
|
21
|
+
*
|
|
22
|
+
* Plaintext values are NEVER returned. `amba_secrets_list` returns
|
|
23
|
+
* name + version + sync_status (pending/syncing/synced/failed) only.
|
|
24
|
+
*
|
|
25
|
+
* Authentication: every tool accepts an optional inline `pat` arg via the
|
|
26
|
+
* `registerTool` helper in `../lib/with-pat.ts`. Resolution: `args.pat ??
|
|
27
|
+
* inbound-Authorization-Bearer`, with `MISSING_PAT` short-circuit if neither.
|
|
28
|
+
*/
|
|
29
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
30
|
+
import type { ApiClient } from '../api-client.js';
|
|
31
|
+
export declare function registerTools(server: McpServer, apiClient: ApiClient): void;
|
package/dist/tools/setup.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
2
|
import type { ApiClient } from '../api-client.js';
|
|
3
|
-
export declare function registerTools(server: McpServer,
|
|
3
|
+
export declare function registerTools(server: McpServer, apiClient: ApiClient): void;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Static-site MCP tools (#38).
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the CLI's `amba sites ...` surface so an agent can register a
|
|
5
|
+
* static site, deploy files, attach custom domains, and tear everything
|
|
6
|
+
* down — all through MCP, no human-in-loop.
|
|
7
|
+
*
|
|
8
|
+
* Wire details:
|
|
9
|
+
* - `amba_sites_deploy` is create-or-deploy in one shot: it POSTs `/sites`
|
|
10
|
+
* to mint the row (tolerating `ALREADY_EXISTS`), then POSTs the
|
|
11
|
+
* per-file multipart bundle to `/sites/:name/deployments`. The two-call
|
|
12
|
+
* pattern matches the CLI's flow exactly, just collapsed for agent
|
|
13
|
+
* ergonomics — one tool call, one canonical public URL out. The
|
|
14
|
+
* 409-tolerance branch is now driven by the upstream `error.code`
|
|
15
|
+
* (via `AmbaApiError`), not regex over the prose, so an unrelated
|
|
16
|
+
* 409 (e.g. quota) is NOT silently swallowed.
|
|
17
|
+
* - `amba_sites_add_domain` runs the upstream custom hostname
|
|
18
|
+
* registration server-side (Wave-3 / #100); customers no longer
|
|
19
|
+
* need a direct upstream API token client-side.
|
|
20
|
+
* - `amba_sites_remove_domain` is idempotent — a 404 from the API is
|
|
21
|
+
* treated as success (the row was already gone).
|
|
22
|
+
*
|
|
23
|
+
* Files: pass an object keyed by repo-relative path
|
|
24
|
+
* (e.g. {"index.html": "<!doctype html>...", "assets/main.css": "..."}).
|
|
25
|
+
* Each value is the file content as a string. Per-file cap is 25 MiB.
|
|
26
|
+
*
|
|
27
|
+
* Hostname inputs are lowercased at the tool boundary (HTTP semantics
|
|
28
|
+
* + matches the API's storage normalisation) so a customer typing
|
|
29
|
+
* "App.Example.com" doesn't end up with an unfindable binding.
|
|
30
|
+
*
|
|
31
|
+
* Authentication: every tool accepts an optional inline `pat` arg via the
|
|
32
|
+
* `registerTool` helper in `../lib/with-pat.ts`. Resolution: `args.pat ??
|
|
33
|
+
* inbound-Authorization-Bearer`, with `MISSING_PAT` short-circuit if neither.
|
|
34
|
+
*/
|
|
35
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
36
|
+
import type { ApiClient } from '../api-client.js';
|
|
37
|
+
export declare function registerTools(server: McpServer, apiClient: ApiClient): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layers/amba-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.2",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
".": {
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"import": "./dist/index.js"
|
|
15
|
+
},
|
|
16
|
+
"./prompts": {
|
|
17
|
+
"types": "./dist/resources/prompts.d.ts",
|
|
18
|
+
"import": "./dist/resources/prompts.js"
|
|
15
19
|
}
|
|
16
20
|
},
|
|
17
21
|
"files": [
|
|
@@ -22,12 +26,13 @@
|
|
|
22
26
|
"dependencies": {
|
|
23
27
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
24
28
|
"zod": "^3.25.0",
|
|
25
|
-
"@layers/amba-shared": "
|
|
29
|
+
"@layers/amba-shared": "4.0.2"
|
|
26
30
|
},
|
|
27
31
|
"devDependencies": {
|
|
28
32
|
"@types/node": "^22.10.2",
|
|
29
33
|
"tsdown": "^0.12.5",
|
|
30
|
-
"typescript": "^5.8.3"
|
|
34
|
+
"typescript": "^5.8.3",
|
|
35
|
+
"vitest": "^3.2.4"
|
|
31
36
|
},
|
|
32
37
|
"repository": {
|
|
33
38
|
"type": "git",
|
|
@@ -43,9 +48,10 @@
|
|
|
43
48
|
},
|
|
44
49
|
"description": "MCP server tools for amba — agentic developer onboarding, project provisioning, and SDK introspection over the Model Context Protocol.",
|
|
45
50
|
"scripts": {
|
|
46
|
-
"build": "tsdown && tsc --emitDeclarationOnly",
|
|
51
|
+
"build": "tsdown && tsc --emitDeclarationOnly --project tsconfig.build.json",
|
|
47
52
|
"dev": "tsdown --watch",
|
|
48
53
|
"typecheck": "tsc --noEmit",
|
|
54
|
+
"test": "vitest run",
|
|
49
55
|
"clean": "rm -rf dist"
|
|
50
56
|
}
|
|
51
57
|
}
|