@goplausible/algorand-mcp 4.1.1 → 4.2.1
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.
|
@@ -22,18 +22,19 @@ export declare class Arc26Manager {
|
|
|
22
22
|
qrCodePng: string;
|
|
23
23
|
qrCodeUtf8: string;
|
|
24
24
|
}>;
|
|
25
|
+
/**
|
|
26
|
+
* Constructs an Algorand URI according to ARC-26 specification and generates a QR code
|
|
27
|
+
* @param params The parameters for constructing the URI
|
|
28
|
+
* @returns Object containing the URI and QR code as base64 data URL
|
|
29
|
+
*/
|
|
30
|
+
generateUri(params: Arc26ToolInput): Promise<{
|
|
31
|
+
uri: string;
|
|
32
|
+
}>;
|
|
25
33
|
handleTool(name: string, args: Record<string, unknown>): Promise<{
|
|
26
|
-
content:
|
|
34
|
+
content: {
|
|
27
35
|
type: string;
|
|
28
36
|
text: string;
|
|
29
|
-
|
|
30
|
-
mimeType?: undefined;
|
|
31
|
-
} | {
|
|
32
|
-
type: string;
|
|
33
|
-
data: string;
|
|
34
|
-
mimeType: string;
|
|
35
|
-
text?: undefined;
|
|
36
|
-
})[];
|
|
37
|
+
}[];
|
|
37
38
|
}>;
|
|
38
39
|
}
|
|
39
40
|
export declare const arc26Manager: Arc26Manager;
|
|
@@ -114,6 +114,52 @@ export class Arc26Manager {
|
|
|
114
114
|
qrCodeUtf8: qrCodeUtf8
|
|
115
115
|
};
|
|
116
116
|
}
|
|
117
|
+
/**
|
|
118
|
+
* Constructs an Algorand URI according to ARC-26 specification and generates a QR code
|
|
119
|
+
* @param params The parameters for constructing the URI
|
|
120
|
+
* @returns Object containing the URI and QR code as base64 data URL
|
|
121
|
+
*/
|
|
122
|
+
async generateUri(params) {
|
|
123
|
+
// Validate address format (base32 string)
|
|
124
|
+
if (!params.address || !/^[A-Z2-7]{58}$/.test(params.address)) {
|
|
125
|
+
throw new McpError(ErrorCode.InvalidParams, 'Invalid Algorand address format');
|
|
126
|
+
}
|
|
127
|
+
// Start building the URI with the scheme and address
|
|
128
|
+
let uri = `algorand://${params.address}`;
|
|
129
|
+
// Build query parameters
|
|
130
|
+
const queryParams = [];
|
|
131
|
+
// Add optional parameters if provided
|
|
132
|
+
if (params.label) {
|
|
133
|
+
queryParams.push(`label=${encodeURIComponent(params.label)}`);
|
|
134
|
+
}
|
|
135
|
+
if (typeof params.amount === 'number') {
|
|
136
|
+
if (params.amount < 0) {
|
|
137
|
+
throw new McpError(ErrorCode.InvalidParams, 'Amount must be non-negative');
|
|
138
|
+
}
|
|
139
|
+
// Convert to microAlgos and ensure no decimals
|
|
140
|
+
const microAlgos = Math.floor(params.amount);
|
|
141
|
+
queryParams.push(`amount=${microAlgos}`);
|
|
142
|
+
}
|
|
143
|
+
if (typeof params.asset === 'number') {
|
|
144
|
+
if (params.asset < 0) {
|
|
145
|
+
throw new McpError(ErrorCode.InvalidParams, 'Asset ID must be non-negative');
|
|
146
|
+
}
|
|
147
|
+
queryParams.push(`asset=${params.asset}`);
|
|
148
|
+
}
|
|
149
|
+
if (params.note) {
|
|
150
|
+
queryParams.push(`note=${encodeURIComponent(params.note)}`);
|
|
151
|
+
}
|
|
152
|
+
if (params.xnote) {
|
|
153
|
+
queryParams.push(`xnote=${encodeURIComponent(params.xnote)}`);
|
|
154
|
+
}
|
|
155
|
+
// Add query parameters to URI if any exist
|
|
156
|
+
if (queryParams.length > 0) {
|
|
157
|
+
uri += '?' + queryParams.join('&');
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
uri,
|
|
161
|
+
};
|
|
162
|
+
}
|
|
117
163
|
async handleTool(name, args) {
|
|
118
164
|
// Cast args to Arc26ToolInput after validation
|
|
119
165
|
const toolArgs = {
|
|
@@ -125,13 +171,32 @@ export class Arc26Manager {
|
|
|
125
171
|
xnote: args.xnote
|
|
126
172
|
};
|
|
127
173
|
if (name === 'generate_algorand_qrcode') {
|
|
128
|
-
const { uri, qrCodePng, qrCodeUtf8 } = await this.generateUriAndQr(toolArgs);
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
174
|
+
// const { uri, qrCodePng, qrCodeUtf8 } = await this.generateUriAndQr(toolArgs);
|
|
175
|
+
const { uri } = await this.generateUri(toolArgs);
|
|
176
|
+
// return {
|
|
177
|
+
// content: [
|
|
178
|
+
// { type: "text", text: qrCodeUtf8 + "\n\n```\n" + uri + "\n```" },
|
|
179
|
+
// { type: "image", data: qrCodePng.replace(/^data:image\/png;base64,/, ''), mimeType: "image/png" }
|
|
180
|
+
// ]
|
|
181
|
+
// };
|
|
182
|
+
try {
|
|
183
|
+
const qrclawUrl = `https://qrclaw.goplausible.xyz/?q=${encodeURIComponent(uri)}`;
|
|
184
|
+
const response = await fetch(qrclawUrl, {
|
|
185
|
+
method: 'GET',
|
|
186
|
+
headers: { 'Accept': 'application/json' }
|
|
187
|
+
});
|
|
188
|
+
if (response.ok) {
|
|
189
|
+
const data = await response.json();
|
|
190
|
+
return {
|
|
191
|
+
content: [
|
|
192
|
+
{ type: "text", text: data.qr + "\n\n```\n" + uri + "\n```\n\nLink: " + data.link + "\nExpires in: " + data.expires_in }
|
|
193
|
+
]
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
throw new McpError(ErrorCode.InternalError, `QR Tool Error: ${error instanceof Error ? error.message : String(error)}`);
|
|
199
|
+
}
|
|
135
200
|
}
|
|
136
201
|
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
137
202
|
}
|
|
@@ -86,7 +86,7 @@ export class UtilityManager {
|
|
|
86
86
|
type: 'text',
|
|
87
87
|
text: JSON.stringify({
|
|
88
88
|
name: 'Algorand MCP Server',
|
|
89
|
-
version: '4.
|
|
89
|
+
version: '4.2.1',
|
|
90
90
|
builder: 'GoPlausible',
|
|
91
91
|
description: 'A Model Context Protocol (MCP) server providing comprehensive access to the Algorand blockchain. Supports account management, transaction building and signing, smart contract interaction, asset operations, ARC-26 URI generation, and deep integration with Algorand ecosystem services including NFDomains, Tinyman, Vestige, and Ultrade.',
|
|
92
92
|
blockchain: 'Algorand — a carbon-negative, pure proof-of-stake Layer 1 blockchain delivering instant finality, low fees, and advanced smart contract capabilities via AVM (Algorand Virtual Machine).',
|