@dopost/mcp-server 1.0.1 → 1.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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dopost
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @dopost/mcp-server
2
2
 
3
- MCP (Model Context Protocol) server for **dopost**. Allows AI agents to schedule and manage social media posts through any MCP-compatible host.
3
+ MCP (Model Context Protocol) server for **dopost**. It lets AI agents schedule and manage social media posts, read reliable workspace analytics, and prepare public YouTube, Instagram, and TikTok downloads through any MCP-compatible host.
4
4
 
5
5
  ## Install
6
6
 
@@ -16,12 +16,14 @@ npx @dopost/mcp-server
16
16
 
17
17
  ## Configuration
18
18
 
19
- The server requires two environment variables:
19
+ The server supports these environment variables:
20
20
 
21
- | Variable | Required | Default | Description |
22
- |----------|----------|---------|-------------|
23
- | `DOPOST_API_KEY` | Yes | — | Your dopost API key |
24
- | `DOPOST_API_URL` | No | `https://dopost.co` | API base URL |
21
+ | Variable | Required | Default | Description |
22
+ | ---------------- | ----------------------- | ------------------- | --------------------------------------------------------------------------------------------------------- |
23
+ | `DOPOST_API_KEY` | For authenticated tools | None | Required for posts, analytics, accounts, and Media library tools. Public downloader tools work without it |
24
+ | `DOPOST_API_URL` | No | `https://dopost.co` | API base URL |
25
+
26
+ To use only the public downloader tools, start the server without `DOPOST_API_KEY`. Configure the key when you also want to publish posts or access a dopost workspace.
25
27
 
26
28
  ## Usage with MCP hosts
27
29
 
@@ -82,19 +84,32 @@ Add to Cursor settings under MCP servers:
82
84
 
83
85
  ## Available tools
84
86
 
85
- | Tool | Description |
86
- |------|-------------|
87
- | `publish_post` | Create and publish or schedule a social media post |
88
- | `list_posts` | List posts with optional status filter and pagination |
89
- | `get_post` | Get full details of a specific post |
90
- | `get_post_status` | Check the publishing status of a post job |
91
- | `reschedule_post` | Change the scheduled date of a pending post |
92
- | `delete_post` | Delete a post (cancels schedule if pending) |
93
- | `list_accounts` | List connected social media accounts |
94
- | `get_platform_limits` | Get content limits for a platform |
95
- | `upload_media` | Get a presigned URL to upload a media file |
96
- | `list_media` | List uploaded media files |
97
- | `delete_media` | Delete a media file |
87
+ | Tool | Description |
88
+ | ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
89
+ | `get_social_media_download_options` | List temporary MP4 and MP3 options for a public YouTube, Instagram, or TikTok URL. No API key required |
90
+ | `prepare_social_media_download` | Select one quality and return its temporary download URL. No API key required |
91
+ | `publish_post` | Publish, schedule, reply on X or Threads, or create a thread on X, Threads, or Mastodon |
92
+ | `list_posts` | List posts with optional status filter and pagination |
93
+ | `get_post` | Get full details of a specific post |
94
+ | `reschedule_post` | Change the scheduled date of a pending post |
95
+ | `delete_post` | Delete a post (cancels schedule if pending) |
96
+ | `create_recurring_post` | Create a daily, weekly, or monthly recurring post series |
97
+ | `list_recurring_posts` | List recurring series, their next run, accounts, and latest result |
98
+ | `update_recurring_post` | Update future content, media, cadence, or the next occurrence |
99
+ | `list_workspaces` | List workspaces available to the current credential |
100
+ | `list_accounts` | List connected social accounts, grouped by workspace for OAuth |
101
+ | `get_platform_limits` | Get content limits for a platform |
102
+ | `upload_media` | Upload a local file to the media library (handles presigned URL + upload + finalize in one call) |
103
+ | `list_media` | List uploaded media files |
104
+ | `delete_media` | Delete a media file |
105
+ | `get_google_business_search_terms` | Read monthly location discovery keywords and privacy thresholds |
106
+ | `get_analytics_overview` | Read account KPIs, rankings, comparisons, and data availability |
107
+ | `list_post_performance` | List performance for posts published through dopost |
108
+ | `get_post_performance` | Read metrics and cumulative snapshots for one post |
109
+ | `get_content_insights` | Read Best Time, Best Day, Format Opportunity, and Platform Pulse |
110
+ | `get_audience_analytics` | Read available audience breakdowns |
111
+
112
+ Analytics tools require the `analytics:read` scope and an active paid plan. Existing credentials are not upgraded automatically; create a new API key with the scope or reauthorize the remote MCP client. Reconnect clients that cache the old tool schema.
98
113
 
