posterly-mcp-server 0.56.2 → 0.57.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/README.md CHANGED
@@ -123,7 +123,7 @@ Add the same server definition to your Cursor MCP settings:
123
123
 
124
124
  ## Available tools
125
125
 
126
- `posterly-mcp-server@0.56.2` exposes 74 tools covering 117 actions. The hosted HTTP endpoint exposes the same catalog minus the three signup tools: 71 tools covering 114 actions.
126
+ `posterly-mcp-server@0.57.0` exposes 74 tools covering 117 actions. The hosted HTTP endpoint exposes the same catalog minus the three signup tools: 71 tools covering 114 actions.
127
127
 
128
128
  Many tools pick what to do with one parameter: `view` (reads), `action` (writes), or `type`. A few pick their mode from which parameters you pass (for example `update_post` with `status` changes the status instead of editing). Every tool description names all of its views and actions.
129
129
 
@@ -151,7 +151,7 @@ Accounts, posting, media, schedule, analytics, and support. What most assistants
151
151
  | `find_available_slot` | Find a free slot |
152
152
  | `submit_agent_feedback` | Agent feedback |
153
153
  | `submit_product_feedback` | Product feedback |
154
- | `validate_post` | Validate a post |
154
+ | `validate_post` | Validate a post (optional `brand_compliance: true` adds advisory brand name and competitor checks; they never block) |
155
155
  | `create_post` | Create a post (optional `idempotency_key` makes a retry safe) |
156
156
  | `create_posts_batch` | Create posts in bulk (optional `idempotency_key`, also per item) |
157
157
  | `get_x_posting_quota` | X posting quota |
@@ -520,7 +520,7 @@ The brand tools let an assistant work at the same level a human does:
520
520
  - `list_brands` lets the agent see clients/brands in the workspace
521
521
  - `list_brands` with `view: "brand"` returns summary info for one brand
522
522
  - `list_brands` with `view: "accounts"` resolves a brand into the actual connected accounts
523
- - `list_brands` with `view: "profile"` returns saved brand guidance like tone, audience, keywords, dos and don'ts, and visual notes
523
+ - `list_brands` with `view: "profile"` returns saved brand guidance like tone, audience, keywords, dos and don'ts, and the saved Visual identity (hex colours by role, heading and body fonts, logo URLs; any value only derived from the brand profile is marked as a starting suggestion to confirm with the user)
524
524
 
525
525
  This makes prompts like:
526
526
 
@@ -66,6 +66,8 @@ export interface BrandProfile {
66
66
  updated_at?: string | null;
67
67
  source: 'canonical' | 'legacy';
68
68
  learned_voice?: LearnedVoice[];
69
+ /** Saved Visual identity: exact colours by role, fonts, logo URLs. Absent on older servers. */
70
+ visual_identity?: Record<string, unknown>;
69
71
  }
