@socialseal/mcp-server 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.
- package/dist/client.d.ts +35 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +336 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +78 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +13 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +37 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/registry.d.ts +24 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +210 -0
- package/dist/registry.js.map +1 -0
- package/dist/server.d.ts +16 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +341 -0
- package/dist/server.js.map +1 -0
- package/dist/smoke.d.ts +2 -0
- package/dist/smoke.d.ts.map +1 -0
- package/dist/smoke.js +37 -0
- package/dist/smoke.js.map +1 -0
- package/dist/types.d.ts +20 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +32 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { SocialSealConfig, StatusKind, WorkspaceSelection } from "./types.js";
|
|
2
|
+
type FetchLike = typeof fetch;
|
|
3
|
+
export interface SocialSealClientOptions {
|
|
4
|
+
config: SocialSealConfig;
|
|
5
|
+
fetchImpl?: FetchLike;
|
|
6
|
+
}
|
|
7
|
+
export declare class SocialSealClient {
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly fetchImpl;
|
|
10
|
+
constructor(options: SocialSealClientOptions);
|
|
11
|
+
getCurrentWorkspace(explicitWorkspaceId?: string | null): WorkspaceSelection;
|
|
12
|
+
requireWorkspace(explicitWorkspaceId?: string | null): WorkspaceSelection & {
|
|
13
|
+
workspaceId: string;
|
|
14
|
+
};
|
|
15
|
+
listWorkspaces(): Promise<unknown>;
|
|
16
|
+
callTool(toolName: string, body: Record<string, unknown>, options?: {
|
|
17
|
+
workspaceId?: string | null;
|
|
18
|
+
async?: boolean;
|
|
19
|
+
}): Promise<unknown>;
|
|
20
|
+
getStatus(options: {
|
|
21
|
+
id: string | number;
|
|
22
|
+
kind: StatusKind;
|
|
23
|
+
workspaceId?: string | null;
|
|
24
|
+
includeResults?: boolean;
|
|
25
|
+
resultsLimit?: number;
|
|
26
|
+
}): Promise<unknown>;
|
|
27
|
+
exportTrackingData(body: Record<string, unknown>, workspaceId?: string | null): Promise<unknown>;
|
|
28
|
+
exportReport(body: Record<string, unknown>, workspaceId?: string | null): Promise<unknown>;
|
|
29
|
+
private readAgentToolJobStatus;
|
|
30
|
+
private readSearchJourneyRunStatus;
|
|
31
|
+
private readGoogleAiRunStatus;
|
|
32
|
+
private request;
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAanF,KAAK,SAAS,GAAG,OAAO,KAAK,CAAC;AAE9B,MAAM,WAAW,uBAAuB;IACtC,MAAM,EAAE,gBAAgB,CAAC;IACzB,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAeD,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAY;gBAE1B,OAAO,EAAE,uBAAuB;IAK5C,mBAAmB,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,kBAAkB;IAW5E,gBAAgB,CAAC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,kBAAkB,GAAG;QAAE,WAAW,EAAE,MAAM,CAAA;KAAE;IAW7F,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAQlC,QAAQ,CACZ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,OAAO,GAAE;QAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAAC,KAAK,CAAC,EAAE,OAAO,CAAA;KAAO,GAC7D,OAAO,CAAC,OAAO,CAAC;IAyBb,SAAS,CAAC,OAAO,EAAE;QACvB,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;QACpB,IAAI,EAAE,UAAU,CAAC;QACjB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;QAC5B,cAAc,CAAC,EAAE,OAAO,CAAC;QACzB,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,OAAO,CAAC;IA2Dd,kBAAkB,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;IAIhG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC;YAIlF,sBAAsB;YAItB,0BAA0B;YAQ1B,qBAAqB;YA4BrB,OAAO;CAqCtB"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
import { requireApiKey } from "./config.js";
|
|
2
|
+
import { SocialSealMcpError } from "./errors.js";
|
|
3
|
+
import { getToolEntry } from "./registry.js";
|
|
4
|
+
const CLI_KEY_HEADER = "X-CLI-Key";
|
|
5
|
+
const WORKSPACE_HEADER = "X-Workspace-Id";
|
|
6
|
+
const DEFAULT_STATUS_RESULTS_LIMIT = 10;
|
|
7
|
+
const MAX_REQUEST_BODY_BYTES = 200_000;
|
|
8
|
+
const MAX_REQUEST_BODY_DEPTH = 20;
|
|
9
|
+
const MAX_REQUEST_BODY_ITEMS = 5_000;
|
|
10
|
+
const MAX_UPSTREAM_RESPONSE_BYTES = 1_000_000;
|
|
11
|
+
const UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
12
|
+
const WORKSPACE_KEY_PATTERN = /^(workspaceId|workspace_id)$/;
|
|
13
|
+
export class SocialSealClient {
|
|
14
|
+
config;
|
|
15
|
+
fetchImpl;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
this.config = options.config;
|
|
18
|
+
this.fetchImpl = options.fetchImpl ?? fetch;
|
|
19
|
+
}
|
|
20
|
+
getCurrentWorkspace(explicitWorkspaceId) {
|
|
21
|
+
const normalizedExplicit = normalizeOptionalString(explicitWorkspaceId);
|
|
22
|
+
if (normalizedExplicit) {
|
|
23
|
+
return { workspaceId: normalizedExplicit, source: "explicit" };
|
|
24
|
+
}
|
|
25
|
+
return {
|
|
26
|
+
workspaceId: this.config.workspaceId,
|
|
27
|
+
source: this.config.workspaceSource,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
requireWorkspace(explicitWorkspaceId) {
|
|
31
|
+
const selection = this.getCurrentWorkspace(explicitWorkspaceId);
|
|
32
|
+
if (!selection.workspaceId) {
|
|
33
|
+
throw new SocialSealMcpError("This SocialSeal tool requires a workspace. Set SOCIALSEAL_WORKSPACE_ID or pass workspaceId.", { code: "WORKSPACE_REQUIRED" });
|
|
34
|
+
}
|
|
35
|
+
return { ...selection, workspaceId: selection.workspaceId };
|
|
36
|
+
}
|
|
37
|
+
async listWorkspaces() {
|
|
38
|
+
const payload = await this.request("/cli/workspaces", {
|
|
39
|
+
method: "GET",
|
|
40
|
+
label: "Workspace discovery",
|
|
41
|
+
});
|
|
42
|
+
return unwrapData(payload);
|
|
43
|
+
}
|
|
44
|
+
async callTool(toolName, body, options = {}) {
|
|
45
|
+
const entry = getToolEntry(toolName);
|
|
46
|
+
if (!entry) {
|
|
47
|
+
throw new SocialSealMcpError(`Unsupported SocialSeal tool: ${toolName}`, {
|
|
48
|
+
code: "UNSUPPORTED_TOOL",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const workspace = entry.workspaceScoped ? this.requireWorkspace(options.workspaceId) : this.getCurrentWorkspace(options.workspaceId);
|
|
52
|
+
const scopedBody = entry.workspaceScoped
|
|
53
|
+
? enforceWorkspaceBody(body, workspace.workspaceId)
|
|
54
|
+
: body;
|
|
55
|
+
const payload = options.async === true && toolName === "search-journey-run"
|
|
56
|
+
? { ...scopedBody, executionMode: "async" }
|
|
57
|
+
: scopedBody;
|
|
58
|
+
return this.request(`/cli/tools/${encodeURIComponent(toolName)}`, {
|
|
59
|
+
method: "POST",
|
|
60
|
+
body: payload,
|
|
61
|
+
workspaceId: workspace.workspaceId,
|
|
62
|
+
label: `SocialSeal tool ${toolName}`,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async getStatus(options) {
|
|
66
|
+
const identifier = parseStatusIdentifier(options.id);
|
|
67
|
+
const kind = options.kind;
|
|
68
|
+
const includeResults = options.includeResults === true;
|
|
69
|
+
const resultsLimit = normalizeResultsLimit(options.resultsLimit);
|
|
70
|
+
if (kind === "google_ai_run" || (kind === "auto" && identifier.numericId != null)) {
|
|
71
|
+
if (identifier.numericId == null) {
|
|
72
|
+
throw new SocialSealMcpError("google_ai_run status expects a numeric run id.", {
|
|
73
|
+
code: "INVALID_STATUS_ID",
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return this.readGoogleAiRunStatus(identifier.numericId, includeResults, resultsLimit);
|
|
77
|
+
}
|
|
78
|
+
if (kind === "agent_job") {
|
|
79
|
+
if (!identifier.uuidId) {
|
|
80
|
+
throw new SocialSealMcpError("agent_job status expects a UUID job id.", {
|
|
81
|
+
code: "INVALID_STATUS_ID",
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return this.readAgentToolJobStatus(identifier.uuidId);
|
|
85
|
+
}
|
|
86
|
+
if (kind === "journey_run") {
|
|
87
|
+
if (!identifier.uuidId) {
|
|
88
|
+
throw new SocialSealMcpError("journey_run status expects a UUID run id.", {
|
|
89
|
+
code: "INVALID_STATUS_ID",
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
const workspace = this.requireWorkspace(options.workspaceId);
|
|
93
|
+
return this.readSearchJourneyRunStatus(identifier.uuidId, workspace.workspaceId);
|
|
94
|
+
}
|
|
95
|
+
if (!identifier.uuidId) {
|
|
96
|
+
throw new SocialSealMcpError("auto status expects a numeric id or UUID.", {
|
|
97
|
+
code: "INVALID_STATUS_ID",
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
return await this.readAgentToolJobStatus(identifier.uuidId);
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
if (!(error instanceof SocialSealMcpError) || error.status !== 404) {
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const workspace = this.getCurrentWorkspace(options.workspaceId);
|
|
109
|
+
if (workspace.workspaceId) {
|
|
110
|
+
return this.readSearchJourneyRunStatus(identifier.uuidId, workspace.workspaceId);
|
|
111
|
+
}
|
|
112
|
+
throw new SocialSealMcpError(`No matching status record found for ${identifier.rawId}.`, {
|
|
113
|
+
code: "STATUS_NOT_FOUND",
|
|
114
|
+
status: 404,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
async exportTrackingData(body, workspaceId) {
|
|
118
|
+
return this.callTool("export_tracking_data", body, { workspaceId });
|
|
119
|
+
}
|
|
120
|
+
async exportReport(body, workspaceId) {
|
|
121
|
+
return this.callTool("export-report", body, { workspaceId });
|
|
122
|
+
}
|
|
123
|
+
async readAgentToolJobStatus(jobId) {
|
|
124
|
+
return this.callTool("agent-tool-jobs", { action: "status", jobId });
|
|
125
|
+
}
|
|
126
|
+
async readSearchJourneyRunStatus(runId, workspaceId) {
|
|
127
|
+
return this.callTool("search-journey-run", { action: "status", workspaceId, runId }, { workspaceId });
|
|
128
|
+
}
|
|
129
|
+
async readGoogleAiRunStatus(runId, includeResults, resultsLimit) {
|
|
130
|
+
const runsPayload = await this.callTool("get-google-ai-search-runs", {
|
|
131
|
+
runId,
|
|
132
|
+
limit: 1,
|
|
133
|
+
offset: 0,
|
|
134
|
+
});
|
|
135
|
+
if (!includeResults) {
|
|
136
|
+
return runsPayload;
|
|
137
|
+
}
|
|
138
|
+
const resultsPayload = await this.callTool("get-google-ai-search-results", {
|
|
139
|
+
runId,
|
|
140
|
+
includeCitations: true,
|
|
141
|
+
limit: resultsLimit,
|
|
142
|
+
offset: 0,
|
|
143
|
+
});
|
|
144
|
+
return {
|
|
145
|
+
run: runsPayload,
|
|
146
|
+
results: resultsPayload,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
async request(path, options) {
|
|
150
|
+
const apiKey = requireApiKey(this.config);
|
|
151
|
+
const method = (options.method ?? "POST").toUpperCase();
|
|
152
|
+
const hasBody = method !== "GET" && method !== "HEAD" && options.body !== undefined;
|
|
153
|
+
const url = new URL(path, `${this.config.apiBase.replace(/\/$/, "")}/`);
|
|
154
|
+
const headers = new Headers({
|
|
155
|
+
Accept: "application/json, text/csv, text/plain",
|
|
156
|
+
[CLI_KEY_HEADER]: apiKey,
|
|
157
|
+
});
|
|
158
|
+
if (options.workspaceId)
|
|
159
|
+
headers.set(WORKSPACE_HEADER, options.workspaceId);
|
|
160
|
+
if (hasBody)
|
|
161
|
+
headers.set("Content-Type", "application/json");
|
|
162
|
+
const serializedBody = hasBody
|
|
163
|
+
? serializeRequestBodyLimited(options.body, options.label)
|
|
164
|
+
: undefined;
|
|
165
|
+
let response;
|
|
166
|
+
try {
|
|
167
|
+
response = await this.fetchImpl(url, {
|
|
168
|
+
method,
|
|
169
|
+
headers,
|
|
170
|
+
body: serializedBody,
|
|
171
|
+
signal: AbortSignal.timeout(this.config.timeoutMs),
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
catch (error) {
|
|
175
|
+
if (error instanceof Error && error.name === "TimeoutError") {
|
|
176
|
+
throw new SocialSealMcpError(`${options.label} timed out.`, { code: "TIMEOUT" });
|
|
177
|
+
}
|
|
178
|
+
throw error;
|
|
179
|
+
}
|
|
180
|
+
if (!response.ok) {
|
|
181
|
+
throw await buildHttpError(response, options.label);
|
|
182
|
+
}
|
|
183
|
+
return readResponseBody(response, options.label);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function normalizeOptionalString(value) {
|
|
187
|
+
if (typeof value !== "string")
|
|
188
|
+
return null;
|
|
189
|
+
const trimmed = value.trim();
|
|
190
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
191
|
+
}
|
|
192
|
+
function unwrapData(payload) {
|
|
193
|
+
if (payload && typeof payload === "object" && "data" in payload) {
|
|
194
|
+
return payload.data;
|
|
195
|
+
}
|
|
196
|
+
return payload;
|
|
197
|
+
}
|
|
198
|
+
function parseStatusIdentifier(id) {
|
|
199
|
+
const rawId = String(id).trim();
|
|
200
|
+
const parsedNumericId = /^\d+$/.test(rawId) ? Number(rawId) : null;
|
|
201
|
+
if (parsedNumericId != null && !Number.isSafeInteger(parsedNumericId)) {
|
|
202
|
+
throw new SocialSealMcpError("Status id must be a safe integer or UUID.", {
|
|
203
|
+
code: "INVALID_STATUS_ID",
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
rawId,
|
|
208
|
+
numericId: parsedNumericId,
|
|
209
|
+
uuidId: UUID_PATTERN.test(rawId) ? rawId : null,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
function normalizeResultsLimit(value) {
|
|
213
|
+
if (value == null)
|
|
214
|
+
return DEFAULT_STATUS_RESULTS_LIMIT;
|
|
215
|
+
const parsed = Number(value);
|
|
216
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
217
|
+
throw new SocialSealMcpError("resultsLimit must be a positive integer.", {
|
|
218
|
+
code: "INVALID_RESULTS_LIMIT",
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
return Math.min(parsed, 50);
|
|
222
|
+
}
|
|
223
|
+
async function readResponseBody(response, label) {
|
|
224
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
225
|
+
const raw = await readResponseTextLimited(response, label);
|
|
226
|
+
if (!raw)
|
|
227
|
+
return null;
|
|
228
|
+
if (contentType.includes("application/json")) {
|
|
229
|
+
try {
|
|
230
|
+
return JSON.parse(raw);
|
|
231
|
+
}
|
|
232
|
+
catch {
|
|
233
|
+
throw new SocialSealMcpError(`${label} returned malformed JSON.`, {
|
|
234
|
+
code: "MALFORMED_RESPONSE",
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return raw;
|
|
239
|
+
}
|
|
240
|
+
async function buildHttpError(response, label) {
|
|
241
|
+
const details = await readResponseBody(response, label).catch(() => null);
|
|
242
|
+
return new SocialSealMcpError(`${label} failed.`, {
|
|
243
|
+
code: "HTTP_ERROR",
|
|
244
|
+
status: response.status,
|
|
245
|
+
details,
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
async function readResponseTextLimited(response, label) {
|
|
249
|
+
const contentLength = response.headers.get("content-length");
|
|
250
|
+
if (contentLength && Number(contentLength) > MAX_UPSTREAM_RESPONSE_BYTES) {
|
|
251
|
+
throw new SocialSealMcpError(`${label} response is too large for MCP output.`, {
|
|
252
|
+
code: "UPSTREAM_RESPONSE_TOO_LARGE",
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if (!response.body)
|
|
256
|
+
return response.text();
|
|
257
|
+
const reader = response.body.getReader();
|
|
258
|
+
const chunks = [];
|
|
259
|
+
let receivedBytes = 0;
|
|
260
|
+
while (true) {
|
|
261
|
+
const { done, value } = await reader.read();
|
|
262
|
+
if (done)
|
|
263
|
+
break;
|
|
264
|
+
receivedBytes += value.byteLength;
|
|
265
|
+
if (receivedBytes > MAX_UPSTREAM_RESPONSE_BYTES) {
|
|
266
|
+
await reader.cancel();
|
|
267
|
+
throw new SocialSealMcpError(`${label} response is too large for MCP output.`, {
|
|
268
|
+
code: "UPSTREAM_RESPONSE_TOO_LARGE",
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
chunks.push(value);
|
|
272
|
+
}
|
|
273
|
+
return new TextDecoder().decode(concatChunks(chunks, receivedBytes));
|
|
274
|
+
}
|
|
275
|
+
function concatChunks(chunks, totalLength) {
|
|
276
|
+
const combined = new Uint8Array(totalLength);
|
|
277
|
+
let offset = 0;
|
|
278
|
+
for (const chunk of chunks) {
|
|
279
|
+
combined.set(chunk, offset);
|
|
280
|
+
offset += chunk.byteLength;
|
|
281
|
+
}
|
|
282
|
+
return combined;
|
|
283
|
+
}
|
|
284
|
+
function serializeRequestBodyLimited(value, label) {
|
|
285
|
+
assertRequestBodyBudget(value, label);
|
|
286
|
+
const serialized = JSON.stringify(value);
|
|
287
|
+
if (serialized.length > MAX_REQUEST_BODY_BYTES) {
|
|
288
|
+
throw new SocialSealMcpError(`${label} request body is too large.`, {
|
|
289
|
+
code: "REQUEST_BODY_TOO_LARGE",
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
return serialized;
|
|
293
|
+
}
|
|
294
|
+
function assertRequestBodyBudget(value, label, depth = 0, state = { items: 0 }) {
|
|
295
|
+
if (depth > MAX_REQUEST_BODY_DEPTH) {
|
|
296
|
+
throw new SocialSealMcpError(`${label} request body is too deeply nested.`, {
|
|
297
|
+
code: "REQUEST_BODY_TOO_DEEP",
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
if (!value || typeof value !== "object")
|
|
301
|
+
return;
|
|
302
|
+
const entries = Array.isArray(value) ? value : Object.values(value);
|
|
303
|
+
state.items += entries.length;
|
|
304
|
+
if (state.items > MAX_REQUEST_BODY_ITEMS) {
|
|
305
|
+
throw new SocialSealMcpError(`${label} request body has too many fields/items.`, {
|
|
306
|
+
code: "REQUEST_BODY_TOO_LARGE",
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
for (const entry of entries) {
|
|
310
|
+
assertRequestBodyBudget(entry, label, depth + 1, state);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
function enforceWorkspaceBody(body, workspaceId) {
|
|
314
|
+
if (!workspaceId)
|
|
315
|
+
return body;
|
|
316
|
+
assertNoConflictingWorkspace(body, workspaceId, "body");
|
|
317
|
+
return "workspaceId" in body ? body : { ...body, workspaceId };
|
|
318
|
+
}
|
|
319
|
+
function assertNoConflictingWorkspace(value, workspaceId, path) {
|
|
320
|
+
if (!value || typeof value !== "object")
|
|
321
|
+
return;
|
|
322
|
+
if (Array.isArray(value)) {
|
|
323
|
+
value.forEach((entry, index) => assertNoConflictingWorkspace(entry, workspaceId, `${path}[${index}]`));
|
|
324
|
+
return;
|
|
325
|
+
}
|
|
326
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
327
|
+
if (WORKSPACE_KEY_PATTERN.test(key)) {
|
|
328
|
+
const entryWorkspaceId = normalizeOptionalString(entry);
|
|
329
|
+
if (entryWorkspaceId && entryWorkspaceId !== workspaceId) {
|
|
330
|
+
throw new SocialSealMcpError(`Workspace mismatch at ${path}.${key}; use the resolved workspace ${workspaceId}.`, { code: "WORKSPACE_MISMATCH" });
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
assertNoConflictingWorkspace(entry, workspaceId, `${path}.${key}`);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AA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K,CAAC,CAAC;YACxD,IAAI,gBAAgB,IAAI,gBAAgB,KAAK,WAAW,EAAE,CAAC;gBACzD,MAAM,IAAI,kBAAkB,CAC1B,yBAAyB,IAAI,IAAI,GAAG,gCAAgC,WAAW,GAAG,EAClF,EAAE,IAAI,EAAE,oBAAoB,EAAE,CAC/B,CAAC;YACJ,CAAC;QACH,CAAC;QACD,4BAA4B,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC,CAAC;IACrE,CAAC;AACH,CAAC"}
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SocialSealConfig } from "./types.js";
|
|
2
|
+
export declare const DEFAULT_CONFIG_PATH: string;
|
|
3
|
+
interface ConfigResolverOptions {
|
|
4
|
+
env?: NodeJS.ProcessEnv;
|
|
5
|
+
readFile?: (filePath: string) => string;
|
|
6
|
+
homeDir?: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function resolveConfig(options?: ConfigResolverOptions): SocialSealConfig;
|
|
9
|
+
export declare function requireApiKey(config: SocialSealConfig): string;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAc,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAM/D,eAAO,MAAM,mBAAmB,QAK/B,CAAC;AAEF,UAAU,qBAAqB;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AA8CD,wBAAgB,aAAa,CAAC,OAAO,GAAE,qBAA0B,GAAG,gBAAgB,CAuBnF;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAQ9D"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { SocialSealMcpError } from "./errors.js";
|
|
5
|
+
const DEFAULT_API_BASE = "https://api.socialseal.co";
|
|
6
|
+
const DEFAULT_TIMEOUT_MS = 15_000;
|
|
7
|
+
const MAX_TIMEOUT_MS = 15_000;
|
|
8
|
+
export const DEFAULT_CONFIG_PATH = path.join(os.homedir(), ".config", "socialseal", "config.json");
|
|
9
|
+
function trimString(value) {
|
|
10
|
+
if (typeof value !== "string")
|
|
11
|
+
return null;
|
|
12
|
+
const trimmed = value.trim();
|
|
13
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
14
|
+
}
|
|
15
|
+
function parseTimeoutMs(value, fallback) {
|
|
16
|
+
const raw = typeof value === "number" ? value : trimString(value);
|
|
17
|
+
if (raw == null || raw === "")
|
|
18
|
+
return fallback;
|
|
19
|
+
const parsed = Number(raw);
|
|
20
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
21
|
+
throw new SocialSealMcpError("Invalid SocialSeal timeout value.", {
|
|
22
|
+
code: "INVALID_TIMEOUT",
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return Math.min(parsed, MAX_TIMEOUT_MS);
|
|
26
|
+
}
|
|
27
|
+
function readConfigFile(configPath, readFile) {
|
|
28
|
+
try {
|
|
29
|
+
const raw = readFile(configPath);
|
|
30
|
+
if (!raw.trim())
|
|
31
|
+
return {};
|
|
32
|
+
const parsed = JSON.parse(raw);
|
|
33
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
34
|
+
throw new SocialSealMcpError("SocialSeal config file must contain a JSON object.", {
|
|
35
|
+
code: "INVALID_CONFIG",
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
return parsed;
|
|
39
|
+
}
|
|
40
|
+
catch (error) {
|
|
41
|
+
if (error instanceof SocialSealMcpError)
|
|
42
|
+
throw error;
|
|
43
|
+
if (error && typeof error === "object" && "code" in error && error.code === "ENOENT") {
|
|
44
|
+
return {};
|
|
45
|
+
}
|
|
46
|
+
if (error instanceof SyntaxError) {
|
|
47
|
+
throw new SocialSealMcpError("SocialSeal config file contains invalid JSON.", {
|
|
48
|
+
code: "INVALID_CONFIG_JSON",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
throw error;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function resolveConfig(options = {}) {
|
|
55
|
+
const env = options.env ?? process.env;
|
|
56
|
+
const readFile = options.readFile ?? ((filePath) => fs.readFileSync(filePath, "utf8"));
|
|
57
|
+
const configPath = trimString(env.SOCIALSEAL_CONFIG) ??
|
|
58
|
+
path.join(options.homeDir ?? os.homedir(), ".config", "socialseal", "config.json");
|
|
59
|
+
const fileConfig = readConfigFile(configPath, readFile);
|
|
60
|
+
const envWorkspaceId = trimString(env.SOCIALSEAL_WORKSPACE_ID);
|
|
61
|
+
const configWorkspaceId = trimString(fileConfig.workspaceId);
|
|
62
|
+
const workspaceId = envWorkspaceId ?? configWorkspaceId;
|
|
63
|
+
return {
|
|
64
|
+
apiBase: trimString(env.SOCIALSEAL_API_BASE) ?? trimString(fileConfig.apiBase) ?? DEFAULT_API_BASE,
|
|
65
|
+
apiKey: trimString(env.SOCIALSEAL_API_KEY) ?? trimString(fileConfig.apiKey),
|
|
66
|
+
workspaceId,
|
|
67
|
+
timeoutMs: parseTimeoutMs(env.SOCIALSEAL_TIMEOUT_MS ?? fileConfig.timeoutMs, DEFAULT_TIMEOUT_MS),
|
|
68
|
+
configPath,
|
|
69
|
+
workspaceSource: envWorkspaceId ? "env" : configWorkspaceId ? "config" : "none",
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
export function requireApiKey(config) {
|
|
73
|
+
if (!config.apiKey) {
|
|
74
|
+
throw new SocialSealMcpError("Missing SocialSeal API key. Set SOCIALSEAL_API_KEY or apiKey in the SocialSeal config file.", { code: "MISSING_API_KEY" });
|
|
75
|
+
}
|
|
76
|
+
return config.apiKey;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,gBAAgB,GAAG,2BAA2B,CAAC;AACrD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAClC,MAAM,cAAc,GAAG,MAAM,CAAC;AAE9B,MAAM,CAAC,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAC1C,EAAE,CAAC,OAAO,EAAE,EACZ,SAAS,EACT,YAAY,EACZ,aAAa,CACd,CAAC;AAQF,SAAS,UAAU,CAAC,KAAc;IAChC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC7C,CAAC;AAED,SAAS,cAAc,CAAC,KAAc,EAAE,QAAgB;IACtD,MAAM,GAAG,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IAClE,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,QAAQ,CAAC;IAE/C,MAAM,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAC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AE,CAAC;QACnB,MAAM,IAAI,kBAAkB,CAC1B,6FAA6F,EAC7F,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAC5B,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC;AACvB,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare class SocialSealMcpError extends Error {
|
|
2
|
+
readonly code: string;
|
|
3
|
+
readonly status?: number;
|
|
4
|
+
readonly details?: unknown;
|
|
5
|
+
constructor(message: string, options: {
|
|
6
|
+
code: string;
|
|
7
|
+
status?: number;
|
|
8
|
+
details?: unknown;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
export declare function redactSecrets(value: unknown): unknown;
|
|
12
|
+
export declare function formatError(error: unknown): string;
|
|
13
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE;CAQhE;AAID,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAarD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CASlD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export class SocialSealMcpError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
status;
|
|
4
|
+
details;
|
|
5
|
+
constructor(message, options) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = "SocialSealMcpError";
|
|
8
|
+
this.code = options.code;
|
|
9
|
+
this.status = options.status;
|
|
10
|
+
this.details = redactSecrets(options.details);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
const SECRET_KEY_PATTERN = /(?:api[_-]?key|cli[_-]?key|authorization|token|secret|password)/i;
|
|
14
|
+
export function redactSecrets(value) {
|
|
15
|
+
if (Array.isArray(value)) {
|
|
16
|
+
return value.map((entry) => redactSecrets(entry));
|
|
17
|
+
}
|
|
18
|
+
if (!value || typeof value !== "object") {
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
const redacted = {};
|
|
22
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
23
|
+
redacted[key] = SECRET_KEY_PATTERN.test(key) ? "[redacted]" : redactSecrets(entry);
|
|
24
|
+
}
|
|
25
|
+
return redacted;
|
|
26
|
+
}
|
|
27
|
+
export function formatError(error) {
|
|
28
|
+
if (error instanceof SocialSealMcpError) {
|
|
29
|
+
const suffix = error.status ? ` (HTTP ${error.status})` : "";
|
|
30
|
+
return `${error.message}${suffix} [${error.code}]`;
|
|
31
|
+
}
|
|
32
|
+
if (error instanceof Error) {
|
|
33
|
+
return error.message;
|
|
34
|
+
}
|
|
35
|
+
return "Unknown SocialSeal MCP error.";
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAClC,IAAI,CAAS;IACb,MAAM,CAAU;IAChB,OAAO,CAAW;IAE3B,YACE,OAAe,EACf,OAA6D;QAE7D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,oBAAoB,CAAC;QACjC,IAAI,CAAC,IAAI,GAAG,OAAO,CAA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AAC;IACD,OAAO,+BAA+B,CAAC;AACzC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { createSocialSealMcpServer } from "./server.js";
|
|
4
|
+
async function main() {
|
|
5
|
+
const server = createSocialSealMcpServer();
|
|
6
|
+
const transport = new StdioServerTransport();
|
|
7
|
+
await server.connect(transport);
|
|
8
|
+
}
|
|
9
|
+
main().catch((error) => {
|
|
10
|
+
const message = error instanceof Error ? error.message : "Unknown SocialSeal MCP startup error.";
|
|
11
|
+
process.stderr.write(`[socialseal-mcp] ${message}\n`);
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAExD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,yBAAyB,EAAE,CAAC;IAC3C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,MAAM,OAAO,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,uCAAuC,CAAC;IACjG,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,oBAAoB,OAAO,IAAI,CAAC,CAAC;IACtD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { JsonValue } from "./types.js";
|
|
2
|
+
export interface ToolRegistryEntry {
|
|
3
|
+
name: string;
|
|
4
|
+
category: string;
|
|
5
|
+
description: string;
|
|
6
|
+
workspaceScoped: boolean;
|
|
7
|
+
notes?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ToolSchemaHint {
|
|
10
|
+
summary: string;
|
|
11
|
+
operations: Array<{
|
|
12
|
+
action: string;
|
|
13
|
+
required: string[];
|
|
14
|
+
optional: string[];
|
|
15
|
+
example: JsonValue;
|
|
16
|
+
}>;
|
|
17
|
+
cliExamples: string[];
|
|
18
|
+
}
|
|
19
|
+
export declare const TOOL_REGISTRY: ToolRegistryEntry[];
|
|
20
|
+
export declare const TOOL_SCHEMA_HINTS: Record<string, ToolSchemaHint>;
|
|
21
|
+
export declare function getToolEntry(toolName: string): ToolRegistryEntry | null;
|
|
22
|
+
export declare function listTools(category?: string): ToolRegistryEntry[];
|
|
23
|
+
export declare function getToolSchema(toolName: string): ToolSchemaHint | null;
|
|
24
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,KAAK,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,QAAQ,EAAE,MAAM,EAAE,CAAC;QACnB,OAAO,EAAE,SAAS,CAAC;KACpB,CAAC,CAAC;IACH,WAAW,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,EAAE,iBAAiB,EAqG5C,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CA6F5D,CAAC;AAIF,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,iBAAiB,GAAG,IAAI,CAEvE;AAED,wBAAgB,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAIhE;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAErE"}
|