@tickernelz/paperclip-pro-mcp-server 2026.925.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,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Paperclip AI
4
+ Copyright (c) 2026 Zhafron Adani Kautsar (paperclip-pro fork modifications)
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in all
14
+ copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # Paperclip MCP Server
2
+
3
+ Model Context Protocol server for Paperclip.
4
+
5
+ This package is a thin MCP wrapper over the existing Paperclip REST API. It does
6
+ not talk to the database directly and it does not reimplement business logic.
7
+
8
+ ## Authentication
9
+
10
+ The server reads its configuration from environment variables:
11
+
12
+ - `PAPERCLIP_API_URL` - Paperclip base URL, for example `http://localhost:3100`
13
+ - `PAPERCLIP_API_KEY` - bearer token used for `/api` requests
14
+ - `PAPERCLIP_COMPANY_ID` - optional default company for company-scoped tools
15
+ - `PAPERCLIP_AGENT_ID` - optional default agent for checkout helpers
16
+ - `PAPERCLIP_RUN_ID` - optional run id forwarded on mutating requests
17
+
18
+ Inside an active heartbeat, Paperclip also injects `PAPERCLIP_RUNTIME_TOOLS_*` variables. They enable the run-scoped `connections_search` and `connection_request` tools and expire with the run.
19
+
20
+ ## Usage
21
+
22
+ ```sh
23
+ npx -y @tickernelz/paperclip-pro-mcp-server
24
+ ```
25
+
26
+ Or locally in this repo:
27
+
28
+ ```sh
29
+ pnpm --filter @tickernelz/paperclip-pro-mcp-server build
30
+ node packages/mcp-server/dist/stdio.js
31
+ ```
32
+
33
+ ## Tool Surface
34
+
35
+ Run-scoped connection tools:
36
+
37
+ - `connections_search`
38
+ - `connection_request`
39
+
40
+ Read tools:
41
+
42
+ - `paperclipMe`
43
+ - `paperclipInboxLite`
44
+ - `paperclipListAgents`
45
+ - `paperclipGetAgent`
46
+ - `paperclipListIssues`
47
+ - `paperclipGetIssue`
48
+ - `paperclipGetHeartbeatContext`
49
+ - `paperclipListComments`
50
+ - `paperclipGetComment`
51
+ - `paperclipListIssueApprovals`
52
+ - `paperclipListDocuments`
53
+ - `paperclipGetDocument`
54
+ - `paperclipListDocumentRevisions`
55
+ - `paperclipListProjects`
56
+ - `paperclipGetProject`
57
+ - `paperclipGetIssueWorkspaceRuntime`
58
+ - `paperclipWaitForIssueWorkspaceService`
59
+ - `paperclipListGoals`
60
+ - `paperclipGetGoal`
61
+ - `paperclipListApprovals`
62
+ - `paperclipGetApproval`
63
+ - `paperclipGetApprovalIssues`
64
+ - `paperclipListApprovalComments`
65
+
66
+ Write tools:
67
+
68
+ - `paperclipCreateIssue`
69
+ - `paperclipUpdateIssue`
70
+ - `paperclipCheckoutIssue`
71
+ - `paperclipReleaseIssue`
72
+ - `paperclipAddComment`
73
+ - `paperclipSuggestTasks`
74
+ - `paperclipAskUserQuestions`
75
+ - `paperclipRequestConfirmation`
76
+ - `paperclipUpsertIssueDocument`
77
+ - `paperclipRestoreIssueDocumentRevision`
78
+ - `paperclipControlIssueWorkspaceServices`
79
+ - `paperclipCreateApproval`
80
+ - `paperclipLinkIssueApproval`
81
+ - `paperclipUnlinkIssueApproval`
82
+ - `paperclipApprovalDecision`
83
+ - `paperclipAddApprovalComment`
84
+
85
+ Escape hatch:
86
+
87
+ - `paperclipApiRequest`
88
+
89
+ `paperclipApiRequest` is limited to paths under `/api` and JSON bodies. It is
90
+ meant for endpoints that do not yet have a dedicated MCP tool.
@@ -0,0 +1,31 @@
1
+ import type { PaperclipMcpConfig } from "./config.js";
2
+ export declare class PaperclipApiError extends Error {
3
+ readonly status: number;
4
+ readonly method: string;
5
+ readonly path: string;
6
+ readonly body: unknown;
7
+ constructor(input: {
8
+ status: number;
9
+ method: string;
10
+ path: string;
11
+ body: unknown;
12
+ message: string;
13
+ });
14
+ }
15
+ export interface JsonRequestOptions {
16
+ body?: unknown;
17
+ includeRunId?: boolean;
18
+ }
19
+ export declare class PaperclipApiClient {
20
+ private readonly config;
21
+ constructor(config: PaperclipMcpConfig);
22
+ get defaults(): {
23
+ companyId: string | null;
24
+ agentId: string | null;
25
+ runId: string | null;
26
+ };
27
+ resolveCompanyId(companyId?: string | null): string;
28
+ resolveAgentId(agentId?: string | null): string;
29
+ requestJson<T>(method: string, path: string, options?: JsonRequestOptions): Promise<T>;
30
+ }
31
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEtD,qBAAa,iBAAkB,SAAQ,KAAK;IAC1C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IAEvB,YAAY,KAAK,EAAE;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,OAAO,CAAC;QACd,OAAO,EAAE,MAAM,CAAC;KACjB,EAOA;CACF;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAuBD,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAAnC,YAA6B,MAAM,EAAE,kBAAkB,EAAI;IAE3D,IAAI,QAAQ;QAER,SAAS;QACT,OAAO;QACP,KAAK;MAER;IAED,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAMlD;IAED,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAM9C;IAEK,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,kBAAuB,GAAG,OAAO,CAAC,CAAC,CAAC,CAmC/F;CACF"}
package/dist/client.js ADDED
@@ -0,0 +1,94 @@
1
+ export class PaperclipApiError extends Error {
2
+ status;
3
+ method;
4
+ path;
5
+ body;
6
+ constructor(input) {
7
+ super(input.message);
8
+ this.name = "PaperclipApiError";
9
+ this.status = input.status;
10
+ this.method = input.method;
11
+ this.path = input.path;
12
+ this.body = input.body;
13
+ }
14
+ }
15
+ function isWriteMethod(method) {
16
+ return !["GET", "HEAD"].includes(method.toUpperCase());
17
+ }
18
+ function buildErrorMessage(method, path, status, body) {
19
+ if (body && typeof body === "object" && "error" in body && typeof body.error === "string") {
20
+ return `${method} ${path} failed with ${status}: ${body.error}`;
21
+ }
22
+ return `${method} ${path} failed with ${status}`;
23
+ }
24
+ async function parseResponseBody(response) {
25
+ const text = await response.text();
26
+ if (!text)
27
+ return null;
28
+ try {
29
+ return JSON.parse(text);
30
+ }
31
+ catch {
32
+ return text;
33
+ }
34
+ }
35
+ export class PaperclipApiClient {
36
+ config;
37
+ constructor(config) {
38
+ this.config = config;
39
+ }
40
+ get defaults() {
41
+ return {
42
+ companyId: this.config.companyId,
43
+ agentId: this.config.agentId,
44
+ runId: this.config.runId,
45
+ };
46
+ }
47
+ resolveCompanyId(companyId) {
48
+ const resolved = companyId?.trim() || this.config.companyId;
49
+ if (!resolved) {
50
+ throw new Error("companyId is required because PAPERCLIP_COMPANY_ID is not set");
51
+ }
52
+ return resolved;
53
+ }
54
+ resolveAgentId(agentId) {
55
+ const resolved = agentId?.trim() || this.config.agentId;
56
+ if (!resolved) {
57
+ throw new Error("agentId is required because PAPERCLIP_AGENT_ID is not set");
58
+ }
59
+ return resolved;
60
+ }
61
+ async requestJson(method, path, options = {}) {
62
+ if (!path.startsWith("/")) {
63
+ throw new Error(`API path must start with "/": ${path}`);
64
+ }
65
+ const url = new URL(path.slice(1), `${this.config.apiUrl}/`);
66
+ const headers = {
67
+ Authorization: `Bearer ${this.config.apiKey}`,
68
+ Accept: "application/json",
69
+ };
70
+ if (options.body !== undefined) {
71
+ headers["Content-Type"] = "application/json";
72
+ }
73
+ if ((options.includeRunId ?? isWriteMethod(method)) && this.config.runId) {
74
+ headers["X-Paperclip-Run-Id"] = this.config.runId;
75
+ }
76
+ const response = await fetch(url, {
77
+ method,
78
+ headers,
79
+ body: options.body === undefined ? undefined : JSON.stringify(options.body),
80
+ });
81
+ const parsedBody = await parseResponseBody(response);
82
+ if (!response.ok) {
83
+ throw new PaperclipApiError({
84
+ status: response.status,
85
+ method: method.toUpperCase(),
86
+ path,
87
+ body: parsedBody,
88
+ message: buildErrorMessage(method.toUpperCase(), path, response.status, parsedBody),
89
+ });
90
+ }
91
+ return parsedBody;
92
+ }
93
+ }
94
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.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AAE,UAAU,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;YAC7C,MAAM,EAAE,kBAAkB;SAC3B,CAAC;QACF,IAAI,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;YAC/B,OAAO,CAAC,cAAc,CAAC,GAAG,kBAAkB,CAAC;QAC/C,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,YAAY,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzE,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;QACpD,CAAC;QAED,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM;YACN,OAAO;YACP,IAAI,EAAE,OAAO,CAAC,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC;SAC5E,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;QAErD,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,iBAAiB,CAAC;gBAC1B,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,MAAM,EAAE,MAAM,CAAC,WAAW,EAAE;gBAC5B,IAAI;gBACJ,IAAI,EAAE,UAAU;gBAChB,OAAO,EAAE,iBAAiB,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC;aACpF,CAAC,CAAC;QACL,CAAC;QAED,OAAO,UAAe,CAAC;IACzB,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export interface PaperclipMcpConfig {
2
+ apiUrl: string;
3
+ apiKey: string;
4
+ companyId: string | null;
5
+ agentId: string | null;
6
+ runId: string | null;
7
+ }
8
+ export declare function normalizeApiUrl(apiUrl: string): string;
9
+ export declare function readConfigFromEnv(env?: NodeJS.ProcessEnv): PaperclipMcpConfig;
10
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;CACtB;AAUD,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAGtD;AAED,wBAAgB,iBAAiB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,kBAAkB,CAiB1F"}
package/dist/config.js ADDED
@@ -0,0 +1,28 @@
1
+ function nonEmpty(value) {
2
+ return typeof value === "string" && value.trim().length > 0 ? value.trim() : null;
3
+ }
4
+ function stripTrailingSlash(value) {
5
+ return value.replace(/\/+$/, "");
6
+ }
7
+ export function normalizeApiUrl(apiUrl) {
8
+ const trimmed = stripTrailingSlash(apiUrl.trim());
9
+ return trimmed.endsWith("/api") ? trimmed : `${trimmed}/api`;
10
+ }
11
+ export function readConfigFromEnv(env = process.env) {
12
+ const apiUrl = nonEmpty(env.PAPERCLIP_API_URL);
13
+ if (!apiUrl) {
14
+ throw new Error("Missing PAPERCLIP_API_URL");
15
+ }
16
+ const apiKey = nonEmpty(env.PAPERCLIP_API_KEY);
17
+ if (!apiKey) {
18
+ throw new Error("Missing PAPERCLIP_API_KEY");
19
+ }
20
+ return {
21
+ apiUrl: normalizeApiUrl(apiUrl),
22
+ apiKey,
23
+ companyId: nonEmpty(env.PAPERCLIP_COMPANY_ID),
24
+ agentId: nonEmpty(env.PAPERCLIP_AGENT_ID),
25
+ runId: nonEmpty(env.PAPERCLIP_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Q,CAAC,GAAG,CAAC,kBAAkB,CAAC;QACzC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC,gBAAgB,CAAC;KACtC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,10 @@
1
+ type McpTextResponse = {
2
+ content: Array<{
3
+ type: "text";
4
+ text: string;
5
+ }>;
6
+ };
7
+ export declare function formatTextResponse(value: unknown): McpTextResponse;
8
+ export declare function formatErrorResponse(error: unknown): McpTextResponse;
9
+ export {};
10
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAEA,KAAK,eAAe,GAAG;IACrB,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChD,CAAC;AAEF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CASlE;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,eAAe,CAanE"}
package/dist/format.js ADDED
@@ -0,0 +1,26 @@
1
+ import { PaperclipApiError } from "./client.js";
2
+ export function formatTextResponse(value) {
3
+ return {
4
+ content: [
5
+ {
6
+ type: "text",
7
+ text: typeof value === "string" ? value : JSON.stringify(value, null, 2),
8
+ },
9
+ ],
10
+ };
11
+ }
12
+ export function formatErrorResponse(error) {
13
+ if (error instanceof PaperclipApiError) {
14
+ return formatTextResponse({
15
+ error: error.message,
16
+ status: error.status,
17
+ method: error.method,
18
+ path: error.path,
19
+ body: error.body,
20
+ });
21
+ }
22
+ return formatTextResponse({
23
+ error: error instanceof Error ? error.message : String(error),
24
+ });
25
+ }
26
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAMhD,MAAM,UAAU,kBAAkB,CAAC,KAAc;IAC/C,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;aACzE;SACF;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,IAAI,KAAK,YAAY,iBAAiB,EAAE,CAAC;QACvC,OAAO,kBAAkB,CAAC;YACxB,KAAK,EAAE,KAAK,CAAC,OAAO;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IACD,OAAO,kBAAkB,CAAC;QACxB,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;KAC9D,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { PaperclipApiClient } from "./client.js";
3
+ import { type PaperclipMcpConfig } from "./config.js";
4
+ export declare function createPaperclipMcpServer(config?: PaperclipMcpConfig): {
5
+ server: McpServer;
6
+ tools: import("./tools.js").ToolDefinition[];
7
+ client: PaperclipApiClient;
8
+ };
9
+ export declare function runServer(config?: PaperclipMcpConfig): Promise<void>;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAEpE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAqB,KAAK,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGzE,wBAAgB,wBAAwB,CAAC,MAAM,GAAE,kBAAwC;;;;EAiBxF;AAED,wBAAsB,SAAS,CAAC,MAAM,GAAE,kBAAwC,iBAI/E"}
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
3
+ import { PaperclipApiClient } from "./client.js";
4
+ import { readConfigFromEnv } from "./config.js";
5
+ import { createToolDefinitions } from "./tools.js";
6
+ export function createPaperclipMcpServer(config = readConfigFromEnv()) {
7
+ const server = new McpServer({
8
+ name: "paperclip",
9
+ version: "0.1.0",
10
+ });
11
+ const client = new PaperclipApiClient(config);
12
+ const tools = createToolDefinitions(client);
13
+ for (const tool of tools) {
14
+ server.tool(tool.name, tool.description, tool.schema.shape, tool.execute);
15
+ }
16
+ return {
17
+ server,
18
+ tools,
19
+ client,
20
+ };
21
+ }
22
+ export async function runServer(config = readConfigFromEnv()) {
23
+ const { server } = createPaperclipMcpServer(config);
24
+ const transport = new StdioServerTransport();
25
+ await server.connect(transport);
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,aAAa,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEnD,MAAM,UAAU,wBAAwB,CAAC,MAAM,GAAuB,iBAAiB,EAAE;IACvF,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,qBAAqB,CAAC,MAAM,CAAC,CAAC;IAC5C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5E,CAAC;IAED,OAAO;QACL,MAAM;QACN,KAAK;QACL,MAAM;KACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,MAAM,GAAuB,iBAAiB,EAAE;IAC9E,MAAM,EAAE,MAAM,EAAE,GAAG,wBAAwB,CAAC,MAAM,CAAC,CAAC;IACpD,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=stdio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.d.ts","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":""}
package/dist/stdio.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runServer } from "./index.js";
3
+ void runServer().catch((error) => {
4
+ console.error("Failed to start Paperclip MCP server:", error);
5
+ process.exit(1);
6
+ });
7
+ //# sourceMappingURL=stdio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stdio.js","sourceRoot":"","sources":["../src/stdio.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEvC,KAAK,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC/B,OAAO,CAAC,KAAK,CAAC,uCAAuC,EAAE,KAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { z } from "zod";
2
+ import { PaperclipApiClient } from "./client.js";
3
+ export interface ToolDefinition {
4
+ name: string;
5
+ description: string;
6
+ schema: z.ZodObject;
7
+ execute: (input: Record<string, unknown>) => Promise<{
8
+ content: Array<{
9
+ type: "text";
10
+ text: string;
11
+ }>;
12
+ }>;
13
+ }
14
+ export declare function createToolDefinitions(client: PaperclipApiClient): ToolDefinition[];
15
+ //# sourceMappingURL=tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAmBxB,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,CAAC,CAAC,SAAS,CAAC;IACpB,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,OAAO,CAAC;QACnD,OAAO,EAAE,KAAK,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KAChD,CAAC,CAAC;CACJ;AAgPD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,kBAAkB,GAAG,cAAc,EAAE,CAqalF"}