UNPKG

@postdom/mcp

Version:

Postdom MCP server for agent-led social publishing and performance measurement.

124 lines (120 loc) 4.79 kB
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import { z } from 'zod'; declare const mediaUploadRequestSchema: z.ZodObject<{ content_type: z.ZodEnum<{ "video/mp4": "video/mp4"; "video/quicktime": "video/quicktime"; }>; size_bytes: z.ZodNumber; platforms: z.ZodArray<z.ZodEnum<{ tiktok: "tiktok"; instagram: "instagram"; youtube: "youtube"; }>>; }, z.core.$strip>; type MediaUploadRequest = z.infer<typeof mediaUploadRequestSchema>; declare const mediaUploadResponseSchema: z.ZodObject<{ media_handle: z.ZodString; upload_url: z.ZodURL; method: z.ZodLiteral<"PUT">; headers: z.ZodObject<{ "Content-Type": z.ZodString; "Content-Length": z.ZodString; }, z.core.$strip>; expires_at: z.ZodISODateTime; }, z.core.$strip>; type MediaUploadResponse = z.infer<typeof mediaUploadResponseSchema>; declare const mediaStatusResponseSchema: z.ZodObject<{ media_handle: z.ZodString; status: z.ZodEnum<{ pending: "pending"; stored: "stored"; failed: "failed"; }>; content_type: z.ZodEnum<{ "video/mp4": "video/mp4"; "video/quicktime": "video/quicktime"; }>; size_bytes: z.ZodNumber; media_url: z.ZodNullable<z.ZodURL>; failure_reason: z.ZodNullable<z.ZodString>; }, z.core.$strip>; type MediaStatusResponse = z.infer<typeof mediaStatusResponseSchema>; type PostdomPlatform = "tiktok" | "instagram" | "youtube"; declare const POSTDOM_MCP_VERSION = "0.3.0"; declare const performanceMetricSchema: z.ZodEnum<{ views: "views"; likes: "likes"; comments: "comments"; shares: "shares"; saves: "saves"; watch_time_s: "watch_time_s"; avg_watch_pct: "avg_watch_pct"; completion_pct: "completion_pct"; follower_delta: "follower_delta"; }>; type PerformanceMetric = z.infer<typeof performanceMetricSchema>; interface PostdomAccount { id?: string; orgId?: string; providerAccountId: string; platform: string; handle?: string | null; status: string; } interface PostdomClientOptions { apiKey: string; baseUrl?: string; fetch?: typeof globalThis.fetch; agentIdentity?: string; } declare const POSTDOM_MCP_TOOL_NAMES: readonly ["get_workspace_status", "get_brief", "get_digest", "list_accounts", "connect_account", "upload_media", "get_media", "publish_video", "submit_plan", "get_plan", "get_publish", "get_performance", "get_best_posts"]; declare class PostdomClient { private readonly options; private readonly baseUrl; private readonly fetch; constructor(options: PostdomClientOptions); request<T>(path: string, init?: RequestInit): Promise<T>; listAccounts(): Promise<PostdomAccount[]>; getWorkspaceStatus(): Promise<Record<string, unknown>>; connectAccount(platform: PostdomPlatform): Promise<Record<string, unknown>>; createMediaUpload(input: MediaUploadRequest): Promise<MediaUploadResponse>; getMedia(mediaHandle: string): Promise<MediaStatusResponse>; publishVideo(input: { accountIds: string[]; videoUrl?: string; mediaHandle?: string; caption: string; intent: string; agentIdentity?: string; publishAt?: string; planId?: string; idempotencyKey?: string; }): Promise<Record<string, unknown>>; submitPlan(input: { accountIds: string[]; title: string; objective: string; startsAt: string; endsAt: string; maxPosts: number; briefVersion?: number; intent: string; agentIdentity?: string; idempotencyKey?: string; }): Promise<Record<string, unknown>>; getPlan(planId: string): Promise<Record<string, unknown>>; getBrief(): Promise<Record<string, unknown>>; getDigest(): Promise<Record<string, unknown>>; getPublish(postId: string): Promise<Record<string, unknown>>; getPostPerformance(postId: string): Promise<Record<string, unknown>>; getAccountPerformance(accountId: string, window: "7d" | "30d"): Promise<Record<string, unknown>>; getBestPosts(accountId: string, metric: PerformanceMetric, window: "7d" | "30d"): Promise<Record<string, unknown>>; } declare function createPostdomMcpServer(client: PostdomClient): McpServer; /** * Serve the same runtime used by the stdio CLI over stateless Streamable HTTP. * Authentication belongs to the hosting API and must run before this handler. */ declare function handlePostdomMcpHttpRequest(request: Request, options: PostdomClientOptions): Promise<Response>; export { POSTDOM_MCP_TOOL_NAMES, POSTDOM_MCP_VERSION, type PostdomAccount, PostdomClient, type PostdomClientOptions, type PostdomPlatform, createPostdomMcpServer, handlePostdomMcpHttpRequest };