@se-studio/contentful-cms 1.3.7 → 2.0.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/CHANGELOG.md +12 -0
- package/HOSTED.md +25 -72
- package/INSTALL.md +2 -2
- package/README.md +1 -1
- package/dist/cli/program.js +2 -2
- package/dist/cli/program.js.map +1 -1
- package/dist/commands/entry-search.d.ts.map +1 -1
- package/dist/commands/entry-search.js +4 -1
- package/dist/commands/entry-search.js.map +1 -1
- package/dist/commands/host-scaffold.d.ts +4 -0
- package/dist/commands/host-scaffold.d.ts.map +1 -0
- package/dist/commands/host-scaffold.js +73 -0
- package/dist/commands/host-scaffold.js.map +1 -0
- package/dist/commands/{mcpb-pack.d.ts → host-stage.d.ts} +2 -2
- package/dist/commands/host-stage.d.ts.map +1 -0
- package/dist/commands/host-stage.js +60 -0
- package/dist/commands/host-stage.js.map +1 -0
- package/dist/commands/host.d.ts +3 -0
- package/dist/commands/host.d.ts.map +1 -0
- package/dist/commands/host.js +9 -0
- package/dist/commands/host.js.map +1 -0
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +26 -2
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/sitemap.d.ts.map +1 -1
- package/dist/commands/sitemap.js +17 -2
- package/dist/commands/sitemap.js.map +1 -1
- package/dist/contentful/cda-sync.d.ts.map +1 -1
- package/dist/contentful/cda-sync.js +2 -0
- package/dist/contentful/cda-sync.js.map +1 -1
- package/dist/contentful/reference-record.d.ts +4 -0
- package/dist/contentful/reference-record.d.ts.map +1 -1
- package/dist/contentful/reference-record.js +7 -0
- package/dist/contentful/reference-record.js.map +1 -1
- package/dist/generated/hosted-guide.d.ts +1 -1
- package/dist/generated/hosted-guide.d.ts.map +1 -1
- package/dist/generated/hosted-guide.js +1 -1
- package/dist/generated/hosted-guide.js.map +1 -1
- package/dist/generated/version.d.ts +1 -1
- package/dist/generated/version.js +1 -1
- package/dist/hosted/index.d.ts +7 -0
- package/dist/hosted/index.d.ts.map +1 -1
- package/dist/hosted/index.js +7 -0
- package/dist/hosted/index.js.map +1 -1
- package/dist/hosted/next/claude-connect.d.ts +8 -0
- package/dist/hosted/next/claude-connect.d.ts.map +1 -0
- package/dist/hosted/next/claude-connect.js +23 -0
- package/dist/hosted/next/claude-connect.js.map +1 -0
- package/dist/hosted/next/context.d.ts +3 -0
- package/dist/hosted/next/context.d.ts.map +1 -0
- package/dist/hosted/next/context.js +11 -0
- package/dist/hosted/next/context.js.map +1 -0
- package/dist/hosted/next/editor-pack-path.d.ts +2 -0
- package/dist/hosted/next/editor-pack-path.d.ts.map +1 -0
- package/dist/hosted/next/editor-pack-path.js +6 -0
- package/dist/hosted/next/editor-pack-path.js.map +1 -0
- package/dist/hosted/next/page-styles.d.ts +6 -0
- package/dist/hosted/next/page-styles.d.ts.map +1 -0
- package/dist/hosted/next/page-styles.js +37 -0
- package/dist/hosted/next/page-styles.js.map +1 -0
- package/dist/hosted/next/pages/CmsEditPage.d.ts +2 -0
- package/dist/hosted/next/pages/CmsEditPage.d.ts.map +1 -0
- package/dist/hosted/next/pages/CmsEditPage.js +22 -0
- package/dist/hosted/next/pages/CmsEditPage.js.map +1 -0
- package/dist/hosted/next/pages/ContentfulCallbackPage.d.ts +2 -0
- package/dist/hosted/next/pages/ContentfulCallbackPage.d.ts.map +1 -0
- package/dist/hosted/next/pages/ContentfulCallbackPage.js +45 -0
- package/dist/hosted/next/pages/ContentfulCallbackPage.js.map +1 -0
- package/dist/hosted/next/pages/HomePage.d.ts +2 -0
- package/dist/hosted/next/pages/HomePage.d.ts.map +1 -0
- package/dist/hosted/next/pages/HomePage.js +36 -0
- package/dist/hosted/next/pages/HomePage.js.map +1 -0
- package/dist/hosted/next/redis.d.ts +5 -0
- package/dist/hosted/next/redis.d.ts.map +1 -0
- package/dist/hosted/next/redis.js +23 -0
- package/dist/hosted/next/redis.js.map +1 -0
- package/dist/hosted/next/routes/connect.d.ts +2 -0
- package/dist/hosted/next/routes/connect.d.ts.map +1 -0
- package/dist/hosted/next/routes/connect.js +19 -0
- package/dist/hosted/next/routes/connect.js.map +1 -0
- package/dist/hosted/next/routes/health.d.ts +2 -0
- package/dist/hosted/next/routes/health.d.ts.map +1 -0
- package/dist/hosted/next/routes/health.js +51 -0
- package/dist/hosted/next/routes/health.js.map +1 -0
- package/dist/hosted/next/routes/link-contentful.d.ts +2 -0
- package/dist/hosted/next/routes/link-contentful.d.ts.map +1 -0
- package/dist/hosted/next/routes/link-contentful.js +6 -0
- package/dist/hosted/next/routes/link-contentful.js.map +1 -0
- package/dist/hosted/next/routes/mcp.d.ts +4 -0
- package/dist/hosted/next/routes/mcp.d.ts.map +1 -0
- package/dist/hosted/next/routes/mcp.js +52 -0
- package/dist/hosted/next/routes/mcp.js.map +1 -0
- package/dist/hosted/next/routes/oauth-authorization-server.d.ts +2 -0
- package/dist/hosted/next/routes/oauth-authorization-server.d.ts.map +1 -0
- package/dist/hosted/next/routes/oauth-authorization-server.js +5 -0
- package/dist/hosted/next/routes/oauth-authorization-server.js.map +1 -0
- package/dist/hosted/next/routes/oauth-authorize.d.ts +2 -0
- package/dist/hosted/next/routes/oauth-authorize.d.ts.map +1 -0
- package/dist/hosted/next/routes/oauth-authorize.js +6 -0
- package/dist/hosted/next/routes/oauth-authorize.js.map +1 -0
- package/dist/hosted/next/routes/oauth-protected-resource.d.ts +2 -0
- package/dist/hosted/next/routes/oauth-protected-resource.d.ts.map +1 -0
- package/dist/hosted/next/routes/oauth-protected-resource.js +5 -0
- package/dist/hosted/next/routes/oauth-protected-resource.js.map +1 -0
- package/dist/hosted/next/routes/oauth-register.d.ts +2 -0
- package/dist/hosted/next/routes/oauth-register.d.ts.map +1 -0
- package/dist/hosted/next/routes/oauth-register.js +6 -0
- package/dist/hosted/next/routes/oauth-register.js.map +1 -0
- package/dist/hosted/next/routes/oauth-token.d.ts +2 -0
- package/dist/hosted/next/routes/oauth-token.d.ts.map +1 -0
- package/dist/hosted/next/routes/oauth-token.js +6 -0
- package/dist/hosted/next/routes/oauth-token.js.map +1 -0
- package/dist/hosted/next/stage-site.d.ts +11 -0
- package/dist/hosted/next/stage-site.d.ts.map +1 -0
- package/dist/hosted/next/stage-site.js +49 -0
- package/dist/hosted/next/stage-site.js.map +1 -0
- package/dist/hosted/oauth/auth.d.ts +11 -0
- package/dist/hosted/oauth/auth.d.ts.map +1 -0
- package/dist/hosted/oauth/auth.js +41 -0
- package/dist/hosted/oauth/auth.js.map +1 -0
- package/dist/hosted/oauth/complete.d.ts +13 -0
- package/dist/hosted/oauth/complete.d.ts.map +1 -0
- package/dist/hosted/oauth/complete.js +40 -0
- package/dist/hosted/oauth/complete.js.map +1 -0
- package/dist/hosted/oauth/config.d.ts +7 -0
- package/dist/hosted/oauth/config.d.ts.map +1 -0
- package/dist/hosted/oauth/config.js +33 -0
- package/dist/hosted/oauth/config.js.map +1 -0
- package/dist/hosted/oauth/handlers.d.ts +18 -0
- package/dist/hosted/oauth/handlers.d.ts.map +1 -0
- package/dist/hosted/oauth/handlers.js +212 -0
- package/dist/hosted/oauth/handlers.js.map +1 -0
- package/dist/hosted/oauth/jwt.d.ts +9 -0
- package/dist/hosted/oauth/jwt.d.ts.map +1 -0
- package/dist/hosted/oauth/jwt.js +31 -0
- package/dist/hosted/oauth/jwt.js.map +1 -0
- package/dist/hosted/oauth/pkce.d.ts +3 -0
- package/dist/hosted/oauth/pkce.d.ts.map +1 -0
- package/dist/hosted/oauth/pkce.js +9 -0
- package/dist/hosted/oauth/pkce.js.map +1 -0
- package/dist/hosted/oauth/store.d.ts +35 -0
- package/dist/hosted/oauth/store.d.ts.map +1 -0
- package/dist/hosted/oauth/store.js +70 -0
- package/dist/hosted/oauth/store.js.map +1 -0
- package/dist/index/db.d.ts.map +1 -1
- package/dist/index/db.js +5 -1
- package/dist/index/db.js.map +1 -1
- package/dist/index/query.d.ts +4 -0
- package/dist/index/query.d.ts.map +1 -1
- package/dist/index/query.js +13 -2
- package/dist/index/query.js.map +1 -1
- package/dist/index/reference-lookup.d.ts.map +1 -1
- package/dist/index/reference-lookup.js +4 -0
- package/dist/index/reference-lookup.js.map +1 -1
- package/dist/index/schema.d.ts +5 -3
- package/dist/index/schema.d.ts.map +1 -1
- package/dist/index/schema.js +8 -3
- package/dist/index/schema.js.map +1 -1
- package/dist/index/sync.d.ts.map +1 -1
- package/dist/index/sync.js +5 -4
- package/dist/index/sync.js.map +1 -1
- package/dist/mcp/guide.js +5 -5
- package/dist/mcp/guide.js.map +1 -1
- package/dist/mcp/prompts/onboarding.js +1 -1
- package/dist/mcp/tools/cms-edit.d.ts +1 -1
- package/dist/mcp/tools/cms-edit.d.ts.map +1 -1
- package/dist/mcp/tools/cms-edit.js +10 -2
- package/dist/mcp/tools/cms-edit.js.map +1 -1
- package/dist/output/json.d.ts.map +1 -1
- package/dist/output/json.js +1 -0
- package/dist/output/json.js.map +1 -1
- package/dist/project/types.d.ts +0 -8
- package/dist/project/types.d.ts.map +1 -1
- package/dist/project/types.js +0 -8
- package/dist/project/types.js.map +1 -1
- package/docs/help/fields-article.md +14 -0
- package/docs/help/index-sync.md +1 -0
- package/docs/mcp/hosted-guide.md +29 -5
- package/package.json +34 -6
- package/skills/core/SKILL.md +7 -0
- package/skills/setup/SKILL.md +12 -15
- package/dist/commands/mcpb-pack.d.ts.map +0 -1
- package/dist/commands/mcpb-pack.js +0 -60
- package/dist/commands/mcpb-pack.js.map +0 -1
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { CSSProperties } from 'react';
|
|
2
|
+
export declare const pageStyle: CSSProperties;
|
|
3
|
+
export declare const codeStyle: CSSProperties;
|
|
4
|
+
export declare const buttonStyle: CSSProperties;
|
|
5
|
+
export declare function resolveRequestOrigin(): Promise<string>;
|
|
6
|
+
//# sourceMappingURL=page-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-styles.d.ts","sourceRoot":"","sources":["../../../src/hosted/next/page-styles.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,SAAS,EAAE,aAKvB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,aASvB,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,aASzB,CAAC;AAEF,wBAAsB,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,CAQ5D"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { headers } from 'next/headers';
|
|
2
|
+
export const pageStyle = {
|
|
3
|
+
fontFamily: 'system-ui, sans-serif',
|
|
4
|
+
padding: '2rem',
|
|
5
|
+
maxWidth: '42rem',
|
|
6
|
+
lineHeight: 1.5,
|
|
7
|
+
};
|
|
8
|
+
export const codeStyle = {
|
|
9
|
+
display: 'block',
|
|
10
|
+
margin: '0.5rem 0',
|
|
11
|
+
padding: '0.75rem 1rem',
|
|
12
|
+
background: '#f4f4f5',
|
|
13
|
+
borderRadius: '0.375rem',
|
|
14
|
+
fontSize: '0.875rem',
|
|
15
|
+
wordBreak: 'break-all',
|
|
16
|
+
whiteSpace: 'pre-wrap',
|
|
17
|
+
};
|
|
18
|
+
export const buttonStyle = {
|
|
19
|
+
display: 'inline-block',
|
|
20
|
+
marginTop: '0.5rem',
|
|
21
|
+
padding: '0.75rem 1.25rem',
|
|
22
|
+
backgroundColor: '#111',
|
|
23
|
+
color: '#fff',
|
|
24
|
+
textDecoration: 'none',
|
|
25
|
+
borderRadius: '0.375rem',
|
|
26
|
+
fontWeight: 600,
|
|
27
|
+
};
|
|
28
|
+
export async function resolveRequestOrigin() {
|
|
29
|
+
const headerList = await headers();
|
|
30
|
+
const host = headerList.get('host');
|
|
31
|
+
if (!host) {
|
|
32
|
+
return process.env['CMS_EDIT_PUBLIC_ORIGIN'] ?? 'http://localhost:3020';
|
|
33
|
+
}
|
|
34
|
+
const proto = headerList.get('x-forwarded-proto') ?? 'http';
|
|
35
|
+
return `${proto}://${host}`;
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=page-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"page-styles.js","sourceRoot":"","sources":["../../../src/hosted/next/page-styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,UAAU,EAAE,uBAAuB;IACnC,OAAO,EAAE,MAAM;IACf,QAAQ,EAAE,OAAO;IACjB,UAAU,EAAE,GAAG;CAChB,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAkB;IACtC,OAAO,EAAE,OAAO;IAChB,MAAM,EAAE,UAAU;IAClB,OAAO,EAAE,cAAc;IACvB,UAAU,EAAE,SAAS;IACrB,YAAY,EAAE,UAAU;IACxB,QAAQ,EAAE,UAAU;IACpB,SAAS,EAAE,WAAW;IACtB,UAAU,EAAE,UAAU;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAkB;IACxC,OAAO,EAAE,cAAc;IACvB,SAAS,EAAE,QAAQ;IACnB,OAAO,EAAE,iBAAiB;IAC1B,eAAe,EAAE,MAAM;IACvB,KAAK,EAAE,MAAM;IACb,cAAc,EAAE,MAAM;IACtB,YAAY,EAAE,UAAU;IACxB,UAAU,EAAE,GAAG;CAChB,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,oBAAoB;IACxC,MAAM,UAAU,GAAG,MAAM,OAAO,EAAE,CAAC;IACnC,MAAM,IAAI,GAAG,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,OAAO,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,IAAI,uBAAuB,CAAC;IAC1E,CAAC;IACD,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,CAAC,mBAAmB,CAAC,IAAI,MAAM,CAAC;IAC5D,OAAO,GAAG,KAAK,MAAM,IAAI,EAAE,CAAC;AAC9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsEditPage.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/pages/CmsEditPage.tsx"],"names":[],"mappings":"AAIA,wBAA8B,qBAAqB,yCAkGlD"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { getMcpResourceUrl, loadHostedDeploymentFromEnv } from '../../index.js';
|
|
3
|
+
import { buildClaudeConnectorInstallUrl, isPublicHttpsMcpUrl } from '../claude-connect.js';
|
|
4
|
+
import { buttonStyle, codeStyle, pageStyle, resolveRequestOrigin } from '../page-styles.js';
|
|
5
|
+
export default async function CmsEditOnboardingPage() {
|
|
6
|
+
const origin = await resolveRequestOrigin();
|
|
7
|
+
let displayName = 'your site';
|
|
8
|
+
let mcpUrl = `${origin}/api/mcp`;
|
|
9
|
+
try {
|
|
10
|
+
const deployment = loadHostedDeploymentFromEnv();
|
|
11
|
+
displayName = process.env['CMS_EDIT_DISPLAY_NAME'] ?? deployment.projectKey;
|
|
12
|
+
mcpUrl = getMcpResourceUrl();
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// env not set during local dev without .env.local
|
|
16
|
+
}
|
|
17
|
+
const connectorName = `cms-edit (${displayName})`;
|
|
18
|
+
const installUrl = buildClaudeConnectorInstallUrl(mcpUrl, connectorName);
|
|
19
|
+
const canUseInstallLink = isPublicHttpsMcpUrl(mcpUrl);
|
|
20
|
+
return (_jsxs("main", { style: pageStyle, children: [_jsxs("h1", { children: ["cms-edit for ", displayName] }), _jsx("p", { children: "Edit Contentful draft content from Claude. Sign in with your Contentful account \u2014 no tokens or command line required." }), _jsxs("section", { children: [_jsx("h2", { children: "Quick connect (recommended)" }), canUseInstallLink ? (_jsxs(_Fragment, { children: [_jsx("p", { children: "Click the button below. It opens Claude with the connector name and URL prefilled \u2014 you just confirm and sign in with Contentful." }), _jsx("p", { children: _jsx("a", { href: installUrl, style: buttonStyle, children: "Connect to Claude" }) }), _jsxs("p", { style: { fontSize: '0.9375rem', color: '#52525b' }, children: ["Works in Claude Desktop and claude.ai (same account). Shortcut:", ' ', _jsx("a", { href: "/connect", children: "/connect" })] })] })) : (_jsx("p", { children: "The one-click link requires a public HTTPS URL. For local dev, add the connector manually below or use Claude Code." }))] }), _jsxs("section", { children: [_jsx("h2", { children: "Manual setup" }), _jsxs("ol", { children: [_jsxs("li", { children: ["Install ", _jsx("a", { href: "https://claude.ai/download", children: "Claude Desktop" }), " if needed"] }), _jsxs("li", { children: ["Open ", _jsx("strong", { children: "Customize \u2192 Connectors" }), " (or Settings \u2192 Integrations in some versions)"] }), _jsxs("li", { children: ["Click ", _jsx("strong", { children: "Add custom connector" })] }), _jsxs("li", { children: ["Paste this URL, then ", _jsx("strong", { children: "Connect" }), " and sign in with Contentful:"] })] }), _jsx("code", { style: codeStyle, children: mcpUrl })] }), _jsxs("section", { children: [_jsx("h2", { children: "Verify" }), _jsx("p", { children: "Start a new conversation and ask:" }), _jsx("blockquote", { style: { margin: '0.5rem 0', padding: '0.75rem 1rem', background: '#f4f4f5' }, children: "Read the cms-edit guide and verify the connection." })] }), _jsxs("section", { children: [_jsx("h2", { children: "Troubleshooting" }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Connection stopped working?" }), " Open Customize \u2192 Connectors and click", ' ', _jsx("strong", { children: "Connect" }), " again."] }), _jsxs("li", { children: [_jsx("strong", { children: "Wrong space?" }), " Your Contentful account must have access to this site's space."] }), _jsxs("li", { children: ["Health check: ", _jsx("code", { children: "/api/health" })] })] })] })] }));
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=CmsEditPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CmsEditPage.js","sourceRoot":"","sources":["../../../../src/hosted/next/pages/CmsEditPage.tsx"],"names":[],"mappings":";AAAA,OA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CACL,IACO,EAEV,8BACE,wCAAqB,EACrB,yBACE,qCACU,YAAG,IAAI,EAAC,4BAA4B,+BAAmB,kBAC5D,EACL,kCACO,2DAAuC,2DAEzC,EACL,mCACQ,oDAAqC,IACxC,EACL,kDACuB,uCAAwB,qCAC1C,IACF,EACL,eAAM,KAAK,EAAE,SAAS,YAAG,MAAM,GAAQ,IAC/B,EAEV,8BACE,kCAAe,EACf,4DAAwC,EACxC,qBAAY,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,mEAE5E,IACL,EAEV,8BACE,2CAAwB,EACxB,yBACE,yBACE,2DAA4C,iDAAuC,GAAG,EACtF,uCAAwB,eACrB,EACL,yBACE,4CAA6B,uEAE1B,EACL,2CACgB,yCAAwB,IACnC,IACF,IACG,IACL,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentfulCallbackPage.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/pages/ContentfulCallbackPage.tsx"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,sBAAsB,gCA6C7C"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
function parseHashParams(hash) {
|
|
5
|
+
const trimmed = hash.startsWith('#') ? hash.slice(1) : hash;
|
|
6
|
+
return new URLSearchParams(trimmed);
|
|
7
|
+
}
|
|
8
|
+
export default function ContentfulCallbackPage() {
|
|
9
|
+
const [message, setMessage] = useState('Completing Contentful sign-in…');
|
|
10
|
+
useEffect(() => {
|
|
11
|
+
async function completeLink() {
|
|
12
|
+
const params = parseHashParams(window.location.hash);
|
|
13
|
+
const accessToken = params.get('access_token');
|
|
14
|
+
const authRequestId = params.get('state');
|
|
15
|
+
const error = params.get('error');
|
|
16
|
+
if (error) {
|
|
17
|
+
setMessage(`Contentful authorization failed: ${error}`);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (!accessToken || !authRequestId) {
|
|
21
|
+
setMessage('Missing access token or state from Contentful callback.');
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
const res = await fetch('/api/oauth/link-contentful', {
|
|
26
|
+
method: 'POST',
|
|
27
|
+
headers: { 'Content-Type': 'application/json' },
|
|
28
|
+
body: JSON.stringify({ contentfulToken: accessToken, authRequestId }),
|
|
29
|
+
});
|
|
30
|
+
const data = (await res.json());
|
|
31
|
+
if (!res.ok || !data.redirectUrl) {
|
|
32
|
+
setMessage(data.error ?? 'Failed to link Contentful account.');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
window.location.href = data.redirectUrl;
|
|
36
|
+
}
|
|
37
|
+
catch (err) {
|
|
38
|
+
setMessage(err instanceof Error ? err.message : String(err));
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
void completeLink();
|
|
42
|
+
}, []);
|
|
43
|
+
return (_jsxs("main", { style: { fontFamily: 'system-ui, sans-serif', padding: '2rem', maxWidth: '32rem' }, children: [_jsx("h1", { children: "Contentful sign-in" }), _jsx("p", { children: message })] }));
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=ContentfulCallbackPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ContentfulCallbackPage.js","sourceRoot":"","sources":["../../../../src/hosted/next/pages/ContentfulCallbackPage.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5C,SAAS,eAAe,CAAC,IAAY;IACnC,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CA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CAAC;oBAC/D,OAAO;gBACT,CAAC;gBACD,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC;YAC1C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,UAAU,CAAC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC;YAC/D,CAAC;QACH,CAAC;QAED,KAAK,YAAY,EAAE,CAAC;IACtB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CACL,gBAAM,KAAK,EAAE,EAAE,UAAU,EAAE,uBAAuB,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,aACtF,8CAA2B,EAC3B,sBAAI,OAAO,GAAK,IACX,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomePage.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/pages/HomePage.tsx"],"names":[],"mappings":"AAIA,wBAA8B,QAAQ,yCA6GrC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getMcpResourceUrl, getVersionInfo, loadHostedDeploymentFromEnv } from '../../index.js';
|
|
3
|
+
import { buildClaudeConnectorInstallUrl, isPublicHttpsMcpUrl } from '../claude-connect.js';
|
|
4
|
+
import { buttonStyle, codeStyle, pageStyle, resolveRequestOrigin } from '../page-styles.js';
|
|
5
|
+
export default async function HomePage() {
|
|
6
|
+
const origin = await resolveRequestOrigin();
|
|
7
|
+
const { version } = getVersionInfo();
|
|
8
|
+
let projectKey = 'default';
|
|
9
|
+
let spaceId = '(not configured)';
|
|
10
|
+
let displayName = 'your site';
|
|
11
|
+
let mcpUrl = `${origin}/api/mcp`;
|
|
12
|
+
try {
|
|
13
|
+
const deployment = loadHostedDeploymentFromEnv();
|
|
14
|
+
projectKey = deployment.projectKey;
|
|
15
|
+
spaceId = deployment.spaceId;
|
|
16
|
+
displayName = process.env['CMS_EDIT_DISPLAY_NAME'] ?? deployment.projectKey;
|
|
17
|
+
mcpUrl = getMcpResourceUrl();
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
// env not set during local dev without .env.local
|
|
21
|
+
}
|
|
22
|
+
const connectorName = `cms-edit (${displayName})`;
|
|
23
|
+
const installUrl = buildClaudeConnectorInstallUrl(mcpUrl, connectorName);
|
|
24
|
+
const canUseInstallLink = isPublicHttpsMcpUrl(mcpUrl);
|
|
25
|
+
const claudeCodeCommand = `claude mcp add --transport http cms-edit ${mcpUrl}`;
|
|
26
|
+
const mcpJson = JSON.stringify({
|
|
27
|
+
mcpServers: {
|
|
28
|
+
'cms-edit': {
|
|
29
|
+
type: 'http',
|
|
30
|
+
url: mcpUrl,
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
}, null, 2);
|
|
34
|
+
return (_jsxs("main", { style: pageStyle, children: [_jsxs("h1", { children: ["cms-edit for ", displayName] }), _jsx("p", { children: "Hosted MCP server for editing Contentful draft content. Sign in with your Contentful account via OAuth \u2014 no personal access token required." }), canUseInstallLink && (_jsxs("section", { children: [_jsx("h2", { children: "Connect to Claude" }), _jsx("p", { children: "One-click setup \u2014 opens Claude with the connector prefilled. Confirm, then sign in with Contentful." }), _jsx("p", { children: _jsx("a", { href: installUrl, style: buttonStyle, children: "Connect to Claude" }) }), _jsxs("p", { style: { fontSize: '0.9375rem', color: '#52525b' }, children: ["Or use ", _jsx("a", { href: "/connect", children: "/connect" }), " \u00B7 Editor guide: ", _jsx("a", { href: "/cms-edit", children: "/cms-edit" })] })] })), _jsxs("section", { children: [_jsx("h2", { children: "Deployment" }), _jsxs("ul", { children: [_jsxs("li", { children: [_jsx("strong", { children: "Project:" }), " ", projectKey] }), _jsxs("li", { children: [_jsx("strong", { children: "Space ID:" }), " ", spaceId] }), _jsxs("li", { children: [_jsx("strong", { children: "cms-edit version:" }), " ", version] }), _jsxs("li", { children: [_jsx("strong", { children: "MCP URL:" }), " ", _jsx("code", { children: mcpUrl })] }), _jsxs("li", { children: [_jsx("strong", { children: "Health:" }), " ", _jsx("a", { href: "/api/health", children: "/api/health" })] })] })] }), _jsxs("section", { children: [_jsx("h2", { children: "Claude Desktop (manual)" }), _jsxs("p", { children: [_jsx("strong", { children: "Customize \u2192 Connectors \u2192 Add custom connector" }), " \u2014 paste the MCP URL, then Connect and sign in with Contentful."] })] }), _jsxs("section", { children: [_jsx("h2", { children: "Claude Code" }), _jsx("p", { children: "Add the server from your terminal (local scope \u2014 this project only):" }), _jsx("code", { style: codeStyle, children: claudeCodeCommand }), _jsxs("p", { children: ["Then run ", _jsx("code", { children: "/mcp" }), " in Claude Code and complete OAuth + Contentful sign-in."] }), _jsx("code", { style: codeStyle, children: mcpJson })] }), _jsxs("section", { children: [_jsx("h2", { children: "Verify" }), _jsx("blockquote", { style: { margin: '0.5rem 0', padding: '0.75rem 1rem', background: '#f4f4f5' }, children: "Read the cms-edit guide and verify the connection." })] })] }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=HomePage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HomePage.js","sourceRoot":"","sources":["../../../../src/hosted/next/pages/HomePage.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAChG,OAAO,EAAE,8BAA8B,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE5F,MAAM,CAAC,OAAO,CAAC,KAAK,UAAU,QAAQ;IACpC,MAAM,MAAM,GAAG,MAAM,oBAAoB,EAAE,CAAC;IAC5C,MAAM,EAAE,OAAO,EAAE,GAAG,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AAC,UAAU,yBAAa,4BAAiB,YAAG,IAAI,EAAC,WAAW,0BAAc,IACtF,IACI,CACX,EAED,8BACE,sCAAmB,EACnB,yBACE,yBACE,wCAAyB,OAAE,UAAU,IAClC,EACL,yBACE,yCAA0B,OAAE,OAAO,IAChC,EACL,yBACE,iDAAkC,OAAE,OAAO,IACxC,EACL,yBACE,wCAAyB,OAAC,yBAAO,MAAM,GAAQ,IAC5C,EACL,yBACE,uCAAwB,OAAC,YAAG,IAAI,EAAC,aAAa,4BAAgB,IAC3D,IACF,IACG,EAEV,8BACE,mDAAgC,EAChC,wBACE,uFAA8D,4EAE5D,IACI,EAEV,8BACE,uCAAoB,EACpB,oGAA2E,EAC3E,eAAM,KAAK,EAAE,SAAS,YAAG,iBAAiB,GAAQ,EAClD,qCACW,kCAAiB,gEACxB,EACJ,eAAM,KAAK,EAAE,SAAS,YAAG,OAAO,GAAQ,IAChC,EAEV,8BACE,kCAAe,EACf,qBAAY,KAAK,EAAE,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,mEAE5E,IACL,IACL,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis.d.ts","sourceRoot":"","sources":["../../../src/hosted/next/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,eAAO,MAAM,YAAY,OAAkB,CAAC;AAE5C,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,KAAoB,GAAG,WAAW,CAkB1E"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Redis } from '@upstash/redis';
|
|
2
|
+
export const upstashRedis = Redis.fromEnv();
|
|
3
|
+
export function createRedisClient(redis = upstashRedis) {
|
|
4
|
+
return {
|
|
5
|
+
get: async (key) => {
|
|
6
|
+
const value = await redis.get(key);
|
|
7
|
+
return value ?? null;
|
|
8
|
+
},
|
|
9
|
+
set: async (key, value, options) => {
|
|
10
|
+
if (options?.ex !== undefined) {
|
|
11
|
+
await redis.set(key, value, { ex: options.ex });
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
await redis.set(key, value);
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
del: async (key) => {
|
|
18
|
+
await redis.del(key);
|
|
19
|
+
},
|
|
20
|
+
keys: async (pattern) => redis.keys(pattern),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=redis.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redis.js","sourceRoot":"","sources":["../../../src/hosted/next/redis.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAGvC,MAAM,CAAC,MAAM,YAAY,GAAG,KAAK,CAAC,OAAO,EAAE,CAAC;AAE5C,MAAM,UAAU,iBAAiB,CAAC,QAAe,YAAY;IAC3D,OAAO;QACL,GAAG,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE;YACzB,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACnC,OAAO,KAAK,IAAI,IAAI,CAAC;QACvB,CAAC;QACD,GAAG,EAAE,KAAK,EAAE,GAAW,EAAE,KAAa,EAAE,OAAyB,EAAE,EAAE;YACnE,IAAI,OAAO,EAAE,EAAE,KAAK,SAAS,EAAE,CAAC;gBAC9B,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,OAAO,CAAC,EAAE,EAAE,CAAC,CAAC;YAClD,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;YAC9B,CAAC;QACH,CAAC;QACD,GAAG,EAAE,KAAK,EAAE,GAAW,EAAE,EAAE;YACzB,MAAM,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;QACD,IAAI,EAAE,KAAK,EAAE,OAAe,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC;KACrD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/connect.ts"],"names":[],"mappings":"AAIA,wBAAsB,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAe7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { getMcpResourceUrl, loadHostedDeploymentFromEnv } from '../../index.js';
|
|
2
|
+
import { buildClaudeConnectorInstallUrl } from '../claude-connect.js';
|
|
3
|
+
import { resolveRequestOrigin } from '../page-styles.js';
|
|
4
|
+
export async function GET() {
|
|
5
|
+
const origin = await resolveRequestOrigin();
|
|
6
|
+
let displayName = 'cms-edit';
|
|
7
|
+
let mcpUrl = `${origin}/api/mcp`;
|
|
8
|
+
try {
|
|
9
|
+
const deployment = loadHostedDeploymentFromEnv();
|
|
10
|
+
displayName = `cms-edit (${process.env['CMS_EDIT_DISPLAY_NAME'] ?? deployment.projectKey})`;
|
|
11
|
+
mcpUrl = getMcpResourceUrl();
|
|
12
|
+
}
|
|
13
|
+
catch {
|
|
14
|
+
// partial env during local dev
|
|
15
|
+
}
|
|
16
|
+
const installUrl = buildClaudeConnectorInstallUrl(mcpUrl, displayName);
|
|
17
|
+
return Response.redirect(installUrl, 302);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/connect.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,8BAA8B,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,MAAM,MAAM,GAAG,MAAM,oBAAoB,EAAE,CAAC;IAC5C,IAAI,WAAW,GAAG,UAAU,CAAC;IAC7B,IAAI,MAAM,GAAG,GAAG,MAAM,UAAU,CAAC;IAEjC,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,2BAA2B,EAAE,CAAC;QACjD,WAAW,GAAG,aAAa,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,IAAI,UAAU,CAAC,UAAU,GAAG,CAAC;QAC5F,MAAM,GAAG,iBAAiB,EAAE,CAAC;IAC/B,CAAC;IAAC,MAAM,CAAC;QACP,+BAA+B;IACjC,CAAC;IAED,MAAM,UAAU,GAAG,8BAA8B,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACvE,OAAO,QAAQ,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/health.ts"],"names":[],"mappings":"AAeA,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAqD7D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { GETTING_STARTED_INFO, getMcpResourceUrl, getVersionInfo, handleOAuthHealthCheck, loadHostedDeploymentFromEnv, } from '../../index.js';
|
|
2
|
+
import { upstashRedis } from '../redis.js';
|
|
3
|
+
export async function GET(request) {
|
|
4
|
+
const deployment = loadHostedDeploymentFromEnv();
|
|
5
|
+
const checks = {
|
|
6
|
+
config: {
|
|
7
|
+
ok: Boolean(process.env['CONTENTFUL_SPACE_ID']),
|
|
8
|
+
detail: process.env['CONTENTFUL_SPACE_ID'] ? 'CONTENTFUL_SPACE_ID is set' : 'Missing',
|
|
9
|
+
},
|
|
10
|
+
redis: { ok: false, detail: 'Not checked' },
|
|
11
|
+
oauth: { ok: false, detail: 'Not checked' },
|
|
12
|
+
};
|
|
13
|
+
try {
|
|
14
|
+
const probeKey = 'cms-edit:health-probe';
|
|
15
|
+
await upstashRedis.set(probeKey, 'ok', { ex: 30 });
|
|
16
|
+
const value = await upstashRedis.get(probeKey);
|
|
17
|
+
checks.redis = {
|
|
18
|
+
ok: value === 'ok',
|
|
19
|
+
detail: value === 'ok' ? 'Redis read/write OK' : 'Redis probe failed',
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
checks.redis = {
|
|
24
|
+
ok: false,
|
|
25
|
+
detail: err instanceof Error ? err.message : String(err),
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
checks.oauth = await handleOAuthHealthCheck();
|
|
29
|
+
const ok = checks.config.ok && checks.redis.ok && checks.oauth.ok;
|
|
30
|
+
const origin = new URL(request.url).origin;
|
|
31
|
+
const landingPageUrl = `${origin}/cms-edit`;
|
|
32
|
+
let mcpUrl = `${origin}/api/mcp`;
|
|
33
|
+
try {
|
|
34
|
+
mcpUrl = getMcpResourceUrl();
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// CMS_EDIT_PUBLIC_ORIGIN may be unset during partial local setup
|
|
38
|
+
}
|
|
39
|
+
return Response.json({
|
|
40
|
+
ok,
|
|
41
|
+
cmsEdit: getVersionInfo(),
|
|
42
|
+
gettingStarted: {
|
|
43
|
+
...GETTING_STARTED_INFO,
|
|
44
|
+
landingPageUrl,
|
|
45
|
+
mcpIntegrationUrl: mcpUrl,
|
|
46
|
+
},
|
|
47
|
+
deployment: { projectKey: deployment.projectKey, spaceId: deployment.spaceId },
|
|
48
|
+
checks,
|
|
49
|
+
}, { status: ok ? 200 : 503 });
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=health.js.map
|
|
@@ -0,0 +1 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1
|
+
import { handleLinkContentfulPost } from '../../index.js';
|
|
2
|
+
import { createOAuthHandlerContext } from '../context.js';
|
|
3
|
+
export async function POST(request) {
|
|
4
|
+
return handleLinkContentfulPost(request, createOAuthHandlerContext());
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=link-contentful.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-contentful.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/link-contentful.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAgB;IACzC,OAAO,wBAAwB,CAAC,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mcp.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/mcp.ts"],"names":[],"mappings":"AAiBA,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE7D;AAED,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE9D;AAED,wBAAsB,MAAM,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAEhE"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { buildHostedConfig, handleHostedMcpRequest, isMcpUnauthorizedError, loadHostedDeploymentFromEnv, RedisSessionStore, resolveContentfulTokenFromRequest, unauthorizedMcpResponse, validatePatForDeployment, } from '../../index.js';
|
|
2
|
+
import { createOAuthHandlerContext } from '../context.js';
|
|
3
|
+
import { getHostedEditorPackPath } from '../editor-pack-path.js';
|
|
4
|
+
import { createRedisClient } from '../redis.js';
|
|
5
|
+
const redisClient = createRedisClient();
|
|
6
|
+
const editorPackPath = getHostedEditorPackPath();
|
|
7
|
+
export async function GET(request) {
|
|
8
|
+
return handleMcp(request);
|
|
9
|
+
}
|
|
10
|
+
export async function POST(request) {
|
|
11
|
+
return handleMcp(request);
|
|
12
|
+
}
|
|
13
|
+
export async function DELETE(request) {
|
|
14
|
+
return handleMcp(request);
|
|
15
|
+
}
|
|
16
|
+
async function handleMcp(request) {
|
|
17
|
+
const oauthCtx = createOAuthHandlerContext();
|
|
18
|
+
let user;
|
|
19
|
+
try {
|
|
20
|
+
const { contentfulToken } = await resolveContentfulTokenFromRequest(request, oauthCtx.store);
|
|
21
|
+
const deployment = loadHostedDeploymentFromEnv();
|
|
22
|
+
user = await validatePatForDeployment(contentfulToken, deployment);
|
|
23
|
+
}
|
|
24
|
+
catch (err) {
|
|
25
|
+
if (isMcpUnauthorizedError(err)) {
|
|
26
|
+
return unauthorizedMcpResponse();
|
|
27
|
+
}
|
|
28
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
29
|
+
return Response.json({ error: message }, { status: 401 });
|
|
30
|
+
}
|
|
31
|
+
try {
|
|
32
|
+
const deployment = loadHostedDeploymentFromEnv();
|
|
33
|
+
const runtimeContext = {
|
|
34
|
+
config: buildHostedConfig(deployment, user.token),
|
|
35
|
+
sessionStore: new RedisSessionStore(redisClient),
|
|
36
|
+
user: { userId: user.userId, email: user.email },
|
|
37
|
+
};
|
|
38
|
+
return await handleHostedMcpRequest(request, {
|
|
39
|
+
resolveContext: async () => runtimeContext,
|
|
40
|
+
getMcpInfo: () => ({
|
|
41
|
+
projectKey: deployment.projectKey,
|
|
42
|
+
displayName: process.env['CMS_EDIT_DISPLAY_NAME'],
|
|
43
|
+
}),
|
|
44
|
+
editorPackPath,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
49
|
+
return Response.json({ error: message }, { status: 500 });
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52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ACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-authorization-server.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-authorization-server.ts"],"names":[],"mappings":"AAEA,wBAAsB,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAE7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-authorization-server.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-authorization-server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yCAAyC,EAAE,MAAM,gBAAgB,CAAC;AAE3E,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,OAAO,yCAAyC,EAAE,CAAC;AACrD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-authorize.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-authorize.ts"],"names":[],"mappings":"AAGA,wBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE7D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { handleOAuthAuthorizeGet } from '../../index.js';
|
|
2
|
+
import { createOAuthHandlerContext } from '../context.js';
|
|
3
|
+
export async function GET(request) {
|
|
4
|
+
return handleOAuthAuthorizeGet(request, createOAuthHandlerContext());
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=oauth-authorize.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-authorize.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-authorize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,OAAgB;IACxC,OAAO,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-protected-resource.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-protected-resource.ts"],"names":[],"mappings":"AAEA,wBAAsB,GAAG,IAAI,OAAO,CAAC,QAAQ,CAAC,CAE7C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-protected-resource.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-protected-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uCAAuC,EAAE,MAAM,gBAAgB,CAAC;AAEzE,MAAM,CAAC,KAAK,UAAU,GAAG;IACvB,OAAO,uCAAuC,EAAE,CAAC;AACnD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-register.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-register.ts"],"names":[],"mappings":"AAGA,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE9D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { handleOAuthRegisterPost } from '../../index.js';
|
|
2
|
+
import { createOAuthHandlerContext } from '../context.js';
|
|
3
|
+
export async function POST(request) {
|
|
4
|
+
return handleOAuthRegisterPost(request, createOAuthHandlerContext());
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=oauth-register.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-register.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-register.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAgB;IACzC,OAAO,uBAAuB,CAAC,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-token.d.ts","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-token.ts"],"names":[],"mappings":"AAGA,wBAAsB,IAAI,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE9D"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { handleOAuthTokenPost } from '../../index.js';
|
|
2
|
+
import { createOAuthHandlerContext } from '../context.js';
|
|
3
|
+
export async function POST(request) {
|
|
4
|
+
return handleOAuthTokenPost(request, createOAuthHandlerContext());
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=oauth-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-token.js","sourceRoot":"","sources":["../../../../src/hosted/next/routes/oauth-token.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,CAAC,KAAK,UAAU,IAAI,CAAC,OAAgB;IACzC,OAAO,oBAAoB,CAAC,OAAO,EAAE,yBAAyB,EAAE,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface StageSiteOptions {
|
|
2
|
+
hostDir: string;
|
|
3
|
+
repoRoot?: string;
|
|
4
|
+
cmsEditRoot?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function resolveCmsEditRoot(hostDir: string, repoRoot: string, cmsEditRoot?: string): string;
|
|
7
|
+
export declare function stageEditorPack(options: StageSiteOptions): {
|
|
8
|
+
projectKey: string;
|
|
9
|
+
skipped: boolean;
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=stage-site.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stage-site.d.ts","sourceRoot":"","sources":["../../../src/hosted/next/stage-site.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAMD,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,WAAW,CAAC,EAAE,MAAM,GACnB,MAAM,CAsBR;AAED,wBAAgB,eAAe,CAAC,OAAO,EAAE,gBAAgB,GAAG;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,OAAO,CAAC;CAClB,CAgCA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cpSync, existsSync, readFileSync, rmSync } from 'node:fs';
|
|
2
|
+
import { join, resolve } from 'node:path';
|
|
3
|
+
function fail(message) {
|
|
4
|
+
throw new Error(message);
|
|
5
|
+
}
|
|
6
|
+
export function resolveCmsEditRoot(hostDir, repoRoot, cmsEditRoot) {
|
|
7
|
+
const hasSingleSiteLayout = existsSync(join(repoRoot, 'cms-edit/project.json'));
|
|
8
|
+
let root = cmsEditRoot ?? process.env['CMS_EDIT_ROOT'];
|
|
9
|
+
if (!root) {
|
|
10
|
+
if (process.env['VERCEL']) {
|
|
11
|
+
fail('CMS_EDIT_ROOT is required on Vercel. Set it on the cms-edit-host project (e.g. cms-edit for single-site, cms-edit/<site> for multi-site).');
|
|
12
|
+
}
|
|
13
|
+
if (hasSingleSiteLayout) {
|
|
14
|
+
root = 'cms-edit';
|
|
15
|
+
}
|
|
16
|
+
else if (existsSync(join(hostDir, 'editor-pack/manifest.json'))) {
|
|
17
|
+
return '';
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
fail('CMS_EDIT_ROOT is required locally. Set it in cms-edit/host/.env.local (e.g. CMS_EDIT_ROOT=cms-edit/pedestal-health).');
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return root;
|
|
24
|
+
}
|
|
25
|
+
export function stageEditorPack(options) {
|
|
26
|
+
const hostDir = resolve(options.hostDir);
|
|
27
|
+
const repoRoot = resolve(options.repoRoot ?? join(hostDir, '../..'));
|
|
28
|
+
const cmsEditRoot = resolveCmsEditRoot(hostDir, repoRoot, options.cmsEditRoot);
|
|
29
|
+
if (!cmsEditRoot) {
|
|
30
|
+
return { projectKey: 'unknown', skipped: true };
|
|
31
|
+
}
|
|
32
|
+
const siteDir = resolve(repoRoot, cmsEditRoot);
|
|
33
|
+
const projectJsonPath = join(siteDir, 'project.json');
|
|
34
|
+
if (!existsSync(projectJsonPath)) {
|
|
35
|
+
fail(`Missing ${projectJsonPath}. Check CMS_EDIT_ROOT (${cmsEditRoot}).`);
|
|
36
|
+
}
|
|
37
|
+
const projectKey = JSON.parse(readFileSync(projectJsonPath, 'utf8')).projectKey;
|
|
38
|
+
if (!projectKey) {
|
|
39
|
+
fail(`projectKey missing in ${projectJsonPath}`);
|
|
40
|
+
}
|
|
41
|
+
const editorPackSrc = join(siteDir, 'editor-pack');
|
|
42
|
+
if (!existsSync(editorPackSrc)) {
|
|
43
|
+
fail(`Missing ${editorPackSrc} — run editor-pack generate for this site, then commit editor-pack/`);
|
|
44
|
+
}
|
|
45
|
+
rmSync(join(hostDir, 'editor-pack'), { force: true, recursive: true });
|
|
46
|
+
cpSync(editorPackSrc, join(hostDir, 'editor-pack'), { recursive: true });
|
|
47
|
+
return { projectKey, skipped: false };
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=stage-site.js.map
|