@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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Fanyang Meng
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,151 @@
1
+ # Ghost MCP Server
2
+
3
+ ## ‼️ Important Notice: Python to TypeScript Migration
4
+ I've completely rewritten the Ghost MCP Server from Python to TypeScript in this v0.1.0 release. This major change brings several benefits:
5
+
6
+ - Simplified installation: Now available as an NPM package (@fanyangmeng/ghost-mcp)
7
+ - Improved reliability: Uses the official @tryghost/admin-api client instead of custom implementation
8
+ - Better maintainability: TypeScript provides type safety and better code organization
9
+ - Streamlined configuration: Simple environment variable setup
10
+
11
+ ### Breaking Changes
12
+
13
+ - Python dependencies are no longer required
14
+ - Configuration method has changed (now using Node.js environment variables)
15
+ - Docker deployment has been simplified
16
+ - Different installation process (now using NPM)
17
+
18
+ Please see the below updated documentation for details on migrating from the Python version. If you encounter any issues, feel free to open an issue on GitHub.
19
+
20
+ ---
21
+
22
+ A Model Context Protocol (MCP) server for interacting with Ghost CMS through LLM interfaces like Claude. This server provides secure and comprehensive access to your Ghost blog, leveraging JWT authentication and a rich set of MCP tools for managing posts, users, members, tiers, offers, and newsletters.
23
+
24
+ ![demo](./assets/ghost-mcp-demo.gif)
25
+
26
+ ## Features
27
+
28
+ - Secure Ghost Admin API requests with `@tryghost/admin-api`
29
+ - Comprehensive entity access including posts, users, members, tiers, offers, and newsletters
30
+ - Advanced search functionality with both fuzzy and exact matching options
31
+ - Detailed, human-readable output for Ghost entities
32
+ - Robust error handling using custom `GhostError` exceptions
33
+ - Integrated logging support via MCP context for enhanced troubleshooting
34
+
35
+ ## Usage
36
+
37
+ To use this with MCP clients, for instance, Claude Desktop, add the following to your `claude_desktop_config.json`:
38
+ ```json
39
+ {
40
+ "mcpServers": {
41
+ "ghost-mcp": {
42
+ "command": "npx",
43
+ "args": ["-y", "@fanyangmeng/ghost-mcp"],
44
+ "env": {
45
+ "GHOST_API_URL": "https://yourblog.com",
46
+ "GHOST_ADMIN_API_KEY": "your_admin_api_key",
47
+ "GHOST_API_VERSION": "v5.0"
48
+ }
49
+ }
50
+ }
51
+ }
52
+ ```
53
+
54
+ ## Available Resources
55
+
56
+ The following Ghost CMS resources are available through this MCP server:
57
+
58
+ - **Posts**: Articles and content published on your Ghost site.
59
+ - **Members**: Registered users and subscribers of your site.
60
+ - **Newsletters**: Email newsletters managed and sent via Ghost.
61
+ - **Offers**: Promotional offers and discounts for members.
62
+ - **Invites**: Invitations for new users or staff to join your Ghost site.
63
+ - **Roles**: User roles and permissions within the Ghost admin.
64
+ - **Tags**: Organizational tags for posts and content.
65
+ - **Tiers**: Subscription tiers and plans for members.
66
+ - **Users**: Admin users and staff accounts.
67
+ - **Webhooks**: Automated event notifications to external services.
68
+
69
+ ## Available Tools
70
+
71
+ This MCP server exposes a comprehensive set of tools for managing your Ghost CMS via the Model Context Protocol. Each resource provides a set of operations, typically including browsing, reading, creating, editing, and deleting entities. Below is a summary of the available tools:
72
+
73
+ ### Posts
74
+ - **Browse Posts**: List posts with optional filters, pagination, and ordering.
75
+ - **Read Post**: Retrieve a post by ID or slug.
76
+ - **Add Post**: Create a new post with title, content, and status.
77
+ - **Edit Post**: Update an existing post by ID.
78
+ - **Delete Post**: Remove a post by ID.
79
+
80
+ ### Members
81
+ - **Browse Members**: List members with filters and pagination.
82
+ - **Read Member**: Retrieve a member by ID or email.
83
+ - **Add Member**: Create a new member.
84
+ - **Edit Member**: Update member details.
85
+ - **Delete Member**: Remove a member.
86
+
87
+ ### Newsletters
88
+ - **Browse Newsletters**: List newsletters.
89
+ - **Read Newsletter**: Retrieve a newsletter by ID.
90
+ - **Add Newsletter**: Create a new newsletter.
91
+ - **Edit Newsletter**: Update newsletter details.
92
+ - **Delete Newsletter**: Remove a newsletter.
93
+
94
+ ### Offers
95
+ - **Browse Offers**: List offers.
96
+ - **Read Offer**: Retrieve an offer by ID.
97
+ - **Add Offer**: Create a new offer.
98
+ - **Edit Offer**: Update offer details.
99
+ - **Delete Offer**: Remove an offer.
100
+
101
+ ### Invites
102
+ - **Browse Invites**: List invites.
103
+ - **Add Invite**: Create a new invite.
104
+ - **Delete Invite**: Remove an invite.
105
+
106
+ ### Roles
107
+ - **Browse Roles**: List roles.
108
+ - **Read Role**: Retrieve a role by ID.
109
+
110
+ ### Tags
111
+ - **Browse Tags**: List tags.
112
+ - **Read Tag**: Retrieve a tag by ID or slug.
113
+ - **Add Tag**: Create a new tag.
114
+ - **Edit Tag**: Update tag details.
115
+ - **Delete Tag**: Remove a tag.
116
+
117
+ ### Tiers
118
+ - **Browse Tiers**: List tiers.
119
+ - **Read Tier**: Retrieve a tier by ID.
120
+ - **Add Tier**: Create a new tier.
121
+ - **Edit Tier**: Update tier details.
122
+ - **Delete Tier**: Remove a tier.
123
+
124
+ ### Users
125
+ - **Browse Users**: List users.
126
+ - **Read User**: Retrieve a user by ID or slug.
127
+ - **Edit User**: Update user details.
128
+ - **Delete User**: Remove a user.
129
+
130
+ ### Webhooks
131
+ - **Browse Webhooks**: List webhooks.
132
+ - **Add Webhook**: Create a new webhook.
133
+ - **Delete Webhook**: Remove a webhook.
134
+
135
+ > Each tool is accessible via the MCP protocol and can be invoked from compatible clients. For detailed parameter schemas and usage, see the source code in `src/tools/`.
136
+
137
+
138
+ ## Error Handling
139
+
140
+ Ghost MCP Server employs a custom `GhostError` exception to handle API communication errors and processing issues. This ensures clear and descriptive error messages to assist with troubleshooting.
141
+
142
+ ## Contributing
143
+
144
+ 1. Fork repository
145
+ 2. Create feature branch
146
+ 3. Commit changes
147
+ 4. Create pull request
148
+
149
+ ## License
150
+
151
+ MIT
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GHOST_API_VERSION = exports.GHOST_ADMIN_API_KEY = exports.GHOST_API_URL = void 0;
4
+ // Read configuration values directly from process.env
5
+ exports.GHOST_API_URL = process.env.GHOST_API_URL;
6
+ exports.GHOST_ADMIN_API_KEY = process.env.GHOST_ADMIN_API_KEY;
7
+ exports.GHOST_API_VERSION = process.env.GHOST_API_VERSION || 'v5.0'; // Default to v5.0
8
+ // Basic validation to ensure required environment variables are set
9
+ if (!exports.GHOST_API_URL) {
10
+ console.error("Error: GHOST_API_URL environment variable is not set.");
11
+ process.exit(1);
12
+ }
13
+ if (!exports.GHOST_ADMIN_API_KEY) {
14
+ console.error("Error: GHOST_ADMIN_API_KEY environment variable is not set.");
15
+ process.exit(1);
16
+ }
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ghostApiClient = void 0;
7
+ const admin_api_1 = __importDefault(require("@tryghost/admin-api"));
8
+ const config_1 = require("./config");
9
+ // Initialize and export the Ghost Admin API client instance.
10
+ // Configuration is loaded from src/config.ts.
11
+ exports.ghostApiClient = new admin_api_1.default({
12
+ url: config_1.GHOST_API_URL,
13
+ key: config_1.GHOST_ADMIN_API_KEY,
14
+ version: config_1.GHOST_API_VERSION
15
+ });
16
+ // You can add helper functions here to wrap API calls and handle errors
17
+ // For example:
18
+ /*
19
+ export async function getPostById(postId: string): Promise<any> {
20
+ try {
21
+ const post = await ghostApiClient.posts.read({ id: postId });
22
+ return post;
23
+ } catch (error) {
24
+ console.error(`Error fetching post ${postId}:`, error);
25
+ throw new Error(`Failed to fetch post ${postId}`);
26
+ }
27
+ }
28
+ */
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerPrompts = registerPrompts;
4
+ // src/prompts.ts
5
+ const zod_1 = require("zod");
6
+ const ghostApi_1 = require("./ghostApi");
7
+ // Example prompt: summarize-post
8
+ function registerPrompts(server) {
9
+ server.prompt("summarize-post", { postId: zod_1.z.string() }, async ({ postId }) => {
10
+ // Fetch the post by ID
11
+ const post = await ghostApi_1.ghostApiClient.posts.read({ id: postId });
12
+ const title = post.title || "";
13
+ const excerpt = post.excerpt || "";
14
+ const html = post.html || "";
15
+ // Compose a summary message
16
+ const summary = `Title: ${title}\nExcerpt: ${excerpt}\n\nContent Preview:\n${html.slice(0, 300)}...`;
17
+ return {
18
+ messages: [
19
+ {
20
+ role: "user",
21
+ content: {
22
+ type: "text",
23
+ text: `Summarize the following Ghost post:\n\n${summary}`,
24
+ },
25
+ },
26
+ ],
27
+ };
28
+ });
29
+ }
@@ -0,0 +1,222 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.handlePostResource = exports.handleNewsletterResource = exports.handleOfferResource = exports.handleTierResource = exports.handleMemberResource = exports.handleUserResource = void 0;
4
+ exports.handleBlogInfoResource = handleBlogInfoResource;
5
+ // Handler for the user resource
6
+ const handleUserResource = async (uri, variables) => {
7
+ try {
8
+ const userId = variables.user_id; // Access parameter from variables
9
+ if (!userId) {
10
+ // TODO: Return a structured MCP error for missing parameter
11
+ throw new Error("Missing user_id parameter");
12
+ }
13
+ // TODO: Use ghostApiClient to fetch user data by ID
14
+ // const user: User = await ghostApiClient.users.read({ id: userId });
15
+ // return {
16
+ // contents: [{
17
+ // uri: uri.href,
18
+ // text: JSON.stringify(user, null, 2), // Or format as needed
19
+ // mimeType: 'application/json'
20
+ // }]
21
+ // };
22
+ return {
23
+ contents: [{
24
+ uri: uri.href,
25
+ text: `User resource requested for ID: ${userId}`,
26
+ mimeType: 'text/plain'
27
+ }]
28
+ };
29
+ }
30
+ catch (error) {
31
+ console.error(`Error fetching user ${variables.user_id}:`, error);
32
+ // TODO: Return an error result in the MCP format
33
+ throw error;
34
+ }
35
+ };
36
+ exports.handleUserResource = handleUserResource;
37
+ // Handler for the member resource
38
+ const handleMemberResource = async (uri, variables) => {
39
+ try {
40
+ const memberId = variables.member_id; // Access parameter from variables
41
+ if (!memberId) {
42
+ // TODO: Return a structured MCP error for missing parameter
43
+ throw new Error("Missing member_id parameter");
44
+ }
45
+ // TODO: Use ghostApiClient to fetch member data by ID
46
+ // const member: Member = await ghostApiClient.members.read({ id: memberId });
47
+ // return {
48
+ // contents: [{
49
+ // uri: uri.href,
50
+ // text: JSON.stringify(member, null, 2), // Or format as needed
51
+ // mimeType: 'application/json'
52
+ // }]
53
+ // };
54
+ return {
55
+ contents: [{
56
+ uri: uri.href,
57
+ text: `Member resource requested for ID: ${memberId}`,
58
+ mimeType: 'text/plain'
59
+ }]
60
+ };
61
+ }
62
+ catch (error) {
63
+ console.error(`Error fetching member ${variables.member_id}:`, error);
64
+ // TODO: Return an error result in the MCP format
65
+ throw error;
66
+ }
67
+ };
68
+ exports.handleMemberResource = handleMemberResource;
69
+ // Handler for the tier resource
70
+ const handleTierResource = async (uri, variables) => {
71
+ try {
72
+ const tierId = variables.tier_id; // Access parameter from variables
73
+ if (!tierId) {
74
+ // TODO: Return a structured MCP error for missing parameter
75
+ throw new Error("Missing tier_id parameter");
76
+ }
77
+ // TODO: Use ghostApiClient to fetch tier data by ID
78
+ // const tier: Tier = await ghostApiClient.tiers.read({ id: tierId });
79
+ // return {
80
+ // contents: [{
81
+ // uri: uri.href,
82
+ // text: JSON.stringify(tier, null, 2), // Or format as needed
83
+ // mimeType: 'application/json'
84
+ // }]
85
+ // };
86
+ return {
87
+ contents: [{
88
+ uri: uri.href,
89
+ text: `Tier resource requested for ID: ${tierId}`,
90
+ mimeType: 'text/plain'
91
+ }]
92
+ };
93
+ }
94
+ catch (error) {
95
+ console.error(`Error fetching tier ${variables.tier_id}:`, error);
96
+ // TODO: Return an error result in the MCP format
97
+ throw error;
98
+ }
99
+ };
100
+ exports.handleTierResource = handleTierResource;
101
+ // Handler for the offer resource
102
+ const handleOfferResource = async (uri, variables) => {
103
+ try {
104
+ const offerId = variables.offer_id; // Access parameter from variables
105
+ if (!offerId) {
106
+ // TODO: Return a structured MCP error for missing parameter
107
+ throw new Error("Missing offer_id parameter");
108
+ }
109
+ // TODO: Use ghostApiClient to fetch offer data by ID
110
+ // const offer: Offer = await ghostApiClient.offers.read({ id: offerId });
111
+ // return {
112
+ // contents: [{
113
+ // uri: uri.href,
114
+ // text: JSON.stringify(offer, null, 2), // Or format as needed
115
+ // mimeType: 'application/json'
116
+ // }]
117
+ // };
118
+ return {
119
+ contents: [{
120
+ uri: uri.href,
121
+ text: `Offer resource requested for ID: ${offerId}`,
122
+ mimeType: 'text/plain'
123
+ }]
124
+ };
125
+ }
126
+ catch (error) {
127
+ console.error(`Error fetching offer ${variables.offer_id}:`, error);
128
+ // TODO: Return an error result in the MCP format
129
+ throw error;
130
+ }
131
+ };
132
+ exports.handleOfferResource = handleOfferResource;
133
+ // Handler for the newsletter resource
134
+ const handleNewsletterResource = async (uri, variables) => {
135
+ try {
136
+ const newsletterId = variables.newsletter_id; // Access parameter from variables
137
+ if (!newsletterId) {
138
+ // TODO: Return a structured MCP error for missing parameter
139
+ throw new Error("Missing newsletter_id parameter");
140
+ }
141
+ // TODO: Use ghostApiClient to fetch newsletter data by ID
142
+ // const newsletter: Newsletter = await ghostApiClient.newsletters.read({ id: newsletterId });
143
+ // return {
144
+ // contents: [{
145
+ // uri: uri.href,
146
+ // text: JSON.stringify(newsletter, null, 2), // Or format as needed
147
+ // mimeType: 'application/json'
148
+ // }]
149
+ // };
150
+ return {
151
+ contents: [{
152
+ uri: uri.href,
153
+ text: `Newsletter resource requested for ID: ${newsletterId}`,
154
+ mimeType: 'text/plain'
155
+ }]
156
+ };
157
+ }
158
+ catch (error) {
159
+ console.error(`Error fetching newsletter ${variables.newsletter_id}:`, error);
160
+ // TODO: Return an error result in the MCP format
161
+ throw error;
162
+ }
163
+ };
164
+ exports.handleNewsletterResource = handleNewsletterResource;
165
+ // Handler for the post resource
166
+ const handlePostResource = async (uri, variables) => {
167
+ try {
168
+ const postId = variables.post_id; // Access parameter from variables
169
+ if (!postId) {
170
+ // TODO: Return a structured MCP error for missing parameter
171
+ throw new Error("Missing post_id parameter");
172
+ }
173
+ // TODO: Use ghostApiClient to fetch post data by ID
174
+ // const post: Post = await ghostApiClient.posts.read({ id: postId });
175
+ // return {
176
+ // contents: [{
177
+ // uri: uri.href,
178
+ // text: JSON.stringify(post, null, 2), // Or format as needed
179
+ // mimeType: 'application/json'
180
+ // }]
181
+ // };
182
+ return {
183
+ contents: [{
184
+ uri: uri.href,
185
+ text: `Post resource requested for ID: ${postId}`,
186
+ mimeType: 'text/plain'
187
+ }]
188
+ };
189
+ }
190
+ catch (error) {
191
+ console.error(`Error fetching post ${variables.post_id}:`, error);
192
+ // TODO: Return an error result in the MCP format
193
+ throw error;
194
+ }
195
+ };
196
+ exports.handlePostResource = handlePostResource;
197
+ // Handler for the blog info resource
198
+ async function handleBlogInfoResource(uri) {
199
+ try {
200
+ // TODO: Use ghostApiClient to fetch blog info
201
+ // const blogInfo = await ghostApiClient.site.read();
202
+ // return {
203
+ // contents: [{
204
+ // uri: uri.href,
205
+ // text: JSON.stringify(blogInfo, null, 2), // Or format as needed
206
+ // mimeType: 'application/json'
207
+ // }]
208
+ // };
209
+ return {
210
+ contents: [{
211
+ uri: uri.href,
212
+ text: `Blog info resource requested`,
213
+ mimeType: 'text/plain'
214
+ }]
215
+ };
216
+ }
217
+ catch (error) {
218
+ console.error(`Error fetching blog info:`, error);
219
+ // TODO: Return an error result in the MCP format
220
+ throw error;
221
+ }
222
+ }
@@ -0,0 +1,59 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
5
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
6
+ const resources_1 = require("./resources"); // Import resource handlers
7
+ // Create an MCP server instance
8
+ const server = new mcp_js_1.McpServer({
9
+ name: "ghost-mcp-ts",
10
+ version: "1.0.0", // TODO: Get version from package.json
11
+ capabilities: {
12
+ resources: {}, // Capabilities will be enabled as handlers are registered
13
+ tools: {},
14
+ prompts: {},
15
+ logging: {} // Enable logging capability
16
+ }
17
+ });
18
+ // Register resource handlers
19
+ server.resource("user", new mcp_js_1.ResourceTemplate("user://{user_id}", { list: undefined }), resources_1.handleUserResource);
20
+ server.resource("member", new mcp_js_1.ResourceTemplate("member://{member_id}", { list: undefined }), resources_1.handleMemberResource);
21
+ server.resource("tier", new mcp_js_1.ResourceTemplate("tier://{tier_id}", { list: undefined }), resources_1.handleTierResource);
22
+ server.resource("offer", new mcp_js_1.ResourceTemplate("offer://{offer_id}", { list: undefined }), resources_1.handleOfferResource);
23
+ server.resource("newsletter", new mcp_js_1.ResourceTemplate("newsletter://{newsletter_id}", { list: undefined }), resources_1.handleNewsletterResource);
24
+ server.resource("post", new mcp_js_1.ResourceTemplate("post://{post_id}", { list: undefined }), resources_1.handlePostResource);
25
+ server.resource("blog-info", "blog://info", resources_1.handleBlogInfoResource);
26
+ // Register tools
27
+ const posts_1 = require("./tools/posts");
28
+ const members_1 = require("./tools/members");
29
+ (0, posts_1.registerPostTools)(server);
30
+ (0, members_1.registerMemberTools)(server);
31
+ const users_1 = require("./tools/users");
32
+ (0, users_1.registerUserTools)(server);
33
+ const tags_1 = require("./tools/tags");
34
+ (0, tags_1.registerTagTools)(server);
35
+ const tiers_1 = require("./tools/tiers");
36
+ (0, tiers_1.registerTierTools)(server);
37
+ const offers_1 = require("./tools/offers");
38
+ (0, offers_1.registerOfferTools)(server);
39
+ const newsletters_1 = require("./tools/newsletters");
40
+ (0, newsletters_1.registerNewsletterTools)(server);
41
+ const invites_1 = require("./tools/invites");
42
+ (0, invites_1.registerInviteTools)(server);
43
+ const roles_1 = require("./tools/roles");
44
+ (0, roles_1.registerRoleTools)(server);
45
+ const webhooks_1 = require("./tools/webhooks");
46
+ (0, webhooks_1.registerWebhookTools)(server);
47
+ const prompts_1 = require("./prompts");
48
+ (0, prompts_1.registerPrompts)(server);
49
+ // Set up and connect to the standard I/O transport
50
+ async function startServer() {
51
+ const transport = new stdio_js_1.StdioServerTransport();
52
+ await server.connect(transport);
53
+ console.error("Ghost MCP TypeScript Server running on stdio"); // Log to stderr
54
+ }
55
+ // Start the server
56
+ startServer().catch((error) => {
57
+ console.error("Fatal error starting server:", error);
58
+ process.exit(1);
59
+ });
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerInviteTools = registerInviteTools;
4
+ // src/tools/invites.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 addParams = {
15
+ role_id: zod_1.z.string(),
16
+ email: zod_1.z.string(),
17
+ };
18
+ const deleteParams = {
19
+ id: zod_1.z.string(),
20
+ };
21
+ function registerInviteTools(server) {
22
+ // Browse invites
23
+ server.tool("invites_browse", browseParams, async (args, _extra) => {
24
+ const invites = await ghostApi_1.ghostApiClient.invites.browse(args);
25
+ return {
26
+ content: [
27
+ {
28
+ type: "text",
29
+ text: JSON.stringify(invites, null, 2),
30
+ },
31
+ ],
32
+ };
33
+ });
34
+ // Add invite
35
+ server.tool("invites_add", addParams, async (args, _extra) => {
36
+ const invite = await ghostApi_1.ghostApiClient.invites.add(args);
37
+ return {
38
+ content: [
39
+ {
40
+ type: "text",
41
+ text: JSON.stringify(invite, null, 2),
42
+ },
43
+ ],
44
+ };
45
+ });
46
+ // Delete invite
47
+ server.tool("invites_delete", deleteParams, async (args, _extra) => {
48
+ await ghostApi_1.ghostApiClient.invites.delete(args);
49
+ return {
50
+ content: [
51
+ {
52
+ type: "text",
53
+ text: `Invite with id ${args.id} deleted.`,
54
+ },
55
+ ],
56
+ };
57
+ });
58
+ }