ampless 1.0.0-beta.60 → 1.0.0-beta.62
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/dist/index.d.ts +33 -1
- package/dist/index.js +14 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1669,6 +1669,24 @@ interface AiConfig {
|
|
|
1669
1669
|
* abuse protection.
|
|
1670
1670
|
*/
|
|
1671
1671
|
publicMcp?: boolean;
|
|
1672
|
+
/**
|
|
1673
|
+
* **Experimental.** Publish MCP discovery metadata so AI clients can
|
|
1674
|
+
* find the public endpoint without being handed its URL: a well-known
|
|
1675
|
+
* catalog at `/.well-known/mcp/catalog.json` and a Server Card at
|
|
1676
|
+
* `/api/mcp/server-card`. Requires `publicMcp: true` (discovery only
|
|
1677
|
+
* advertises the same `/api/mcp` endpoint) and an `http(s)` `site.url`
|
|
1678
|
+
* to resolve the absolute URLs it advertises — when either is missing
|
|
1679
|
+
* the discovery routes 404.
|
|
1680
|
+
*
|
|
1681
|
+
* **Default: false.** This tracks the prototype
|
|
1682
|
+
* `modelcontextprotocol/experimental-ext-server-card` spec (SEP-2127 —
|
|
1683
|
+
* still open / unmerged), whose schema and paths may change to follow
|
|
1684
|
+
* upstream, so it is isolated behind this opt-in flag. When enabled,
|
|
1685
|
+
* the `/api/mcp` `initialize` response's `serverInfo` also switches to
|
|
1686
|
+
* a site-derived reverse-DNS name + version so it matches the Server
|
|
1687
|
+
* Card (default OFF sites keep the static `ampless-mcp` serverInfo).
|
|
1688
|
+
*/
|
|
1689
|
+
mcpDiscovery?: boolean;
|
|
1672
1690
|
}
|
|
1673
1691
|
type Role = 'reader' | 'editor' | 'admin';
|
|
1674
1692
|
interface AuthContext {
|
|
@@ -1939,6 +1957,20 @@ declare function decodeAwsJson(value: unknown): unknown;
|
|
|
1939
1957
|
*/
|
|
1940
1958
|
declare function formatPublicAssetUrl(bucket: string, region: string, key: string): string;
|
|
1941
1959
|
|
|
1960
|
+
/**
|
|
1961
|
+
* Resolve the public MCP endpoint URL from the `ai.publicMcp` flag and the
|
|
1962
|
+
* effective site URL.
|
|
1963
|
+
*
|
|
1964
|
+
* - Returns `undefined` when `publicMcp` isn't `true` (the feature is off —
|
|
1965
|
+
* callers use this to distinguish "not enabled" from "enabled but
|
|
1966
|
+
* unresolvable").
|
|
1967
|
+
* - Returns `null` when `publicMcp` is `true` but `siteUrl` is missing,
|
|
1968
|
+
* blank, unparsable, or not an `http:`/`https:` URL (e.g. `ftp://...`,
|
|
1969
|
+
* `mailto:...`) — there is no safe absolute URL to advertise.
|
|
1970
|
+
* - Otherwise returns the absolute `/api/mcp` URL at `siteUrl`'s origin.
|
|
1971
|
+
*/
|
|
1972
|
+
declare function resolvePublicMcpEndpoint(publicMcp: boolean | undefined, siteUrl: string | undefined): string | null | undefined;
|
|
1973
|
+
|
|
1942
1974
|
/**
|
|
1943
1975
|
* Validate the user-supplied key for ctx.writePublicAsset.
|
|
1944
1976
|
*
|
|
@@ -2162,4 +2194,4 @@ declare function pickDefaultEntrypoint(files: readonly {
|
|
|
2162
2194
|
|
|
2163
2195
|
declare const VERSION = "0.0.1";
|
|
2164
2196
|
|
|
2165
|
-
export { type AiConfig, type AmplessEvent, type AmplessPlugin, type AuthContext, type BoundedScanOptions, type BoundedScanPage, type BoundedScanResult, type BoundedScanTruncation, type BundleExtractResult, type CacheConfig, type CacheStrategy, type Config, type ContentEventPayload, type ContentEventType, type ContentFieldRenderer, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_ENTRYPOINT, type DateFormat, type EventPayloadOf, type EventType, type ExtractedFile, type FieldDefinition, type FieldType, type HistoryConfig, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type ListPostHistoryOptions, type LocalizedString, MAX_BUNDLE_BYTES, type MarkdownEmbedMatch, type Media, type MediaEventPayload, type MediaEventType, type MediaMetadata, type MediaProcessingDefaults, type OgImageConfig, type OgImageFont, type OgImageRenderContext, PLUGIN_KEY_PATTERN, type Page, type PluginBooleanField, type PluginCapability, type PluginCodeField, type PluginEventHandler, type PluginHookResult, type PluginJsonField, type PluginMetadata, type PluginNumberField, type PluginPackageManifest, type PluginPublicRenderContext, type PluginRepeatableField, type PluginRepeatableSubField, type PluginRuntimeContext, type PluginSecretField, type PluginSelectField, type PluginSettingField, type PluginSettingsManifest, type PluginTextField, type PluginTextareaField, type PluginUninstallContext, type PluginUrlField, type Post, type PostIndexEventPayload, type PostIndexEventType, type PostListFilterOptions, type PostListSort, type PostListStatusFilter, type PostMetadata, type PostRevision, type PostRevisionConnection, type PostStatus, type PostSummary, type PostsProvider, type PublicBodyDescriptor, type PublicHeadDescriptor, type PublicPostBodyDescriptor, type PublicPostHtmlDescriptor, type PublicPostHtmlPosition, type PublicPostScriptDescriptor, type Role, SITE_CONFIG_PK, type ScriptStrategy, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StaticPostFileMeta, type StreamEventName, type SummaryListOptions, TEXT_EXTENSIONS, type ThemeColorField, type ThemeField, type ThemeFieldType, type ThemeFontFamilyField, type ThemeImageField, type ThemeLengthField, type ThemeLinkListField, type ThemeManifest, type ThemeModule, type ThemeRouteContext, type ThemeSelectField, type ThemeTextField, type TiptapNodeHtmlAdapters, type TiptapNodeMarkdownAdapters, type TiptapNodeToHtml, type TiptapNodeToMarkdown, type TiptapRenderNode, type TrustLevel, type TrustedPluginRuntimeContext, VERSION, type ValidationIssue, bundlePrefix, collectBounded, collectTags, createPost, decodeAwsJson, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, encodeAwsJson, escapeXml, extractFirstImageUrl, filterSortPostSummaries, findAbsolutePathRefs, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getKvStore, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isTagListUrl, isValidPluginKey, listPostHistory, listPostSummaries, listPosts, listSiteSettings, mimeTypeFor, parseColorPair, parseLinkList, pickDefaultEntrypoint, resolveLocalized, resolvePluginSettings, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, stringifyLinkList, stripCommonPrefix, themeSettingKey, unflattenSettings, updatePost, validateBundle, validateBundlePath, validatePluginSettingValue, validatePublicAssetKey, validateThemeValue };
|
|
2197
|
+
export { type AiConfig, type AmplessEvent, type AmplessPlugin, type AuthContext, type BoundedScanOptions, type BoundedScanPage, type BoundedScanResult, type BoundedScanTruncation, type BundleExtractResult, type CacheConfig, type CacheStrategy, type Config, type ContentEventPayload, type ContentEventType, type ContentFieldRenderer, type ContentFormat, type ContentTypeDefinition, type CreatePostInput, DEFAULT_ENTRYPOINT, type DateFormat, type EventPayloadOf, type EventType, type ExtractedFile, type FieldDefinition, type FieldType, type HistoryConfig, type ImageDisplay, type KvItem, type KvStore, type LinkListItem, type ListOptions, type ListPostHistoryOptions, type LocalizedString, MAX_BUNDLE_BYTES, type MarkdownEmbedMatch, type Media, type MediaEventPayload, type MediaEventType, type MediaMetadata, type MediaProcessingDefaults, type OgImageConfig, type OgImageFont, type OgImageRenderContext, PLUGIN_KEY_PATTERN, type Page, type PluginBooleanField, type PluginCapability, type PluginCodeField, type PluginEventHandler, type PluginHookResult, type PluginJsonField, type PluginMetadata, type PluginNumberField, type PluginPackageManifest, type PluginPublicRenderContext, type PluginRepeatableField, type PluginRepeatableSubField, type PluginRuntimeContext, type PluginSecretField, type PluginSelectField, type PluginSettingField, type PluginSettingsManifest, type PluginTextField, type PluginTextareaField, type PluginUninstallContext, type PluginUrlField, type Post, type PostIndexEventPayload, type PostIndexEventType, type PostListFilterOptions, type PostListSort, type PostListStatusFilter, type PostMetadata, type PostRevision, type PostRevisionConnection, type PostStatus, type PostSummary, type PostsProvider, type PublicBodyDescriptor, type PublicHeadDescriptor, type PublicPostBodyDescriptor, type PublicPostHtmlDescriptor, type PublicPostHtmlPosition, type PublicPostScriptDescriptor, type Role, SITE_CONFIG_PK, type ScriptStrategy, type SiteSettingsEventPayload, type SiteSettingsEventType, type StaticPostBody, type StaticPostFileMeta, type StreamEventName, type SummaryListOptions, TEXT_EXTENSIONS, type ThemeColorField, type ThemeField, type ThemeFieldType, type ThemeFontFamilyField, type ThemeImageField, type ThemeLengthField, type ThemeLinkListField, type ThemeManifest, type ThemeModule, type ThemeRouteContext, type ThemeSelectField, type ThemeTextField, type TiptapNodeHtmlAdapters, type TiptapNodeMarkdownAdapters, type TiptapNodeToHtml, type TiptapNodeToMarkdown, type TiptapRenderNode, type TrustLevel, type TrustedPluginRuntimeContext, VERSION, type ValidationIssue, bundlePrefix, collectBounded, collectTags, createPost, decodeAwsJson, defineConfig, definePlugin, defineSchema, defineTheme, defineThemeModule, deletePost, deleteSiteSetting, detectContentEvents, encodeAwsJson, escapeXml, extractFirstImageUrl, filterSortPostSummaries, findAbsolutePathRefs, flattenSettings, formatColorPair, formatDate, formatPublicAssetUrl, getKvStore, getPost, getPostById, getSiteSetting, hasKvStore, hasPostsProvider, isTagListUrl, isValidPluginKey, listPostHistory, listPostSummaries, listPosts, listSiteSettings, mimeTypeFor, parseColorPair, parseLinkList, pickDefaultEntrypoint, resolveLocalized, resolvePluginSettings, resolvePublicMcpEndpoint, resolveThemeValues, setKvStore, setPostsProvider, setSiteSetting, stringifyLinkList, stripCommonPrefix, themeSettingKey, unflattenSettings, updatePost, validateBundle, validateBundlePath, validatePluginSettingValue, validatePublicAssetKey, validateThemeValue };
|
package/dist/index.js
CHANGED
|
@@ -244,6 +244,19 @@ function formatPublicAssetUrl(bucket, region, key) {
|
|
|
244
244
|
return `https://${bucket}.s3.${region}.amazonaws.com/${key}`;
|
|
245
245
|
}
|
|
246
246
|
|
|
247
|
+
// src/public-mcp.ts
|
|
248
|
+
function resolvePublicMcpEndpoint(publicMcp, siteUrl) {
|
|
249
|
+
if (publicMcp !== true) return void 0;
|
|
250
|
+
if (!siteUrl?.trim()) return null;
|
|
251
|
+
try {
|
|
252
|
+
const parsed = new URL(siteUrl);
|
|
253
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:") return null;
|
|
254
|
+
return new URL("/api/mcp", parsed.origin).toString();
|
|
255
|
+
} catch {
|
|
256
|
+
return null;
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
247
260
|
// src/plugin.ts
|
|
248
261
|
function definePlugin(p) {
|
|
249
262
|
if (p.settings?.secret && p.settings.secret.length > 0) {
|
|
@@ -957,6 +970,7 @@ export {
|
|
|
957
970
|
pickDefaultEntrypoint,
|
|
958
971
|
resolveLocalized,
|
|
959
972
|
resolvePluginSettings,
|
|
973
|
+
resolvePublicMcpEndpoint,
|
|
960
974
|
resolveThemeValues,
|
|
961
975
|
setKvStore,
|
|
962
976
|
setPostsProvider,
|