grid402-mcp 1.3.0 → 1.6.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 +22 -0
- package/README.md +8 -0
- package/index.mjs +7 -1
- package/package.json +8 -2
- package/tools.mjs +72 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Grid402 Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
package/README.md
CHANGED
|
@@ -20,6 +20,8 @@ Compatível nativamente com **Claude Desktop**, **Cursor**, **Smithery.ai**, **C
|
|
|
20
20
|
| `grid402_cnpj` | Consulta cadastral de CNPJ da Receita Federal com status e CNAE | On-Demand | 0.0020 USDC |
|
|
21
21
|
| `grid402_indicators` | Indicadores macroeconômicos oficiais (Selic meta e diária, CDI anual e IPCA) | On-Demand | 0.0005 USDC |
|
|
22
22
|
| `grid402_holidays` | Calendário oficial de feriados nacionais e bancários ANBIMA por ano | On-Demand | 0.0005 USDC |
|
|
23
|
+
| `grid402_workdays` | Calculadora de dias úteis financeiros e projeção de vencimentos ANBIMA | On-Demand | 0.0005 USDC |
|
|
24
|
+
| `grid402_verify` | Validação matemática de prova criptográfica de oráculo (_oracle_proof) secp256k1 | Direto | Gratuito |
|
|
23
25
|
|
|
24
26
|
---
|
|
25
27
|
|
|
@@ -100,6 +102,12 @@ O provedor gerencia automaticamente o ciclo de vida HTTP 402, transferindo os mi
|
|
|
100
102
|
|
|
101
103
|
---
|
|
102
104
|
|
|
105
|
+
## 🛡️ Prova Criptografica de Oraculo (Proof of Data)
|
|
106
|
+
|
|
107
|
+
Todas as ferramentas pagas e em sandbox retornam o bloco `_oracle_proof` com garantia matematica de integridade e assinatura ECDSA secp256k1 emitida pela carteira oficial do Grid402 (`0xa31c31069c43ac1c0075a93c325b0dcd7744356c`). Isso permite que agentes validem que os dados consumidos sao legitimos e nao sofreram alteracao durante o trânsito.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
103
111
|
## 🧪 Testando Localmente
|
|
104
112
|
|
|
105
113
|
```bash
|
package/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { MCP_TOOLS_DEFINITIONS, executeGrid402Request, DEFAULT_ENDPOINT } from '
|
|
|
13
13
|
const server = new Server(
|
|
14
14
|
{
|
|
15
15
|
name: 'grid402-mcp-server',
|
|
16
|
-
version: '1.
|
|
16
|
+
version: '1.6.0',
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
capabilities: {
|
|
@@ -67,6 +67,12 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
|
67
67
|
case 'grid402_holidays':
|
|
68
68
|
service = 'holidays';
|
|
69
69
|
break;
|
|
70
|
+
case 'grid402_workdays':
|
|
71
|
+
service = 'workdays';
|
|
72
|
+
break;
|
|
73
|
+
case 'grid402_verify':
|
|
74
|
+
service = 'verify';
|
|
75
|
+
break;
|
|
70
76
|
default:
|
|
71
77
|
throw new Error(`Ferramenta MCP desconhecida: ${toolName}`);
|
|
72
78
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "grid402-mcp",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Official Model Context Protocol (MCP) Server for Grid402 - Public Open Data e Network Utilities Hub (Forex, Crypto, DNS, SSL, ASN, CEP, CNPJ) with Base x402 micropayments e Sandbox.",
|
|
3
|
+
"version": "1.6.0",
|
|
4
|
+
"description": "Official Model Context Protocol (MCP) Server for Grid402 - Public Open Data e Network Utilities Hub (Forex, Crypto, DNS, SSL, ASN, CEP, CNPJ, Indicators, Holidays, Workdays, Oracle Verifier) with Base x402 micropayments, Oracle Proof e Sandbox.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
7
|
"grid402-mcp": "index.mjs"
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
"tools.mjs",
|
|
13
13
|
"x402_payer.mjs",
|
|
14
14
|
"README.md",
|
|
15
|
+
"LICENSE",
|
|
15
16
|
"package.json"
|
|
16
17
|
],
|
|
17
18
|
"scripts": {
|
|
@@ -36,6 +37,11 @@
|
|
|
36
37
|
"asn",
|
|
37
38
|
"cep",
|
|
38
39
|
"cnpj",
|
|
40
|
+
"indicators",
|
|
41
|
+
"holidays",
|
|
42
|
+
"workdays",
|
|
43
|
+
"oracle",
|
|
44
|
+
"proof-of-data",
|
|
39
45
|
"sandbox"
|
|
40
46
|
],
|
|
41
47
|
"author": "Grid402 Team <contato@grid402.com.br>",
|
package/tools.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { settleX402Payment } from './x402_payer.mjs';
|
|
|
7
7
|
export const DEFAULT_ENDPOINT = process.env.GRID402_ENDPOINT || process.env.GRID402_API_URL || 'https://orangered-jackal-900744.hostingersite.com';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Definições formais das
|
|
10
|
+
* Definições formais das 11 ferramentas no padrão MCP
|
|
11
11
|
*/
|
|
12
12
|
export const MCP_TOOLS_DEFINITIONS = [
|
|
13
13
|
{
|
|
@@ -169,6 +169,50 @@ export const MCP_TOOLS_DEFINITIONS = [
|
|
|
169
169
|
required: [],
|
|
170
170
|
},
|
|
171
171
|
},
|
|
172
|
+
{
|
|
173
|
+
name: 'grid402_workdays',
|
|
174
|
+
description: 'Calcula dias úteis financeiros e projeção de vencimentos na convenção ANBIMA (D+0 exclusivo no início e inclusivo no fim) ou verifica se uma data é dia útil bancário.',
|
|
175
|
+
inputSchema: {
|
|
176
|
+
type: 'object',
|
|
177
|
+
properties: {
|
|
178
|
+
start_date: {
|
|
179
|
+
type: 'string',
|
|
180
|
+
description: 'Data de início no formato AAAA-MM-DD para contagem de intervalo ou projeção de prazo.',
|
|
181
|
+
},
|
|
182
|
+
end_date: {
|
|
183
|
+
type: 'string',
|
|
184
|
+
description: 'Data de término no formato AAAA-MM-DD para contagem de intervalo de dias úteis.',
|
|
185
|
+
},
|
|
186
|
+
days: {
|
|
187
|
+
type: 'integer',
|
|
188
|
+
description: 'Quantidade inteira de dias úteis para projeção de vencimento (positivo para futuro, negativo para passado).',
|
|
189
|
+
},
|
|
190
|
+
date: {
|
|
191
|
+
type: 'string',
|
|
192
|
+
description: 'Data pontual no formato AAAA-MM-DD para verificação de dia útil.',
|
|
193
|
+
},
|
|
194
|
+
payment_tx_hash: {
|
|
195
|
+
type: 'string',
|
|
196
|
+
description: 'Hash opcional de transacao na Base Mainnet comprovando o pagamento de 0.0005 USDC caso nao utilize liquidacao automatica.',
|
|
197
|
+
},
|
|
198
|
+
},
|
|
199
|
+
required: [],
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
name: 'grid402_verify',
|
|
204
|
+
description: 'Valida a integridade matematica da prova criptografica de oraculo (_oracle_proof) secp256k1 em uma resposta do Grid402 (gratuito).',
|
|
205
|
+
inputSchema: {
|
|
206
|
+
type: 'object',
|
|
207
|
+
properties: {
|
|
208
|
+
payload: {
|
|
209
|
+
type: 'string',
|
|
210
|
+
description: 'Payload JSON serializado da resposta da API contendo a chave _oracle_proof.',
|
|
211
|
+
},
|
|
212
|
+
},
|
|
213
|
+
required: ['payload'],
|
|
214
|
+
},
|
|
215
|
+
},
|
|
172
216
|
];
|
|
173
217
|
|
|
174
218
|
/**
|
|
@@ -219,8 +263,33 @@ export async function executeGrid402Request(service, params = {}, options = {})
|
|
|
219
263
|
path = '/api/v1/holidays';
|
|
220
264
|
if (params.year) queryParams.set('year', params.year);
|
|
221
265
|
break;
|
|
266
|
+
case 'workdays':
|
|
267
|
+
path = '/api/v1/workdays';
|
|
268
|
+
if (params.start_date || params.startDate) queryParams.set('start_date', params.start_date || params.startDate);
|
|
269
|
+
if (params.end_date || params.endDate) queryParams.set('end_date', params.end_date || params.endDate);
|
|
270
|
+
if (params.days !== undefined && params.days !== null) queryParams.set('days', params.days);
|
|
271
|
+
if (params.date) queryParams.set('date', params.date);
|
|
272
|
+
break;
|
|
273
|
+
case 'verify':
|
|
274
|
+
path = '/api/v1/verify';
|
|
275
|
+
break;
|
|
222
276
|
default:
|
|
223
|
-
throw new Error(`
|
|
277
|
+
throw new Error(`Servico desconhecido: ${service}`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
// Verificacao de oraculo via POST sem estado
|
|
281
|
+
if (service === 'verify') {
|
|
282
|
+
const postPayload = typeof params.payload === 'string' ? params.payload : JSON.stringify(params.payload || params);
|
|
283
|
+
const verifyRes = await fetch(`${endpoint}/api/v1/verify`, {
|
|
284
|
+
method: 'POST',
|
|
285
|
+
headers: {
|
|
286
|
+
'Content-Type': 'application/json',
|
|
287
|
+
'Accept': 'application/json',
|
|
288
|
+
'User-Agent': 'Grid402-MCP-Server/1.6',
|
|
289
|
+
},
|
|
290
|
+
body: postPayload,
|
|
291
|
+
});
|
|
292
|
+
return await verifyRes.json();
|
|
224
293
|
}
|
|
225
294
|
|
|
226
295
|
const queryString = queryParams.toString();
|
|
@@ -228,7 +297,7 @@ export async function executeGrid402Request(service, params = {}, options = {})
|
|
|
228
297
|
|
|
229
298
|
const headers = {
|
|
230
299
|
'Accept': 'application/json',
|
|
231
|
-
'User-Agent': 'Grid402-MCP-Server/1.
|
|
300
|
+
'User-Agent': 'Grid402-MCP-Server/1.6',
|
|
232
301
|
};
|
|
233
302
|
|
|
234
303
|
if (params.payment_tx_hash) {
|