70
72
  export interface LearnedVoice {
71
73
  social_account_id: number;
@@ -344,6 +346,7 @@ export type ValidatePostResponse = {
344
346
  post_type: string;
345
347
  scheduled_at: string;
346
348
  workspace_id: string | null;
349
+ brand_id?: string | null;
347
350
  };
348
351
  warnings: Array<{
349
352
  code: string;
@@ -352,6 +355,8 @@ export type ValidatePostResponse = {
352
355
  would_create: {
353
356
  status: string;
354
357
  };
358
+ /** Present only when the call asked for brand_compliance. Advisory. */
359
+ brand_compliance?: Record<string, unknown>;
355
360
  };
356
361
  export type AgentFeedbackPayload = {
357
362
  source: 'mcp' | 'cli' | 'rest' | 'skill';
@@ -1757,7 +1762,9 @@ export declare class PosterlyClient {
1757
1762
  createPost(data: CreatePostPayload, options?: {
1758
1763
  idempotencyKey?: string | null;
1759
1764
  }): Promise<CreatePostResponse>;
1760
- validatePost(data: CreatePostPayload): Promise<ValidatePostResponse>;
1765
+ validatePost(data: CreatePostPayload, options?: {
1766
+ brandCompliance?: boolean;
1767
+ }): Promise<ValidatePostResponse>;
1761
1768
  submitAgentFeedback(data: AgentFeedbackPayload): Promise<AgentFeedbackResponse>;
1762
1769
  submitProductFeedback(data: ProductFeedbackPayload): Promise<ProductFeedbackResponse>;
1763
1770
  createPostsBatch(data: {
@@ -482,8 +482,8 @@ export class PosterlyClient {
482
482
  async createPost(data, options) {
483
483
  return this.request('POST', '/posts', data, { idempotencyKey: options?.idempotencyKey });
484
484
  }
485
- async validatePost(data) {
486
- return this.request('POST', '/posts', { ...data, dry_run: true });
485
+ async validatePost(data, options = {}) {
486
+ return this.request('POST', '/posts', { ...data, dry_run: true, ...(options.brandCompliance ? { brand_compliance: true } : {}) });
487
487
  }
488
488
  async submitAgentFeedback(data) {
489
489
  return this.request('POST', '/agent-feedback', data);
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Renders the advisory `brand_compliance` block from a validate_post dry run
3
+ * (POST /api/v1/posts with dry_run and brand_compliance). Shared by the npm
4
+ * stdio server and the hosted /api/mcp server.
5
+ *
6
+ * Brand compliance never blocks a post and never rewrites the caption: the
7
+ * text says so, so an agent shows the warnings to the user rather than
8
+ * silently editing approved copy.
9
+ */
10
+ export declare function formatBrandComplianceSection(result: any): string;
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Renders the advisory `brand_compliance` block from a validate_post dry run
3
+ * (POST /api/v1/posts with dry_run and brand_compliance). Shared by the npm
4
+ * stdio server and the hosted /api/mcp server.
5
+ *
6
+ * Brand compliance never blocks a post and never rewrites the caption: the
7
+ * text says so, so an agent shows the warnings to the user rather than
8
+ * silently editing approved copy.
9
+ */
10
+ export function formatBrandComplianceSection(result) {
11
+ if (!result || typeof result !== 'object')
12
+ return '';
13
+ const brand = result.brand_name ? `${result.brand_name}${result.brand_id ? ` (\`${result.brand_id}\`)` : ''}` : result.brand_id ? `\`${result.brand_id}\`` : 'no brand';
14
+ const notChecked = Array.isArray(result.not_checked) && result.not_checked.length
15
+ ? `Not checked automatically (review these yourself against list_brands view=profile): ${result.not_checked.join(', ')}.`
16
+ : '';
17
+ if (result.status === 'not_checked') {
18
+ return ['## Brand compliance: not checked', result.reason || 'No brand rules could be checked.', notChecked].filter(Boolean).join('\n\n');
19
+ }
20
+ const issues = Array.isArray(result.issues) ? result.issues : [];
21
+ const checks = Array.isArray(result.checks_run) ? result.checks_run.join(', ') : '';
22
+ const header = result.status === 'warnings'
23
+ ? `## Brand compliance: ${issues.length} warning${issues.length === 1 ? '' : 's'}`
24
+ : '## Brand compliance: no issues found';
25
+ return [
26
+ header,
27
+ `Brand: ${brand}. Checks run: ${checks || 'none'}. These are advisory and do not block publishing.`,
28
+ issues.length
29
+ ? issues.map((issue) => `- ${issue.rule} (${issue.severity}): ${issue.message}`).join('\n')
30
+ : '',
31
+ issues.length ? 'Show these to the user. Do not change an approved caption without their agreement.' : '',
32
+ notChecked,
33
+ ].filter(Boolean).join('\n\n');
34
+ }
@@ -1 +1 @@
1
- export declare const POSTERLY_MCP_VERSION = "0.56.2";
1
+ export declare const POSTERLY_MCP_VERSION = "0.57.0";
@@ -5,4 +5,4 @@
5
5
  // tool set (minus the intentional pre-auth signup tools that only this stdio
6
6
  // package exposes). `npm run check:mcp-parity` enforces both the version match
7
7
  // and the tool-list match, and runs in the pre-commit hook.
8
- export const POSTERLY_MCP_VERSION = '0.56.2';
8
+ export const POSTERLY_MCP_VERSION = '0.57.0';
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Renders a brand's saved Visual identity (the `visual_identity` object on
3
+ * GET /api/v1/brands/:id/profile) for list_brands view=profile. Shared by
4
+ * the npm stdio server and the hosted /api/mcp server so both say the same
5
+ * thing.
6
+ *
7
+ * The section ends with the object itself as a JSON block: an agent making
8
+ * branded media needs the hex values and logo URLs, not a summary. Nothing
9
+ * here invents a value. A role the API reports as null is shown as "not set"
10
+ * and listed under what to ask the user for. A value the API lists under
11
+ * `unconfirmed` is only what posterly derived from the brand profile, so it
12
+ * is shown as a starting suggestion to confirm with the user, never as an
13
+ * exact brand value.
14
+ */
15
+ export declare function formatVisualIdentitySection(identity: any): string;
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Renders a brand's saved Visual identity (the `visual_identity` object on
3
+ * GET /api/v1/brands/:id/profile) for list_brands view=profile. Shared by
4
+ * the npm stdio server and the hosted /api/mcp server so both say the same
5
+ * thing.
6
+ *
7
+ * The section ends with the object itself as a JSON block: an agent making
8
+ * branded media needs the hex values and logo URLs, not a summary. Nothing
9
+ * here invents a value. A role the API reports as null is shown as "not set"
10
+ * and listed under what to ask the user for. A value the API lists under
11
+ * `unconfirmed` is only what posterly derived from the brand profile, so it
12
+ * is shown as a starting suggestion to confirm with the user, never as an
13
+ * exact brand value.
14
+ */
15
+ const COLOR_ROLE_ORDER = ['bg_a', 'bg_b', 'text_on_a', 'text_on_b', 'accent', 'highlight'];
16
+ const COLOR_ROLE_LABELS = {
17
+ bg_a: 'Background A',
18
+ bg_b: 'Background B',
19
+ text_on_a: 'Text on A',
20
+ text_on_b: 'Text on B',
21
+ accent: 'Accent',
22
+ highlight: 'Highlight',
23
+ };
24
+ function cell(value) {
25
+ return String(value ?? '').replace(/\|/g, '\\|').replace(/\r?\n/g, ' ');
26
+ }
27
+ const SUGGESTION_NOTE = 'starting suggestion, confirm with the user';
28
+ function fontText(value, unconfirmed = false) {
29
+ if (!value || typeof value !== 'object' || !value.family)
30
+ return 'not set';
31
+ const base = `${value.family} (${value.category || 'font'}, id \`${value.id}\`)`;
32
+ return unconfirmed ? `${base} - ${SUGGESTION_NOTE}` : base;
33
+ }
34
+ function sourceText(source) {
35
+ if (source === 'brand_kit')
36
+ return 'saved Visual identity';
37
+ if (source === 'brand_profile')
38
+ return 'brand profile only (the Visual identity editor has not been saved)';
39
+ return 'nothing saved';
40
+ }
41
+ export function formatVisualIdentitySection(identity) {
42
+ if (!identity || typeof identity !== 'object')
43
+ return '';
44
+ if (!identity.configured) {
45
+ return [
46
+ '## Visual identity',
47
+ 'No colours, fonts or logo are saved for this brand. Ask the user for them, or have them fill in Visual identity on the brand page in posterly. Do not guess brand colours.',
48
+ ].join('\n\n');
49
+ }
50
+ const colors = identity.colors && typeof identity.colors === 'object' ? identity.colors : {};
51
+ const roles = identity.color_roles && typeof identity.color_roles === 'object' ? identity.color_roles : {};
52
+ const unconfirmed = Array.isArray(identity.unconfirmed)
53
+ ? identity.unconfirmed.filter((entry) => typeof entry === 'string')
54
+ : [];
55
+ const colorRows = COLOR_ROLE_ORDER.map((role) => {
56
+ const hex = typeof colors[role] === 'string' ? colors[role] : null;
57
+ const hexCell = hex ? `\`${hex}\`${unconfirmed.includes(`colors.${role}`) ? ` (${SUGGESTION_NOTE})` : ''}` : 'not set';
58
+ return `| ${COLOR_ROLE_LABELS[role]} | \`${role}\` | ${hexCell} | ${cell(roles[role] || '')} |`;
59
+ });
60
+ const profileColors = identity.profile_colors && typeof identity.profile_colors === 'object' ? identity.profile_colors : {};
61
+ // A flat profile colour that just mirrors an unconfirmed kit role (a kit save
62
+ // writes bg_a, bg_b and accent back to the profile) is still a suggestion.
63
+ const profileKitRole = { primary_color: 'bg_a', secondary_color: 'bg_b', accent_color: 'accent' };
64
+ const profileColorText = ['primary_color', 'secondary_color', 'accent_color']
65
+ .filter((key) => typeof profileColors[key] === 'string')
66
+ .map((key) => {
67
+ const role = profileKitRole[key];
68
+ const mirrorsSuggestion = unconfirmed.includes(`colors.${role}`) && colors[role] === profileColors[key];
69
+ return `${key.replace('_color', '')} \`${profileColors[key]}\`${mirrorsSuggestion ? ` (${SUGGESTION_NOTE})` : ''}`;
70
+ })
71
+ .join(', ');
72
+ const typography = identity.typography && typeof identity.typography === 'object' ? identity.typography : {};
73
+ const logos = identity.logos && typeof identity.logos === 'object' ? identity.logos : {};
74
+ const missing = Array.isArray(identity.missing) ? identity.missing : [];
75
+ const lines = [
76
+ `- Source: ${sourceText(identity.source)}`,
77
+ `- Heading font: ${fontText(typography.heading_font, unconfirmed.includes('typography.heading_font'))}`,
78
+ `- Body font: ${fontText(typography.body_font, unconfirmed.includes('typography.body_font'))}`,
79
+ typography.font_style ? `- Font style: ${cell(typography.font_style)}` : '',
80
+ identity.visual_style ? `- Visual style: ${cell(identity.visual_style)}` : '',
81
+ profileColorText ? `- Brand profile colours: ${profileColorText}` : '',
82
+ `- Logo (for light backgrounds): ${logos.dark || 'not set'}`,
83
+ `- Logo (for dark backgrounds): ${logos.light || 'not set'}`,
84
+ identity.updated_at ? `- Last updated: ${identity.updated_at}` : '',
85
+ missing.length ? `- Not saved: ${missing.join(', ')}` : '',
86
+ ].filter(Boolean);
87
+ const guidance = unconfirmed.length
88
+ ? `Use these exact values for branded media, except the ones marked "${SUGGESTION_NOTE}": those are only what posterly derived from the brand profile, so ask the user to confirm or change them before relying on them. Do not substitute other colours or fonts for confirmed values, and use the logo files at these URLs rather than redrawing the logo.`
89
+ : 'Use these exact values for branded media. Do not substitute other colours or fonts, and use the logo files at these URLs rather than redrawing the logo.';
90
+ // color_roles is the same constant description of each role for every
91
+ // brand and the table above already shows it, so the JSON block omits it.
92
+ const { color_roles: _colorRoles, ...identityForJson } = identity;
93
+ return [
94
+ '## Visual identity',
95
+ guidance,
96
+ ['| Role | Key | Hex | Use |', '| --- | --- | --- | --- |', ...colorRows].join('\n'),
97
+ lines.join('\n'),
98
+ ['```json', JSON.stringify(identityForJson, null, 2), '```'].join('\n'),
99
+ ].join('\n\n');
100
+ }
@@ -1,9 +1,10 @@
1
1
  import { z } from 'zod';
2
2
  import { code, compactText, formatDateTime, mdEmpty, mdKeyValue, mdLearnedVoice, mdSection, mdTable, mdTitle } from '../lib/format.js';
3
3
  import { validateArgs } from '../lib/tool-runtime.js';
4
+ import { formatVisualIdentitySection } from '../lib/visual-identity-text.js';
4
5
  export const listBrandsTool = {
5
6
  name: 'list_brands',
6
- description: 'Brands (clients) and their saved context. view=brands (default): brands the caller can access with brand ID, name, workspace ID, source, and how many social accounts are assigned (optional workspace_id). view=brand (brand_id): one brand with its workspace, source, and linked legacy brand group. view=accounts (brand_id): the connected social accounts assigned to the brand; use it when a user refers to a brand name rather than an account handle. view=profile (brand_id): voice and tone, audience, keywords, dos and don’ts, visual notes, and other saved brand context.',
7
+ description: 'Brands (clients) and their saved context. view=brands (default): brands the caller can access with brand ID, name, workspace ID, source, and how many social accounts are assigned (optional workspace_id). view=brand (brand_id): one brand with its workspace, source, and linked legacy brand group. view=accounts (brand_id): the connected social accounts assigned to the brand; use it when a user refers to a brand name rather than an account handle. view=profile (brand_id): voice and tone, audience, keywords, dos and don’ts, and other saved brand context, plus Visual identity (hex colours, fonts, logo URLs).',
7
8
  inputSchema: z.object({
8
9
  view: z
9
10
  .enum(['brands', 'brand', 'accounts', 'profile'])
@@ -121,6 +122,7 @@ async function brandProfile(client, input) {
121
122
  return [
122
123
  mdTitle(`Brand profile: ${profile.brand_name}`),
123
124
  profileBody || 'No extended brand profile fields have been saved yet.',
125
+ formatVisualIdentitySection(profile.visual_identity),
124
126
  learnedBody ||
125
127
  '_No learned voice yet. posterly learns each account’s voice automatically once it has enough published posts._',
126
128
  ].filter(Boolean).join('\n\n');