@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.
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerUserTools = registerUserTools;
4
+ // src/tools/users.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
+ slug: zod_1.z.string().optional(),
18
+ };
19
+ const editParams = {
20
+ id: zod_1.z.string(),
21
+ name: zod_1.z.string().optional(),
22
+ email: zod_1.z.string().optional(),
23
+ slug: zod_1.z.string().optional(),
24
+ bio: zod_1.z.string().optional(),
25
+ website: zod_1.z.string().optional(),
26
+ location: zod_1.z.string().optional(),
27
+ facebook: zod_1.z.string().optional(),
28
+ twitter: zod_1.z.string().optional(),
29
+ // Add more fields as needed
30
+ };
31
+ const deleteParams = {
32
+ id: zod_1.z.string(),
33
+ };
34
+ function registerUserTools(server) {
35
+ // Browse users
36
+ server.tool("users_browse", browseParams, async (args, _extra) => {
37
+ const users = await ghostApi_1.ghostApiClient.users.browse(args);
38
+ return {
39
+ content: [
40
+ {
41
+ type: "text",
42
+ text: JSON.stringify(users, null, 2),
43
+ },
44
+ ],
45
+ };
46
+ });
47
+ // Read user
48
+ server.tool("users_read", readParams, async (args, _extra) => {
49
+ const user = await ghostApi_1.ghostApiClient.users.read(args);
50
+ return {
51
+ content: [
52
+ {
53
+ type: "text",
54
+ text: JSON.stringify(user, null, 2),
55
+ },
56
+ ],
57
+ };
58
+ });
59
+ // Edit user
60
+ server.tool("users_edit", editParams, async (args, _extra) => {
61
+ const user = await ghostApi_1.ghostApiClient.users.edit(args);
62
+ return {
63
+ content: [
64
+ {
65
+ type: "text",
66
+ text: JSON.stringify(user, null, 2),
67
+ },
68
+ ],
69
+ };
70
+ });
71
+ // Delete user
72
+ server.tool("users_delete", deleteParams, async (args, _extra) => {
73
+ await ghostApi_1.ghostApiClient.users.delete(args);
74
+ return {
75
+ content: [
76
+ {
77
+ type: "text",
78
+ text: `User with id ${args.id} deleted.`,
79
+ },
80
+ ],
81
+ };
82
+ });
83
+ }
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerWebhookTools = registerWebhookTools;
4
+ // src/tools/webhooks.ts
5
+ const zod_1 = require("zod");
6
+ const ghostApi_1 = require("../ghostApi");
7
+ // Parameter schemas as ZodRawShape (object literals)
8
+ const addParams = {
9
+ event: zod_1.z.string(),
10
+ target_url: zod_1.z.string(),
11
+ name: zod_1.z.string().optional(),
12
+ secret: zod_1.z.string().optional(),
13
+ api_version: zod_1.z.string().optional(),
14
+ integration_id: zod_1.z.string().optional(), // Required for user-authenticated requests
15
+ };
16
+ const editParams = {
17
+ id: zod_1.z.string(),
18
+ event: zod_1.z.string().optional(),
19
+ target_url: zod_1.z.string().optional(),
20
+ name: zod_1.z.string().optional(),
21
+ api_version: zod_1.z.string().optional(),
22
+ };
23
+ const deleteParams = {
24
+ id: zod_1.z.string(),
25
+ };
26
+ function registerWebhookTools(server) {
27
+ // Add webhook
28
+ server.tool("webhooks_add", addParams, async (args, _extra) => {
29
+ const webhook = await ghostApi_1.ghostApiClient.webhooks.add(args);
30
+ return {
31
+ content: [
32
+ {
33
+ type: "text",
34
+ text: JSON.stringify(webhook, null, 2),
35
+ },
36
+ ],
37
+ };
38
+ });
39
+ // Edit webhook
40
+ server.tool("webhooks_edit", editParams, async (args, _extra) => {
41
+ const webhook = await ghostApi_1.ghostApiClient.webhooks.edit(args);
42
+ return {
43
+ content: [
44
+ {
45
+ type: "text",
46
+ text: JSON.stringify(webhook, null, 2),
47
+ },
48
+ ],
49
+ };
50
+ });
51
+ // Delete webhook
52
+ server.tool("webhooks_delete", deleteParams, async (args, _extra) => {
53
+ await ghostApi_1.ghostApiClient.webhooks.delete(args);
54
+ return {
55
+ content: [
56
+ {
57
+ type: "text",
58
+ text: `Webhook with id ${args.id} deleted.`,
59
+ },
60
+ ],
61
+ };
62
+ });
63
+ }
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@junis/ghost-mcp",
3
+ "version": "0.1.0",
4
+ "description": "MCP server for using the Ghost API",
5
+ "main": "build/server.js",
6
+ "bin": {
7
+ "ghost-mcp": "build/server.js"
8
+ },
9
+ "files": [
10
+ "build/"
11
+ ],
12
+ "scripts": {
13
+ "build": "tsc",
14
+ "start": "node build/server.js",
15
+ "prepare": "npm run build",
16
+ "test": "echo \"Error: no test specified\" && exit 1"
17
+ },
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "keywords": [],
22
+ "author": "Fanyang Meng (https://mfydev.link)",
23
+ "license": "ISC",
24
+ "type": "commonjs",
25
+ "dependencies": {
26
+ "@modelcontextprotocol/sdk": "^1.10.1",
27
+ "@tryghost/admin-api": "^1.13.13",
28
+ "axios": "^1.8.4",
29
+ "zod": "^3.24.3"
30
+ },
31
+ "devDependencies": {
32
+ "@types/axios": "^0.9.36",
33
+ "@types/node": "^22.14.1",
34
+ "typescript": "^5.8.3"
35
+ }
36
+ }