@taghost/mcp 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +98 -4
- package/dist/chunk-JKPKXGK7.js +3384 -0
- package/dist/chunk-NP37ZIKB.js +3469 -0
- package/dist/chunk-ZM4TEOAC.js +3446 -0
- package/dist/chunk-ZSIUY6WV.js +3607 -0
- package/dist/index.cjs +583 -343
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +11 -1
- package/dist/server-BAkdXx6J.d.cts +208 -0
- package/dist/server-BAkdXx6J.d.ts +208 -0
- package/dist/server-BzjamriK.d.cts +215 -0
- package/dist/server-BzjamriK.d.ts +215 -0
- package/dist/server-XvrYGhnU.d.cts +209 -0
- package/dist/server-XvrYGhnU.d.ts +209 -0
- package/dist/server.cjs +561 -343
- package/dist/server.d.cts +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
- package/smithery.yaml +3 -2
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
ALL_MCP_SCOPES: () => ALL_MCP_SCOPES,
|
|
33
34
|
InMemoryTransport: () => import_inMemory.InMemoryTransport,
|
|
35
|
+
MCP_SCOPES: () => MCP_SCOPES,
|
|
34
36
|
TAGHOST_OPENAPI_SPEC: () => TAGHOST_OPENAPI_SPEC,
|
|
35
37
|
TagHostClient: () => TagHostClient,
|
|
36
38
|
bundleDirectory: () => bundleDirectory,
|
|
@@ -38,7 +40,10 @@ __export(index_exports, {
|
|
|
38
40
|
createTagHostMcpServer: () => createTagHostMcpServer,
|
|
39
41
|
findProjectBinding: () => findProjectBinding,
|
|
40
42
|
getApiUrl: () => getApiUrl,
|
|
43
|
+
hasMcpScope: () => hasMcpScope,
|
|
44
|
+
normalizeMcpScopes: () => normalizeMcpScopes,
|
|
41
45
|
resolveAuthToken: () => resolveAuthToken,
|
|
46
|
+
sanitizeAuthToken: () => sanitizeAuthToken,
|
|
42
47
|
startServer: () => startServer,
|
|
43
48
|
validateReadOnlySql: () => validateReadOnlySql
|
|
44
49
|
});
|
|
@@ -60,19 +65,31 @@ function getApiUrl() {
|
|
|
60
65
|
function credentialsPath(homeDir = process.env.TAGHOST_HOME || import_node_os.default.homedir()) {
|
|
61
66
|
return import_node_path.default.join(homeDir, ".taghost", "credentials.json");
|
|
62
67
|
}
|
|
68
|
+
var PLACEHOLDER_TOKEN_PATTERN = /^<?(your[_-].*token|replace[_-]?me|changeme|placeholder)>?$/i;
|
|
69
|
+
function sanitizeAuthToken(value) {
|
|
70
|
+
if (typeof value !== "string") return null;
|
|
71
|
+
const trimmed = value.trim();
|
|
72
|
+
if (!trimmed || PLACEHOLDER_TOKEN_PATTERN.test(trimmed)) {
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
return trimmed;
|
|
76
|
+
}
|
|
63
77
|
function resolveAuthToken() {
|
|
64
|
-
|
|
65
|
-
|
|
78
|
+
const apiToken = sanitizeAuthToken(process.env.TAGHOST_API_TOKEN);
|
|
79
|
+
if (apiToken) {
|
|
80
|
+
return apiToken;
|
|
66
81
|
}
|
|
67
|
-
|
|
68
|
-
|
|
82
|
+
const token = sanitizeAuthToken(process.env.TAGHOST_TOKEN);
|
|
83
|
+
if (token) {
|
|
84
|
+
return token;
|
|
69
85
|
}
|
|
70
86
|
const credsPath = credentialsPath();
|
|
71
87
|
if (import_node_fs.default.existsSync(credsPath)) {
|
|
72
88
|
try {
|
|
73
89
|
const data = JSON.parse(import_node_fs.default.readFileSync(credsPath, "utf8"));
|
|
74
|
-
|
|
75
|
-
|
|
90
|
+
const stored = sanitizeAuthToken(data?.token);
|
|
91
|
+
if (stored) {
|
|
92
|
+
return stored;
|
|
76
93
|
}
|
|
77
94
|
} catch {
|
|
78
95
|
}
|
|
@@ -112,16 +129,27 @@ function findProjectBinding(startDir = process.cwd()) {
|
|
|
112
129
|
// src/client/taghost-client.ts
|
|
113
130
|
var TagHostClient = class {
|
|
114
131
|
apiUrl;
|
|
115
|
-
|
|
132
|
+
explicitToken;
|
|
116
133
|
constructor(options = {}) {
|
|
117
134
|
this.apiUrl = (options.apiUrl || getApiUrl()).replace(/\/+$/, "");
|
|
118
|
-
this.
|
|
135
|
+
this.explicitToken = sanitizeAuthToken(options.token);
|
|
136
|
+
}
|
|
137
|
+
getToken() {
|
|
138
|
+
return this.explicitToken || resolveAuthToken();
|
|
119
139
|
}
|
|
120
140
|
async request(endpoint, options = {}) {
|
|
121
141
|
const url = endpoint.startsWith("http") ? endpoint : `${this.apiUrl}${endpoint.startsWith("/") ? "" : "/"}${endpoint}`;
|
|
122
142
|
const headers = new Headers(options.headers || {});
|
|
123
|
-
if (
|
|
124
|
-
|
|
143
|
+
if (!headers.has("Authorization")) {
|
|
144
|
+
const token = this.getToken();
|
|
145
|
+
if (!token) {
|
|
146
|
+
const error = new Error(
|
|
147
|
+
'Not authenticated with TagHost. Run "tag login" (saved to ~/.taghost/credentials.json) or set TAGHOST_API_TOKEN.'
|
|
148
|
+
);
|
|
149
|
+
error.status = 401;
|
|
150
|
+
throw error;
|
|
151
|
+
}
|
|
152
|
+
headers.set("Authorization", `Bearer ${token}`);
|
|
125
153
|
}
|
|
126
154
|
const response = await fetch(url, {
|
|
127
155
|
...options,
|
|
@@ -345,6 +373,13 @@ var TagHostClient = class {
|
|
|
345
373
|
body: JSON.stringify(payload)
|
|
346
374
|
});
|
|
347
375
|
}
|
|
376
|
+
async cloneWordPressSite(projectId, payload) {
|
|
377
|
+
return this.request(`/projects/${projectId}/migrations/wordpress/clone`, {
|
|
378
|
+
method: "POST",
|
|
379
|
+
headers: { "Content-Type": "application/json" },
|
|
380
|
+
body: JSON.stringify(payload)
|
|
381
|
+
});
|
|
382
|
+
}
|
|
348
383
|
async listOrders(projectId, options = {}) {
|
|
349
384
|
const params = new URLSearchParams();
|
|
350
385
|
if (options.status) params.set("status", options.status);
|
|
@@ -567,154 +602,258 @@ var TagHostClient = class {
|
|
|
567
602
|
|
|
568
603
|
// src/tools/projects.ts
|
|
569
604
|
var import_zod = require("zod");
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
"
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
"
|
|
635
|
-
"
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
}
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
605
|
+
|
|
606
|
+
// src/scopes.ts
|
|
607
|
+
var MCP_SCOPES = [
|
|
608
|
+
{
|
|
609
|
+
id: "projects:read",
|
|
610
|
+
label: "Projects & quotas",
|
|
611
|
+
description: "List projects, inspect configuration, check quotas, and preview AST eject output.",
|
|
612
|
+
icon: "layers",
|
|
613
|
+
access: "read",
|
|
614
|
+
defaultSelected: true
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
id: "deployments:write",
|
|
618
|
+
label: "Deployments & environment",
|
|
619
|
+
description: "Deploy site bundles, publish partial files, manage env vars, set expiry, and rollback.",
|
|
620
|
+
icon: "deployed_code",
|
|
621
|
+
access: "write",
|
|
622
|
+
defaultSelected: true
|
|
623
|
+
},
|
|
624
|
+
{
|
|
625
|
+
id: "content:write",
|
|
626
|
+
label: "Edge content & collections",
|
|
627
|
+
description: "Edit [data-tag] bindings, patch HTML canvas elements, and publish CMS collection items.",
|
|
628
|
+
icon: "draw",
|
|
629
|
+
access: "write",
|
|
630
|
+
defaultSelected: true
|
|
631
|
+
},
|
|
632
|
+
{
|
|
633
|
+
id: "domains:write",
|
|
634
|
+
label: "Domains & DNS",
|
|
635
|
+
description: "Search/check domain availability, attach custom domains, verify SSL, and manage DNS records.",
|
|
636
|
+
icon: "language",
|
|
637
|
+
access: "write"
|
|
638
|
+
},
|
|
639
|
+
{
|
|
640
|
+
id: "mail:read",
|
|
641
|
+
label: "TagMail (read)",
|
|
642
|
+
description: "List and read TagMail threads and check mail domain DNS verification.",
|
|
643
|
+
icon: "inbox",
|
|
644
|
+
access: "read"
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
id: "mail:send",
|
|
648
|
+
label: "TagMail (send & mailboxes)",
|
|
649
|
+
description: "Send outbound transactional email and create workspace mailboxes.",
|
|
650
|
+
icon: "mail",
|
|
651
|
+
access: "write"
|
|
652
|
+
},
|
|
653
|
+
{
|
|
654
|
+
id: "commerce:write",
|
|
655
|
+
label: "Commerce & orders",
|
|
656
|
+
description: "Configure stores, manage coupons, view/fulfill orders, and migrate catalogs.",
|
|
657
|
+
icon: "storefront",
|
|
658
|
+
access: "write"
|
|
659
|
+
},
|
|
660
|
+
{
|
|
661
|
+
id: "forms:read",
|
|
662
|
+
label: "Forms, CRM & webhooks",
|
|
663
|
+
description: "Inspect form submissions, enroll leads in CRM sequences, and configure webhooks.",
|
|
664
|
+
icon: "assignment",
|
|
665
|
+
access: "write"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
id: "sql:read",
|
|
669
|
+
label: "Serverless D1 SQL (read-only)",
|
|
670
|
+
description: "Introspect project database schemas and execute read-only SELECT queries.",
|
|
671
|
+
icon: "database",
|
|
672
|
+
access: "read"
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
id: "workspace:collaborate",
|
|
676
|
+
label: "Tasks, calendar, notes & Meet",
|
|
677
|
+
description: "Manage TagWork tasks, calendar events, notes, Meet rooms, and scheduled automations.",
|
|
678
|
+
icon: "event",
|
|
679
|
+
access: "write"
|
|
680
|
+
}
|
|
681
|
+
];
|
|
682
|
+
var ALL_MCP_SCOPES = MCP_SCOPES.map((s) => s.id);
|
|
683
|
+
var VALID_SCOPE_SET = new Set(ALL_MCP_SCOPES);
|
|
684
|
+
function normalizeMcpScopes(input) {
|
|
685
|
+
if (!input) return [];
|
|
686
|
+
const raw = Array.isArray(input) ? input : input.split(/[\s,]+/);
|
|
687
|
+
const seen = /* @__PURE__ */ new Set();
|
|
688
|
+
for (const item of raw) {
|
|
689
|
+
const trimmed = item.trim();
|
|
690
|
+
if (VALID_SCOPE_SET.has(trimmed)) {
|
|
691
|
+
seen.add(trimmed);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
return Array.from(seen);
|
|
695
|
+
}
|
|
696
|
+
function hasMcpScope(granted, required) {
|
|
697
|
+
if (granted == null) return true;
|
|
698
|
+
if (granted.includes("*")) return true;
|
|
699
|
+
return granted.includes(required);
|
|
700
|
+
}
|
|
701
|
+
|
|
702
|
+
// src/tools/projects.ts
|
|
703
|
+
function registerProjectTools(server, client, scopes) {
|
|
704
|
+
if (hasMcpScope(scopes, "deployments:write")) {
|
|
705
|
+
server.tool(
|
|
706
|
+
"taghost_project_create",
|
|
707
|
+
"Create a new project on TagHost edge platform.",
|
|
708
|
+
{
|
|
709
|
+
name: import_zod.z.string().describe('Human readable name of the project (e.g. "Acme Storefront")'),
|
|
710
|
+
slug: import_zod.z.string().optional().describe('URL slug for the project (e.g. "acme-storefront")'),
|
|
711
|
+
framework: import_zod.z.string().optional().describe('Framework template (e.g. "html", "react", "nextjs", "vue")')
|
|
712
|
+
},
|
|
713
|
+
async ({ name, slug, framework }) => {
|
|
714
|
+
try {
|
|
715
|
+
const result = await client.createProject({ name, slug, framework });
|
|
674
716
|
return {
|
|
675
|
-
content: [
|
|
717
|
+
content: [
|
|
718
|
+
{
|
|
719
|
+
type: "text",
|
|
720
|
+
text: JSON.stringify(
|
|
721
|
+
{
|
|
722
|
+
success: true,
|
|
723
|
+
message: `Project "${name}" created successfully.`,
|
|
724
|
+
project: result.project || result
|
|
725
|
+
},
|
|
726
|
+
null,
|
|
727
|
+
2
|
|
728
|
+
)
|
|
729
|
+
}
|
|
730
|
+
]
|
|
731
|
+
};
|
|
732
|
+
} catch (err) {
|
|
733
|
+
return {
|
|
734
|
+
isError: true,
|
|
735
|
+
content: [{ type: "text", text: `Failed to create project: ${err.message}` }]
|
|
676
736
|
};
|
|
677
737
|
}
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
738
|
+
}
|
|
739
|
+
);
|
|
740
|
+
}
|
|
741
|
+
if (hasMcpScope(scopes, "projects:read")) {
|
|
742
|
+
server.tool(
|
|
743
|
+
"taghost_project_list",
|
|
744
|
+
"List all projects accessible within the current TagHost workspace.",
|
|
745
|
+
{
|
|
746
|
+
limit: import_zod.z.number().optional().describe("Maximum number of projects to return (default: 50)")
|
|
747
|
+
},
|
|
748
|
+
async ({ limit }) => {
|
|
749
|
+
try {
|
|
750
|
+
const result = await client.listProjects();
|
|
751
|
+
const list = Array.isArray(result) ? result : result.projects || [];
|
|
752
|
+
const items = limit ? list.slice(0, limit) : list;
|
|
686
753
|
return {
|
|
687
754
|
content: [
|
|
688
755
|
{
|
|
689
756
|
type: "text",
|
|
690
|
-
text: JSON.stringify({ success: true,
|
|
757
|
+
text: JSON.stringify({ success: true, count: items.length, projects: items }, null, 2)
|
|
691
758
|
}
|
|
692
759
|
]
|
|
693
760
|
};
|
|
761
|
+
} catch (err) {
|
|
762
|
+
return {
|
|
763
|
+
isError: true,
|
|
764
|
+
content: [{ type: "text", text: `Failed to list projects: ${err.message}` }]
|
|
765
|
+
};
|
|
694
766
|
}
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
767
|
+
}
|
|
768
|
+
);
|
|
769
|
+
server.tool(
|
|
770
|
+
"taghost_project_get",
|
|
771
|
+
"Get detailed information about a specific TagHost project, including active deployment and domains.",
|
|
772
|
+
{
|
|
773
|
+
projectId: import_zod.z.string().optional().describe('Project ID (e.g. "proj_..."). Defaults to active project.')
|
|
774
|
+
},
|
|
775
|
+
async ({ projectId }) => {
|
|
776
|
+
try {
|
|
777
|
+
const id = await client.resolveProjectId(projectId);
|
|
778
|
+
const result = await client.getProject(id);
|
|
700
779
|
return {
|
|
701
780
|
content: [
|
|
702
781
|
{
|
|
703
782
|
type: "text",
|
|
704
|
-
text: JSON.stringify({ success: true,
|
|
783
|
+
text: JSON.stringify({ success: true, project: result.project || result }, null, 2)
|
|
705
784
|
}
|
|
706
785
|
]
|
|
707
786
|
};
|
|
787
|
+
} catch (err) {
|
|
788
|
+
return {
|
|
789
|
+
isError: true,
|
|
790
|
+
content: [{ type: "text", text: `Failed to get project: ${err.message}` }]
|
|
791
|
+
};
|
|
708
792
|
}
|
|
709
|
-
return { isError: true, content: [{ type: "text", text: `Unknown action: ${action}` }] };
|
|
710
|
-
} catch (err) {
|
|
711
|
-
return {
|
|
712
|
-
isError: true,
|
|
713
|
-
content: [{ type: "text", text: `Failed to manage env vars: ${err.message}` }]
|
|
714
|
-
};
|
|
715
793
|
}
|
|
716
|
-
|
|
717
|
-
|
|
794
|
+
);
|
|
795
|
+
}
|
|
796
|
+
if (hasMcpScope(scopes, "deployments:write")) {
|
|
797
|
+
server.tool(
|
|
798
|
+
"taghost_env_manage",
|
|
799
|
+
"Manage environment variables for a TagHost project.",
|
|
800
|
+
{
|
|
801
|
+
projectId: import_zod.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
802
|
+
action: import_zod.z.enum(["list", "set", "delete"]).describe("Action to perform"),
|
|
803
|
+
key: import_zod.z.string().optional().describe("Environment variable key"),
|
|
804
|
+
value: import_zod.z.string().optional().describe("Environment variable value (for set action)"),
|
|
805
|
+
target: import_zod.z.enum(["production", "preview", "all"]).optional().describe("Deployment target")
|
|
806
|
+
},
|
|
807
|
+
async ({ projectId, action, key, value, target }) => {
|
|
808
|
+
try {
|
|
809
|
+
const id = await client.resolveProjectId(projectId);
|
|
810
|
+
if (action === "list") {
|
|
811
|
+
const res = await client.getProjectEnv(id);
|
|
812
|
+
return {
|
|
813
|
+
content: [{ type: "text", text: JSON.stringify({ success: true, envVars: res }, null, 2) }]
|
|
814
|
+
};
|
|
815
|
+
}
|
|
816
|
+
if (action === "set") {
|
|
817
|
+
if (!key || value === void 0) {
|
|
818
|
+
return {
|
|
819
|
+
isError: true,
|
|
820
|
+
content: [{ type: "text", text: 'Both key and value are required for "set" action.' }]
|
|
821
|
+
};
|
|
822
|
+
}
|
|
823
|
+
const res = await client.setProjectEnv(id, key, value, target || "all");
|
|
824
|
+
return {
|
|
825
|
+
content: [
|
|
826
|
+
{
|
|
827
|
+
type: "text",
|
|
828
|
+
text: JSON.stringify({ success: true, message: `Environment variable "${key}" set.`, result: res }, null, 2)
|
|
829
|
+
}
|
|
830
|
+
]
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
if (action === "delete") {
|
|
834
|
+
if (!key) {
|
|
835
|
+
return { isError: true, content: [{ type: "text", text: 'Key is required for "delete" action.' }] };
|
|
836
|
+
}
|
|
837
|
+
await client.deleteProjectEnv(id, key);
|
|
838
|
+
return {
|
|
839
|
+
content: [
|
|
840
|
+
{
|
|
841
|
+
type: "text",
|
|
842
|
+
text: JSON.stringify({ success: true, message: `Environment variable "${key}" deleted.` }, null, 2)
|
|
843
|
+
}
|
|
844
|
+
]
|
|
845
|
+
};
|
|
846
|
+
}
|
|
847
|
+
return { isError: true, content: [{ type: "text", text: `Unknown action: ${action}` }] };
|
|
848
|
+
} catch (err) {
|
|
849
|
+
return {
|
|
850
|
+
isError: true,
|
|
851
|
+
content: [{ type: "text", text: `Failed to manage env vars: ${err.message}` }]
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
}
|
|
855
|
+
);
|
|
856
|
+
}
|
|
718
857
|
}
|
|
719
858
|
|
|
720
859
|
// src/tools/deployments.ts
|
|
@@ -1009,199 +1148,205 @@ function registerDeploymentTools(server, client) {
|
|
|
1009
1148
|
|
|
1010
1149
|
// src/tools/mail.ts
|
|
1011
1150
|
var import_zod3 = require("zod");
|
|
1012
|
-
function registerMailTools(server, client) {
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1151
|
+
function registerMailTools(server, client, scopes) {
|
|
1152
|
+
if (hasMcpScope(scopes, "mail:read")) {
|
|
1153
|
+
server.tool(
|
|
1154
|
+
"taghost_mail_threads_list",
|
|
1155
|
+
"Check mail: list email threads and messages in the TagMail inbox with search and mailbox filters.",
|
|
1156
|
+
{
|
|
1157
|
+
projectId: import_zod3.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
1158
|
+
mailboxId: import_zod3.z.string().optional().describe("Filter by specific mailbox ID"),
|
|
1159
|
+
query: import_zod3.z.string().optional().describe("Search query for sender, subject or body text"),
|
|
1160
|
+
limit: import_zod3.z.number().optional().describe("Maximum number of threads to return (default: 25)")
|
|
1161
|
+
},
|
|
1162
|
+
async ({ projectId, mailboxId, query, limit }) => {
|
|
1163
|
+
try {
|
|
1164
|
+
const id = await client.resolveProjectId(projectId);
|
|
1165
|
+
const result = await client.listMailThreads(id, { mailboxId, query, limit: limit || 25 });
|
|
1166
|
+
const threads = Array.isArray(result) ? result : result.threads || [];
|
|
1167
|
+
return {
|
|
1168
|
+
content: [
|
|
1169
|
+
{
|
|
1170
|
+
type: "text",
|
|
1171
|
+
text: JSON.stringify(
|
|
1172
|
+
{
|
|
1173
|
+
success: true,
|
|
1174
|
+
count: threads.length,
|
|
1175
|
+
threads: threads.map((t) => ({
|
|
1176
|
+
id: t.id,
|
|
1177
|
+
subject: t.subject || "(no subject)",
|
|
1178
|
+
from: t.fromAddress || t.snippetSender,
|
|
1179
|
+
snippet: t.snippet,
|
|
1180
|
+
unread: Boolean(t.unread),
|
|
1181
|
+
messageCount: t.messageCount || 1,
|
|
1182
|
+
receivedAt: t.lastMessageAt || t.receivedAt || t.createdAt
|
|
1183
|
+
}))
|
|
1184
|
+
},
|
|
1185
|
+
null,
|
|
1186
|
+
2
|
|
1187
|
+
)
|
|
1188
|
+
}
|
|
1189
|
+
]
|
|
1190
|
+
};
|
|
1191
|
+
} catch (err) {
|
|
1192
|
+
return {
|
|
1193
|
+
isError: true,
|
|
1194
|
+
content: [{ type: "text", text: `Failed to check mail: ${err.message}` }]
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1056
1197
|
}
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
}
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
}
|
|
1198
|
+
);
|
|
1199
|
+
server.tool(
|
|
1200
|
+
"taghost_mail_thread_get",
|
|
1201
|
+
"Read the full contents of an email thread, including all inbound and outbound messages and attachment metadata.",
|
|
1202
|
+
{
|
|
1203
|
+
projectId: import_zod3.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
1204
|
+
threadId: import_zod3.z.string().describe("The email thread ID to retrieve")
|
|
1205
|
+
},
|
|
1206
|
+
async ({ projectId, threadId }) => {
|
|
1207
|
+
try {
|
|
1208
|
+
const id = await client.resolveProjectId(projectId);
|
|
1209
|
+
const result = await client.getMailThread(id, threadId);
|
|
1210
|
+
return {
|
|
1211
|
+
content: [
|
|
1212
|
+
{
|
|
1213
|
+
type: "text",
|
|
1214
|
+
text: JSON.stringify({ success: true, thread: result.thread || result }, null, 2)
|
|
1215
|
+
}
|
|
1216
|
+
]
|
|
1217
|
+
};
|
|
1218
|
+
} catch (err) {
|
|
1219
|
+
return {
|
|
1220
|
+
isError: true,
|
|
1221
|
+
content: [{ type: "text", text: `Failed to read mail thread: ${err.message}` }]
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1083
1224
|
}
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1225
|
+
);
|
|
1226
|
+
}
|
|
1227
|
+
if (hasMcpScope(scopes, "mail:send")) {
|
|
1228
|
+
server.tool(
|
|
1229
|
+
"taghost_mail_send",
|
|
1230
|
+
"Send an email from a TagMail mailbox.",
|
|
1231
|
+
{
|
|
1232
|
+
projectId: import_zod3.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
1233
|
+
mailboxId: import_zod3.z.string().optional().describe("Sender mailbox ID (defaults to project primary mailbox)"),
|
|
1234
|
+
to: import_zod3.z.string().describe("Recipient email address"),
|
|
1235
|
+
subject: import_zod3.z.string().describe("Email subject line"),
|
|
1236
|
+
text: import_zod3.z.string().optional().describe("Plain text body content"),
|
|
1237
|
+
html: import_zod3.z.string().optional().describe("HTML formatted body content"),
|
|
1238
|
+
cc: import_zod3.z.array(import_zod3.z.string()).optional().describe("Optional CC recipients"),
|
|
1239
|
+
bcc: import_zod3.z.array(import_zod3.z.string()).optional().describe("Optional BCC recipients")
|
|
1240
|
+
},
|
|
1241
|
+
async ({ projectId, mailboxId, to, subject, text, html, cc, bcc }) => {
|
|
1242
|
+
try {
|
|
1243
|
+
const id = await client.resolveProjectId(projectId);
|
|
1244
|
+
const result = await client.sendMail(id, {
|
|
1245
|
+
mailboxId,
|
|
1246
|
+
to,
|
|
1247
|
+
subject,
|
|
1248
|
+
text,
|
|
1249
|
+
html,
|
|
1250
|
+
cc,
|
|
1251
|
+
bcc
|
|
1252
|
+
});
|
|
1253
|
+
return {
|
|
1254
|
+
content: [
|
|
1255
|
+
{
|
|
1256
|
+
type: "text",
|
|
1257
|
+
text: JSON.stringify(
|
|
1258
|
+
{
|
|
1259
|
+
success: true,
|
|
1260
|
+
message: `Email sent to ${to} successfully.`,
|
|
1261
|
+
result
|
|
1262
|
+
},
|
|
1263
|
+
null,
|
|
1264
|
+
2
|
|
1265
|
+
)
|
|
1266
|
+
}
|
|
1267
|
+
]
|
|
1268
|
+
};
|
|
1269
|
+
} catch (err) {
|
|
1270
|
+
return {
|
|
1271
|
+
isError: true,
|
|
1272
|
+
content: [{ type: "text", text: `Failed to send email: ${err.message}` }]
|
|
1273
|
+
};
|
|
1274
|
+
}
|
|
1132
1275
|
}
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
}
|
|
1276
|
+
);
|
|
1277
|
+
server.tool(
|
|
1278
|
+
"taghost_mail_create_mailbox",
|
|
1279
|
+
'Provision a new corporate mailbox (e.g. "sales@acme.com" or "hello@acme.com") on TagHost.',
|
|
1280
|
+
{
|
|
1281
|
+
projectId: import_zod3.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
1282
|
+
localPart: import_zod3.z.string().describe('Local part of address before @ (e.g. "support", "orders", "hello")'),
|
|
1283
|
+
domain: import_zod3.z.string().optional().describe("Domain name for mailbox (defaults to project custom domain)"),
|
|
1284
|
+
displayName: import_zod3.z.string().optional().describe('Friendly display name (e.g. "Support Team")'),
|
|
1285
|
+
password: import_zod3.z.string().optional().describe("Initial password for Webmail/IMAP/SMTP access")
|
|
1286
|
+
},
|
|
1287
|
+
async ({ projectId, localPart, domain, displayName, password }) => {
|
|
1288
|
+
try {
|
|
1289
|
+
const id = await client.resolveProjectId(projectId);
|
|
1290
|
+
const result = await client.createMailbox(id, {
|
|
1291
|
+
localPart,
|
|
1292
|
+
domain,
|
|
1293
|
+
displayName,
|
|
1294
|
+
password
|
|
1295
|
+
});
|
|
1296
|
+
return {
|
|
1297
|
+
content: [
|
|
1298
|
+
{
|
|
1299
|
+
type: "text",
|
|
1300
|
+
text: JSON.stringify(
|
|
1301
|
+
{
|
|
1302
|
+
success: true,
|
|
1303
|
+
message: `Mailbox "${localPart}@${domain || "custom-domain"}" created.`,
|
|
1304
|
+
mailbox: result.mailbox || result
|
|
1305
|
+
},
|
|
1306
|
+
null,
|
|
1307
|
+
2
|
|
1308
|
+
)
|
|
1309
|
+
}
|
|
1310
|
+
]
|
|
1311
|
+
};
|
|
1312
|
+
} catch (err) {
|
|
1313
|
+
return {
|
|
1314
|
+
isError: true,
|
|
1315
|
+
content: [{ type: "text", text: `Failed to create mailbox: ${err.message}` }]
|
|
1316
|
+
};
|
|
1317
|
+
}
|
|
1175
1318
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1319
|
+
);
|
|
1320
|
+
}
|
|
1321
|
+
if (hasMcpScope(scopes, "mail:read")) {
|
|
1322
|
+
server.tool(
|
|
1323
|
+
"taghost_mail_domain_verify",
|
|
1324
|
+
"Inspect DNS verification status for corporate email (MX, SPF, DKIM, DMARC records).",
|
|
1325
|
+
{
|
|
1326
|
+
projectId: import_zod3.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
1327
|
+
domain: import_zod3.z.string().describe('Domain name to verify (e.g. "acme.com")')
|
|
1328
|
+
},
|
|
1329
|
+
async ({ projectId, domain }) => {
|
|
1330
|
+
try {
|
|
1331
|
+
const id = await client.resolveProjectId(projectId);
|
|
1332
|
+
const result = await client.getMailDomainVerification(id, domain);
|
|
1333
|
+
return {
|
|
1334
|
+
content: [
|
|
1335
|
+
{
|
|
1336
|
+
type: "text",
|
|
1337
|
+
text: JSON.stringify({ success: true, domain, verification: result }, null, 2)
|
|
1338
|
+
}
|
|
1339
|
+
]
|
|
1340
|
+
};
|
|
1341
|
+
} catch (err) {
|
|
1342
|
+
return {
|
|
1343
|
+
isError: true,
|
|
1344
|
+
content: [{ type: "text", text: `Failed to verify email domain: ${err.message}` }]
|
|
1345
|
+
};
|
|
1346
|
+
}
|
|
1202
1347
|
}
|
|
1203
|
-
|
|
1204
|
-
|
|
1348
|
+
);
|
|
1349
|
+
}
|
|
1205
1350
|
}
|
|
1206
1351
|
|
|
1207
1352
|
// src/tools/domains.ts
|
|
@@ -1691,7 +1836,7 @@ function registerCommerceTools(server, client) {
|
|
|
1691
1836
|
);
|
|
1692
1837
|
server.tool(
|
|
1693
1838
|
"taghost_commerce_migrate_woocommerce",
|
|
1694
|
-
"Migrate a WordPress/WooCommerce
|
|
1839
|
+
"Migrate a WordPress/WooCommerce site to TagHost Edge. Migrates products, posts, pages, custom post types, customers, orders, R2 media, theme tokens, and 301 _redirects.",
|
|
1695
1840
|
{
|
|
1696
1841
|
projectId: import_zod5.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
1697
1842
|
url: import_zod5.z.string().optional().describe('WordPress/WooCommerce site URL (e.g. "https://my-store.com")'),
|
|
@@ -1699,19 +1844,24 @@ function registerCommerceTools(server, client) {
|
|
|
1699
1844
|
consumerSecret: import_zod5.z.string().optional().describe("WooCommerce REST API Consumer Secret (cs_...)"),
|
|
1700
1845
|
products: import_zod5.z.array(import_zod5.z.any()).optional().describe("Direct array of WooCommerce product objects to import (or parsed from CSV/JSON)"),
|
|
1701
1846
|
posts: import_zod5.z.array(import_zod5.z.any()).optional().describe("Direct array of WordPress blog post objects to import"),
|
|
1847
|
+
pages: import_zod5.z.array(import_zod5.z.any()).optional().describe("Direct array of WordPress page objects to import"),
|
|
1702
1848
|
customers: import_zod5.z.array(import_zod5.z.any()).optional().describe("Direct array of WooCommerce customer objects to import"),
|
|
1703
1849
|
orders: import_zod5.z.array(import_zod5.z.any()).optional().describe("Direct array of WooCommerce order objects to import"),
|
|
1704
1850
|
wxrXml: import_zod5.z.string().optional().describe("Raw WordPress WXR XML export content (from Tools > Export) for complete offline migration"),
|
|
1705
1851
|
options: import_zod5.z.object({
|
|
1706
1852
|
importProducts: import_zod5.z.boolean().optional().describe("Whether to import products (default: true)"),
|
|
1707
1853
|
importPosts: import_zod5.z.boolean().optional().describe("Whether to import WordPress blog posts (default: true)"),
|
|
1854
|
+
importPages: import_zod5.z.boolean().optional().describe("Whether to import WordPress pages into a pages collection (default: true)"),
|
|
1708
1855
|
importCustomers: import_zod5.z.boolean().optional().describe("Whether to import customers (default: true)"),
|
|
1709
1856
|
importOrders: import_zod5.z.boolean().optional().describe("Whether to import orders (default: true)"),
|
|
1710
1857
|
scrapeDesign: import_zod5.z.boolean().optional().describe("Whether to scrape brand design & font tokens from site HTML (default: true)"),
|
|
1711
|
-
mirrorMedia: import_zod5.z.boolean().optional().describe("Whether to mirror remote images into Cloudflare R2 Edge Storage (default: true)")
|
|
1858
|
+
mirrorMedia: import_zod5.z.boolean().optional().describe("Whether to mirror remote images into Cloudflare R2 Edge Storage (default: true)"),
|
|
1859
|
+
cleanMarkup: import_zod5.z.boolean().optional().describe("Whether to strip Gutenberg comments and legacy page-builder shortcodes (default: true)"),
|
|
1860
|
+
writeRedirects: import_zod5.z.boolean().optional().describe("Whether to generate and merge 301 _redirects for legacy WordPress permalinks (default: true)"),
|
|
1861
|
+
maxPages: import_zod5.z.number().int().min(1).max(25).optional().describe("Max REST API pages to fetch per resource (100 items/page, default: 10)")
|
|
1712
1862
|
}).optional().describe("Migration options")
|
|
1713
1863
|
},
|
|
1714
|
-
async ({ projectId, url, consumerKey, consumerSecret, products, posts, customers, orders, wxrXml, options }) => {
|
|
1864
|
+
async ({ projectId, url, consumerKey, consumerSecret, products, posts, pages, customers, orders, wxrXml, options }) => {
|
|
1715
1865
|
try {
|
|
1716
1866
|
const id = await client.resolveProjectId(projectId);
|
|
1717
1867
|
const res = await client.migrateWooCommerce(id, {
|
|
@@ -1720,6 +1870,7 @@ function registerCommerceTools(server, client) {
|
|
|
1720
1870
|
consumerSecret,
|
|
1721
1871
|
products,
|
|
1722
1872
|
posts,
|
|
1873
|
+
pages,
|
|
1723
1874
|
customers,
|
|
1724
1875
|
orders,
|
|
1725
1876
|
wxrXml,
|
|
@@ -1732,11 +1883,17 @@ function registerCommerceTools(server, client) {
|
|
|
1732
1883
|
text: JSON.stringify(
|
|
1733
1884
|
{
|
|
1734
1885
|
success: res.success,
|
|
1735
|
-
message: `WooCommerce migration completed for project ${id}.`,
|
|
1886
|
+
message: `WordPress/WooCommerce migration completed for project ${id}.`,
|
|
1736
1887
|
summary: {
|
|
1737
1888
|
productsMigrated: res.productsMigrated,
|
|
1889
|
+
postsMigrated: res.postsMigrated,
|
|
1890
|
+
pagesMigrated: res.pagesMigrated,
|
|
1891
|
+
customItemsMigrated: res.customItemsMigrated,
|
|
1892
|
+
mediaMirrored: res.mediaMirrored,
|
|
1738
1893
|
customersMigrated: res.customersMigrated,
|
|
1739
1894
|
ordersMigrated: res.ordersMigrated,
|
|
1895
|
+
redirectsGenerated: res.redirectsGenerated,
|
|
1896
|
+
redirectsAppliedToDeployment: res.redirectsAppliedToDeployment,
|
|
1740
1897
|
themeScraped: res.themeScraped
|
|
1741
1898
|
},
|
|
1742
1899
|
errors: res.errors
|
|
@@ -1750,7 +1907,62 @@ function registerCommerceTools(server, client) {
|
|
|
1750
1907
|
} catch (err) {
|
|
1751
1908
|
return {
|
|
1752
1909
|
isError: true,
|
|
1753
|
-
content: [{ type: "text", text: `Failed to execute WooCommerce migration: ${err.message}` }]
|
|
1910
|
+
content: [{ type: "text", text: `Failed to execute WordPress/WooCommerce migration: ${err.message}` }]
|
|
1911
|
+
};
|
|
1912
|
+
}
|
|
1913
|
+
}
|
|
1914
|
+
);
|
|
1915
|
+
server.tool(
|
|
1916
|
+
"taghost_wordpress_visual_clone",
|
|
1917
|
+
"Clone a live WordPress website into TagHost Edge preserving its exact visual design (HTML, theme/Elementor/Divi CSS, webfonts, images) as an immutable R2 deployment ready for Tier 2 Visual Studio editing, with WordPress forms auto-rewired to /_tag/forms/*.",
|
|
1918
|
+
{
|
|
1919
|
+
projectId: import_zod5.z.string().optional().describe("Project ID. Defaults to active project."),
|
|
1920
|
+
url: import_zod5.z.string().describe('Public live WordPress site URL (e.g. "https://example.com")'),
|
|
1921
|
+
maxPages: import_zod5.z.number().int().min(1).max(30).optional().describe("Max pages to clone (default: 15, max: 30)"),
|
|
1922
|
+
maxAssets: import_zod5.z.number().int().min(10).max(250).optional().describe("Max CSS/font/image assets to mirror (default: 120, max: 250)"),
|
|
1923
|
+
rewireForms: import_zod5.z.boolean().optional().describe("Auto-rewire WordPress contact forms to TagHost Edge Forms (default: true)"),
|
|
1924
|
+
syncCollections: import_zod5.z.boolean().optional().describe("Also import WP posts & pages into TagHost Collections CMS (default: false)")
|
|
1925
|
+
},
|
|
1926
|
+
async ({ projectId, url, maxPages, maxAssets, rewireForms, syncCollections }) => {
|
|
1927
|
+
try {
|
|
1928
|
+
const id = await client.resolveProjectId(projectId);
|
|
1929
|
+
const res = await client.cloneWordPressSite(id, {
|
|
1930
|
+
url,
|
|
1931
|
+
maxPages,
|
|
1932
|
+
maxAssets,
|
|
1933
|
+
rewireForms,
|
|
1934
|
+
syncCollections
|
|
1935
|
+
});
|
|
1936
|
+
return {
|
|
1937
|
+
content: [
|
|
1938
|
+
{
|
|
1939
|
+
type: "text",
|
|
1940
|
+
text: JSON.stringify(
|
|
1941
|
+
{
|
|
1942
|
+
success: res.success,
|
|
1943
|
+
message: `WordPress visual clone deployed for project ${id}.`,
|
|
1944
|
+
deployment: res.deployment,
|
|
1945
|
+
summary: {
|
|
1946
|
+
pagesCloned: res.pagesCloned,
|
|
1947
|
+
editablePagesCount: res.editablePagesCount,
|
|
1948
|
+
totalDiscoveredPages: res.totalDiscoveredPages,
|
|
1949
|
+
assetsMirrored: res.assetsMirrored,
|
|
1950
|
+
formsRewired: res.formsRewired,
|
|
1951
|
+
rewiredFormNames: res.rewiredFormNames,
|
|
1952
|
+
detectedDynamicWidgets: res.detectedDynamicWidgets
|
|
1953
|
+
},
|
|
1954
|
+
errors: res.errors
|
|
1955
|
+
},
|
|
1956
|
+
null,
|
|
1957
|
+
2
|
|
1958
|
+
)
|
|
1959
|
+
}
|
|
1960
|
+
]
|
|
1961
|
+
};
|
|
1962
|
+
} catch (err) {
|
|
1963
|
+
return {
|
|
1964
|
+
isError: true,
|
|
1965
|
+
content: [{ type: "text", text: `Failed to visually clone WordPress site: ${err.message}` }]
|
|
1754
1966
|
};
|
|
1755
1967
|
}
|
|
1756
1968
|
}
|
|
@@ -3377,18 +3589,41 @@ function createTagHostMcpServer(options = {}) {
|
|
|
3377
3589
|
version: options.version || "1.0.0"
|
|
3378
3590
|
});
|
|
3379
3591
|
const client = new TagHostClient(options);
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3592
|
+
const scopes = options.scopes ?? null;
|
|
3593
|
+
if (hasMcpScope(scopes, "projects:read") || hasMcpScope(scopes, "deployments:write")) {
|
|
3594
|
+
registerProjectTools(server, client, scopes);
|
|
3595
|
+
}
|
|
3596
|
+
if (hasMcpScope(scopes, "deployments:write")) {
|
|
3597
|
+
registerDeploymentTools(server, client);
|
|
3598
|
+
}
|
|
3599
|
+
if (hasMcpScope(scopes, "mail:read") || hasMcpScope(scopes, "mail:send")) {
|
|
3600
|
+
registerMailTools(server, client, scopes);
|
|
3601
|
+
}
|
|
3602
|
+
if (hasMcpScope(scopes, "domains:write")) {
|
|
3603
|
+
registerDomainTools(server, client);
|
|
3604
|
+
}
|
|
3605
|
+
if (hasMcpScope(scopes, "commerce:write")) {
|
|
3606
|
+
registerCommerceTools(server, client);
|
|
3607
|
+
}
|
|
3608
|
+
if (hasMcpScope(scopes, "content:write")) {
|
|
3609
|
+
registerCollectionTools(server, client);
|
|
3610
|
+
registerContentTools(server, client);
|
|
3611
|
+
}
|
|
3612
|
+
if (hasMcpScope(scopes, "forms:read")) {
|
|
3613
|
+
registerFormsCrmTools(server, client);
|
|
3614
|
+
}
|
|
3615
|
+
if (hasMcpScope(scopes, "sql:read")) {
|
|
3616
|
+
registerSqlTools(server, client);
|
|
3617
|
+
}
|
|
3618
|
+
if (hasMcpScope(scopes, "projects:read")) {
|
|
3619
|
+
registerObservabilityTools(server, client);
|
|
3620
|
+
}
|
|
3621
|
+
if (hasMcpScope(scopes, "workspace:collaborate")) {
|
|
3622
|
+
registerTasksCollaborationTools(server, client);
|
|
3623
|
+
}
|
|
3624
|
+
if (hasMcpScope(scopes, "projects:read")) {
|
|
3625
|
+
registerResources(server, client);
|
|
3626
|
+
}
|
|
3392
3627
|
registerPrompts(server);
|
|
3393
3628
|
return { server, client };
|
|
3394
3629
|
}
|
|
@@ -3602,7 +3837,9 @@ var TAGHOST_OPENAPI_SPEC = {
|
|
|
3602
3837
|
};
|
|
3603
3838
|
// Annotate the CommonJS export names for ESM import in node:
|
|
3604
3839
|
0 && (module.exports = {
|
|
3840
|
+
ALL_MCP_SCOPES,
|
|
3605
3841
|
InMemoryTransport,
|
|
3842
|
+
MCP_SCOPES,
|
|
3606
3843
|
TAGHOST_OPENAPI_SPEC,
|
|
3607
3844
|
TagHostClient,
|
|
3608
3845
|
bundleDirectory,
|
|
@@ -3610,7 +3847,10 @@ var TAGHOST_OPENAPI_SPEC = {
|
|
|
3610
3847
|
createTagHostMcpServer,
|
|
3611
3848
|
findProjectBinding,
|
|
3612
3849
|
getApiUrl,
|
|
3850
|
+
hasMcpScope,
|
|
3851
|
+
normalizeMcpScopes,
|
|
3613
3852
|
resolveAuthToken,
|
|
3853
|
+
sanitizeAuthToken,
|
|
3614
3854
|
startServer,
|
|
3615
3855
|
validateReadOnlySql
|
|
3616
3856
|
});
|