@1ly/mcp-server 0.1.2 → 0.1.4
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 +112 -2
- package/dist/budget.d.ts.map +1 -1
- package/dist/budget.js +19 -1
- package/dist/budget.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +78 -15
- package/dist/config.js.map +1 -1
- package/dist/http.d.ts +2 -0
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +27 -1
- package/dist/http.js.map +1 -1
- package/dist/index.js +21 -1
- package/dist/index.js.map +1 -1
- package/dist/rate-limit.d.ts +24 -0
- package/dist/rate-limit.d.ts.map +1 -0
- package/dist/rate-limit.js +50 -0
- package/dist/rate-limit.js.map +1 -0
- package/dist/security-log.d.ts +55 -0
- package/dist/security-log.d.ts.map +1 -0
- package/dist/security-log.js +52 -0
- package/dist/security-log.js.map +1 -0
- package/dist/tools/create-link.d.ts +4 -0
- package/dist/tools/create-link.d.ts.map +1 -1
- package/dist/tools/create-link.js +3 -0
- package/dist/tools/create-link.js.map +1 -1
- package/dist/tools/list-withdrawals.d.ts +26 -0
- package/dist/tools/list-withdrawals.d.ts.map +1 -0
- package/dist/tools/list-withdrawals.js +43 -0
- package/dist/tools/list-withdrawals.js.map +1 -0
- package/dist/tools/update-avatar.d.ts +34 -0
- package/dist/tools/update-avatar.d.ts.map +1 -0
- package/dist/tools/update-avatar.js +89 -0
- package/dist/tools/update-avatar.js.map +1 -0
- package/dist/tools/update-link.d.ts +3 -0
- package/dist/tools/update-link.d.ts.map +1 -1
- package/dist/tools/update-link.js +3 -0
- package/dist/tools/update-link.js.map +1 -1
- package/dist/tools/update-profile.d.ts +30 -0
- package/dist/tools/update-profile.d.ts.map +1 -0
- package/dist/tools/update-profile.js +42 -0
- package/dist/tools/update-profile.js.map +1 -0
- package/dist/tools/update-socials.d.ts +41 -0
- package/dist/tools/update-socials.d.ts.map +1 -0
- package/dist/tools/update-socials.js +85 -0
- package/dist/tools/update-socials.js.map +1 -0
- package/dist/tools/withdraw.d.ts +27 -0
- package/dist/tools/withdraw.d.ts.map +1 -0
- package/dist/tools/withdraw.js +45 -0
- package/dist/tools/withdraw.js.map +1 -0
- package/dist/wallet/evm.d.ts.map +1 -1
- package/dist/wallet/evm.js +35 -0
- package/dist/wallet/evm.js.map +1 -1
- package/dist/wallet/solana.d.ts.map +1 -1
- package/dist/wallet/solana.js +32 -0
- package/dist/wallet/solana.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Security Event Audit Logging
|
|
3
|
+
*
|
|
4
|
+
* Provides structured logging for security-relevant events to support:
|
|
5
|
+
* - Compliance auditing (SOC 2, ISO 27001)
|
|
6
|
+
* - Security monitoring and alerting
|
|
7
|
+
* - Incident response and forensics
|
|
8
|
+
* - Operational analytics
|
|
9
|
+
*
|
|
10
|
+
* Implementation Notes:
|
|
11
|
+
* - Logs to stderr (stdout reserved for MCP protocol communication)
|
|
12
|
+
* - JSON format for machine readability and SIEM integration
|
|
13
|
+
* - ISO 8601 timestamps for log aggregation
|
|
14
|
+
* - Non-blocking operation
|
|
15
|
+
*
|
|
16
|
+
* @module security-log
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Security event types categorized by domain
|
|
20
|
+
*/
|
|
21
|
+
export type SecurityEventType = "budget_exceeded" | "rate_limit_exceeded" | "wallet_path_violation" | "api_base_violation" | "invalid_budget_config" | "large_upload_blocked" | "api_call_paid" | "store_created" | "withdrawal_requested";
|
|
22
|
+
/**
|
|
23
|
+
* Structured security event log entry
|
|
24
|
+
*/
|
|
25
|
+
export interface SecurityEvent {
|
|
26
|
+
/** ISO 8601 timestamp */
|
|
27
|
+
timestamp: string;
|
|
28
|
+
/** Event type identifier */
|
|
29
|
+
event: SecurityEventType;
|
|
30
|
+
/** Event-specific contextual data */
|
|
31
|
+
details: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Log a security-relevant event for audit trail
|
|
35
|
+
*
|
|
36
|
+
* Events are written to stderr in JSON format for:
|
|
37
|
+
* - Log aggregation systems (Datadog, Splunk, ELK)
|
|
38
|
+
* - SIEM platforms
|
|
39
|
+
* - Compliance reporting
|
|
40
|
+
*
|
|
41
|
+
* @param event - Event type identifier
|
|
42
|
+
* @param details - Event-specific contextual information
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```typescript
|
|
46
|
+
* logSecurityEvent("budget_exceeded", {
|
|
47
|
+
* type: "daily",
|
|
48
|
+
* currentSpent: 48.50,
|
|
49
|
+
* limit: 50.00,
|
|
50
|
+
* attemptedAmount: 2.00
|
|
51
|
+
* });
|
|
52
|
+
* ```
|
|
53
|
+
*/
|
|
54
|
+
export declare function logSecurityEvent(event: SecurityEventType, details?: Record<string, unknown>): void;
|
|
55
|
+
//# sourceMappingURL=security-log.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-log.d.ts","sourceRoot":"","sources":["../src/security-log.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAEzB,iBAAiB,GACjB,qBAAqB,GAErB,uBAAuB,GACvB,oBAAoB,GACpB,uBAAuB,GAEvB,sBAAsB,GAEtB,eAAe,GACf,eAAe,GACf,sBAAsB,CAAC;AAE3B;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,4BAA4B;IAC5B,KAAK,EAAE,iBAAiB,CAAC;IACzB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,iBAAiB,EACxB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACpC,IAAI,CAUN"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Security Event Audit Logging
|
|
4
|
+
*
|
|
5
|
+
* Provides structured logging for security-relevant events to support:
|
|
6
|
+
* - Compliance auditing (SOC 2, ISO 27001)
|
|
7
|
+
* - Security monitoring and alerting
|
|
8
|
+
* - Incident response and forensics
|
|
9
|
+
* - Operational analytics
|
|
10
|
+
*
|
|
11
|
+
* Implementation Notes:
|
|
12
|
+
* - Logs to stderr (stdout reserved for MCP protocol communication)
|
|
13
|
+
* - JSON format for machine readability and SIEM integration
|
|
14
|
+
* - ISO 8601 timestamps for log aggregation
|
|
15
|
+
* - Non-blocking operation
|
|
16
|
+
*
|
|
17
|
+
* @module security-log
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.logSecurityEvent = logSecurityEvent;
|
|
21
|
+
/**
|
|
22
|
+
* Log a security-relevant event for audit trail
|
|
23
|
+
*
|
|
24
|
+
* Events are written to stderr in JSON format for:
|
|
25
|
+
* - Log aggregation systems (Datadog, Splunk, ELK)
|
|
26
|
+
* - SIEM platforms
|
|
27
|
+
* - Compliance reporting
|
|
28
|
+
*
|
|
29
|
+
* @param event - Event type identifier
|
|
30
|
+
* @param details - Event-specific contextual information
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```typescript
|
|
34
|
+
* logSecurityEvent("budget_exceeded", {
|
|
35
|
+
* type: "daily",
|
|
36
|
+
* currentSpent: 48.50,
|
|
37
|
+
* limit: 50.00,
|
|
38
|
+
* attemptedAmount: 2.00
|
|
39
|
+
* });
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function logSecurityEvent(event, details = {}) {
|
|
43
|
+
const entry = {
|
|
44
|
+
timestamp: new Date().toISOString(),
|
|
45
|
+
event,
|
|
46
|
+
details,
|
|
47
|
+
};
|
|
48
|
+
// Write to stderr (stdout is MCP protocol channel)
|
|
49
|
+
// Using console.error for non-blocking write
|
|
50
|
+
console.error(JSON.stringify(entry));
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=security-log.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"security-log.js","sourceRoot":"","sources":["../src/security-log.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;GAgBG;;AAqDH,4CAaC;AAlCD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,SAAgB,gBAAgB,CAC9B,KAAwB,EACxB,UAAmC,EAAE;IAErC,MAAM,KAAK,GAAkB;QAC3B,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,KAAK;QACL,OAAO;KACR,CAAC;IAEF,mDAAmD;IACnD,6CAA6C;IAC7C,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC;AACvC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-link.d.ts","sourceRoot":"","sources":["../../src/tools/create-link.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"create-link.d.ts","sourceRoot":"","sources":["../../src/tools/create-link.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkB1B,CAAC;AAcF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;;;GA4BnE"}
|
|
@@ -19,6 +19,7 @@ exports.createLinkTool = {
|
|
|
19
19
|
currency: { type: "string", enum: ["USDC"] },
|
|
20
20
|
isPublic: { type: "boolean" },
|
|
21
21
|
isStealth: { type: "boolean" },
|
|
22
|
+
webhookUrl: { type: "string", description: "Optional webhook URL for purchase events" },
|
|
22
23
|
},
|
|
23
24
|
required: ["title", "url"],
|
|
24
25
|
},
|
|
@@ -32,6 +33,7 @@ const InputSchema = zod_1.z.object({
|
|
|
32
33
|
currency: zod_1.z.literal("USDC").optional(),
|
|
33
34
|
isPublic: zod_1.z.boolean().optional(),
|
|
34
35
|
isStealth: zod_1.z.boolean().optional(),
|
|
36
|
+
webhookUrl: zod_1.z.string().url().optional(),
|
|
35
37
|
});
|
|
36
38
|
async function handleCreateLink(args, config) {
|
|
37
39
|
const input = InputSchema.parse(args);
|
|
@@ -53,6 +55,7 @@ async function handleCreateLink(args, config) {
|
|
|
53
55
|
currency: input.currency || "USDC",
|
|
54
56
|
isPublic: input.isPublic ?? true,
|
|
55
57
|
isStealth: input.isStealth ?? false,
|
|
58
|
+
webhookUrl: input.webhookUrl,
|
|
56
59
|
}),
|
|
57
60
|
});
|
|
58
61
|
await (0, http_js_1.assertOk)(res, "Create link failed");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-link.js","sourceRoot":"","sources":["../../src/tools/create-link.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"create-link.js","sourceRoot":"","sources":["../../src/tools/create-link.ts"],"names":[],"mappings":";;;AAqCA,4CA4BC;AAjED,6BAAwB;AAExB,wCAAwD;AACxD,sCAAkC;AAErB,QAAA,cAAc,GAAG;IAC5B,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,wEAAwE;IACrF,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACzB,GAAG,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACvB,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YAC/B,IAAI,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;YACxB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KAAK,UAAU,gBAAgB,CAAC,IAAa,EAAE,MAAc;IAClE,MAAM,KAAK,GAAG,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC3D,CAAC;IAED,MAAM,GAAG,GAAG,MAAM,IAAA,0BAAgB,EAAC,GAAG,MAAM,CAAC,OAAO,eAAe,EAAE;QACnE,MAAM,EAAE,MAAM;QACd,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE;SACzC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACnB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,MAAM;YAClC,QAAQ,EAAE,KAAK,CAAC,QAAQ,IAAI,IAAI;YAChC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,KAAK;YACnC,UAAU,EAAE,KAAK,CAAC,UAAU;SAC7B,CAAC;KACH,CAAC,CAAC;IAEH,MAAM,IAAA,kBAAQ,EAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,OAAO,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { Config } from "../config.js";
|
|
2
|
+
export declare const listWithdrawalsTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
limit: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
cursor: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export declare function handleListWithdrawals(args: unknown, config: Config): Promise<{
|
|
20
|
+
isError?: true | undefined;
|
|
21
|
+
content: {
|
|
22
|
+
type: "text";
|
|
23
|
+
text: string;
|
|
24
|
+
}[];
|
|
25
|
+
}>;
|
|
26
|
+
//# sourceMappingURL=list-withdrawals.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-withdrawals.d.ts","sourceRoot":"","sources":["../../src/tools/list-withdrawals.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;CAU/B,CAAC;AAOF,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;;;GAoBxE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listWithdrawalsTool = void 0;
|
|
4
|
+
exports.handleListWithdrawals = handleListWithdrawals;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const http_js_1 = require("../http.js");
|
|
7
|
+
const mcp_js_1 = require("../mcp.js");
|
|
8
|
+
exports.listWithdrawalsTool = {
|
|
9
|
+
name: "1ly_list_withdrawals",
|
|
10
|
+
description: "List withdrawal requests for your store (requires ONELY_API_KEY).",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
limit: { type: "number", description: "Max items (default 25, max 100)" },
|
|
15
|
+
cursor: { type: "string", description: "Pagination cursor from previous response" },
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const InputSchema = zod_1.z.object({
|
|
20
|
+
limit: zod_1.z.number().min(1).max(100).optional(),
|
|
21
|
+
cursor: zod_1.z.string().optional(),
|
|
22
|
+
});
|
|
23
|
+
async function handleListWithdrawals(args, config) {
|
|
24
|
+
const input = InputSchema.parse(args);
|
|
25
|
+
if (!config.apiKey) {
|
|
26
|
+
throw new Error("Missing ONELY_API_KEY for listing withdrawals");
|
|
27
|
+
}
|
|
28
|
+
const url = new URL(`${config.apiBase}/api/v1/withdrawals`);
|
|
29
|
+
if (input.limit)
|
|
30
|
+
url.searchParams.set("limit", String(input.limit));
|
|
31
|
+
if (input.cursor)
|
|
32
|
+
url.searchParams.set("cursor", input.cursor);
|
|
33
|
+
const res = await (0, http_js_1.fetchWithTimeout)(url.toString(), {
|
|
34
|
+
method: "GET",
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
await (0, http_js_1.assertOk)(res, "List withdrawals failed");
|
|
40
|
+
const data = await res.json();
|
|
41
|
+
return (0, mcp_js_1.mcpOk)(data);
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=list-withdrawals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"list-withdrawals.js","sourceRoot":"","sources":["../../src/tools/list-withdrawals.ts"],"names":[],"mappings":";;;AAsBA,sDAoBC;AA1CD,6BAAwB;AAExB,wCAAwD;AACxD,sCAAkC;AAErB,QAAA,mBAAmB,GAAG;IACjC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EAAE,mEAAmE;IAChF,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,iCAAiC,EAAE;YACzE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE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;AACrB,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Config } from "../config.js";
|
|
2
|
+
export declare const updateAvatarTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
avatarUrl: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
imageBase64: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
mimeType: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
filename: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export declare function handleUpdateAvatar(args: unknown, config: Config): Promise<{
|
|
28
|
+
isError?: true | undefined;
|
|
29
|
+
content: {
|
|
30
|
+
type: "text";
|
|
31
|
+
text: string;
|
|
32
|
+
}[];
|
|
33
|
+
}>;
|
|
34
|
+
//# sourceMappingURL=update-avatar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-avatar.d.ts","sourceRoot":"","sources":["../../src/tools/update-avatar.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAY5B,CAAC;AAmBF,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;;;GA6DrE"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateAvatarTool = void 0;
|
|
4
|
+
exports.handleUpdateAvatar = handleUpdateAvatar;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const http_js_1 = require("../http.js");
|
|
7
|
+
const mcp_js_1 = require("../mcp.js");
|
|
8
|
+
exports.updateAvatarTool = {
|
|
9
|
+
name: "1ly_update_avatar",
|
|
10
|
+
description: "Update your store avatar image (requires ONELY_API_KEY).",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
avatarUrl: { type: "string", description: "Public image URL to use as avatar" },
|
|
15
|
+
imageBase64: { type: "string", description: "Base64-encoded image bytes" },
|
|
16
|
+
mimeType: { type: "string", description: "Image MIME type (image/png, image/jpeg, image/webp, image/gif)" },
|
|
17
|
+
filename: { type: "string", description: "Optional filename (default: avatar.png)" },
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
};
|
|
21
|
+
const InputSchema = zod_1.z.object({
|
|
22
|
+
avatarUrl: zod_1.z.string().url().optional(),
|
|
23
|
+
imageBase64: zod_1.z
|
|
24
|
+
.string()
|
|
25
|
+
.min(1)
|
|
26
|
+
.max(10_485_760) // 10MB max (base64 encoded ~= 1.37x original size)
|
|
27
|
+
.optional(),
|
|
28
|
+
mimeType: zod_1.z
|
|
29
|
+
.enum(["image/png", "image/jpeg", "image/jpg", "image/webp", "image/gif"]) // Strict MIME type validation
|
|
30
|
+
.optional(),
|
|
31
|
+
filename: zod_1.z
|
|
32
|
+
.string()
|
|
33
|
+
.regex(/^[a-zA-Z0-9_.-]+$/) // Prevent path traversal in filename
|
|
34
|
+
.max(255)
|
|
35
|
+
.optional(),
|
|
36
|
+
});
|
|
37
|
+
async function handleUpdateAvatar(args, config) {
|
|
38
|
+
const input = InputSchema.parse(args);
|
|
39
|
+
if (!config.apiKey) {
|
|
40
|
+
throw new Error("Missing ONELY_API_KEY for updating avatar");
|
|
41
|
+
}
|
|
42
|
+
if (input.avatarUrl) {
|
|
43
|
+
const res = await (0, http_js_1.fetchWithTimeout)(`${config.apiBase}/api/v1/avatar`, {
|
|
44
|
+
method: "POST",
|
|
45
|
+
headers: {
|
|
46
|
+
"Content-Type": "application/json",
|
|
47
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
48
|
+
},
|
|
49
|
+
body: JSON.stringify({ avatarUrl: input.avatarUrl }),
|
|
50
|
+
});
|
|
51
|
+
await (0, http_js_1.assertOk)(res, "Update avatar failed");
|
|
52
|
+
const data = await res.json();
|
|
53
|
+
return (0, mcp_js_1.mcpOk)(data);
|
|
54
|
+
}
|
|
55
|
+
if (!input.imageBase64 || !input.mimeType) {
|
|
56
|
+
throw new Error("Provide either avatarUrl or imageBase64 + mimeType");
|
|
57
|
+
}
|
|
58
|
+
// Decode and validate base64
|
|
59
|
+
let buffer;
|
|
60
|
+
try {
|
|
61
|
+
buffer = Buffer.from(input.imageBase64, "base64");
|
|
62
|
+
}
|
|
63
|
+
catch (err) {
|
|
64
|
+
throw new Error("Invalid base64 encoding");
|
|
65
|
+
}
|
|
66
|
+
// Validate decoded size (5MB max for actual image data)
|
|
67
|
+
const maxSize = 5 * 1024 * 1024; // 5MB
|
|
68
|
+
if (buffer.length > maxSize) {
|
|
69
|
+
throw new Error(`Image size ${(buffer.length / 1024 / 1024).toFixed(2)}MB exceeds 5MB limit`);
|
|
70
|
+
}
|
|
71
|
+
// Minimum size check (prevent empty uploads)
|
|
72
|
+
if (buffer.length < 100) {
|
|
73
|
+
throw new Error("Image too small - minimum 100 bytes");
|
|
74
|
+
}
|
|
75
|
+
const blob = new Blob([buffer], { type: input.mimeType });
|
|
76
|
+
const formData = new FormData();
|
|
77
|
+
formData.append("file", blob, input.filename || "avatar.png");
|
|
78
|
+
const res = await (0, http_js_1.fetchWithTimeout)(`${config.apiBase}/api/v1/avatar`, {
|
|
79
|
+
method: "POST",
|
|
80
|
+
headers: {
|
|
81
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
82
|
+
},
|
|
83
|
+
body: formData,
|
|
84
|
+
});
|
|
85
|
+
await (0, http_js_1.assertOk)(res, "Update avatar failed");
|
|
86
|
+
const data = await res.json();
|
|
87
|
+
return (0, mcp_js_1.mcpOk)(data);
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=update-avatar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-avatar.js","sourceRoot":"","sources":["../../src/tools/update-avatar.ts"],"names":[],"mappings":";;;AAoCA,gDA6DC;AAjGD,6BAAwB;AAExB,wCAAwD;AACxD,sCAAkC;AAErB,QAAA,gBAAgB,GAAG;IAC9B,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,0DAA0D;IACvE,WAAW,EAAE;QACX,IAAI,EAAE,QAAiB;QACvB,UAAU,EAAE;YACV,SAAS,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,mCAAmC,EAAE;YAC/E,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,4BAA4B,EAAE;YAC1E,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,gEAAgE,EAAE;YAC3G,QAAQ,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,yCAAyC,EAAE;SACrF;KACF;CACF,CAAC;AAEF,MAAM,WAAW,GAAG,OAAC,CAAC,MAAM,CAAC;IAC3B,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IACtC,WAAW,EAAE,OAAC;SACX,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,CAAC;SACN,GAAG,CAAC,UAAU,CAAC,CAAC,mDAAmD;SACnE,QAAQ,EAAE;IACb,QAAQ,EAAE,OAAC;SACR,IAAI,CAAC,CAAC,WAAW,EAAE,YAAY,EAAE,WAAW,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC,8BAA8B;SACxG,QAAQ,EAAE;IACb,QAAQ,EAAE,OAAC;SACR,MAAM,EAAE;SACR,KAAK,CAAC,mBAAmB,CAAC,CAAC,qCAAqC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E,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"update-link.d.ts","sourceRoot":"","sources":["../../src/tools/update-link.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkB1B,CAAC;AAcF,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;;;GA2BnE"}
|
|
@@ -19,6 +19,7 @@ exports.updateLinkTool = {
|
|
|
19
19
|
price: { type: "string" },
|
|
20
20
|
isPublic: { type: "boolean" },
|
|
21
21
|
isStealth: { type: "boolean" },
|
|
22
|
+
webhookUrl: { type: "string" },
|
|
22
23
|
},
|
|
23
24
|
required: ["id"],
|
|
24
25
|
},
|
|
@@ -32,6 +33,7 @@ const InputSchema = zod_1.z.object({
|
|
|
32
33
|
price: zod_1.z.string().regex(/^\d+(\.\d{1,18})?$/).optional(),
|
|
33
34
|
isPublic: zod_1.z.boolean().optional(),
|
|
34
35
|
isStealth: zod_1.z.boolean().optional(),
|
|
36
|
+
webhookUrl: zod_1.z.string().url().optional().nullable(),
|
|
35
37
|
});
|
|
36
38
|
async function handleUpdateLink(args, config) {
|
|
37
39
|
const input = InputSchema.parse(args);
|
|
@@ -52,6 +54,7 @@ async function handleUpdateLink(args, config) {
|
|
|
52
54
|
price: input.price,
|
|
53
55
|
isPublic: input.isPublic,
|
|
54
56
|
isStealth: input.isStealth,
|
|
57
|
+
webhookUrl: input.webhookUrl,
|
|
55
58
|
}),
|
|
56
59
|
});
|
|
57
60
|
await (0, http_js_1.assertOk)(res, "Update link failed");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-link.js","sourceRoot":"","sources":["../../src/tools/update-link.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"update-link.js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CAAC;KACH,CAAC,CAAC;IAEH,MAAM,IAAA,kBAAQ,EAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,OAAO,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Config } from "../config.js";
|
|
2
|
+
export declare const updateProfileTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
username: {
|
|
9
|
+
type: string;
|
|
10
|
+
description: string;
|
|
11
|
+
};
|
|
12
|
+
displayName: {
|
|
13
|
+
type: string;
|
|
14
|
+
description: string;
|
|
15
|
+
};
|
|
16
|
+
bio: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export declare function handleUpdateProfile(args: unknown, config: Config): Promise<{
|
|
24
|
+
isError?: true | undefined;
|
|
25
|
+
content: {
|
|
26
|
+
type: "text";
|
|
27
|
+
text: string;
|
|
28
|
+
}[];
|
|
29
|
+
}>;
|
|
30
|
+
//# sourceMappingURL=update-profile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-profile.d.ts","sourceRoot":"","sources":["../../src/tools/update-profile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;CAW7B,CAAC;AAQF,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;;;GAkBtE"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateProfileTool = void 0;
|
|
4
|
+
exports.handleUpdateProfile = handleUpdateProfile;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const http_js_1 = require("../http.js");
|
|
7
|
+
const mcp_js_1 = require("../mcp.js");
|
|
8
|
+
exports.updateProfileTool = {
|
|
9
|
+
name: "1ly_update_profile",
|
|
10
|
+
description: "Update basic store profile details (requires ONELY_API_KEY).",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
username: { type: "string", description: "New username (lowercase, underscores)" },
|
|
15
|
+
displayName: { type: "string", description: "Public display name" },
|
|
16
|
+
bio: { type: "string", description: "Short bio (max 160 chars)" },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
const InputSchema = zod_1.z.object({
|
|
21
|
+
username: zod_1.z.string().min(3).max(32).regex(/^[a-z0-9_]+$/).optional(),
|
|
22
|
+
displayName: zod_1.z.string().max(50).optional(),
|
|
23
|
+
bio: zod_1.z.string().max(160).optional(),
|
|
24
|
+
});
|
|
25
|
+
async function handleUpdateProfile(args, config) {
|
|
26
|
+
const input = InputSchema.parse(args);
|
|
27
|
+
if (!config.apiKey) {
|
|
28
|
+
throw new Error("Missing ONELY_API_KEY for updating profile");
|
|
29
|
+
}
|
|
30
|
+
const res = await (0, http_js_1.fetchWithTimeout)(`${config.apiBase}/api/v1/profile`, {
|
|
31
|
+
method: "PATCH",
|
|
32
|
+
headers: {
|
|
33
|
+
"Content-Type": "application/json",
|
|
34
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
35
|
+
},
|
|
36
|
+
body: JSON.stringify(input),
|
|
37
|
+
});
|
|
38
|
+
await (0, http_js_1.assertOk)(res, "Update profile failed");
|
|
39
|
+
const data = await res.json();
|
|
40
|
+
return (0, mcp_js_1.mcpOk)(data);
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=update-profile.js.map
|
|
@@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GAAG,MAAM,CAAC,OAAO,iBAAiB,EAAE;QACrE,MAAM,EAAE,OAAO;QACf,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,aAAa,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE;SACzC;QACD,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;KAC5B,CAAC,CAAC;IAEH,MAAM,IAAA,kBAAQ,EAAC,GAAG,EAAE,uBAAuB,CAAC,CAAC;IAC7C,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,OAAO,IAAA,cAAK,EAAC,IAAI,CAAC,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { Config } from "../config.js";
|
|
2
|
+
export declare const updateSocialsTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object";
|
|
7
|
+
properties: {
|
|
8
|
+
socials: {
|
|
9
|
+
type: string;
|
|
10
|
+
items: {
|
|
11
|
+
type: string;
|
|
12
|
+
properties: {
|
|
13
|
+
type: {
|
|
14
|
+
type: string;
|
|
15
|
+
enum: string[];
|
|
16
|
+
};
|
|
17
|
+
url: {
|
|
18
|
+
type: string;
|
|
19
|
+
};
|
|
20
|
+
displayOrder: {
|
|
21
|
+
type: string;
|
|
22
|
+
};
|
|
23
|
+
isVisible: {
|
|
24
|
+
type: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
required: string[];
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
required: string[];
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
export declare function handleUpdateSocials(args: unknown, config: Config): Promise<{
|
|
35
|
+
isError?: true | undefined;
|
|
36
|
+
content: {
|
|
37
|
+
type: "text";
|
|
38
|
+
text: string;
|
|
39
|
+
}[];
|
|
40
|
+
}>;
|
|
41
|
+
//# sourceMappingURL=update-socials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-socials.d.ts","sourceRoot":"","sources":["../../src/tools/update-socials.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAI3C,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqC7B,CAAC;AA2BF,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;;;;;;GAkBtE"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateSocialsTool = void 0;
|
|
4
|
+
exports.handleUpdateSocials = handleUpdateSocials;
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const http_js_1 = require("../http.js");
|
|
7
|
+
const mcp_js_1 = require("../mcp.js");
|
|
8
|
+
exports.updateSocialsTool = {
|
|
9
|
+
name: "1ly_update_socials",
|
|
10
|
+
description: "Update socials for your store (requires ONELY_API_KEY).",
|
|
11
|
+
inputSchema: {
|
|
12
|
+
type: "object",
|
|
13
|
+
properties: {
|
|
14
|
+
socials: {
|
|
15
|
+
type: "array",
|
|
16
|
+
items: {
|
|
17
|
+
type: "object",
|
|
18
|
+
properties: {
|
|
19
|
+
type: {
|
|
20
|
+
type: "string",
|
|
21
|
+
enum: [
|
|
22
|
+
"x",
|
|
23
|
+
"github",
|
|
24
|
+
"telegram",
|
|
25
|
+
"web3_bio",
|
|
26
|
+
"website",
|
|
27
|
+
"youtube",
|
|
28
|
+
"linkedin",
|
|
29
|
+
"discord",
|
|
30
|
+
"facebook",
|
|
31
|
+
"tiktok",
|
|
32
|
+
"instagram",
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
url: { type: "string" },
|
|
36
|
+
displayOrder: { type: "number" },
|
|
37
|
+
isVisible: { type: "boolean" },
|
|
38
|
+
},
|
|
39
|
+
required: ["type", "url"],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
required: ["socials"],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
const socialTypeEnum = zod_1.z.enum([
|
|
47
|
+
"x",
|
|
48
|
+
"github",
|
|
49
|
+
"telegram",
|
|
50
|
+
"web3_bio",
|
|
51
|
+
"website",
|
|
52
|
+
"youtube",
|
|
53
|
+
"linkedin",
|
|
54
|
+
"discord",
|
|
55
|
+
"facebook",
|
|
56
|
+
"tiktok",
|
|
57
|
+
"instagram",
|
|
58
|
+
]);
|
|
59
|
+
const socialSchema = zod_1.z.object({
|
|
60
|
+
type: socialTypeEnum,
|
|
61
|
+
url: zod_1.z.string().url(),
|
|
62
|
+
displayOrder: zod_1.z.number().min(0).max(50).optional(),
|
|
63
|
+
isVisible: zod_1.z.boolean().optional(),
|
|
64
|
+
});
|
|
65
|
+
const InputSchema = zod_1.z.object({
|
|
66
|
+
socials: zod_1.z.array(socialSchema).max(10),
|
|
67
|
+
});
|
|
68
|
+
async function handleUpdateSocials(args, config) {
|
|
69
|
+
const input = InputSchema.parse(args);
|
|
70
|
+
if (!config.apiKey) {
|
|
71
|
+
throw new Error("Missing ONELY_API_KEY for updating socials");
|
|
72
|
+
}
|
|
73
|
+
const res = await (0, http_js_1.fetchWithTimeout)(`${config.apiBase}/api/v1/socials`, {
|
|
74
|
+
method: "POST",
|
|
75
|
+
headers: {
|
|
76
|
+
"Content-Type": "application/json",
|
|
77
|
+
Authorization: `Bearer ${config.apiKey}`,
|
|
78
|
+
},
|
|
79
|
+
body: JSON.stringify({ socials: input.socials }),
|
|
80
|
+
});
|
|
81
|
+
await (0, http_js_1.assertOk)(res, "Update socials failed");
|
|
82
|
+
const data = await res.json();
|
|
83
|
+
return (0, mcp_js_1.mcpOk)(data);
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=update-socials.js.map
|