@junis/ghost-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 +21 -0
- package/README.md +151 -0
- package/build/config.js +16 -0
- package/build/ghostApi.js +28 -0
- package/build/models.js +2 -0
- package/build/prompts.js +29 -0
- package/build/resources.js +222 -0
- package/build/server.js +59 -0
- package/build/tools/invites.js +58 -0
- package/build/tools/members.js +97 -0
- package/build/tools/newsletters.js +120 -0
- package/build/tools/offers.js +104 -0
- package/build/tools/posts.js +120 -0
- package/build/tools/roles.js +43 -0
- package/build/tools/tags.js +95 -0
- package/build/tools/tiers.js +107 -0
- package/build/tools/users.js +83 -0
- package/build/tools/webhooks.js +63 -0
- package/package.json +36 -0
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerMemberTools = registerMemberTools;
|
|
4
|
+
// src/tools/members.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ghostApi_1 = require("../ghostApi");
|
|
7
|
+
// Parameter schemas as ZodRawShape (object literals)
|
|
8
|
+
const browseParams = {
|
|
9
|
+
filter: zod_1.z.string().optional(),
|
|
10
|
+
limit: zod_1.z.number().optional(),
|
|
11
|
+
page: zod_1.z.number().optional(),
|
|
12
|
+
order: zod_1.z.string().optional(),
|
|
13
|
+
};
|
|
14
|
+
const readParams = {
|
|
15
|
+
id: zod_1.z.string().optional(),
|
|
16
|
+
email: zod_1.z.string().optional(),
|
|
17
|
+
};
|
|
18
|
+
const addParams = {
|
|
19
|
+
email: zod_1.z.string(),
|
|
20
|
+
name: zod_1.z.string().optional(),
|
|
21
|
+
note: zod_1.z.string().optional(),
|
|
22
|
+
labels: zod_1.z.array(zod_1.z.object({ name: zod_1.z.string(), slug: zod_1.z.string().optional() })).optional(),
|
|
23
|
+
newsletters: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string() })).optional(),
|
|
24
|
+
};
|
|
25
|
+
const editParams = {
|
|
26
|
+
id: zod_1.z.string(),
|
|
27
|
+
email: zod_1.z.string().optional(),
|
|
28
|
+
name: zod_1.z.string().optional(),
|
|
29
|
+
note: zod_1.z.string().optional(),
|
|
30
|
+
labels: zod_1.z.array(zod_1.z.object({ name: zod_1.z.string(), slug: zod_1.z.string().optional() })).optional(),
|
|
31
|
+
newsletters: zod_1.z.array(zod_1.z.object({ id: zod_1.z.string() })).optional(),
|
|
32
|
+
};
|
|
33
|
+
const deleteParams = {
|
|
34
|
+
id: zod_1.z.string(),
|
|
35
|
+
};
|
|
36
|
+
function registerMemberTools(server) {
|
|
37
|
+
// Browse members
|
|
38
|
+
server.tool("members_browse", browseParams, async (args, _extra) => {
|
|
39
|
+
const members = await ghostApi_1.ghostApiClient.members.browse(args);
|
|
40
|
+
return {
|
|
41
|
+
content: [
|
|
42
|
+
{
|
|
43
|
+
type: "text",
|
|
44
|
+
text: JSON.stringify(members, null, 2),
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
};
|
|
48
|
+
});
|
|
49
|
+
// Read member
|
|
50
|
+
server.tool("members_read", readParams, async (args, _extra) => {
|
|
51
|
+
const member = await ghostApi_1.ghostApiClient.members.read(args);
|
|
52
|
+
return {
|
|
53
|
+
content: [
|
|
54
|
+
{
|
|
55
|
+
type: "text",
|
|
56
|
+
text: JSON.stringify(member, null, 2),
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
// Add member
|
|
62
|
+
server.tool("members_add", addParams, async (args, _extra) => {
|
|
63
|
+
const member = await ghostApi_1.ghostApiClient.members.add(args);
|
|
64
|
+
return {
|
|
65
|
+
content: [
|
|
66
|
+
{
|
|
67
|
+
type: "text",
|
|
68
|
+
text: JSON.stringify(member, null, 2),
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
});
|
|
73
|
+
// Edit member
|
|
74
|
+
server.tool("members_edit", editParams, async (args, _extra) => {
|
|
75
|
+
const member = await ghostApi_1.ghostApiClient.members.edit(args);
|
|
76
|
+
return {
|
|
77
|
+
content: [
|
|
78
|
+
{
|
|
79
|
+
type: "text",
|
|
80
|
+
text: JSON.stringify(member, null, 2),
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
// Delete member
|
|
86
|
+
server.tool("members_delete", deleteParams, async (args, _extra) => {
|
|
87
|
+
await ghostApi_1.ghostApiClient.members.delete(args);
|
|
88
|
+
return {
|
|
89
|
+
content: [
|
|
90
|
+
{
|
|
91
|
+
type: "text",
|
|
92
|
+
text: `Member with id ${args.id} deleted.`,
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerNewsletterTools = registerNewsletterTools;
|
|
4
|
+
// src/tools/newsletters.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ghostApi_1 = require("../ghostApi");
|
|
7
|
+
// Parameter schemas as ZodRawShape (object literals)
|
|
8
|
+
const browseParams = {
|
|
9
|
+
filter: zod_1.z.string().optional(),
|
|
10
|
+
limit: zod_1.z.number().optional(),
|
|
11
|
+
page: zod_1.z.number().optional(),
|
|
12
|
+
order: zod_1.z.string().optional(),
|
|
13
|
+
};
|
|
14
|
+
const readParams = {
|
|
15
|
+
id: zod_1.z.string().optional(),
|
|
16
|
+
slug: zod_1.z.string().optional(),
|
|
17
|
+
};
|
|
18
|
+
const addParams = {
|
|
19
|
+
name: zod_1.z.string(),
|
|
20
|
+
description: zod_1.z.string().optional(),
|
|
21
|
+
sender_reply_to: zod_1.z.string().optional(),
|
|
22
|
+
status: zod_1.z.string().optional(),
|
|
23
|
+
subscribe_on_signup: zod_1.z.boolean().optional(),
|
|
24
|
+
show_header_icon: zod_1.z.boolean().optional(),
|
|
25
|
+
show_header_title: zod_1.z.boolean().optional(),
|
|
26
|
+
show_header_name: zod_1.z.boolean().optional(),
|
|
27
|
+
title_font_category: zod_1.z.string().optional(),
|
|
28
|
+
title_alignment: zod_1.z.string().optional(),
|
|
29
|
+
show_feature_image: zod_1.z.boolean().optional(),
|
|
30
|
+
body_font_category: zod_1.z.string().optional(),
|
|
31
|
+
show_badge: zod_1.z.boolean().optional(),
|
|
32
|
+
// Add more fields as needed
|
|
33
|
+
};
|
|
34
|
+
const editParams = {
|
|
35
|
+
id: zod_1.z.string(),
|
|
36
|
+
name: zod_1.z.string().optional(),
|
|
37
|
+
description: zod_1.z.string().optional(),
|
|
38
|
+
sender_name: zod_1.z.string().optional(),
|
|
39
|
+
sender_email: zod_1.z.string().optional(),
|
|
40
|
+
sender_reply_to: zod_1.z.string().optional(),
|
|
41
|
+
status: zod_1.z.string().optional(),
|
|
42
|
+
subscribe_on_signup: zod_1.z.boolean().optional(),
|
|
43
|
+
sort_order: zod_1.z.number().optional(),
|
|
44
|
+
header_image: zod_1.z.string().optional(),
|
|
45
|
+
show_header_icon: zod_1.z.boolean().optional(),
|
|
46
|
+
show_header_title: zod_1.z.boolean().optional(),
|
|
47
|
+
title_font_category: zod_1.z.string().optional(),
|
|
48
|
+
title_alignment: zod_1.z.string().optional(),
|
|
49
|
+
show_feature_image: zod_1.z.boolean().optional(),
|
|
50
|
+
body_font_category: zod_1.z.string().optional(),
|
|
51
|
+
footer_content: zod_1.z.string().optional(),
|
|
52
|
+
show_badge: zod_1.z.boolean().optional(),
|
|
53
|
+
show_header_name: zod_1.z.boolean().optional(),
|
|
54
|
+
// Add more fields as needed
|
|
55
|
+
};
|
|
56
|
+
const deleteParams = {
|
|
57
|
+
id: zod_1.z.string(),
|
|
58
|
+
};
|
|
59
|
+
function registerNewsletterTools(server) {
|
|
60
|
+
// Browse newsletters
|
|
61
|
+
server.tool("newsletters_browse", browseParams, async (args, _extra) => {
|
|
62
|
+
const newsletters = await ghostApi_1.ghostApiClient.newsletters.browse(args);
|
|
63
|
+
return {
|
|
64
|
+
content: [
|
|
65
|
+
{
|
|
66
|
+
type: "text",
|
|
67
|
+
text: JSON.stringify(newsletters, null, 2),
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
};
|
|
71
|
+
});
|
|
72
|
+
// Read newsletter
|
|
73
|
+
server.tool("newsletters_read", readParams, async (args, _extra) => {
|
|
74
|
+
const newsletter = await ghostApi_1.ghostApiClient.newsletters.read(args);
|
|
75
|
+
return {
|
|
76
|
+
content: [
|
|
77
|
+
{
|
|
78
|
+
type: "text",
|
|
79
|
+
text: JSON.stringify(newsletter, null, 2),
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
// Add newsletter
|
|
85
|
+
server.tool("newsletters_add", addParams, async (args, _extra) => {
|
|
86
|
+
const newsletter = await ghostApi_1.ghostApiClient.newsletters.add(args);
|
|
87
|
+
return {
|
|
88
|
+
content: [
|
|
89
|
+
{
|
|
90
|
+
type: "text",
|
|
91
|
+
text: JSON.stringify(newsletter, null, 2),
|
|
92
|
+
},
|
|
93
|
+
],
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
// Edit newsletter
|
|
97
|
+
server.tool("newsletters_edit", editParams, async (args, _extra) => {
|
|
98
|
+
const newsletter = await ghostApi_1.ghostApiClient.newsletters.edit(args);
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: JSON.stringify(newsletter, null, 2),
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
// Delete newsletter
|
|
109
|
+
server.tool("newsletters_delete", deleteParams, async (args, _extra) => {
|
|
110
|
+
await ghostApi_1.ghostApiClient.newsletters.delete(args);
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: "text",
|
|
115
|
+
text: `Newsletter with id ${args.id} deleted.`,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerOfferTools = registerOfferTools;
|
|
4
|
+
// src/tools/offers.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ghostApi_1 = require("../ghostApi");
|
|
7
|
+
// Parameter schemas as ZodRawShape (object literals)
|
|
8
|
+
const browseParams = {
|
|
9
|
+
filter: zod_1.z.string().optional(),
|
|
10
|
+
limit: zod_1.z.number().optional(),
|
|
11
|
+
page: zod_1.z.number().optional(),
|
|
12
|
+
order: zod_1.z.string().optional(),
|
|
13
|
+
};
|
|
14
|
+
const readParams = {
|
|
15
|
+
id: zod_1.z.string().optional(),
|
|
16
|
+
code: zod_1.z.string().optional(),
|
|
17
|
+
};
|
|
18
|
+
const addParams = {
|
|
19
|
+
name: zod_1.z.string(),
|
|
20
|
+
code: zod_1.z.string(),
|
|
21
|
+
cadence: zod_1.z.string(),
|
|
22
|
+
duration: zod_1.z.string(),
|
|
23
|
+
amount: zod_1.z.number(),
|
|
24
|
+
tier_id: zod_1.z.string(),
|
|
25
|
+
type: zod_1.z.string(),
|
|
26
|
+
display_title: zod_1.z.string().optional(),
|
|
27
|
+
display_description: zod_1.z.string().optional(),
|
|
28
|
+
duration_in_months: zod_1.z.number().optional(),
|
|
29
|
+
currency: zod_1.z.string().optional(),
|
|
30
|
+
// Add more fields as needed
|
|
31
|
+
};
|
|
32
|
+
const editParams = {
|
|
33
|
+
id: zod_1.z.string(),
|
|
34
|
+
name: zod_1.z.string().optional(),
|
|
35
|
+
code: zod_1.z.string().optional(),
|
|
36
|
+
display_title: zod_1.z.string().optional(),
|
|
37
|
+
display_description: zod_1.z.string().optional(),
|
|
38
|
+
// Only a subset of fields are editable per Ghost API docs
|
|
39
|
+
};
|
|
40
|
+
const deleteParams = {
|
|
41
|
+
id: zod_1.z.string(),
|
|
42
|
+
};
|
|
43
|
+
function registerOfferTools(server) {
|
|
44
|
+
// Browse offers
|
|
45
|
+
server.tool("offers_browse", browseParams, async (args, _extra) => {
|
|
46
|
+
const offers = await ghostApi_1.ghostApiClient.offers.browse(args);
|
|
47
|
+
return {
|
|
48
|
+
content: [
|
|
49
|
+
{
|
|
50
|
+
type: "text",
|
|
51
|
+
text: JSON.stringify(offers, null, 2),
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
});
|
|
56
|
+
// Read offer
|
|
57
|
+
server.tool("offers_read", readParams, async (args, _extra) => {
|
|
58
|
+
const offer = await ghostApi_1.ghostApiClient.offers.read(args);
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: JSON.stringify(offer, null, 2),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
// Add offer
|
|
69
|
+
server.tool("offers_add", addParams, async (args, _extra) => {
|
|
70
|
+
const offer = await ghostApi_1.ghostApiClient.offers.add(args);
|
|
71
|
+
return {
|
|
72
|
+
content: [
|
|
73
|
+
{
|
|
74
|
+
type: "text",
|
|
75
|
+
text: JSON.stringify(offer, null, 2),
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
// Edit offer
|
|
81
|
+
server.tool("offers_edit", editParams, async (args, _extra) => {
|
|
82
|
+
const offer = await ghostApi_1.ghostApiClient.offers.edit(args);
|
|
83
|
+
return {
|
|
84
|
+
content: [
|
|
85
|
+
{
|
|
86
|
+
type: "text",
|
|
87
|
+
text: JSON.stringify(offer, null, 2),
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
// Delete offer
|
|
93
|
+
server.tool("offers_delete", deleteParams, async (args, _extra) => {
|
|
94
|
+
await ghostApi_1.ghostApiClient.offers.delete(args);
|
|
95
|
+
return {
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
type: "text",
|
|
99
|
+
text: `Offer with id ${args.id} deleted.`,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerPostTools = registerPostTools;
|
|
4
|
+
// src/tools/posts.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ghostApi_1 = require("../ghostApi");
|
|
7
|
+
// Parameter schemas as ZodRawShape (object literals)
|
|
8
|
+
const browseParams = {
|
|
9
|
+
filter: zod_1.z.string().optional(),
|
|
10
|
+
limit: zod_1.z.number().optional(),
|
|
11
|
+
page: zod_1.z.number().optional(),
|
|
12
|
+
order: zod_1.z.string().optional(),
|
|
13
|
+
};
|
|
14
|
+
const readParams = {
|
|
15
|
+
id: zod_1.z.string().optional(),
|
|
16
|
+
slug: zod_1.z.string().optional(),
|
|
17
|
+
};
|
|
18
|
+
const addParams = {
|
|
19
|
+
title: zod_1.z.string(),
|
|
20
|
+
html: zod_1.z.string().optional(),
|
|
21
|
+
lexical: zod_1.z.string().optional(),
|
|
22
|
+
status: zod_1.z.string().optional(),
|
|
23
|
+
tags: zod_1.z.array(zod_1.z.object({ name: zod_1.z.string() })).optional(),
|
|
24
|
+
codeinjection_head: zod_1.z.string().optional(),
|
|
25
|
+
codeinjection_foot: zod_1.z.string().optional(),
|
|
26
|
+
meta_title: zod_1.z.string().optional(),
|
|
27
|
+
meta_description: zod_1.z.string().optional(),
|
|
28
|
+
slug: zod_1.z.string().optional(),
|
|
29
|
+
feature_image: zod_1.z.string().optional(),
|
|
30
|
+
og_title: zod_1.z.string().optional(),
|
|
31
|
+
og_description: zod_1.z.string().optional(),
|
|
32
|
+
custom_excerpt: zod_1.z.string().optional(),
|
|
33
|
+
};
|
|
34
|
+
const editParams = {
|
|
35
|
+
id: zod_1.z.string(),
|
|
36
|
+
title: zod_1.z.string().optional(),
|
|
37
|
+
html: zod_1.z.string().optional(),
|
|
38
|
+
lexical: zod_1.z.string().optional(),
|
|
39
|
+
status: zod_1.z.string().optional(),
|
|
40
|
+
updated_at: zod_1.z.string(),
|
|
41
|
+
tags: zod_1.z.array(zod_1.z.object({ name: zod_1.z.string() })).optional(),
|
|
42
|
+
codeinjection_head: zod_1.z.string().optional(),
|
|
43
|
+
codeinjection_foot: zod_1.z.string().optional(),
|
|
44
|
+
meta_title: zod_1.z.string().optional(),
|
|
45
|
+
meta_description: zod_1.z.string().optional(),
|
|
46
|
+
slug: zod_1.z.string().optional(),
|
|
47
|
+
feature_image: zod_1.z.string().optional(),
|
|
48
|
+
og_title: zod_1.z.string().optional(),
|
|
49
|
+
og_description: zod_1.z.string().optional(),
|
|
50
|
+
custom_excerpt: zod_1.z.string().optional(),
|
|
51
|
+
};
|
|
52
|
+
const deleteParams = {
|
|
53
|
+
id: zod_1.z.string(),
|
|
54
|
+
};
|
|
55
|
+
function registerPostTools(server) {
|
|
56
|
+
// Browse posts
|
|
57
|
+
server.tool("posts_browse", browseParams, async (args, _extra) => {
|
|
58
|
+
const posts = await ghostApi_1.ghostApiClient.posts.browse(args);
|
|
59
|
+
return {
|
|
60
|
+
content: [
|
|
61
|
+
{
|
|
62
|
+
type: "text",
|
|
63
|
+
text: JSON.stringify(posts, null, 2),
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
};
|
|
67
|
+
});
|
|
68
|
+
// Read post
|
|
69
|
+
server.tool("posts_read", readParams, async (args, _extra) => {
|
|
70
|
+
const post = await ghostApi_1.ghostApiClient.posts.read(args);
|
|
71
|
+
return {
|
|
72
|
+
content: [
|
|
73
|
+
{
|
|
74
|
+
type: "text",
|
|
75
|
+
text: JSON.stringify(post, null, 2),
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
};
|
|
79
|
+
});
|
|
80
|
+
// Add post
|
|
81
|
+
server.tool("posts_add", addParams, async (args, _extra) => {
|
|
82
|
+
// If html is present, use source: "html" to ensure Ghost uses the html content
|
|
83
|
+
const options = args.html ? { source: "html" } : undefined;
|
|
84
|
+
const post = await ghostApi_1.ghostApiClient.posts.add(args, options);
|
|
85
|
+
return {
|
|
86
|
+
content: [
|
|
87
|
+
{
|
|
88
|
+
type: "text",
|
|
89
|
+
text: JSON.stringify(post, null, 2),
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
// Edit post
|
|
95
|
+
server.tool("posts_edit", editParams, async (args, _extra) => {
|
|
96
|
+
// If html is present, use source: "html" to ensure Ghost uses the html content for updates
|
|
97
|
+
const options = args.html ? { source: "html" } : undefined;
|
|
98
|
+
const post = await ghostApi_1.ghostApiClient.posts.edit(args, options);
|
|
99
|
+
return {
|
|
100
|
+
content: [
|
|
101
|
+
{
|
|
102
|
+
type: "text",
|
|
103
|
+
text: JSON.stringify(post, null, 2),
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
});
|
|
108
|
+
// Delete post
|
|
109
|
+
server.tool("posts_delete", deleteParams, async (args, _extra) => {
|
|
110
|
+
await ghostApi_1.ghostApiClient.posts.delete(args);
|
|
111
|
+
return {
|
|
112
|
+
content: [
|
|
113
|
+
{
|
|
114
|
+
type: "text",
|
|
115
|
+
text: `Post with id ${args.id} deleted.`,
|
|
116
|
+
},
|
|
117
|
+
],
|
|
118
|
+
};
|
|
119
|
+
});
|
|
120
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerRoleTools = registerRoleTools;
|
|
4
|
+
// src/tools/roles.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ghostApi_1 = require("../ghostApi");
|
|
7
|
+
// Parameter schemas as ZodRawShape (object literals)
|
|
8
|
+
const browseParams = {
|
|
9
|
+
filter: zod_1.z.string().optional(),
|
|
10
|
+
limit: zod_1.z.number().optional(),
|
|
11
|
+
page: zod_1.z.number().optional(),
|
|
12
|
+
order: zod_1.z.string().optional(),
|
|
13
|
+
};
|
|
14
|
+
const readParams = {
|
|
15
|
+
id: zod_1.z.string().optional(),
|
|
16
|
+
name: zod_1.z.string().optional(),
|
|
17
|
+
};
|
|
18
|
+
function registerRoleTools(server) {
|
|
19
|
+
// Browse roles
|
|
20
|
+
server.tool("roles_browse", browseParams, async (args, _extra) => {
|
|
21
|
+
const roles = await ghostApi_1.ghostApiClient.roles.browse(args);
|
|
22
|
+
return {
|
|
23
|
+
content: [
|
|
24
|
+
{
|
|
25
|
+
type: "text",
|
|
26
|
+
text: JSON.stringify(roles, null, 2),
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
};
|
|
30
|
+
});
|
|
31
|
+
// Read role
|
|
32
|
+
server.tool("roles_read", readParams, async (args, _extra) => {
|
|
33
|
+
const role = await ghostApi_1.ghostApiClient.roles.read(args);
|
|
34
|
+
return {
|
|
35
|
+
content: [
|
|
36
|
+
{
|
|
37
|
+
type: "text",
|
|
38
|
+
text: JSON.stringify(role, null, 2),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
});
|
|
43
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerTagTools = registerTagTools;
|
|
4
|
+
// src/tools/tags.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ghostApi_1 = require("../ghostApi");
|
|
7
|
+
// Parameter schemas as ZodRawShape (object literals)
|
|
8
|
+
const browseParams = {
|
|
9
|
+
filter: zod_1.z.string().optional(),
|
|
10
|
+
limit: zod_1.z.number().optional(),
|
|
11
|
+
page: zod_1.z.number().optional(),
|
|
12
|
+
order: zod_1.z.string().optional(),
|
|
13
|
+
};
|
|
14
|
+
const readParams = {
|
|
15
|
+
id: zod_1.z.string().optional(),
|
|
16
|
+
slug: zod_1.z.string().optional(),
|
|
17
|
+
};
|
|
18
|
+
const addParams = {
|
|
19
|
+
name: zod_1.z.string(),
|
|
20
|
+
description: zod_1.z.string().optional(),
|
|
21
|
+
slug: zod_1.z.string().optional(),
|
|
22
|
+
// Add more fields as needed
|
|
23
|
+
};
|
|
24
|
+
const editParams = {
|
|
25
|
+
id: zod_1.z.string(),
|
|
26
|
+
name: zod_1.z.string().optional(),
|
|
27
|
+
description: zod_1.z.string().optional(),
|
|
28
|
+
slug: zod_1.z.string().optional(),
|
|
29
|
+
// Add more fields as needed
|
|
30
|
+
};
|
|
31
|
+
const deleteParams = {
|
|
32
|
+
id: zod_1.z.string(),
|
|
33
|
+
};
|
|
34
|
+
function registerTagTools(server) {
|
|
35
|
+
// Browse tags
|
|
36
|
+
server.tool("tags_browse", browseParams, async (args, _extra) => {
|
|
37
|
+
const tags = await ghostApi_1.ghostApiClient.tags.browse(args);
|
|
38
|
+
return {
|
|
39
|
+
content: [
|
|
40
|
+
{
|
|
41
|
+
type: "text",
|
|
42
|
+
text: JSON.stringify(tags, null, 2),
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
// Read tag
|
|
48
|
+
server.tool("tags_read", readParams, async (args, _extra) => {
|
|
49
|
+
const tag = await ghostApi_1.ghostApiClient.tags.read(args);
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
text: JSON.stringify(tag, null, 2),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
// Add tag
|
|
60
|
+
server.tool("tags_add", addParams, async (args, _extra) => {
|
|
61
|
+
const tag = await ghostApi_1.ghostApiClient.tags.add(args);
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: "text",
|
|
66
|
+
text: JSON.stringify(tag, null, 2),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
// Edit tag
|
|
72
|
+
server.tool("tags_edit", editParams, async (args, _extra) => {
|
|
73
|
+
const tag = await ghostApi_1.ghostApiClient.tags.edit(args);
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: "text",
|
|
78
|
+
text: JSON.stringify(tag, null, 2),
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
// Delete tag
|
|
84
|
+
server.tool("tags_delete", deleteParams, async (args, _extra) => {
|
|
85
|
+
await ghostApi_1.ghostApiClient.tags.delete(args);
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: `Tag with id ${args.id} deleted.`,
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerTierTools = registerTierTools;
|
|
4
|
+
// src/tools/tiers.ts
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const ghostApi_1 = require("../ghostApi");
|
|
7
|
+
// Parameter schemas as ZodRawShape (object literals)
|
|
8
|
+
const browseParams = {
|
|
9
|
+
filter: zod_1.z.string().optional(),
|
|
10
|
+
limit: zod_1.z.number().optional(),
|
|
11
|
+
page: zod_1.z.number().optional(),
|
|
12
|
+
order: zod_1.z.string().optional(),
|
|
13
|
+
include: zod_1.z.string().optional(),
|
|
14
|
+
};
|
|
15
|
+
const readParams = {
|
|
16
|
+
id: zod_1.z.string().optional(),
|
|
17
|
+
slug: zod_1.z.string().optional(),
|
|
18
|
+
include: zod_1.z.string().optional(),
|
|
19
|
+
};
|
|
20
|
+
const addParams = {
|
|
21
|
+
name: zod_1.z.string(),
|
|
22
|
+
description: zod_1.z.string().optional(),
|
|
23
|
+
welcome_page_url: zod_1.z.string().optional(),
|
|
24
|
+
visibility: zod_1.z.string().optional(),
|
|
25
|
+
monthly_price: zod_1.z.number().optional(),
|
|
26
|
+
yearly_price: zod_1.z.number().optional(),
|
|
27
|
+
currency: zod_1.z.string().optional(),
|
|
28
|
+
benefits: zod_1.z.array(zod_1.z.string()).optional(),
|
|
29
|
+
// Add more fields as needed
|
|
30
|
+
};
|
|
31
|
+
const editParams = {
|
|
32
|
+
id: zod_1.z.string(),
|
|
33
|
+
name: zod_1.z.string().optional(),
|
|
34
|
+
description: zod_1.z.string().optional(),
|
|
35
|
+
welcome_page_url: zod_1.z.string().optional(),
|
|
36
|
+
visibility: zod_1.z.string().optional(),
|
|
37
|
+
monthly_price: zod_1.z.number().optional(),
|
|
38
|
+
yearly_price: zod_1.z.number().optional(),
|
|
39
|
+
currency: zod_1.z.string().optional(),
|
|
40
|
+
benefits: zod_1.z.array(zod_1.z.string()).optional(),
|
|
41
|
+
// Add more fields as needed
|
|
42
|
+
};
|
|
43
|
+
const deleteParams = {
|
|
44
|
+
id: zod_1.z.string(),
|
|
45
|
+
};
|
|
46
|
+
function registerTierTools(server) {
|
|
47
|
+
// Browse tiers
|
|
48
|
+
server.tool("tiers_browse", browseParams, async (args, _extra) => {
|
|
49
|
+
const tiers = await ghostApi_1.ghostApiClient.tiers.browse(args);
|
|
50
|
+
return {
|
|
51
|
+
content: [
|
|
52
|
+
{
|
|
53
|
+
type: "text",
|
|
54
|
+
text: JSON.stringify(tiers, null, 2),
|
|
55
|
+
},
|
|
56
|
+
],
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
// Read tier
|
|
60
|
+
server.tool("tiers_read", readParams, async (args, _extra) => {
|
|
61
|
+
const tier = await ghostApi_1.ghostApiClient.tiers.read(args);
|
|
62
|
+
return {
|
|
63
|
+
content: [
|
|
64
|
+
{
|
|
65
|
+
type: "text",
|
|
66
|
+
text: JSON.stringify(tier, null, 2),
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
// Add tier
|
|
72
|
+
server.tool("tiers_add", addParams, async (args, _extra) => {
|
|
73
|
+
const tier = await ghostApi_1.ghostApiClient.tiers.add(args);
|
|
74
|
+
return {
|
|
75
|
+
content: [
|
|
76
|
+
{
|
|
77
|
+
type: "text",
|
|
78
|
+
text: JSON.stringify(tier, null, 2),
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
};
|
|
82
|
+
});
|
|
83
|
+
// Edit tier
|
|
84
|
+
server.tool("tiers_edit", editParams, async (args, _extra) => {
|
|
85
|
+
const tier = await ghostApi_1.ghostApiClient.tiers.edit(args);
|
|
86
|
+
return {
|
|
87
|
+
content: [
|
|
88
|
+
{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: JSON.stringify(tier, null, 2),
|
|
91
|
+
},
|
|
92
|
+
],
|
|
93
|
+
};
|
|
94
|
+
});
|
|
95
|
+
// Delete tier
|
|
96
|
+
server.tool("tiers_delete", deleteParams, async (args, _extra) => {
|
|
97
|
+
await ghostApi_1.ghostApiClient.tiers.delete(args);
|
|
98
|
+
return {
|
|
99
|
+
content: [
|
|
100
|
+
{
|
|
101
|
+
type: "text",
|
|
102
|
+
text: `Tier with id ${args.id} deleted.`,
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
};
|
|
106
|
+
});
|
|
107
|
+
}
|