99
114
  ## How it works
100
115
 
@@ -111,7 +126,7 @@ MCP Client (inside the host app)
111
126
  dopost REST API (dopost.co/api/v1/*)
112
127
  ```
113
128
 
114
- The server uses **stdio transport** — the MCP host spawns it as a child process and communicates via stdin/stdout using JSON-RPC 2.0. Each tool maps 1:1 to a dopost REST API endpoint.
129
+ The server uses **stdio transport**. The MCP host spawns it as a child process and communicates via stdin/stdout using JSON-RPC 2.0. Each tool calls a documented dopost REST API endpoint. Download tools return temporary URLs rather than transporting large binary files through MCP.
115
130
 
116
131
  ## Development
117
132
 
@@ -129,3 +144,18 @@ DOPOST_API_KEY=your-key npm start
129
144
  - [Model Context Protocol specification](https://modelcontextprotocol.io/docs/learn/architecture)
130
145
  - [MCP TypeScript SDK v1.x](https://github.com/modelcontextprotocol/typescript-sdk/tree/v1.x)
131
146
  - [Building MCP servers](https://modelcontextprotocol.io/quickstart/server)
147
+
148
+ ## Google Business and workspace dates
149
+
150
+ Connect verified locations in dopost first and use the returned accountId.
151
+ Unzoned dates use the workspace timezone; explicit Z/offset dates retain their
152
+ instant. Publishing supports standard updates, events, offers and gallery media.
153
+ Events/offers may omit text/media; PROFILE/COVER require photos and gallery video
154
+ must be MP4. Recurring supports standard updates only. See the
155
+ [Google Business API guide](https://dopost.co/docs/api/google-business).
156
+
157
+ Overview exposes GOOGLE_BUSINESS daily Search/Maps and action metrics. Monthly
158
+ search terms preserve location identity and privacy thresholds and support
159
+ pagination. They use the existing analytics:read scope and do not call Google.
160
+
161
+ Use `get_google_business_search_terms`; reconnect clients with cached schemas after deployment.
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import "../dist/index.js";
package/dist/api.d.ts CHANGED
@@ -1,18 +1,58 @@
1
- type ToolResult = {
1
+ export type ToolResult = {
2
2
  content: Array<{
3
3
  type: "text";
4
4
  text: string;
5
5
  }>;
6
6
  isError?: boolean;
7
7
  };
8
+ export interface DopostApiClient {
9
+ request(method: string, path: string, body?: unknown): Promise<ToolResult>;
10
+ requestRaw(method: string, path: string, body?: unknown): Promise<Record<string, unknown>>;
11
+ publicRequest(method: string, path: string, body?: unknown): Promise<ToolResult>;
12
+ publicRequestRaw(method: string, path: string, body?: unknown): Promise<Record<string, unknown>>;
13
+ }
14
+ export type RestDopostApiClientOptions = {
15
+ apiUrl?: string;
16
+ apiKey?: string;
17
+ requestId?: string;
18
+ timeoutMs?: number;
19
+ fetchFn?: typeof fetch;
20
+ };
21
+ export type DopostAuthContext = {
22
+ apiKeyId: string;
23
+ credentialType: "apiKey" | "oauth";
24
+ workspaceId: string | null;
25
+ grantId: string | null;
26
+ userId: string;
27
+ scopes: string[];
28
+ };
29
+ export declare class DopostApiError extends Error {
30
+ readonly statusCode?: number | undefined;
31
+ constructor(message: string, statusCode?: number | undefined);
32
+ }
33
+ /**
34
+ * REST adapter used by both MCP transports.
35
+ *
36
+ * Credentials live on the adapter instance instead of in module globals. This
37
+ * is essential for the remote transport, where every request can belong to a
38
+ * different user and workspace.
39
+ */
40
+ export declare class RestDopostApiClient implements DopostApiClient {
41
+ private readonly apiUrl;
42
+ private readonly apiKey;
43
+ private readonly requestId?;
44
+ private readonly timeoutMs;
45
+ private readonly fetchFn;
46
+ constructor(options?: RestDopostApiClientOptions);
47
+ requestRaw(method: string, path: string, body?: unknown): Promise<Record<string, unknown>>;
48
+ publicRequestRaw(method: string, path: string, body?: unknown): Promise<Record<string, unknown>>;
49
+ authenticate(): Promise<DopostAuthContext>;
50
+ request(method: string, path: string, body?: unknown): Promise<ToolResult>;
51
+ publicRequest(method: string, path: string, body?: unknown): Promise<ToolResult>;
52
+ private fetchJson;
53
+ }
8
54
  /**
9
55
  * Sanitize a value before inserting it into a URL path.
10
56
  * Prevents path traversal and injection.
11
57
  */
12
58
  export declare function safePath(value: string): string;
13
- /**
14
- * Make an authenticated request to the dopost REST API
15
- * and return a result shaped for MCP tool responses.
16
- */
17
- export declare function api(method: string, path: string, body?: unknown): Promise<ToolResult>;
18
- export {};
package/dist/api.js CHANGED
@@ -1,5 +1,115 @@
1
- const API_URL = process.env.DOPOST_API_URL || "https://dopost.co";
2
- const API_KEY = process.env.DOPOST_API_KEY || "";
1
+ export class DopostApiError extends Error {
2
+ statusCode;
3
+ constructor(message, statusCode) {
4
+ super(message);
5
+ this.statusCode = statusCode;
6
+ this.name = "DopostApiError";
7
+ }
8
+ }
9
+ const DEFAULT_API_URL = "https://dopost.co";
10
+ const DEFAULT_TIMEOUT_MS = 30_000;
11
+ /**
12
+ * REST adapter used by both MCP transports.
13
+ *
14
+ * Credentials live on the adapter instance instead of in module globals. This
15
+ * is essential for the remote transport, where every request can belong to a
16
+ * different user and workspace.
17
+ */
18
+ export class RestDopostApiClient {
19
+ apiUrl;
20
+ apiKey;
21
+ requestId;
22
+ timeoutMs;
23
+ fetchFn;
24
+ constructor(options = {}) {
25
+ this.apiUrl = (options.apiUrl || DEFAULT_API_URL).replace(/\/+$/, "");
26
+ this.apiKey = options.apiKey?.trim() || "";
27
+ this.requestId = options.requestId;
28
+ this.timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
29
+ this.fetchFn = options.fetchFn ?? fetch;
30
+ }
31
+ async requestRaw(method, path, body) {
32
+ if (!this.apiKey) {
33
+ throw new Error("dopost authentication is required for this tool. Configure DOPOST_API_KEY for stdio or connect with a Bearer token over HTTP.");
34
+ }
35
+ return this.fetchJson(method, path, body, true);
36
+ }
37
+ async publicRequestRaw(method, path, body) {
38
+ return this.fetchJson(method, path, body, false);
39
+ }
40
+ async authenticate() {
41
+ const response = await this.requestRaw("GET", "/api/v1/auth/context");
42
+ const data = response.data;
43
+ if (!isAuthContext(data)) {
44
+ throw new DopostApiError("dopost API returned an invalid auth context");
45
+ }
46
+ return data;
47
+ }
48
+ async request(method, path, body) {
49
+ try {
50
+ const data = await this.requestRaw(method, path, body);
51
+ return asToolResult(data);
52
+ }
53
+ catch (error) {
54
+ return asToolError(error);
55
+ }
56
+ }
57
+ async publicRequest(method, path, body) {
58
+ try {
59
+ const data = await this.publicRequestRaw(method, path, body);
60
+ return asToolResult(data);
61
+ }
62
+ catch (error) {
63
+ return asToolError(error);
64
+ }
65
+ }
66
+ async fetchJson(method, path, body, authenticated) {
67
+ const headers = {
68
+ Accept: "application/json",
69
+ };
70
+ if (authenticated)
71
+ headers["x-api-key"] = this.apiKey;
72
+ if (body !== undefined)
73
+ headers["Content-Type"] = "application/json";
74
+ if (this.requestId) {
75
+ headers["x-request-id"] = this.requestId;
76
+ headers["x-correlation-id"] = this.requestId;
77
+ }
78
+ let response;
79
+ try {
80
+ response = await this.fetchFn(`${this.apiUrl}${path}`, {
81
+ method,
82
+ headers,
83
+ body: body === undefined ? undefined : JSON.stringify(body),
84
+ signal: AbortSignal.timeout(this.timeoutMs),
85
+ });
86
+ }
87
+ catch (error) {
88
+ const detail = error instanceof Error ? error.message : String(error);
89
+ throw new DopostApiError(`dopost API request failed: ${detail}`);
90
+ }
91
+ const data = (await response
92
+ .json()
93
+ .catch(() => ({ error: "Empty or non-JSON response" })));
94
+ if (!response.ok) {
95
+ throw new DopostApiError(`dopost API returned ${response.status}: ${JSON.stringify(data)}`, response.status);
96
+ }
97
+ return data;
98
+ }
99
+ }
100
+ function isAuthContext(value) {
101
+ if (!value || typeof value !== "object")
102
+ return false;
103
+ const context = value;
104
+ return (typeof context.apiKeyId === "string" &&
105
+ (context.credentialType === "apiKey" ||
106
+ context.credentialType === "oauth") &&
107
+ (typeof context.workspaceId === "string" || context.workspaceId === null) &&
108
+ (typeof context.grantId === "string" || context.grantId === null) &&
109
+ typeof context.userId === "string" &&
110
+ Array.isArray(context.scopes) &&
111
+ context.scopes.every((scope) => typeof scope === "string"));
112
+ }
3
113
  /**
4
114
  * Sanitize a value before inserting it into a URL path.
5
115
  * Prevents path traversal and injection.
@@ -13,47 +123,20 @@ export function safePath(value) {
13
123
  }
14
124
  return encodeURIComponent(value);
15
125
  }
16
- /**
17
- * Make an authenticated request to the dopost REST API
18
- * and return a result shaped for MCP tool responses.
19
- */
20
- export async function api(method, path, body) {
21
- if (!API_KEY) {
22
- return {
23
- content: [
24
- {
25
- type: "text",
26
- text: "DOPOST_API_KEY is not set. Configure the environment variable and restart the server.",
27
- },
28
- ],
29
- isError: true,
30
- };
31
- }
32
- const headers = { "x-api-key": API_KEY };
33
- if (body)
34
- headers["Content-Type"] = "application/json";
35
- try {
36
- const res = await fetch(`${API_URL}${path}`, {
37
- method,
38
- headers,
39
- body: body ? JSON.stringify(body) : undefined,
40
- });
41
- const data = await res.json().catch(() => ({ error: "Empty response" }));
42
- const text = JSON.stringify(data, null, 2);
43
- return res.ok
44
- ? { content: [{ type: "text", text }] }
45
- : { content: [{ type: "text", text }], isError: true };
46
- }
47
- catch (err) {
48
- return {
49
- content: [
50
- {
51
- type: "text",
52
- text: `Request failed: ${err instanceof Error ? err.message : String(err)}`,
53
- },
54
- ],
55
- isError: true,
56
- };
57
- }
126
+ function asToolResult(data) {
127
+ return {
128
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
129
+ };
130
+ }
131
+ function asToolError(error) {
132
+ return {
133
+ content: [
134
+ {
135
+ type: "text",
136
+ text: error instanceof Error ? error.message : String(error),
137
+ },
138
+ ],
139
+ isError: true,
140
+ };
58
141
  }
59
142
  //# sourceMappingURL=api.js.map
package/dist/api.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,mBAAmB,CAAC;AAClE,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC;AAOjD;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,IACE,CAAC,KAAK;QACN,KAAK,CAAC,QAAQ,CAAC,GAAG,CAAC;QACnB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;QACpB,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,EACpB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,GAAG,CAAC,CAAC;IACnD,CAAC;IACD,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CACvB,MAAc,EACd,IAAY,EACZ,IAAc;IAEd,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,uFAAuF;iBAC9F;aACF;YACD,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAED,MAAM,OAAO,GAA2B,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;IACjE,IAAI,IAAI;QAAE,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;IAEvD,IAAI,CAAC;QACH,MAAM,GAAG,G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AK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC7D;SACF;QACD,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
@@ -0,0 +1,78 @@
1
+ export declare const SOCIAL_MEDIA_DOWNLOAD_PLATFORMS: readonly ["youtube", "instagram", "tiktok"];
2
+ export type SocialMediaDownloadPlatform = (typeof SOCIAL_MEDIA_DOWNLOAD_PLATFORMS)[number];
3
+ export declare const SOCIAL_MEDIA_DOWNLOAD_MODES: readonly ["video", "audio", "both"];
4
+ export type SocialMediaDownloadMode = (typeof SOCIAL_MEDIA_DOWNLOAD_MODES)[number];
5
+ export type SocialMediaDownloadContainer = "mp4" | "mp3";
6
+ export interface SocialMediaDownloadInfoRequest {
7
+ url: string;
8
+ mode?: SocialMediaDownloadMode;
9
+ }
10
+ export interface SocialMediaDownloadFormatBase {
11
+ id: string;
12
+ label: string;
13
+ container: SocialMediaDownloadContainer;
14
+ hasVideo: boolean;
15
+ hasAudio: boolean;
16
+ height?: number;
17
+ bitrateKbps?: number;
18
+ sizeBytes?: number;
19
+ }
20
+ export interface SocialMediaDownloadTicketFormat extends SocialMediaDownloadFormatBase {
21
+ downloadToken: string;
22
+ expiresAt: string;
23
+ }
24
+ export interface SocialMediaDownloadPublicFormat extends SocialMediaDownloadFormatBase {
25
+ downloadUrl: string;
26
+ expiresAt: string;
27
+ }
28
+ export interface SocialMediaDownloadInfoBase<TFormat extends SocialMediaDownloadFormatBase> {
29
+ platform: SocialMediaDownloadPlatform;
30
+ sourceUrl: string;
31
+ title: string;
32
+ thumbnailUrl: string | null;
33
+ durationSeconds: number | null;
34
+ authorName: string | null;
35
+ formats: TFormat[];
36
+ }
37
+ export type SocialMediaDownloadTicketInfo = SocialMediaDownloadInfoBase<SocialMediaDownloadTicketFormat>;
38
+ export type SocialMediaDownloadPublicInfo = SocialMediaDownloadInfoBase<SocialMediaDownloadPublicFormat>;
39
+ export interface SocialMediaDownloadApiResponse<T> {
40
+ data: T;
41
+ message?: string;
42
+ }
43
+ export type SocialMediaDownloadErrorCode = "INVALID_REQUEST" | "UNSUPPORTED_URL" | "MEDIA_UNAVAILABLE" | "PRIVATE_MEDIA" | "DOWNLOAD_EXPIRED" | "RATE_LIMITED" | "UPSTREAM_ERROR" | "SERVICE_UNAVAILABLE";
44
+ export interface SocialMediaDownloadErrorResponse {
45
+ error: {
46
+ code: SocialMediaDownloadErrorCode;
47
+ message: string;
48
+ };
49
+ }
50
+ export type SocialMediaDownloadVideoQuality = "best" | 144 | 240 | 360 | 480 | 720 | 1080 | 1440 | 2160 | 4320;
51
+ export type SocialMediaDownloadAudioQuality = "best" | 64 | 96 | 128 | 192 | 256 | 320;
52
+ export type PrepareSocialMediaDownloadRequest = {
53
+ url: string;
54
+ format: "mp4";
55
+ quality?: SocialMediaDownloadVideoQuality;
56
+ } | {
57
+ url: string;
58
+ format: "mp3";
59
+ quality?: SocialMediaDownloadAudioQuality;
60
+ };
61
+ export type PrepareYoutubeDownloadRequest = PrepareSocialMediaDownloadRequest;
62
+ export type PrepareInstagramDownloadRequest = PrepareSocialMediaDownloadRequest;
63
+ export type PrepareTikTokDownloadRequest = PrepareSocialMediaDownloadRequest;
64
+ export interface PreparedSocialMediaDownload {
65
+ downloadUrl: string;
66
+ expiresAt: string;
67
+ platform: SocialMediaDownloadPlatform;
68
+ sourceUrl: string;
69
+ title: string;
70
+ thumbnailUrl: string | null;
71
+ authorName: string | null;
72
+ durationSeconds: number | null;
73
+ format: SocialMediaDownloadContainer;
74
+ quality: string;
75
+ height?: number;
76
+ bitrateKbps?: number;
77
+ sizeBytes?: number;
78
+ }
@@ -0,0 +1,7 @@
1
+ export const SOCIAL_MEDIA_DOWNLOAD_PLATFORMS = [
2
+ "youtube",
3
+ "instagram",
4
+ "tiktok",
5
+ ];
6
+ export const SOCIAL_MEDIA_DOWNLOAD_MODES = ["video", "audio", "both"];
7
+ //# sourceMappingURL=download-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-types.js","sourceRoot":"","sources":["../src/download-types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,+BAA+B,GAAG;IAC7C,SAAS;IACT,WAAW;IACX,QAAQ;CACA,CAAC;AAKX,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAU,CAAC"}
package/dist/index.js CHANGED
@@ -1,13 +1,14 @@
1
1
  #!/usr/bin/env node
2
- import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
2
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
- import { registerTools } from "./tools.js";
5
- const server = new McpServer({
6
- name: "dopost",
7
- version: "1.0.0",
8
- description: "Schedule and manage social media posts via AI agents",
3
+ import { RestDopostApiClient } from "./api.js";
4
+ import { createDopostMcpServer } from "./server.js";
5
+ const client = new RestDopostApiClient({
6
+ apiUrl: process.env.DOPOST_API_URL,
7
+ apiKey: process.env.DOPOST_API_KEY,
8
+ });
9
+ const server = createDopostMcpServer(client, {
10
+ enableLocalFileTools: true,
9
11
  });
10
- registerTools(server);
11
12
  const transport = new StdioServerTransport();
12
13
  await server.connect(transport);
13
14
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,QAAQ;IACd,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,sDAAsD;CACpE,CAAC,CAAC;AAEH,aAAa,CAAC,MAAM,CAAC,CAAC;AAEtB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC/C,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,MAAM,MAAM,GAAG,IAAI,mBAAmB,CAAC;IACrC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;IAClC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,cAAc;CACnC,CAAC,CAAC;AACH,MAAM,MAAM,GAAG,qBAAqB,CAAC,MAAM,EAAE;IAC3C,oBAAoB,EAAE,IAAI;CAC3B,CAAC,CAAC;AAEH,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { DopostApiClient } from "./api.js";
3
+ export type CreateDopostMcpServerOptions = {
4
+ enableLocalFileTools?: boolean;
5
+ };
6
+ /** Build a transport-agnostic dopost MCP server for one auth context. */
7
+ export declare function createDopostMcpServer(client: DopostApiClient, options?: CreateDopostMcpServerOptions): McpServer;
package/dist/server.js ADDED
@@ -0,0 +1,22 @@
1
+ import { readFileSync } from "node:fs";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { registerTools } from "./tools.js";
4
+ const packageVersion = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
5
+ /** Build a transport-agnostic dopost MCP server for one auth context. */
6
+ export function createDopostMcpServer(client, options = {}) {
7
+ const server = new McpServer({
8
+ name: "dopost",
9
+ version: packageVersion,
10
+ description: "Schedule and manage social media posts, read reliable workspace analytics, and prepare public media downloads via AI agents",
11
+ }, {
12
+ instructions: "A hosted OAuth connection may access multiple dopost workspaces, while an API key remains restricted to one. " +
13
+ "List results include workspace metadata: present naturally grouped or labelled by workspace. " +
14
+ "Account and resource IDs resolve their workspace automatically, so do not ask the user to choose a workspace when the intended account or resource is already unambiguous. " +
15
+ "Use list_workspaces or ask a concise clarification only when multiple plausible destinations remain. " +
16
+ "Before any write tool, show the exact content, destination, media, time and recurrence that apply, then wait for the user's explicit approval of that plan. " +
17
+ "Never infer approval for an ambiguous destination, unpublished draft, deletion or recurring schedule.",
18
+ });
19
+ registerTools(server, client, options);
20
+ return server;
21
+ }
22
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,cAAc,GAAW,IAAI,CAAC,KAAK,CACvC,YAAY,CAAC,IAAI,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAClE,CAAC,OAAO,CAAC;AAMV,yEAAyE;AACzE,MAAM,UAAU,qBAAqB,CACnC,MAAuB,EACvB,UAAwC,EAAE;IAE1C,MAAM,MAAM,GAAG,IAAI,SAAS,CAC1B;QACE,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,cAAc;QACvB,WAAW,EACT,6HAA6H;KAChI,EACD;QACE,YAAY,EACV,+GAA+G;YAC/G,+FAA+F;YAC/F,6KAA6K;YAC7K,uGAAuG;YACvG,8JAA8J;YAC9J,uGAAuG;KAC1G,CACF,CAAC;IAEF,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;IACvC,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/tools.d.ts CHANGED
@@ -1,2 +1,7 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
- export declare function registerTools(server: McpServer): void;
2
+ import { type DopostApiClient } from "./api.js";
3
+ export type RegisterToolsOptions = {
4
+ /** Tools that read files from the MCP process host are only valid over Stdio. */
5
+ enableLocalFileTools?: boolean;
6
+ };
7
+ export declare function registerTools(server: McpServer, client: DopostApiClient, options?: RegisterToolsOptions): void;