@ampless/mcp-server 1.0.0-alpha.17 → 1.0.0-alpha.18
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.ja.md +45 -123
- package/README.md +45 -123
- package/dist/index.d.ts +127 -1
- package/dist/index.js +1283 -32299
- package/package.json +17 -29
- package/LICENSE +0 -21
- package/dist/bowser-WRHMEFK3.js +0 -2822
- package/dist/chunk-6HZB2ZCT.js +0 -4715
- package/dist/chunk-7JQMGUAU.js +0 -134
- package/dist/chunk-ERHOBKHD.js +0 -891
- package/dist/chunk-ETWWJEHN.js +0 -574
- package/dist/chunk-FLMNALC3.js +0 -47
- package/dist/chunk-FM7TW5TD.js +0 -3558
- package/dist/chunk-IKXKDSVH.js +0 -1414
- package/dist/chunk-LD7M476A.js +0 -502
- package/dist/chunk-LMMQX4CK.js +0 -49
- package/dist/chunk-OBZN5IWW.js +0 -1375
- package/dist/chunk-Q4OVSLY4.js +0 -14
- package/dist/chunk-SPCUAJQT.js +0 -435
- package/dist/chunk-USNYVOYF.js +0 -1422
- package/dist/chunk-WAP4WAMQ.js +0 -867
- package/dist/chunk-YR5GD2D7.js +0 -165
- package/dist/dist-es-2B6UPU6D.js +0 -485
- package/dist/dist-es-4QBVIVDD.js +0 -23
- package/dist/dist-es-DAQMEDLM.js +0 -165
- package/dist/dist-es-DWVRWSTC.js +0 -70
- package/dist/dist-es-H7Y5BZEG.js +0 -315
- package/dist/dist-es-QZOTLLWC.js +0 -377
- package/dist/dist-es-S3US4EVE.js +0 -88
- package/dist/event-streams-IEZDQ3X3.js +0 -44
- package/dist/event-streams-R54SMYED.js +0 -891
- package/dist/loadSso-B4NUZPX5.js +0 -552
- package/dist/signin-BEDHRSJ2.js +0 -647
- package/dist/sso-oidc-UXLRODTA.js +0 -787
- package/dist/sts-3BBU2O3O.js +0 -1366
- package/dist/tools/index.d.ts +0 -127
- package/dist/tools/index.js +0 -16
package/dist/tools/index.d.ts
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { BundleExtractResult } from 'ampless';
|
|
2
|
-
|
|
3
|
-
interface ResolvedSite {
|
|
4
|
-
name: string;
|
|
5
|
-
url?: string;
|
|
6
|
-
environment: 'prod' | 'stg' | 'dev';
|
|
7
|
-
siteId: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Abstract contracts each tool handler depends on. Concrete
|
|
12
|
-
* implementations live elsewhere:
|
|
13
|
-
*
|
|
14
|
-
* - Stdio CLI: `src/appsync.ts` (Cognito-id-token bearer) and
|
|
15
|
-
* `src/s3.ts` (default-credential-chain S3 client).
|
|
16
|
-
* - HTTP transport: `@ampless/admin/api/mcp` wraps the consumer's
|
|
17
|
-
* existing `generateClient<Schema>()` + S3 client.
|
|
18
|
-
*
|
|
19
|
-
* Both routes satisfy these interfaces structurally (no `implements`
|
|
20
|
-
* needed) — TypeScript's structural typing checks the shape on the
|
|
21
|
-
* call site. Tools never instantiate these themselves; the caller
|
|
22
|
-
* passes a ready `ToolContext` into `dispatchToolCall`.
|
|
23
|
-
*/
|
|
24
|
-
interface GraphqlClient {
|
|
25
|
-
query<T>(operation: string, variables?: Record<string, unknown>): Promise<T>;
|
|
26
|
-
}
|
|
27
|
-
interface StorageObject {
|
|
28
|
-
/** Full S3 key including any prefix. */
|
|
29
|
-
key: string;
|
|
30
|
-
/** Object size in bytes (0 when the backend can't supply it). */
|
|
31
|
-
size: number;
|
|
32
|
-
/** ISO 8601 timestamp of the last write, when the backend supplies it. */
|
|
33
|
-
lastModified?: string;
|
|
34
|
-
}
|
|
35
|
-
interface StorageClient {
|
|
36
|
-
/**
|
|
37
|
-
* Upload `body` to the bucket at `key` with `contentType`. Returns
|
|
38
|
-
* the public URL of the stored object (same format both routes use:
|
|
39
|
-
* https://{bucket}.s3.{region}.amazonaws.com/{key}).
|
|
40
|
-
*/
|
|
41
|
-
putObject(key: string, body: Uint8Array, contentType: string): Promise<string>;
|
|
42
|
-
/**
|
|
43
|
-
* Remove the object at `key`. Implementations should treat a missing
|
|
44
|
-
* key as success (S3 DeleteObject is idempotent by default).
|
|
45
|
-
*/
|
|
46
|
-
deleteObject(key: string): Promise<void>;
|
|
47
|
-
/**
|
|
48
|
-
* List every object under `prefix`. Implementations are expected to
|
|
49
|
-
* paginate internally so the caller gets the full set in a single
|
|
50
|
-
* resolved promise — the static-bundle tools never expect more than
|
|
51
|
-
* a few hundred entries per bundle in practice.
|
|
52
|
-
*/
|
|
53
|
-
listObjects(prefix: string): Promise<StorageObject[]>;
|
|
54
|
-
}
|
|
55
|
-
interface ToolContext {
|
|
56
|
-
graphql: GraphqlClient;
|
|
57
|
-
storage: () => StorageClient;
|
|
58
|
-
site?: ResolvedSite;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* Server-side zip extractor used by the static-bundle MCP tools. Both
|
|
63
|
-
* the stdio CLI and the Lambda HTTP transport run this — `fflate` is
|
|
64
|
-
* a workspace dependency of `@ampless/mcp-server`, so the import
|
|
65
|
-
* resolves identically in both. The browser-side admin uploader has
|
|
66
|
-
* its own `extractZip(File)` based on JSZip (works on a `File`, not a
|
|
67
|
-
* `Buffer`).
|
|
68
|
-
*
|
|
69
|
-
* Behaviour parity with the admin extractor:
|
|
70
|
-
* - Skip directory entries (fflate gives byte arrays only, so this
|
|
71
|
-
* is naturally satisfied unless the zip has empty-byte directory
|
|
72
|
-
* placeholders — those still get filtered out by validateBundlePath
|
|
73
|
-
* returning "directory entry" for any path ending with `/`).
|
|
74
|
-
* - Silently drop OS-specific junk (`__MACOSX/*`, `.DS_Store`,
|
|
75
|
-
* `Thumbs.db`) so callers don't see them as bundle entries.
|
|
76
|
-
* - Surface structural issues (absolute paths, parent traversal, null
|
|
77
|
-
* bytes) so the tool can reject the upload.
|
|
78
|
-
* - Strip a common single top-level directory (macOS Finder zips
|
|
79
|
-
* wrap their contents in a folder).
|
|
80
|
-
*/
|
|
81
|
-
|
|
82
|
-
interface ExtractZipOptions {
|
|
83
|
-
/**
|
|
84
|
-
* Hard ceiling on uncompressed bundle bytes. Defaults to 50 MB,
|
|
85
|
-
* matching the browser uploader's MAX_BUNDLE_BYTES. Callers running
|
|
86
|
-
* inside a tight Lambda envelope (Function URL payload cap ~6 MB
|
|
87
|
-
* post-base64) can tighten this; setting it lower than the bundle
|
|
88
|
-
* causes `extractZipFromBuffer` to throw before fully populating
|
|
89
|
-
* `files`.
|
|
90
|
-
*/
|
|
91
|
-
maxBytes?: number;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* Unzip `buffer` in memory and return the same shape the browser
|
|
95
|
-
* `extractZip(File)` helper returns. Throws if the unzip itself fails
|
|
96
|
-
* (corrupt archive) or if the uncompressed size exceeds `maxBytes`.
|
|
97
|
-
*/
|
|
98
|
-
declare function extractZipFromBuffer(buffer: Uint8Array, opts?: ExtractZipOptions): BundleExtractResult;
|
|
99
|
-
/**
|
|
100
|
-
* Decode an extracted file's bytes as UTF-8 text. Used by the tool
|
|
101
|
-
* handler before running cross-file `validateBundle` so we don't
|
|
102
|
-
* instantiate a TextDecoder per entry. fflate provides a fast helper.
|
|
103
|
-
*/
|
|
104
|
-
declare function decodeUtf8(data: Uint8Array): string;
|
|
105
|
-
|
|
106
|
-
interface ToolDefinition {
|
|
107
|
-
name: string;
|
|
108
|
-
description: string;
|
|
109
|
-
inputSchema: Record<string, unknown>;
|
|
110
|
-
handler: (args: Record<string, unknown>, ctx: ToolContext) => Promise<unknown>;
|
|
111
|
-
destructive?: boolean;
|
|
112
|
-
}
|
|
113
|
-
declare const tools: ToolDefinition[];
|
|
114
|
-
/**
|
|
115
|
-
* Look up a tool definition by name and invoke its handler. Returns
|
|
116
|
-
* `null` when no tool with that name is registered — callers should
|
|
117
|
-
* surface that as a JSON-RPC "method not found" error.
|
|
118
|
-
*/
|
|
119
|
-
declare function dispatchToolCall(name: string, args: Record<string, unknown>, ctx: ToolContext): Promise<unknown>;
|
|
120
|
-
/**
|
|
121
|
-
* `tools` is the canonical registry; `getTools()` returns it for
|
|
122
|
-
* callers that prefer a function over a top-level constant (admin's
|
|
123
|
-
* HTTP factory exposes this through its options shape).
|
|
124
|
-
*/
|
|
125
|
-
declare function getTools(): readonly ToolDefinition[];
|
|
126
|
-
|
|
127
|
-
export { type ExtractZipOptions, type GraphqlClient, type StorageClient, type StorageObject, type ToolContext, type ToolDefinition, decodeUtf8, dispatchToolCall, extractZipFromBuffer, getTools, tools };
|
package/dist/tools/index.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
decodeUtf8,
|
|
4
|
-
dispatchToolCall,
|
|
5
|
-
extractZipFromBuffer,
|
|
6
|
-
getTools,
|
|
7
|
-
tools
|
|
8
|
-
} from "../chunk-WAP4WAMQ.js";
|
|
9
|
-
import "../chunk-LMMQX4CK.js";
|
|
10
|
-
export {
|
|
11
|
-
decodeUtf8,
|
|
12
|
-
dispatchToolCall,
|
|
13
|
-
extractZipFromBuffer,
|
|
14
|
-
getTools,
|
|
15
|
-
tools
|
|
16
|
-
};
|