postproxy-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.
Files changed (85) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +635 -0
  3. package/dist/api/client.d.ts +71 -0
  4. package/dist/api/client.d.ts.map +1 -0
  5. package/dist/api/client.js +432 -0
  6. package/dist/api/client.js.map +1 -0
  7. package/dist/auth/credentials.d.ts +19 -0
  8. package/dist/auth/credentials.d.ts.map +1 -0
  9. package/dist/auth/credentials.js +40 -0
  10. package/dist/auth/credentials.js.map +1 -0
  11. package/dist/index.d.ts +6 -0
  12. package/dist/index.d.ts.map +1 -0
  13. package/dist/index.js +44 -0
  14. package/dist/index.js.map +1 -0
  15. package/dist/server.d.ts +162 -0
  16. package/dist/server.d.ts.map +1 -0
  17. package/dist/server.js +220 -0
  18. package/dist/server.js.map +1 -0
  19. package/dist/setup-cli.d.ts +6 -0
  20. package/dist/setup-cli.d.ts.map +1 -0
  21. package/dist/setup-cli.js +10 -0
  22. package/dist/setup-cli.js.map +1 -0
  23. package/dist/setup.d.ts +8 -0
  24. package/dist/setup.d.ts.map +1 -0
  25. package/dist/setup.js +143 -0
  26. package/dist/setup.js.map +1 -0
  27. package/dist/tools/accounts.d.ts +11 -0
  28. package/dist/tools/accounts.d.ts.map +1 -0
  29. package/dist/tools/accounts.js +53 -0
  30. package/dist/tools/accounts.js.map +1 -0
  31. package/dist/tools/auth.d.ts +11 -0
  32. package/dist/tools/auth.d.ts.map +1 -0
  33. package/dist/tools/auth.js +35 -0
  34. package/dist/tools/auth.js.map +1 -0
  35. package/dist/tools/history.d.ts +13 -0
  36. package/dist/tools/history.d.ts.map +1 -0
  37. package/dist/tools/history.js +79 -0
  38. package/dist/tools/history.js.map +1 -0
  39. package/dist/tools/post.d.ts +44 -0
  40. package/dist/tools/post.d.ts.map +1 -0
  41. package/dist/tools/post.js +251 -0
  42. package/dist/tools/post.js.map +1 -0
  43. package/dist/tools/profiles.d.ts +11 -0
  44. package/dist/tools/profiles.d.ts.map +1 -0
  45. package/dist/tools/profiles.js +52 -0
  46. package/dist/tools/profiles.js.map +1 -0
  47. package/dist/types/index.d.ts +147 -0
  48. package/dist/types/index.d.ts.map +1 -0
  49. package/dist/types/index.js +5 -0
  50. package/dist/types/index.js.map +1 -0
  51. package/dist/utils/errors.d.ts +21 -0
  52. package/dist/utils/errors.d.ts.map +1 -0
  53. package/dist/utils/errors.js +33 -0
  54. package/dist/utils/errors.js.map +1 -0
  55. package/dist/utils/idempotency.d.ts +8 -0
  56. package/dist/utils/idempotency.d.ts.map +1 -0
  57. package/dist/utils/idempotency.js +23 -0
  58. package/dist/utils/idempotency.js.map +1 -0
  59. package/dist/utils/logger.d.ts +20 -0
  60. package/dist/utils/logger.d.ts.map +1 -0
  61. package/dist/utils/logger.js +68 -0
  62. package/dist/utils/logger.js.map +1 -0
  63. package/dist/utils/validation.d.ts +555 -0
  64. package/dist/utils/validation.d.ts.map +1 -0
  65. package/dist/utils/validation.js +145 -0
  66. package/dist/utils/validation.js.map +1 -0
  67. package/package.json +39 -0
  68. package/src/api/client.ts +497 -0
  69. package/src/auth/credentials.ts +43 -0
  70. package/src/index.ts +57 -0
  71. package/src/server.ts +235 -0
  72. package/src/setup-cli.ts +11 -0
  73. package/src/setup.ts +187 -0
  74. package/src/tools/auth.ts +45 -0
  75. package/src/tools/history.ts +89 -0
  76. package/src/tools/post.ts +338 -0
  77. package/src/tools/profiles.ts +69 -0
  78. package/src/types/index.ts +161 -0
  79. package/src/utils/errors.ts +38 -0
  80. package/src/utils/idempotency.ts +31 -0
  81. package/src/utils/logger.ts +75 -0
  82. package/src/utils/validation.ts +171 -0
  83. package/tsconfig.json +19 -0
  84. package/worker/index.ts +901 -0
  85. package/wrangler.toml +11 -0
