@kywi-software/mcp 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/LICENSE +661 -0
- package/README.md +77 -0
- package/dist/__tests__/auto-detect.test.d.ts +2 -0
- package/dist/__tests__/auto-detect.test.d.ts.map +1 -0
- package/dist/__tests__/auto-detect.test.js +134 -0
- package/dist/__tests__/auto-detect.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +2 -0
- package/dist/__tests__/config.test.d.ts.map +1 -0
- package/dist/__tests__/config.test.js +72 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/__tests__/developer-mutation.test.d.ts +2 -0
- package/dist/__tests__/developer-mutation.test.d.ts.map +1 -0
- package/dist/__tests__/developer-mutation.test.js +511 -0
- package/dist/__tests__/developer-mutation.test.js.map +1 -0
- package/dist/__tests__/developer-read-only.test.d.ts +2 -0
- package/dist/__tests__/developer-read-only.test.d.ts.map +1 -0
- package/dist/__tests__/developer-read-only.test.js +192 -0
- package/dist/__tests__/developer-read-only.test.js.map +1 -0
- package/dist/__tests__/site-content-tools.test.d.ts +2 -0
- package/dist/__tests__/site-content-tools.test.d.ts.map +1 -0
- package/dist/__tests__/site-content-tools.test.js +446 -0
- package/dist/__tests__/site-content-tools.test.js.map +1 -0
- package/dist/__tests__/site-layout-tools.test.d.ts +2 -0
- package/dist/__tests__/site-layout-tools.test.d.ts.map +1 -0
- package/dist/__tests__/site-layout-tools.test.js +316 -0
- package/dist/__tests__/site-layout-tools.test.js.map +1 -0
- package/dist/__tests__/site-other-tools.test.d.ts +2 -0
- package/dist/__tests__/site-other-tools.test.d.ts.map +1 -0
- package/dist/__tests__/site-other-tools.test.js +318 -0
- package/dist/__tests__/site-other-tools.test.js.map +1 -0
- package/dist/config.d.ts +31 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -0
- package/dist/developer/auto-detect.d.ts +17 -0
- package/dist/developer/auto-detect.d.ts.map +1 -0
- package/dist/developer/auto-detect.js +54 -0
- package/dist/developer/auto-detect.js.map +1 -0
- package/dist/developer/cli.d.ts +3 -0
- package/dist/developer/cli.d.ts.map +1 -0
- package/dist/developer/cli.js +14 -0
- package/dist/developer/cli.js.map +1 -0
- package/dist/developer/index.d.ts +4 -0
- package/dist/developer/index.d.ts.map +1 -0
- package/dist/developer/index.js +9 -0
- package/dist/developer/index.js.map +1 -0
- package/dist/developer/server.d.ts +4 -0
- package/dist/developer/server.d.ts.map +1 -0
- package/dist/developer/server.js +29 -0
- package/dist/developer/server.js.map +1 -0
- package/dist/developer/tools/api-keys.d.ts +48 -0
- package/dist/developer/tools/api-keys.d.ts.map +1 -0
- package/dist/developer/tools/api-keys.js +51 -0
- package/dist/developer/tools/api-keys.js.map +1 -0
- package/dist/developer/tools/config-mutation.d.ts +139 -0
- package/dist/developer/tools/config-mutation.d.ts.map +1 -0
- package/dist/developer/tools/config-mutation.js +277 -0
- package/dist/developer/tools/config-mutation.js.map +1 -0
- package/dist/developer/tools/content-type-tools.d.ts +32 -0
- package/dist/developer/tools/content-type-tools.d.ts.map +1 -0
- package/dist/developer/tools/content-type-tools.js +92 -0
- package/dist/developer/tools/content-type-tools.js.map +1 -0
- package/dist/developer/tools/read-only.d.ts +86 -0
- package/dist/developer/tools/read-only.d.ts.map +1 -0
- package/dist/developer/tools/read-only.js +235 -0
- package/dist/developer/tools/read-only.js.map +1 -0
- package/dist/developer/tools/scaffolding.d.ts +67 -0
- package/dist/developer/tools/scaffolding.d.ts.map +1 -0
- package/dist/developer/tools/scaffolding.js +207 -0
- package/dist/developer/tools/scaffolding.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/shared.d.ts +15 -0
- package/dist/shared.d.ts.map +1 -0
- package/dist/shared.js +7 -0
- package/dist/shared.js.map +1 -0
- package/dist/site/cli.d.ts +3 -0
- package/dist/site/cli.d.ts.map +1 -0
- package/dist/site/cli.js +12 -0
- package/dist/site/cli.js.map +1 -0
- package/dist/site/index.d.ts +4 -0
- package/dist/site/index.d.ts.map +1 -0
- package/dist/site/index.js +9 -0
- package/dist/site/index.js.map +1 -0
- package/dist/site/server.d.ts +10 -0
- package/dist/site/server.d.ts.map +1 -0
- package/dist/site/server.js +73 -0
- package/dist/site/server.js.map +1 -0
- package/dist/site/tools/content.d.ts +250 -0
- package/dist/site/tools/content.d.ts.map +1 -0
- package/dist/site/tools/content.js +329 -0
- package/dist/site/tools/content.js.map +1 -0
- package/dist/site/tools/feeds.d.ts +62 -0
- package/dist/site/tools/feeds.d.ts.map +1 -0
- package/dist/site/tools/feeds.js +97 -0
- package/dist/site/tools/feeds.js.map +1 -0
- package/dist/site/tools/layout.d.ts +163 -0
- package/dist/site/tools/layout.d.ts.map +1 -0
- package/dist/site/tools/layout.js +226 -0
- package/dist/site/tools/layout.js.map +1 -0
- package/dist/site/tools/media.d.ts +38 -0
- package/dist/site/tools/media.d.ts.map +1 -0
- package/dist/site/tools/media.js +52 -0
- package/dist/site/tools/media.js.map +1 -0
- package/dist/site/tools/search.d.ts +40 -0
- package/dist/site/tools/search.d.ts.map +1 -0
- package/dist/site/tools/search.js +60 -0
- package/dist/site/tools/search.js.map +1 -0
- package/dist/site/tools/users.d.ts +60 -0
- package/dist/site/tools/users.d.ts.map +1 -0
- package/dist/site/tools/users.js +71 -0
- package/dist/site/tools/users.js.map +1 -0
- package/dist/site/tools/webhooks.d.ts +34 -0
- package/dist/site/tools/webhooks.d.ts.map +1 -0
- package/dist/site/tools/webhooks.js +44 -0
- package/dist/site/tools/webhooks.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { KywiHttpClient } from '@kywi-software/sdk';
|
|
3
|
+
import type { KywiConfig } from '@kywi-software/core';
|
|
4
|
+
export interface ReadOnlyContext {
|
|
5
|
+
mode: 'filesystem' | 'api';
|
|
6
|
+
configPath?: string | undefined;
|
|
7
|
+
http?: KywiHttpClient | undefined;
|
|
8
|
+
/** Resolved KywiConfig object — when provided, used for richer config summaries */
|
|
9
|
+
config?: KywiConfig | undefined;
|
|
10
|
+
}
|
|
11
|
+
export declare function handleGetConfigSummary(ctx: ReadOnlyContext): Promise<{
|
|
12
|
+
content: [{
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
}];
|
|
16
|
+
isError?: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
content: [{
|
|
19
|
+
type: "text";
|
|
20
|
+
text: string;
|
|
21
|
+
}];
|
|
22
|
+
isError: true;
|
|
23
|
+
}>;
|
|
24
|
+
export declare function handleGetContentTypes(ctx: ReadOnlyContext): Promise<{
|
|
25
|
+
content: [{
|
|
26
|
+
type: "text";
|
|
27
|
+
text: string;
|
|
28
|
+
}];
|
|
29
|
+
isError?: undefined;
|
|
30
|
+
} | {
|
|
31
|
+
content: [{
|
|
32
|
+
type: "text";
|
|
33
|
+
text: string;
|
|
34
|
+
}];
|
|
35
|
+
isError: true;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function handleGetThemes(ctx: ReadOnlyContext): Promise<{
|
|
38
|
+
content: [{
|
|
39
|
+
type: "text";
|
|
40
|
+
text: string;
|
|
41
|
+
}];
|
|
42
|
+
isError?: undefined;
|
|
43
|
+
} | {
|
|
44
|
+
content: [{
|
|
45
|
+
type: "text";
|
|
46
|
+
text: string;
|
|
47
|
+
}];
|
|
48
|
+
isError: true;
|
|
49
|
+
}>;
|
|
50
|
+
export declare function handleGetModules(ctx: ReadOnlyContext): Promise<{
|
|
51
|
+
content: [{
|
|
52
|
+
type: "text";
|
|
53
|
+
text: string;
|
|
54
|
+
}];
|
|
55
|
+
isError?: undefined;
|
|
56
|
+
} | {
|
|
57
|
+
content: [{
|
|
58
|
+
type: "text";
|
|
59
|
+
text: string;
|
|
60
|
+
}];
|
|
61
|
+
isError: true;
|
|
62
|
+
}>;
|
|
63
|
+
export declare function handleGetPlugins(ctx: ReadOnlyContext): Promise<{
|
|
64
|
+
content: [{
|
|
65
|
+
type: "text";
|
|
66
|
+
text: string;
|
|
67
|
+
}];
|
|
68
|
+
isError?: undefined;
|
|
69
|
+
} | {
|
|
70
|
+
content: [{
|
|
71
|
+
type: "text";
|
|
72
|
+
text: string;
|
|
73
|
+
}];
|
|
74
|
+
isError: true;
|
|
75
|
+
}>;
|
|
76
|
+
export declare function handlePreviewSchema(ctx: ReadOnlyContext, args: {
|
|
77
|
+
contentTypeName?: string | undefined;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
content: [{
|
|
80
|
+
type: "text";
|
|
81
|
+
text: string;
|
|
82
|
+
}];
|
|
83
|
+
isError?: undefined;
|
|
84
|
+
}>;
|
|
85
|
+
export declare function registerReadOnlyTools(server: McpServer, ctx: ReadOnlyContext): void;
|
|
86
|
+
//# sourceMappingURL=read-only.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-only.d.ts","sourceRoot":"","sources":["../../../src/developer/tools/read-only.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAGxD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAIrD,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,YAAY,GAAG,KAAK,CAAA;IAC1B,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAC/B,IAAI,CAAC,EAAE,cAAc,GAAG,SAAS,CAAA;IACjC,mFAAmF;IACnF,MAAM,CAAC,EAAE,UAAU,GAAG,SAAS,CAAA;CAChC;AAUD,wBAAsB,sBAAsB,CAAC,GAAG,EAAE,eAAe;;;;;;;;;;;;GAwDhE;AAED,wBAAsB,qBAAqB,CAAC,GAAG,EAAE,eAAe;;;;;;;;;;;;GAe/D;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,eAAe;;;;;;;;;;;;GAczD;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,eAAe;;;;;;;;;;;;GAc1D;AAED,wBAAsB,gBAAgB,CAAC,GAAG,EAAE,eAAe;;;;;;;;;;;;GAc1D;AAED,wBAAsB,mBAAmB,CACvC,GAAG,EAAE,eAAe,EACpB,IAAI,EAAE;IAAE,eAAe,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE;;;;;;GAqG/C;AAID,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,EAAE,eAAe,GAAG,IAAI,CAgCnF"}
|
|
@@ -0,0 +1,235 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
import { textResult, errorResult } from '../../shared.js';
|
|
4
|
+
import { exportConfigAsJson } from '@kywi-software/core';
|
|
5
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
6
|
+
function readConfig(configPath) {
|
|
7
|
+
return readFileSync(configPath, 'utf-8');
|
|
8
|
+
}
|
|
9
|
+
// ─── Exported handler functions (testable without server) ─────────────────
|
|
10
|
+
export async function handleGetConfigSummary(ctx) {
|
|
11
|
+
// Prefer the resolved config object for a rich, structured summary
|
|
12
|
+
if (ctx.config) {
|
|
13
|
+
const exported = exportConfigAsJson(ctx.config);
|
|
14
|
+
return textResult({
|
|
15
|
+
mode: ctx.mode,
|
|
16
|
+
source: 'config-object',
|
|
17
|
+
summary: {
|
|
18
|
+
mode: exported.mode,
|
|
19
|
+
db: exported.db,
|
|
20
|
+
auth: exported.auth,
|
|
21
|
+
siteCount: Array.isArray(exported.sites) ? exported.sites.length : 0,
|
|
22
|
+
contentTypeCount: Array.isArray(exported.contentTypes) ? exported.contentTypes.length : 0,
|
|
23
|
+
moduleCount: Array.isArray(exported.modules) ? exported.modules.length : 0,
|
|
24
|
+
pluginCount: Array.isArray(exported.plugins) ? exported.plugins.length : 0,
|
|
25
|
+
themeCount: Array.isArray(exported.themes) ? exported.themes.length : 0,
|
|
26
|
+
contentTypes: Array.isArray(exported.contentTypes)
|
|
27
|
+
? exported.contentTypes.map(ct => ({
|
|
28
|
+
name: ct['name'],
|
|
29
|
+
label: ct['label'],
|
|
30
|
+
baseType: ct['baseType'],
|
|
31
|
+
fieldCount: Array.isArray(ct['fields']) ? ct['fields'].length : 0,
|
|
32
|
+
}))
|
|
33
|
+
: [],
|
|
34
|
+
cache: exported.cache,
|
|
35
|
+
media: exported.media,
|
|
36
|
+
},
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
if (ctx.mode === 'filesystem' && ctx.configPath) {
|
|
40
|
+
const raw = readConfig(ctx.configPath);
|
|
41
|
+
const contentTypeMatches = raw.match(/defineContentType\s*\(/g);
|
|
42
|
+
const themeMatches = raw.match(/defineTheme\s*\(/g);
|
|
43
|
+
const pluginMatches = raw.match(/definePlugin\s*\(/g);
|
|
44
|
+
return textResult({
|
|
45
|
+
mode: 'filesystem',
|
|
46
|
+
configPath: ctx.configPath,
|
|
47
|
+
contentTypes: contentTypeMatches ? contentTypeMatches.length : 0,
|
|
48
|
+
themes: themeMatches ? themeMatches.length : 0,
|
|
49
|
+
plugins: pluginMatches ? pluginMatches.length : 0,
|
|
50
|
+
rawLength: raw.length,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (ctx.mode === 'api' && ctx.http) {
|
|
54
|
+
const contentTypes = await ctx.http.get('/config/content-types');
|
|
55
|
+
const sites = await ctx.http.get('/config/sites');
|
|
56
|
+
return textResult({
|
|
57
|
+
mode: 'api',
|
|
58
|
+
contentTypes: Array.isArray(contentTypes) ? contentTypes.length : 0,
|
|
59
|
+
sites: Array.isArray(sites) ? sites.length : 0,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return errorResult('No config source available');
|
|
63
|
+
}
|
|
64
|
+
export async function handleGetContentTypes(ctx) {
|
|
65
|
+
if (ctx.mode === 'filesystem' && ctx.configPath) {
|
|
66
|
+
const raw = readConfig(ctx.configPath);
|
|
67
|
+
// Extract content type definitions for inspection
|
|
68
|
+
const matches = [...raw.matchAll(/defineContentType\s*\(\s*(['"`])(\w+)\1/g)];
|
|
69
|
+
const names = matches.map((m) => m[2]);
|
|
70
|
+
return textResult({ mode: 'filesystem', contentTypes: names, source: ctx.configPath });
|
|
71
|
+
}
|
|
72
|
+
if (ctx.mode === 'api' && ctx.http) {
|
|
73
|
+
const data = await ctx.http.get('/config/content-types');
|
|
74
|
+
return textResult({ mode: 'api', contentTypes: data });
|
|
75
|
+
}
|
|
76
|
+
return errorResult('No config source available');
|
|
77
|
+
}
|
|
78
|
+
export async function handleGetThemes(ctx) {
|
|
79
|
+
if (ctx.mode === 'filesystem' && ctx.configPath) {
|
|
80
|
+
const raw = readConfig(ctx.configPath);
|
|
81
|
+
const matches = [...raw.matchAll(/defineTheme\s*\(\s*(['"`])(\w+)\1/g)];
|
|
82
|
+
const names = matches.map((m) => m[2]);
|
|
83
|
+
return textResult({ mode: 'filesystem', themes: names, source: ctx.configPath });
|
|
84
|
+
}
|
|
85
|
+
if (ctx.mode === 'api' && ctx.http) {
|
|
86
|
+
const data = await ctx.http.get('/config/themes');
|
|
87
|
+
return textResult({ mode: 'api', themes: data });
|
|
88
|
+
}
|
|
89
|
+
return errorResult('No config source available');
|
|
90
|
+
}
|
|
91
|
+
export async function handleGetModules(ctx) {
|
|
92
|
+
if (ctx.mode === 'filesystem' && ctx.configPath) {
|
|
93
|
+
const raw = readConfig(ctx.configPath);
|
|
94
|
+
const matches = [...raw.matchAll(/defineModule\s*\(\s*(['"`])(\w+)\1/g)];
|
|
95
|
+
const names = matches.map((m) => m[2]);
|
|
96
|
+
return textResult({ mode: 'filesystem', modules: names, source: ctx.configPath });
|
|
97
|
+
}
|
|
98
|
+
if (ctx.mode === 'api' && ctx.http) {
|
|
99
|
+
const data = await ctx.http.get('/config/modules');
|
|
100
|
+
return textResult({ mode: 'api', modules: data });
|
|
101
|
+
}
|
|
102
|
+
return errorResult('No config source available');
|
|
103
|
+
}
|
|
104
|
+
export async function handleGetPlugins(ctx) {
|
|
105
|
+
if (ctx.mode === 'filesystem' && ctx.configPath) {
|
|
106
|
+
const raw = readConfig(ctx.configPath);
|
|
107
|
+
const matches = [...raw.matchAll(/definePlugin\s*\(\s*(['"`])(\w+)\1/g)];
|
|
108
|
+
const names = matches.map((m) => m[2]);
|
|
109
|
+
return textResult({ mode: 'filesystem', plugins: names, source: ctx.configPath });
|
|
110
|
+
}
|
|
111
|
+
if (ctx.mode === 'api' && ctx.http) {
|
|
112
|
+
const data = await ctx.http.get('/config/plugins');
|
|
113
|
+
return textResult({ mode: 'api', plugins: data });
|
|
114
|
+
}
|
|
115
|
+
return errorResult('No config source available');
|
|
116
|
+
}
|
|
117
|
+
export async function handlePreviewSchema(ctx, args) {
|
|
118
|
+
if (ctx.mode === 'filesystem' && ctx.configPath) {
|
|
119
|
+
const raw = readConfig(ctx.configPath);
|
|
120
|
+
if (args.contentTypeName) {
|
|
121
|
+
// Extract the specific content type block
|
|
122
|
+
const typePattern = new RegExp(`defineContentType\\s*\\(\\s*['"\`]${args.contentTypeName}['"\`]\\s*,\\s*(\\{[\\s\\S]*?\\})\\s*\\)`);
|
|
123
|
+
const match = typePattern.exec(raw);
|
|
124
|
+
if (!match) {
|
|
125
|
+
return textResult({
|
|
126
|
+
mode: 'filesystem',
|
|
127
|
+
contentTypeName: args.contentTypeName,
|
|
128
|
+
found: false,
|
|
129
|
+
note: `Content type '${args.contentTypeName}' not found in config. Use get_content_types to list available types.`,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// Extract field definitions from the block
|
|
133
|
+
const block = match[1] ?? '';
|
|
134
|
+
const fieldMatches = [
|
|
135
|
+
...block.matchAll(/\{\s*name\s*:\s*['"`](\w+)['"`]\s*,\s*type\s*:\s*['"`](\w+)['"`](?:\s*,\s*label\s*:\s*['"`]([^'"`]+)['"`])?(?:\s*,\s*required\s*:\s*(true|false))?/g),
|
|
136
|
+
];
|
|
137
|
+
const fields = fieldMatches.map((m) => ({
|
|
138
|
+
name: m[1],
|
|
139
|
+
type: m[2],
|
|
140
|
+
label: m[3] ?? m[1],
|
|
141
|
+
required: m[4] === 'true',
|
|
142
|
+
}));
|
|
143
|
+
// Map config field types to Drizzle column descriptors
|
|
144
|
+
const typeMap = {
|
|
145
|
+
text: 'text()',
|
|
146
|
+
textarea: 'text()',
|
|
147
|
+
richText: 'text()',
|
|
148
|
+
slug: 'varchar(255)',
|
|
149
|
+
number: 'integer()',
|
|
150
|
+
boolean: 'boolean()',
|
|
151
|
+
date: 'timestamp({ withTimezone: true })',
|
|
152
|
+
image: 'uuid() /* FK → kywi_media */',
|
|
153
|
+
file: 'uuid() /* FK → kywi_media */',
|
|
154
|
+
relationship: 'uuid() /* FK → kywi_content */',
|
|
155
|
+
select: 'text()',
|
|
156
|
+
multiSelect: 'jsonb()',
|
|
157
|
+
color: 'varchar(20)',
|
|
158
|
+
json: 'jsonb()',
|
|
159
|
+
};
|
|
160
|
+
const schemaColumns = fields.map((f) => ({
|
|
161
|
+
field: f.name,
|
|
162
|
+
label: f.label,
|
|
163
|
+
type: f.type,
|
|
164
|
+
drizzleType: typeMap[f.type ?? ''] ?? 'text()',
|
|
165
|
+
required: f.required,
|
|
166
|
+
nullable: !f.required,
|
|
167
|
+
}));
|
|
168
|
+
return textResult({
|
|
169
|
+
mode: 'filesystem',
|
|
170
|
+
contentTypeName: args.contentTypeName,
|
|
171
|
+
found: true,
|
|
172
|
+
tableName: `kywi_content (contentTypeName = '${args.contentTypeName}')`,
|
|
173
|
+
note: 'Kywi stores all content in the unified kywi_content table. Custom fields are mixed in at the application layer.',
|
|
174
|
+
inferredColumns: schemaColumns,
|
|
175
|
+
source: ctx.configPath,
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
// No specific type — return overview of all types
|
|
179
|
+
const matches = [...raw.matchAll(/defineContentType\s*\(\s*(['"`])(\w+)\1/g)];
|
|
180
|
+
const names = matches.map((m) => m[2]);
|
|
181
|
+
return textResult({
|
|
182
|
+
mode: 'filesystem',
|
|
183
|
+
note: "Pass contentTypeName to inspect a specific type's schema. All types share the kywi_content table.",
|
|
184
|
+
availableTypes: names,
|
|
185
|
+
source: ctx.configPath,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
if (ctx.mode === 'api' && ctx.http) {
|
|
189
|
+
try {
|
|
190
|
+
const contentTypes = await ctx.http.get('/config/content-types');
|
|
191
|
+
return textResult({
|
|
192
|
+
mode: 'api',
|
|
193
|
+
contentTypes,
|
|
194
|
+
note: 'Schema is derived at runtime. Use contentTypeName parameter to see field-level detail.',
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
catch (err) {
|
|
198
|
+
return textResult({ mode: 'api', note: 'Schema preview via API not available.', error: String(err) });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return textResult({
|
|
202
|
+
mode: ctx.mode,
|
|
203
|
+
note: 'Schema preview is only available in filesystem or api mode.',
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
// ─── Registration ─────────────────────────────────────────────────────────────
|
|
207
|
+
export function registerReadOnlyTools(server, ctx) {
|
|
208
|
+
server.registerTool('get_config_summary', {
|
|
209
|
+
description: 'Get a summary of the Kywi configuration (content types, themes, plugins)',
|
|
210
|
+
inputSchema: {},
|
|
211
|
+
}, async () => handleGetConfigSummary(ctx));
|
|
212
|
+
server.registerTool('get_content_types', {
|
|
213
|
+
description: 'List all defined content types from the Kywi configuration',
|
|
214
|
+
inputSchema: {},
|
|
215
|
+
}, async () => handleGetContentTypes(ctx));
|
|
216
|
+
server.registerTool('get_themes', {
|
|
217
|
+
description: 'List all defined themes from the Kywi configuration',
|
|
218
|
+
inputSchema: {},
|
|
219
|
+
}, async () => handleGetThemes(ctx));
|
|
220
|
+
server.registerTool('get_modules', {
|
|
221
|
+
description: 'List all defined modules from the Kywi configuration',
|
|
222
|
+
inputSchema: {},
|
|
223
|
+
}, async () => handleGetModules(ctx));
|
|
224
|
+
server.registerTool('get_plugins', {
|
|
225
|
+
description: 'List all defined plugins from the Kywi configuration',
|
|
226
|
+
inputSchema: {},
|
|
227
|
+
}, async () => handleGetPlugins(ctx));
|
|
228
|
+
server.registerTool('preview_schema', {
|
|
229
|
+
description: 'Preview the Drizzle schema definition for a content type — shows table structure, columns, and inferred types',
|
|
230
|
+
inputSchema: {
|
|
231
|
+
contentTypeName: z.string().optional().describe('Content type name to inspect (omit to list all available types)'),
|
|
232
|
+
},
|
|
233
|
+
}, async (args) => handlePreviewSchema(ctx, args));
|
|
234
|
+
}
|
|
235
|
+
//# sourceMappingURL=read-only.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read-only.js","sourceRoot":"","sources":["../../../src/developer/tools/read-only.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AACtC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AAaxD,gFAAgF;AAEhF,SAAS,UAAU,CAAC,UAAkB;IACpC,OAAO,YAAY,CAAC,UAAU,EAAE,OAAO,CAAC,CAAA;AAC1C,CAAC;AAED,6EAA6E;AAE7E,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAAC,GAAoB;IAC/D,mEAAmE;IACnE,IAAI,GAAG,CAAC,MAAM,EAAE,CAAC;QACf,MAAM,QAAQ,GAAG,kBAAkB,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;QAC/C,OAAO,UAAU,CAAC;YAChB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,eAAe;YACvB,OAAO,EAAE;gBACP,IAAI,EA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CAAA;IAE1C,MAAM,CAAC,YAAY,CAAC,YAAY,EAAE;QAChC,WAAW,EAAE,qDAAqD;QAClE,WAAW,EAAE,EAAE;KAChB,EAAE,KAAK,IAAI,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAA;IAEpC,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE;QACjC,WAAW,EAAE,sDAAsD;QACnE,WAAW,EAAE,EAAE;KAChB,EAAE,KAAK,IAAI,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAA;IAErC,MAAM,CAAC,YAAY,CAAC,aAAa,EAAE;QACjC,WAAW,EAAE,sDAAsD;QACnE,WAAW,EAAE,EAAE;KAChB,EAAE,KAAK,IAAI,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAA;IAErC,MAAM,CAAC,YAAY,CAAC,gBAAgB,EAAE;QACpC,WAAW,EAAE,+GAA+G;QAC5H,WAAW,EAAE;YACX,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,iEAAiE,CAAC;SACnH;KACF,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,mBAAmB,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC,CAAA;AACpD,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { KywiSdkScope } from '@kywi-software/sdk';
|
|
3
|
+
export declare function handleScaffoldSiteStructure(sdk: KywiSdkScope, args: {
|
|
4
|
+
siteType: string;
|
|
5
|
+
siteId: string;
|
|
6
|
+
}): Promise<{
|
|
7
|
+
content: [{
|
|
8
|
+
type: "text";
|
|
9
|
+
text: string;
|
|
10
|
+
}];
|
|
11
|
+
isError?: undefined;
|
|
12
|
+
} | {
|
|
13
|
+
content: [{
|
|
14
|
+
type: "text";
|
|
15
|
+
text: string;
|
|
16
|
+
}];
|
|
17
|
+
isError: true;
|
|
18
|
+
}>;
|
|
19
|
+
export declare function handleScaffoldContentType(_sdk: KywiSdkScope, args: {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
}): Promise<{
|
|
23
|
+
content: [{
|
|
24
|
+
type: "text";
|
|
25
|
+
text: string;
|
|
26
|
+
}];
|
|
27
|
+
isError?: undefined;
|
|
28
|
+
}>;
|
|
29
|
+
export declare function handleScaffoldTheme(_sdk: KywiSdkScope, args: {
|
|
30
|
+
name: string;
|
|
31
|
+
description: string;
|
|
32
|
+
regions?: string[] | undefined;
|
|
33
|
+
}): Promise<{
|
|
34
|
+
content: [{
|
|
35
|
+
type: "text";
|
|
36
|
+
text: string;
|
|
37
|
+
}];
|
|
38
|
+
isError?: undefined;
|
|
39
|
+
}>;
|
|
40
|
+
export declare function handleSeedContent(sdk: KywiSdkScope, args: {
|
|
41
|
+
type: string;
|
|
42
|
+
count: number;
|
|
43
|
+
siteId: string;
|
|
44
|
+
}): Promise<{
|
|
45
|
+
content: [{
|
|
46
|
+
type: "text";
|
|
47
|
+
text: string;
|
|
48
|
+
}];
|
|
49
|
+
isError?: undefined;
|
|
50
|
+
}>;
|
|
51
|
+
export declare function handleScaffoldComponent(_sdk: KywiSdkScope, args: {
|
|
52
|
+
moduleName: string;
|
|
53
|
+
description: string;
|
|
54
|
+
props?: Array<{
|
|
55
|
+
name: string;
|
|
56
|
+
type: string;
|
|
57
|
+
label: string;
|
|
58
|
+
}> | undefined;
|
|
59
|
+
}): Promise<{
|
|
60
|
+
content: [{
|
|
61
|
+
type: "text";
|
|
62
|
+
text: string;
|
|
63
|
+
}];
|
|
64
|
+
isError?: undefined;
|
|
65
|
+
}>;
|
|
66
|
+
export declare function registerScaffoldingTools(server: McpServer, sdk: KywiSdkScope): void;
|
|
67
|
+
//# sourceMappingURL=scaffolding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffolding.d.ts","sourceRoot":"","s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-0,0 +1,207 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { textResult, errorResult } from '../../shared.js';
|
|
3
|
+
const siteTemplates = {
|
|
4
|
+
corporate: [
|
|
5
|
+
{ title: 'Home', slug: 'home', type: 'page' },
|
|
6
|
+
{ title: 'About', slug: 'about', type: 'page' },
|
|
7
|
+
{ title: 'Services', slug: 'services', type: 'page' },
|
|
8
|
+
{ title: 'Contact', slug: 'contact', type: 'page' },
|
|
9
|
+
{ title: 'Blog', slug: 'blog', type: 'folder' },
|
|
10
|
+
],
|
|
11
|
+
blog: [
|
|
12
|
+
{ title: 'Home', slug: 'home', type: 'page' },
|
|
13
|
+
{ title: 'Posts', slug: 'posts', type: 'folder' },
|
|
14
|
+
{ title: 'About', slug: 'about', type: 'page' },
|
|
15
|
+
],
|
|
16
|
+
portfolio: [
|
|
17
|
+
{ title: 'Home', slug: 'home', type: 'page' },
|
|
18
|
+
{ title: 'Projects', slug: 'projects', type: 'folder' },
|
|
19
|
+
{ title: 'About', slug: 'about', type: 'page' },
|
|
20
|
+
{ title: 'Contact', slug: 'contact', type: 'page' },
|
|
21
|
+
],
|
|
22
|
+
ecommerce: [
|
|
23
|
+
{ title: 'Home', slug: 'home', type: 'page' },
|
|
24
|
+
{ title: 'Products', slug: 'products', type: 'folder' },
|
|
25
|
+
{ title: 'Categories', slug: 'categories', type: 'folder' },
|
|
26
|
+
{ title: 'Cart', slug: 'cart', type: 'page' },
|
|
27
|
+
{ title: 'About', slug: 'about', type: 'page' },
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
// ─── Exported handler functions (testable without server) ─────────────────
|
|
31
|
+
export async function handleScaffoldSiteStructure(sdk, args) {
|
|
32
|
+
const template = siteTemplates[args.siteType];
|
|
33
|
+
if (!template) {
|
|
34
|
+
return errorResult(`Unknown site type: ${args.siteType}. Valid types: ${Object.keys(siteTemplates).join(', ')}`);
|
|
35
|
+
}
|
|
36
|
+
const created = [];
|
|
37
|
+
const errors = [];
|
|
38
|
+
for (const page of template) {
|
|
39
|
+
try {
|
|
40
|
+
const item = await sdk.content.create('page', {
|
|
41
|
+
title: page.title,
|
|
42
|
+
slug: page.slug,
|
|
43
|
+
contentType: page.type,
|
|
44
|
+
siteId: args.siteId,
|
|
45
|
+
status: 'draft',
|
|
46
|
+
}, args.siteId);
|
|
47
|
+
created.push(item);
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
errors.push({ page: page.title, error: err instanceof Error ? err.message : String(err) });
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return textResult({ siteType: args.siteType, created: created.length, errors, pages: template.map((p) => p.title) });
|
|
54
|
+
}
|
|
55
|
+
export async function handleScaffoldContentType(_sdk, args) {
|
|
56
|
+
// Return a suggested config block for the AI agent to apply via add_content_type
|
|
57
|
+
const suggestion = {
|
|
58
|
+
name: args.name,
|
|
59
|
+
label: args.name.charAt(0).toUpperCase() + args.name.slice(1),
|
|
60
|
+
baseType: 'page',
|
|
61
|
+
fields: [
|
|
62
|
+
{ name: 'title', type: 'text', label: 'Title', required: true },
|
|
63
|
+
{ name: 'slug', type: 'text', label: 'URL Slug', required: true },
|
|
64
|
+
{ name: 'body', type: 'richtext', label: 'Body' },
|
|
65
|
+
{ name: 'featuredImage', type: 'image', label: 'Featured Image' },
|
|
66
|
+
{ name: 'metaTitle', type: 'text', label: 'Meta Title' },
|
|
67
|
+
{ name: 'metaDescription', type: 'text', label: 'Meta Description' },
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
return textResult({
|
|
71
|
+
suggestion,
|
|
72
|
+
description: args.description,
|
|
73
|
+
note: 'This is a suggested content type scaffold. Call add_content_type with the suggestion (or modify it) to apply.',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export async function handleScaffoldTheme(_sdk, args) {
|
|
77
|
+
const regions = args.regions ?? ['header', 'main', 'sidebar', 'footer'];
|
|
78
|
+
return textResult({
|
|
79
|
+
suggestion: {
|
|
80
|
+
name: args.name,
|
|
81
|
+
label: args.name.charAt(0).toUpperCase() + args.name.slice(1),
|
|
82
|
+
regions,
|
|
83
|
+
},
|
|
84
|
+
description: args.description,
|
|
85
|
+
note: 'This is a suggested theme scaffold. Call add_theme with the suggestion (or modify it) to apply.',
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
export async function handleSeedContent(sdk, args) {
|
|
89
|
+
const created = [];
|
|
90
|
+
const errors = [];
|
|
91
|
+
for (let i = 0; i < args.count; i++) {
|
|
92
|
+
try {
|
|
93
|
+
const item = await sdk.content.create(args.type, {
|
|
94
|
+
title: `Sample ${args.type} ${i + 1}`,
|
|
95
|
+
slug: `sample-${args.type}-${i + 1}`,
|
|
96
|
+
body: `This is sample ${args.type} content item ${i + 1}. Auto-generated for development.`,
|
|
97
|
+
status: 'draft',
|
|
98
|
+
siteId: args.siteId,
|
|
99
|
+
}, args.siteId);
|
|
100
|
+
created.push(item);
|
|
101
|
+
}
|
|
102
|
+
catch (err) {
|
|
103
|
+
errors.push({ index: i, error: err instanceof Error ? err.message : String(err) });
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return textResult({ type: args.type, created: created.length, requested: args.count, errors });
|
|
107
|
+
}
|
|
108
|
+
export async function handleScaffoldComponent(_sdk, args) {
|
|
109
|
+
const props = args.props ?? [
|
|
110
|
+
{ name: 'title', type: 'string', label: 'Title' },
|
|
111
|
+
{ name: 'body', type: 'string', label: 'Body' },
|
|
112
|
+
];
|
|
113
|
+
const interfaceName = args.moduleName.charAt(0).toUpperCase() + args.moduleName.slice(1) + 'Props';
|
|
114
|
+
const componentName = args.moduleName.charAt(0).toUpperCase() + args.moduleName.slice(1);
|
|
115
|
+
// Build the props interface lines
|
|
116
|
+
const propLines = props.map((p) => {
|
|
117
|
+
const tsType = p.type === 'boolean' ? 'boolean' : p.type === 'number' ? 'number' : 'string';
|
|
118
|
+
return ` /** ${p.label} */\n ${p.name}: ${tsType}`;
|
|
119
|
+
});
|
|
120
|
+
const destructured = props.map((p) => p.name).join(', ');
|
|
121
|
+
const template = [
|
|
122
|
+
`import React from 'react'`,
|
|
123
|
+
``,
|
|
124
|
+
`// ─── Props ───────────────────────────────────────────────────────────────────`,
|
|
125
|
+
``,
|
|
126
|
+
`export interface ${interfaceName} {`,
|
|
127
|
+
...propLines,
|
|
128
|
+
`}`,
|
|
129
|
+
``,
|
|
130
|
+
`// ─── Component ───────────────────────────────────────────────────────────────`,
|
|
131
|
+
``,
|
|
132
|
+
`export function ${componentName}({ ${destructured} }: ${interfaceName}) {`,
|
|
133
|
+
` return (`,
|
|
134
|
+
` <div className="kywi-module kywi-module--${args.moduleName.toLowerCase()}">`,
|
|
135
|
+
` {/* TODO: implement ${componentName} */}`,
|
|
136
|
+
` </div>`,
|
|
137
|
+
` )`,
|
|
138
|
+
`}`,
|
|
139
|
+
``,
|
|
140
|
+
`export default ${componentName}`,
|
|
141
|
+
].join('\n');
|
|
142
|
+
const moduleDefinition = {
|
|
143
|
+
name: args.moduleName,
|
|
144
|
+
label: args.moduleName.charAt(0).toUpperCase() + args.moduleName.slice(1),
|
|
145
|
+
component: `./${componentName}.tsx`,
|
|
146
|
+
props: Object.fromEntries(props.map((p) => [
|
|
147
|
+
p.name,
|
|
148
|
+
{
|
|
149
|
+
type: p.type === 'boolean' ? 'boolean' : p.type === 'number' ? 'number' : 'text',
|
|
150
|
+
label: p.label,
|
|
151
|
+
},
|
|
152
|
+
])),
|
|
153
|
+
};
|
|
154
|
+
return textResult({
|
|
155
|
+
moduleName: args.moduleName,
|
|
156
|
+
description: args.description,
|
|
157
|
+
componentCode: template,
|
|
158
|
+
moduleDefinition,
|
|
159
|
+
note: 'Copy componentCode into your modules directory. Add the moduleDefinition to your kywi.config.ts modules array.',
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// ─── Registration ─────────────────────────────────────────────────────────────
|
|
163
|
+
export function registerScaffoldingTools(server, sdk) {
|
|
164
|
+
server.registerTool('scaffold_site_structure', {
|
|
165
|
+
description: 'Create template content pages for a site based on a predefined structure',
|
|
166
|
+
inputSchema: {
|
|
167
|
+
siteType: z.enum(['corporate', 'blog', 'portfolio', 'ecommerce']).describe('Type of site to scaffold'),
|
|
168
|
+
siteId: z.string().describe('Site ID to create pages in'),
|
|
169
|
+
},
|
|
170
|
+
}, async (args) => handleScaffoldSiteStructure(sdk, args));
|
|
171
|
+
server.registerTool('scaffold_content_type', {
|
|
172
|
+
description: 'Generate a suggested content type definition (does not apply it; use add_content_type to apply)',
|
|
173
|
+
inputSchema: {
|
|
174
|
+
name: z.string().describe('Content type name'),
|
|
175
|
+
description: z.string().describe('Description of what this content type represents'),
|
|
176
|
+
},
|
|
177
|
+
}, async (args) => handleScaffoldContentType(sdk, args));
|
|
178
|
+
server.registerTool('scaffold_theme', {
|
|
179
|
+
description: 'Generate a suggested theme definition with regions (does not apply it; use add_theme to apply)',
|
|
180
|
+
inputSchema: {
|
|
181
|
+
name: z.string().describe('Theme name'),
|
|
182
|
+
description: z.string().describe('Description of the theme'),
|
|
183
|
+
regions: z.array(z.string()).optional().describe('Region names (defaults to header, main, sidebar, footer)'),
|
|
184
|
+
},
|
|
185
|
+
}, async (args) => handleScaffoldTheme(sdk, args));
|
|
186
|
+
server.registerTool('seed_content', {
|
|
187
|
+
description: 'Create sample content items for development and testing',
|
|
188
|
+
inputSchema: {
|
|
189
|
+
type: z.string().describe('Content type name'),
|
|
190
|
+
count: z.number().min(1).max(100).describe('Number of items to create (1-100)'),
|
|
191
|
+
siteId: z.string().describe('Site ID to create content in'),
|
|
192
|
+
},
|
|
193
|
+
}, async (args) => handleSeedContent(sdk, args));
|
|
194
|
+
server.registerTool('scaffold_component', {
|
|
195
|
+
description: 'Generate starter React component code for a custom Kywi module, including the props interface and module definition',
|
|
196
|
+
inputSchema: {
|
|
197
|
+
moduleName: z.string().describe('Module name in camelCase (e.g. heroSection, featureGrid)'),
|
|
198
|
+
description: z.string().describe('Description of what this module does'),
|
|
199
|
+
props: z.array(z.object({
|
|
200
|
+
name: z.string().describe('Prop name'),
|
|
201
|
+
type: z.enum(['string', 'number', 'boolean']).describe('TypeScript type for this prop'),
|
|
202
|
+
label: z.string().describe('Human-readable label'),
|
|
203
|
+
})).optional().describe('Prop definitions (defaults to title + body if omitted)'),
|
|
204
|
+
},
|
|
205
|
+
}, async (args) => handleScaffoldComponent(sdk, args));
|
|
206
|
+
}
|
|
207
|
+
//# sourceMappingURL=scaffolding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffolding.js","sourceRoot":"","sources":["../../../src/developer/tools/scaffolding.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAA;AAUzD,MAAM,aAAa,GAA8B;IAC/C,SAAS,EAAE;QACT,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;QAC7C,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE;QAC/C,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAE;QACrD,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE;QACnD,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE;KAChD;IACD,IAAI,EAAE;QACJ,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE;QAC7C,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE;QACjD,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EA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|
+
export { createSiteMcpServer, startSiteMcp } from './site/index.js';
|
|
4
|
+
export { createDeveloperMcpServer, startDeveloperMcp } from './developer/index.js';
|
|
5
|
+
export { detectMode } from './developer/auto-detect.js';
|
|
6
|
+
export type { DetectedMode } from './developer/auto-detect.js';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,aAAa,CAAA;AAC3B,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnE,OAAO,EAAE,wBAAwB,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAA;AAClF,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAA;AACvD,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAA"}
|