@goplausible/algorand-mcp 4.1.0 → 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.
@@ -38,7 +38,7 @@ export declare const apiManager: ({
38
38
  src: string;
39
39
  mimeType?: string | undefined;
40
40
  sizes?: string[] | undefined;
41
- theme?: "light" | "dark" | undefined;
41
+ theme?: "dark" | "light" | undefined;
42
42
  }[] | undefined;
43
43
  title?: string | undefined;
44
44
  })[];
@@ -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
- data?: undefined;
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;
@@ -101,7 +101,11 @@ export class Arc26Manager {
101
101
  const qrCodePng = await QRCode.toDataURL(uri, {
102
102
  type: 'image/png',
103
103
  errorCorrectionLevel: 'H',
104
- // margin: 1,
104
+ color: {
105
+ dark: '#000000',
106
+ light: '#FFFFFF'
107
+ },
108
+ margin: 4,
105
109
  width: 128
106
110
  });
107
111
  return {
@@ -110,6 +114,52 @@ export class Arc26Manager {
110
114
  qrCodeUtf8: qrCodeUtf8
111
115
  };
112
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
+ }
113
163
  async handleTool(name, args) {
114
164
  // Cast args to Arc26ToolInput after validation
115
165
  const toolArgs = {
@@ -121,13 +171,32 @@ export class Arc26Manager {
121
171
  xnote: args.xnote
122
172
  };
123
173
  if (name === 'generate_algorand_qrcode') {
124
- const { uri, qrCodePng, qrCodeUtf8 } = await this.generateUriAndQr(toolArgs);
125
- return {
126
- content: [
127
- { type: "text", text: qrCodeUtf8 + "\n\n```\n" + uri + "\n```" },
128
- { type: "image", data: qrCodePng.replace(/^data:image\/png;base64,/, ''), mimeType: "image/png" }
129
- ]
130
- };
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
+ }
131
200
  }
132
201
  throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
133
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.1.0',
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).',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goplausible/algorand-mcp",
3
- "version": "4.1.0",
3
+ "version": "4.2.1",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },