post-engineer-mcp 1.1.1 → 1.3.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/dist/index.js CHANGED
@@ -1,101 +1,100 @@
1
1
  #!/usr/bin/env node
2
+ import { realpathSync } from 'node:fs';
3
+ import { fileURLToPath } from 'node:url';
2
4
  import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
3
5
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
- import { z } from 'zod';
5
- import { PostEngineerClient } from './client.js';
6
- import { handleCreatePersona, handleListPersonas, handleListVoices, handleUpdatePersona, handleListSocialAccounts, handleListSchedules, handleCancelSchedule, handleGetTokenBalance, handleGenerateVideo, handleGetVideoStatus, handleScheduleVideo, } from './tools.js';
6
+ import { PostEngineerClient, MAX_LIBRARY_IMAGES, MAX_LIBRARY_IMAGE_MB } from './client.js';
7
+ import { CreatePersonaShape, ListPersonasShape, ListVoicesShape, ListFacesShape, UpdatePersonaShape, ListSocialAccountsShape, ConnectAccountShape, ListSchedulesShape, GetTokenBalanceShape, ListPostsShape, CancelScheduleShape, GenerateVideoShape, GetVideoStatusShape, ScheduleVideoShape, ListPersonaImagesShape, AddPersonaImageShape, UpdatePersonaImageShape, RemovePersonaImageShape, handleCreatePersona, handleListPersonas, handleListVoices, handleListFaces, handleUpdatePersona, handleListSocialAccounts, handleConnectAccount, handleListSchedules, handleListPosts, handleCancelSchedule, handleGetTokenBalance, handleGenerateVideo, handleGetVideoStatus, handleScheduleVideo, handleListPersonaImages, handleAddPersonaImage, handleUpdatePersonaImage, handleRemovePersonaImage, } from './tools.js';
8
+ // The server advertises the package version: import it so a version bump in
9
+ // package.json flows through without touching this file.
10
+ const { default: pkg } = await import('../package.json', { with: { type: 'json' } });
11
+ export function requireApiKey(env = process.env) {
12
+ const apiKey = env.POST_ENGINEER_API_KEY;
13
+ if (!apiKey) {
14
+ throw new Error('POST_ENGINEER_API_KEY is required');
15
+ }
16
+ return apiKey;
17
+ }
7
18
  export function createPostEngineerMcpServer(client) {
8
- const apiClient = client ?? new PostEngineerClient({ apiKey: process.env.POST_ENGINEER_API_KEY });
19
+ const apiClient = client ?? new PostEngineerClient({ apiKey: requireApiKey() });
9
20
  const server = new McpServer({
10
21
  name: 'post-engineer-mcp',
11
- version: '1.1.0',
12
- });
13
- server.tool('create_persona', 'Create a new AI persona with avatar, voice, language, and niche prompt.', {
14
- name: z.string().min(1, 'Name is required').describe('Name of the persona'),
15
- avatarUrl: z.string().url().optional().nullable().describe('Public URL to the persona avatar image'),
16
- voiceId: z.string().default('alloy').describe('Voice ID to use (e.g. alloy, echo)'),
17
- language: z.string().default('en-US').describe('Language code (e.g. pt-BR, en-US)'),
18
- videoAspect: z.enum(['9:16', '16:9']).default('9:16').describe('Video aspect ratio'),
19
- scriptPrompt: z.string().optional().default('').describe('System prompt instructions for video scripts'),
20
- paragraphNumber: z.number().int().min(1).max(5).default(1).describe('Number of paragraphs'),
21
- niche: z.string().optional().default('General').describe('Content niche topic'),
22
- faceMixPercent: z.number().min(0).max(100).default(50),
23
- faceQuality: z.enum(['ok', 'very_good']).default('very_good'),
24
- }, async (args) => {
22
+ version: pkg.version,
23
+ });
24
+ server.tool('create_persona', 'Create a new AI persona with avatar, voice, language, and niche prompt.', CreatePersonaShape, async (args) => {
25
25
  return handleCreatePersona(apiClient, args);
26
26
  });
27
- server.tool('list_personas', 'List all existing personas for the authenticated user.', {}, async () => {
27
+ server.tool('list_personas', 'List all existing personas for the authenticated user.', ListPersonasShape, async () => {
28
28
  return handleListPersonas(apiClient);
29
29
  });
30
- server.tool('list_voices', 'List all available persona voices (voiceId options) for the authenticated user.', {}, async () => {
30
+ server.tool('list_voices', 'List all available persona voices (voiceId options) for the authenticated user.', ListVoicesShape, async () => {
31
31
  return handleListVoices(apiClient);
32
32
  });
33
- server.tool('update_persona', 'Update an existing AI persona (only the provided fields change).', {
34
- personaId: z.string().min(1, 'personaId is required').describe('The ID of the persona to update'),
35
- name: z.string().min(1).optional().describe('New name for the persona'),
36
- avatarUrl: z.string().url().optional().nullable().describe('New public avatar image URL'),
37
- voiceId: z.string().optional().describe('New voice ID (see list_voices)'),
38
- language: z.string().optional().describe('New language code (e.g. pt-BR, en-US)'),
39
- videoAspect: z.enum(['9:16', '16:9']).optional().describe('New video aspect ratio'),
40
- scriptPrompt: z.string().optional().describe('New system prompt instructions for video scripts'),
41
- paragraphNumber: z.number().int().min(1).max(10).optional().describe('New number of paragraphs'),
42
- niche: z.string().max(300).optional().describe('New content niche topic'),
43
- }, async (args) => {
33
+ server.tool('list_faces', 'List default/stock persona faces (avatar options). Each face includes id, url, name, gender, age (single number, not a range), ethnicity, hair, and description in English so you can pick without seeing the photo. Pass a face url as avatarUrl when calling create_persona.', ListFacesShape, async () => {
34
+ return handleListFaces(apiClient);
35
+ });
36
+ server.tool('update_persona', 'Update an existing AI persona (only the provided fields change).', UpdatePersonaShape, async (args) => {
44
37
  return handleUpdatePersona(apiClient, args);
45
38
  });
46
- server.tool('list_social_accounts', 'List connected social accounts (YouTube, Instagram, LinkedIn) with the account IDs needed for schedule_video.', {}, async () => {
39
+ server.tool('list_social_accounts', 'List connected social accounts (YouTube, Instagram, LinkedIn, Bluesky) with the account IDs needed for schedule_video.', ListSocialAccountsShape, async () => {
47
40
  return handleListSocialAccounts(apiClient);
48
41
  });
49
- server.tool('list_schedules', 'List all automation schedules for the authenticated user.', {}, async () => {
42
+ server.tool('connect_account', 'Connect a social account. For youtube/instagram/linkedin: returns an authorization URL — the user must open it in a browser and authorize, then the account connects automatically (verify with list_social_accounts). For bluesky: connects directly with handle + appPassword (app password, not the main account password).', ConnectAccountShape, async (args) => {
43
+ return handleConnectAccount(apiClient, args);
44
+ });
45
+ server.tool('list_schedules', 'List all automation schedules for the authenticated user.', ListSchedulesShape, async () => {
50
46
  return handleListSchedules(apiClient);
51
47
  });
52
- server.tool('cancel_schedule', 'Cancel (delete) an automation schedule by its schedule ID. Use list_schedules to find the ID.', {
53
- scheduleId: z.string().min(1, 'scheduleId is required').describe('The ID of the schedule to cancel'),
54
- }, async (args) => {
48
+ server.tool('list_posts', 'List upcoming (scheduled) and past (published/failed) posts across all connected accounts. Returns two lists: upcoming slots (id, slot_at, status, topic, schedule_id) and recent results (id, slot_at, status, topic, error, published_at, schedule_id). Use when the user asks about their posts — what is coming next, what already went out, or why a post failed. Combine with list_schedules or list_social_accounts when persona/account names are needed.', ListPostsShape, async (args) => {
49
+ return handleListPosts(apiClient, args);
50
+ });
51
+ server.tool('cancel_schedule', 'Cancel (delete) an automation schedule by its schedule ID. Use list_schedules to find the ID.', CancelScheduleShape, async (args) => {
55
52
  return handleCancelSchedule(apiClient, args);
56
53
  });
57
- server.tool('get_token_balance', 'Get the prepaid token wallet balance. Check before triggering video generation, which costs tokens.', {}, async () => {
54
+ server.tool('get_token_balance', 'Get the prepaid token wallet balance. Check before triggering video generation, which costs tokens.', GetTokenBalanceShape, async () => {
58
55
  return handleGetTokenBalance(apiClient);
59
56
  });
60
- server.tool('generate_video_from_persona', 'Trigger video generation using an existing persona.', {
61
- personaId: z.string().min(1, 'personaId is required').describe('The ID of the persona to generate video with'),
62
- scriptPrompt: z.string().optional().describe('Optional specific prompt override for this video'),
63
- }, async (args) => {
57
+ server.tool('generate_video_from_persona', 'Trigger video generation using an existing persona. Optional scriptPrompt overrides the video script; optional audioUrl (public http(s) URL) supplies custom audio for this video, overriding the persona voice; optional imageId picks a specific image from the persona image library (see list_persona_images), overriding the deterministic per-video selection. For faceless generation, omit personaId and provide videoSubject plus a voice source (audioUrl or voiceId).', GenerateVideoShape, async (args) => {
64
58
  return handleGenerateVideo(apiClient, args);
65
59
  });
66
- server.tool('get_video_status', 'Check the generation status and fetch final video URLs for a taskId.', {
67
- taskId: z.string().min(1, 'taskId is required').describe('The video generation task ID'),
68
- }, async (args) => {
60
+ server.tool('get_video_status', 'Check the generation status and fetch final video URLs for a taskId.', GetVideoStatusShape, async (args) => {
69
61
  return handleGetVideoStatus(apiClient, args);
70
62
  });
71
- server.tool('schedule_video', 'Schedule automated video generation and posting to social channels. IMPORTANT: Schedules must be between 24h and 30 days in advance. Each provider requires at least one account ID — discover them with list_social_accounts first.', {
72
- personaId: z.string().min(1, 'personaId is required').describe('The ID of the persona'),
73
- providers: z
74
- .array(z.enum(['youtube', 'instagram', 'linkedin']))
75
- .min(1, 'At least one provider required')
76
- .describe('Target social platforms'),
77
- youtubeAccountIds: z.array(z.string()).optional().default([]),
78
- instagramAccountIds: z.array(z.string()).optional().default([]),
79
- linkedinAccountIds: z.array(z.string()).optional().default([]),
80
- scheduledAt: z
81
- .string()
82
- .describe('Target ISO date time for scheduling. Must be between 24h and 30 days in the future.'),
83
- daysOfWeek: z.array(z.number().int().min(0).max(6)).optional(),
84
- startHour: z.number().int().min(0).max(23).optional(),
85
- endHour: z.number().int().min(0).max(23).optional(),
86
- postsPerDay: z.number().int().min(1).max(10).optional(),
87
- timezone: z.string().optional().default('UTC'),
88
- }, async (args) => {
63
+ server.tool('list_persona_images', `List the image library of a persona (up to ${MAX_LIBRARY_IMAGES} tagged images). Each entry has id, tag, description, and is_primary. Use the ids with generate_video_from_persona imageId to force a specific image for one video.`, ListPersonaImagesShape, async (args) => {
64
+ return handleListPersonaImages(apiClient, args);
65
+ });
66
+ server.tool('add_persona_image', `Add an image to a persona image library from a local file path (JPG/JPEG, PNG, or WebP, max ${MAX_LIBRARY_IMAGE_MB}MB). Optional tag and description drive the deterministic per-video image selection. The server rejects faceless personas and full libraries (${MAX_LIBRARY_IMAGES} max).`, AddPersonaImageShape, async (args) => {
67
+ return handleAddPersonaImage(apiClient, args);
68
+ });
69
+ server.tool('update_persona_image', 'Update a persona library image tag, description, or primary flag.', UpdatePersonaImageShape, async (args) => {
70
+ return handleUpdatePersonaImage(apiClient, args);
71
+ });
72
+ server.tool('remove_persona_image', 'Remove an image from a persona image library.', RemovePersonaImageShape, async (args) => {
73
+ return handleRemovePersonaImage(apiClient, args);
74
+ });
75
+ server.tool('schedule_video', 'Schedule automated video generation and posting to social channels. IMPORTANT: Schedules must be between 24h and 30 days in advance. Each provider requires at least one account ID — discover them with list_social_accounts first.', ScheduleVideoShape, async (args) => {
89
76
  return handleScheduleVideo(apiClient, args);
90
77
  });
91
78
  return server;
92
79
  }
93
- import { fileURLToPath } from 'url';
94
80
  export function isMainModule() {
95
- return process.argv[1] === fileURLToPath(import.meta.url);
81
+ const entry = process.argv[1];
82
+ if (!entry)
83
+ return false;
84
+ try {
85
+ // Realpath both sides: the published bin is launched through a symlinked
86
+ // .bin entry, and Node may keep the symlink path in either argv[1] or
87
+ // import.meta.url — realpathing both makes the comparison robust either way.
88
+ return realpathSync(entry) === realpathSync(fileURLToPath(import.meta.url));
89
+ }
90
+ catch {
91
+ return false;
92
+ }
96
93
  }
97
94
  async function main() {
98
- const server = createPostEngineerMcpServer();
95
+ // Fail fast: without a key every tool call would fail with an opaque 401.
96
+ const apiKey = requireApiKey();
97
+ const server = createPostEngineerMcpServer(new PostEngineerClient({ apiKey }));
99
98
  const transport = new StdioServerTransport();
100
99
  await server.connect(transport);
101
100
  }
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,mBAAmB,EACnB,wBAAwB,EACxB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,MAAM,UAAU,2BAA2B,CAAC,MAA2B;IACrE,MAAM,SAAS,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AS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,YAAY,EAAE,EAAE,CAAC;IACnB,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;QACnB,OAAO,CAAC,KAAK,CAAC,yBAAyB,EAAE,GAAG,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared library-image size limits.
3
+ *
4
+ * Lives in its own module so both `client.ts` (enforcement) and
5
+ * `errors.ts` (user-facing messages) can use the derived MB value without
6
+ * a client<->errors import cycle.
7
+ */
8
+ /** Max library image size in bytes (10MB). */
9
+ export declare const MAX_LIBRARY_IMAGE_BYTES: number;
10
+ /**
11
+ * Same limit in whole MB, derived from the byte limit so user-facing copy
12
+ * (tool descriptions, error messages) can't drift from the enforced bound.
13
+ */
14
+ export declare const MAX_LIBRARY_IMAGE_MB: number;
package/dist/limits.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Shared library-image size limits.
3
+ *
4
+ * Lives in its own module so both `client.ts` (enforcement) and
5
+ * `errors.ts` (user-facing messages) can use the derived MB value without
6
+ * a client<->errors import cycle.
7
+ */
8
+ /** Max library image size in bytes (10MB). */
9
+ export const MAX_LIBRARY_IMAGE_BYTES = 10 * 1024 * 1024;
10
+ /**
11
+ * Same limit in whole MB, derived from the byte limit so user-facing copy
12
+ * (tool descriptions, error messages) can't drift from the enforced bound.
13
+ */
14
+ export const MAX_LIBRARY_IMAGE_MB = MAX_LIBRARY_IMAGE_BYTES / (1024 * 1024);
15
+ //# sourceMappingURL=limits.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"limits.js","sourceRoot":"","sources":["../src/limits.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,uBAAuB,GAAG,EAAE,GAAG,IAAI,GAAG,IAAI,CAAC;AAExD;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,uBAAuB,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC"}