@@ -0,0 +1,162 @@
1
+ /**
2
+ * MCP Server setup and tool registration
3
+ */
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import type { PostProxyClient } from "./api/client.js";
6
+ /**
7
+ * Tool definitions for the PostProxy MCP server.
8
+ * Exported for potential reuse in other contexts (e.g., Cloudflare Workers).
9
+ */
10
+ export declare const TOOL_DEFINITIONS: readonly [{
11
+ readonly name: "auth.status";
12
+ readonly description: "Check authentication status, API configuration, and workspace information";
13
+ readonly inputSchema: {
14
+ readonly type: "object";
15
+ readonly properties: {};
16
+ };
17
+ }, {
18
+ readonly name: "profiles.list";
19
+ readonly description: "List all available social media profiles (targets) for posting";
20
+ readonly inputSchema: {
21
+ readonly type: "object";
22
+ readonly properties: {};
23
+ };
24
+ }, {
25
+ readonly name: "post.publish";
26
+ readonly description: "Publish a post to specified social media targets. Supports text content, media attachments, scheduling, drafts, and platform-specific customization via the 'platforms' parameter.";
27
+ readonly inputSchema: {
28
+ readonly type: "object";
29
+ readonly properties: {
30
+ readonly content: {
31
+ readonly type: "string";
32
+ readonly description: "Post content text (caption/description)";
33
+ };
34
+ readonly targets: {
35
+ readonly type: "array";
36
+ readonly items: {
37
+ readonly type: "string";
38
+ };
39
+ readonly description: "Array of target profile IDs to publish to";
40
+ };
41
+ readonly schedule: {
42
+ readonly type: "string";
43
+ readonly description: "Optional ISO 8601 scheduled time (e.g., '2024-12-31T23:59:59Z')";
44
+ };
45
+ readonly media: {
46
+ readonly type: "array";
47
+ readonly items: {
48
+ readonly type: "string";
49
+ };
50
+ readonly description: "Optional array of media URLs or local file paths (images or videos). File paths can be absolute (/path/to/file.jpg), relative (./image.png), or use ~ for home directory (~/Pictures/photo.jpg)";
51
+ };
52
+ readonly idempotency_key: {
53
+ readonly type: "string";
54
+ readonly description: "Optional idempotency key for request deduplication";
55
+ };
56
+ readonly require_confirmation: {
57
+ readonly type: "boolean";
58
+ readonly description: "If true, return summary without publishing (dry run)";
59
+ };
60
+ readonly draft: {
61
+ readonly type: "boolean";
62
+ readonly description: "If true, creates a draft post that won't publish automatically";
63
+ };
64
+ readonly platforms: {
65
+ readonly type: "object";
66
+ readonly description: "Platform-specific parameters. Keys are platform names, values are parameter objects. Use this to add collaborators, set video titles, privacy settings, etc.";
67
+ readonly properties: {
68
+ readonly instagram: {
69
+ readonly type: "object";
70
+ readonly description: "Instagram: format (post|reel|story), collaborators (array of usernames), first_comment (string), cover_url (string), audio_name (string), trial_strategy (MANUAL|SS_PERFORMANCE), thumb_offset (string in ms)";
71
+ readonly additionalProperties: true;
72
+ };
73
+ readonly youtube: {
74
+ readonly type: "object";
75
+ readonly description: "YouTube: title (string), privacy_status (public|unlisted|private), cover_url (thumbnail URL)";
76
+ readonly additionalProperties: true;
77
+ };
78
+ readonly tiktok: {
79
+ readonly type: "object";
80
+ readonly description: "TikTok: privacy_status (PUBLIC_TO_EVERYONE|MUTUAL_FOLLOW_FRIENDS|FOLLOWER_OF_CREATOR|SELF_ONLY), photo_cover_index (integer), auto_add_music (bool), made_with_ai (bool), disable_comment (bool), disable_duet (bool), disable_stitch (bool), brand_content_toggle (bool), brand_organic_toggle (bool)";
81
+ readonly additionalProperties: true;
82
+ };
83
+ readonly facebook: {
84
+ readonly type: "object";
85
+ readonly description: "Facebook: format (post|story), first_comment (string), page_id (string)";
86
+ readonly additionalProperties: true;
87
+ };
88
+ readonly linkedin: {
89
+ readonly type: "object";
90
+ readonly description: "LinkedIn: organization_id (string for company pages)";
91
+ readonly additionalProperties: true;
92
+ };
93
+ readonly twitter: {
94
+ readonly type: "object";
95
+ readonly description: "Twitter/X: No platform-specific parameters available";
96
+ readonly additionalProperties: true;
97
+ };
98
+ readonly threads: {
99
+ readonly type: "object";
100
+ readonly description: "Threads: No platform-specific parameters available";
101
+ readonly additionalProperties: true;
102
+ };
103
+ };
104
+ readonly additionalProperties: true;
105
+ };
106
+ };
107
+ readonly required: readonly ["content", "targets"];
108
+ };
109
+ }, {
110
+ readonly name: "post.status";
111
+ readonly description: "Get status of a published post by job ID";
112
+ readonly inputSchema: {
113
+ readonly type: "object";
114
+ readonly properties: {
115
+ readonly job_id: {
116
+ readonly type: "string";
117
+ readonly description: "Job ID from post.publish response";
118
+ };
119
+ };
120
+ readonly required: readonly ["job_id"];
121
+ };
122
+ }, {
123
+ readonly name: "post.publish_draft";
124
+ readonly description: "Publish a draft post. Only posts with draft status can be published using this endpoint";
125
+ readonly inputSchema: {
126
+ readonly type: "object";
127
+ readonly properties: {
128
+ readonly job_id: {
129
+ readonly type: "string";
130
+ readonly description: "Job ID of the draft post to publish";
131
+ };
132
+ };
133
+ readonly required: readonly ["job_id"];
134
+ };
135
+ }, {
136
+ readonly name: "post.delete";
137
+ readonly description: "Delete a post by job ID";
138
+ readonly inputSchema: {
139
+ readonly type: "object";
140
+ readonly properties: {
141
+ readonly job_id: {
142
+ readonly type: "string";
143
+ readonly description: "Job ID to delete";
144
+ };
145
+ };
146
+ readonly required: readonly ["job_id"];
147
+ };
148
+ }, {
149
+ readonly name: "history.list";
150
+ readonly description: "List recent post jobs";
151
+ readonly inputSchema: {
152
+ readonly type: "object";
153
+ readonly properties: {
154
+ readonly limit: {
155
+ readonly type: "number";
156
+ readonly description: "Maximum number of jobs to return (default: 10)";
157
+ };
158
+ };
159
+ };
160
+ }];
161
+ export declare function createMCPServer(client: PostProxyClient): Promise<Server>;
162
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAEnE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAavD;;;GAGG;AACH,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA0JnB,CAAC;AAEX,wBAAsB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,CAuD9E"}
package/dist/server.js ADDED
@@ -0,0 +1,220 @@
1
+ /**
2
+ * MCP Server setup and tool registration
3
+ */
4
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
5
+ import { ListToolsRequestSchema, CallToolRequestSchema } from "@modelcontextprotocol/sdk/types.js";
6
+ import { handleAuthStatus } from "./tools/auth.js";
7
+ import { handleProfilesList } from "./tools/profiles.js";
8
+ import { handlePostPublish, handlePostStatus, handlePostDelete, handlePostPublishDraft, } from "./tools/post.js";
9
+ import { handleHistoryList } from "./tools/history.js";
10
+ import { createError, ErrorCodes } from "./utils/errors.js";
11
+ import { logToolCall } from "./utils/logger.js";
12
+ /**
13
+ * Tool definitions for the PostProxy MCP server.
14
+ * Exported for potential reuse in other contexts (e.g., Cloudflare Workers).
15
+ */
16
+ export const TOOL_DEFINITIONS = [
17
+ {
18
+ name: "auth.status",
19
+ description: "Check authentication status, API configuration, and workspace information",
20
+ inputSchema: {
21
+ type: "object",
22
+ properties: {},
23
+ },
24
+ },
25
+ {
26
+ name: "profiles.list",
27
+ description: "List all available social media profiles (targets) for posting",
28
+ inputSchema: {
29
+ type: "object",
30
+ properties: {},
31
+ },
32
+ },
33
+ {
34
+ name: "post.publish",
35
+ description: "Publish a post to specified social media targets. Supports text content, media attachments, scheduling, drafts, and platform-specific customization via the 'platforms' parameter.",
36
+ inputSchema: {
37
+ type: "object",
38
+ properties: {
39
+ content: {
40
+ type: "string",
41
+ description: "Post content text (caption/description)",
42
+ },
43
+ targets: {
44
+ type: "array",
45
+ items: { type: "string" },
46
+ description: "Array of target profile IDs to publish to",
47
+ },
48
+ schedule: {
49
+ type: "string",
50
+ description: "Optional ISO 8601 scheduled time (e.g., '2024-12-31T23:59:59Z')",
51
+ },
52
+ media: {
53
+ type: "array",
54
+ items: { type: "string" },
55
+ description: "Optional array of media URLs or local file paths (images or videos). File paths can be absolute (/path/to/file.jpg), relative (./image.png), or use ~ for home directory (~/Pictures/photo.jpg)",
56
+ },
57
+ idempotency_key: {
58
+ type: "string",
59
+ description: "Optional idempotency key for request deduplication",
60
+ },
61
+ require_confirmation: {
62
+ type: "boolean",
63
+ description: "If true, return summary without publishing (dry run)",
64
+ },
65
+ draft: {
66
+ type: "boolean",
67
+ description: "If true, creates a draft post that won't publish automatically",
68
+ },
69
+ platforms: {
70
+ type: "object",
71
+ description: "Platform-specific parameters. Keys are platform names, values are parameter objects. Use this to add collaborators, set video titles, privacy settings, etc.",
72
+ properties: {
73
+ instagram: {
74
+ type: "object",
75
+ description: "Instagram: format (post|reel|story), collaborators (array of usernames), first_comment (string), cover_url (string), audio_name (string), trial_strategy (MANUAL|SS_PERFORMANCE), thumb_offset (string in ms)",
76
+ additionalProperties: true,
77
+ },
78
+ youtube: {
79
+ type: "object",
80
+ description: "YouTube: title (string), privacy_status (public|unlisted|private), cover_url (thumbnail URL)",
81
+ additionalProperties: true,
82
+ },
83
+ tiktok: {
84
+ type: "object",
85
+ description: "TikTok: privacy_status (PUBLIC_TO_EVERYONE|MUTUAL_FOLLOW_FRIENDS|FOLLOWER_OF_CREATOR|SELF_ONLY), photo_cover_index (integer), auto_add_music (bool), made_with_ai (bool), disable_comment (bool), disable_duet (bool), disable_stitch (bool), brand_content_toggle (bool), brand_organic_toggle (bool)",
86
+ additionalProperties: true,
87
+ },
88
+ facebook: {
89
+ type: "object",
90
+ description: "Facebook: format (post|story), first_comment (string), page_id (string)",
91
+ additionalProperties: true,
92
+ },
93
+ linkedin: {
94
+ type: "object",
95
+ description: "LinkedIn: organization_id (string for company pages)",
96
+ additionalProperties: true,
97
+ },
98
+ twitter: {
99
+ type: "object",
100
+ description: "Twitter/X: No platform-specific parameters available",
101
+ additionalProperties: true,
102
+ },
103
+ threads: {
104
+ type: "object",
105
+ description: "Threads: No platform-specific parameters available",
106
+ additionalProperties: true,
107
+ },
108
+ },
109
+ additionalProperties: true,
110
+ },
111
+ },
112
+ required: ["content", "targets"],
113
+ },
114
+ },
115
+ {
116
+ name: "post.status",
117
+ description: "Get status of a published post by job ID",
118
+ inputSchema: {
119
+ type: "object",
120
+ properties: {
121
+ job_id: {
122
+ type: "string",
123
+ description: "Job ID from post.publish response",
124
+ },
125
+ },
126
+ required: ["job_id"],
127
+ },
128
+ },
129
+ {
130
+ name: "post.publish_draft",
131
+ description: "Publish a draft post. Only posts with draft status can be published using this endpoint",
132
+ inputSchema: {
133
+ type: "object",
134
+ properties: {
135
+ job_id: {
136
+ type: "string",
137
+ description: "Job ID of the draft post to publish",
138
+ },
139
+ },
140
+ required: ["job_id"],
141
+ },
142
+ },
143
+ {
144
+ name: "post.delete",
145
+ description: "Delete a post by job ID",
146
+ inputSchema: {
147
+ type: "object",
148
+ properties: {
149
+ job_id: {
150
+ type: "string",
151
+ description: "Job ID to delete",
152
+ },
153
+ },
154
+ required: ["job_id"],
155
+ },
156
+ },
157
+ {
158
+ name: "history.list",
159
+ description: "List recent post jobs",
160
+ inputSchema: {
161
+ type: "object",
162
+ properties: {
163
+ limit: {
164
+ type: "number",
165
+ description: "Maximum number of jobs to return (default: 10)",
166
+ },
167
+ },
168
+ },
169
+ },
170
+ ];
171
+ export async function createMCPServer(client) {
172
+ const server = new Server({
173
+ name: "postproxy-mcp",
174
+ version: "0.1.0",
175
+ }, {
176
+ capabilities: {
177
+ tools: {},
178
+ },
179
+ });
180
+ // List available tools
181
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
182
+ return {
183
+ tools: [...TOOL_DEFINITIONS],
184
+ };
185
+ });
186
+ // Handle tool calls
187
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
188
+ const { name, arguments: args } = request.params;
189
+ logToolCall(name, args);
190
+ try {
191
+ switch (name) {
192
+ case "auth.status":
193
+ return await handleAuthStatus(client);
194
+ case "profiles.list":
195
+ return await handleProfilesList(client);
196
+ case "post.publish":
197
+ return await handlePostPublish(client, args);
198
+ case "post.status":
199
+ return await handlePostStatus(client, args);
200
+ case "post.publish_draft":
201
+ return await handlePostPublishDraft(client, args);
202
+ case "post.delete":
203
+ return await handlePostDelete(client, args);
204
+ case "history.list":
205
+ return await handleHistoryList(client, args);
206
+ default:
207
+ throw createError(ErrorCodes.API_ERROR, `Unknown tool: ${name}`);
208
+ }
209
+ }
210
+ catch (error) {
211
+ if (error.code && error.message) {
212
+ // Already an MCPError
213
+ throw error;
214
+ }
215
+ throw createError(ErrorCodes.API_ERROR, error.message || "Tool execution failed");
216
+ }
217
+ });
218
+ return server;
219
+ }
220
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;GAGG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B;QACE,IAAI,EAAE,aAAa;QACnB,WAAW,EAAE,2EAA2E;QACxF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD;QACE,IAAI,EAAE,eAAe;QACrB,WAAW,EAAE,gEAAgE;QAC7E,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE,EAAE;SACf;KACF;IACD;QACE,IAAI,EA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AAa;oBAChB,OAAO,MAAM,gBAAgB,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;gBACrD,KAAK,cAAc;oBACjB,OAAO,MAAM,iBAAiB,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;gBACtD;oBACE,MAAM,WAAW,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAiB,IAAI,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBAChC,sBAAsB;gBACtB,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,WAAW,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,IAAI,uBAAuB,CAAC,CAAC;QACpF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry point for setup script
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=setup-cli.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-cli.d.ts","sourceRoot":"","sources":["../src/setup-cli.ts"],"names":[],"mappings":";AACA;;GAEG"}
@@ -0,0 +1,10 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * CLI entry point for setup script
4
+ */
5
+ import { setup } from "./setup.js";
6
+ setup().catch((error) => {
7
+ console.error(`\n❌ Fatal error: ${error}`);
8
+ process.exit(1);
9
+ });
10
+ //# sourceMappingURL=setup-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup-cli.js","sourceRoot":"","sources":["../src/setup-cli.ts"],"names":[],"mappings":";AACA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,KAAK,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACtB,OAAO,CAAC,KAAK,CAAC,oBAAoB,KAAK,EAAE,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Interactive setup script for PostProxy MCP Server
4
+ * Makes it easy for non-technical users to configure Claude Code integration
5
+ */
6
+ declare function main(): Promise<void>;
7
+ export { main as setup };
8
+ //# sourceMappingURL=setup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AACA;;;GAGG;AA6EH,iBAAe,IAAI,kBAuGlB;AAED,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,CAAC"}
package/dist/setup.js ADDED
@@ -0,0 +1,143 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Interactive setup script for PostProxy MCP Server
4
+ * Makes it easy for non-technical users to configure Claude Code integration
5
+ */
6
+ import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
7
+ import { join, dirname } from "path";
8
+ import { homedir } from "os";
9
+ import * as readline from "readline";
10
+ function getConfigPath() {
11
+ const platform = process.platform;
12
+ if (platform === "win32") {
13
+ return join(process.env.APPDATA || "", "Claude", "claude_desktop_config.json");
14
+ }
15
+ else {
16
+ return join(homedir(), ".config", "claude", "claude_desktop_config.json");
17
+ }
18
+ }
19
+ function readConfig() {
20
+ const configPath = getConfigPath();
21
+ if (!existsSync(configPath)) {
22
+ return {};
23
+ }
24
+ try {
25
+ const content = readFileSync(configPath, "utf-8");
26
+ return JSON.parse(content);
27
+ }
28
+ catch (error) {
29
+ console.error(`⚠️ Error reading config file: ${error}`);
30
+ return {};
31
+ }
32
+ }
33
+ function writeConfig(config) {
34
+ const configPath = getConfigPath();
35
+ const configDir = dirname(configPath);
36
+ // Create directory if it doesn't exist
37
+ if (!existsSync(configDir)) {
38
+ mkdirSync(configDir, { recursive: true });
39
+ }
40
+ try {
41
+ writeFileSync(configPath, JSON.stringify(config, null, 2), "utf-8");
42
+ console.log(`✅ Configuration saved to: ${configPath}`);
43
+ }
44
+ catch (error) {
45
+ console.error(`❌ Error writing config file: ${error}`);
46
+ process.exit(1);
47
+ }
48
+ }
49
+ function question(rl, query) {
50
+ return new Promise((resolve) => {
51
+ rl.question(query, resolve);
52
+ });
53
+ }
54
+ function questionWithDefault(rl, query, defaultValue) {
55
+ return new Promise((resolve) => {
56
+ rl.question(`${query} [${defaultValue}]: `, (answer) => {
57
+ resolve(answer.trim() || defaultValue);
58
+ });
59
+ });
60
+ }
61
+ async function main() {
62
+ console.log("\n🚀 PostProxy MCP Server Setup");
63
+ console.log("=".repeat(50));
64
+ console.log("This script will help you configure Claude Code to use PostProxy MCP Server.\n");
65
+ const rl = readline.createInterface({
66
+ input: process.stdin,
67
+ output: process.stdout,
68
+ });
69
+ try {
70
+ // Get API key
71
+ console.log("📝 Step 1: PostProxy API Configuration");
72
+ console.log("-".repeat(50));
73
+ const apiKey = await question(rl, "Enter your PostProxy API key: ");
74
+ if (!apiKey || apiKey.trim().length === 0) {
75
+ console.error("❌ API key is required!");
76
+ process.exit(1);
77
+ }
78
+ const baseUrl = await questionWithDefault(rl, "Enter PostProxy API base URL", "https://api.postproxy.dev/api");
79
+ // Determine command path
80
+ console.log("\n📦 Step 2: Installation Path");
81
+ console.log("-".repeat(50));
82
+ console.log("\nHow did you install PostProxy MCP Server?");
83
+ console.log("1. Installed globally via npm (npm install -g postproxy-mcp)");
84
+ console.log("2. Using local development build");
85
+ console.log("3. Custom path");
86
+ const installType = await question(rl, "\nSelect option (1-3): ");
87
+ let command;
88
+ if (installType === "1") {
89
+ command = "postproxy-mcp";
90
+ }
91
+ else if (installType === "2") {
92
+ // Try to detect current location
93
+ const currentDir = process.cwd();
94
+ const possiblePath = join(currentDir, "dist", "index.js");
95
+ if (existsSync(possiblePath)) {
96
+ command = possiblePath;
97
+ console.log(`✅ Detected local build at: ${command}`);
98
+ }
99
+ else {
100
+ const customPath = await question(rl, "Enter path to dist/index.js: ");
101
+ command = customPath;
102
+ }
103
+ }
104
+ else {
105
+ command = await question(rl, "Enter full path to postproxy-mcp command: ");
106
+ }
107
+ // Read existing config
108
+ const config = readConfig();
109
+ // Update config
110
+ if (!config.mcpServers) {
111
+ config.mcpServers = {};
112
+ }
113
+ config.mcpServers.postproxy = {
114
+ command: command,
115
+ env: {
116
+ POSTPROXY_API_KEY: apiKey.trim(),
117
+ POSTPROXY_BASE_URL: baseUrl.trim(),
118
+ },
119
+ };
120
+ // Write config
121
+ console.log("\n💾 Step 3: Saving Configuration");
122
+ console.log("-".repeat(50));
123
+ writeConfig(config);
124
+ // Final instructions
125
+ console.log("\n✨ Setup Complete!");
126
+ console.log("=".repeat(50));
127
+ console.log("\n📋 Next steps:");
128
+ console.log("1. Restart your Claude Code session");
129
+ console.log("2. Test the connection by asking Claude: 'Check my PostProxy authentication status'");
130
+ console.log("3. If configured correctly, Claude will automatically use PostProxy tools");
131
+ console.log("\n💡 Tip: You can run this setup again anytime with: postproxy-mcp setup");
132
+ console.log("");
133
+ }
134
+ catch (error) {
135
+ console.error(`\n❌ Setup failed: ${error}`);
136
+ process.exit(1);
137
+ }
138
+ finally {
139
+ rl.close();
140
+ }
141
+ }
142
+ export { main as setup };
143
+ //# sourceMappingURL=setup.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setup.js","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":";AACA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AACxE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAcrC,SAAS,aAAa;IACpB,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAElC,IAA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AAK,CAAC,qBAAqB,KAAK,EAAE,CAAC,CAAC;QAC5C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC;AAED,OAAO,EAAE,IAAI,IAAI,KAAK,EAAE,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Accounts tools: accounts.list
3
+ */
4
+ import type { PostProxyClient } from "../api/client.js";
5
+ export declare function handleAccountsList(client: PostProxyClient): Promise<{
6
+ content: {
7
+ type: string;
8
+ text: string;
9
+ }[];
10
+ }>;
11
+ //# sourceMappingURL=accounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/tools/accounts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAKxD,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,eAAe;;;;;GA6D/D"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Accounts tools: accounts.list
3
+ */
4
+ import { getApiKey } from "../auth/credentials.js";
5
+ import { createError, ErrorCodes } from "../utils/errors.js";
6
+ import { logError, logToolCall } from "../utils/logger.js";
7
+ export async function handleAccountsList(client) {
8
+ logToolCall("accounts.list", {});
9
+ // Check API key
10
+ const apiKey = getApiKey();
11
+ if (!apiKey) {
12
+ throw createError(ErrorCodes.AUTH_MISSING, "API key is not configured");
13
+ }
14
+ try {
15
+ // Get all profile groups
16
+ const profileGroups = await client.getProfileGroups();
17
+ // Get profiles for each group
18
+ const allTargets = [];
19
+ for (const group of profileGroups) {
20
+ try {
21
+ const profiles = await client.getProfiles(group.id);
22
+ for (const profile of profiles) {
23
+ allTargets.push({
24
+ id: profile.id,
25
+ name: profile.name,
26
+ platform: profile.platform,
27
+ profile_group_id: profile.profile_group_id,
28
+ status: profile.status,
29
+ });
30
+ }
31
+ }
32
+ catch (error) {
33
+ logError(error, `accounts.list (group ${group.id})`);
34
+ // Continue with other groups even if one fails
35
+ }
36
+ }
37
+ return {
38
+ content: [
39
+ {
40
+ type: "text",
41
+ text: JSON.stringify({
42
+ targets: allTargets,
43
+ }, null, 2),
44
+ },
45
+ ],
46
+ };
47
+ }
48
+ catch (error) {
49
+ logError(error, "accounts.list");
50
+ throw createError(ErrorCodes.API_ERROR, `Failed to retrieve accounts: ${error.message}`);
51
+ }
52
+ }
53
+ //# sourceMappingURL=accounts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/tools/accounts.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAuB;IAC9D,WAAW,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEjC,gBAAgB;IAChB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,CAAC;QACH,yBAAyB;QACzB,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAEtD,8BAA8B;QAC9B,MAAM,UAAU,GAMX,EAAE,CAAC;QAER,KAAK,MAAM,KAAK,IAAI,aAAa,EAAE,CAAC;YAClC,IAAI,CAAC;gBACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;gBACpD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,C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