next-finance-mcp 0.9.2 → 0.9.3
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/dist/client.js +12 -9
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/client.js
CHANGED
|
@@ -826,13 +826,18 @@ export async function buscarLancamentos(opts) {
|
|
|
826
826
|
if (opts.nomeConta?.trim()) {
|
|
827
827
|
const { contas } = await fetchContas();
|
|
828
828
|
const termo = opts.nomeConta.trim().toLowerCase();
|
|
829
|
-
const
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
829
|
+
const ativas = contas.map(c => c).filter(c => c["Ativo"] !== false);
|
|
830
|
+
const matches = ativas.filter(c => String(c["Nome"] ?? c["NomeConta"] ?? "").toLowerCase().includes(termo));
|
|
831
|
+
if (matches.length === 0) {
|
|
832
|
+
throw new Error(`Conta "${opts.nomeConta}" não encontrada. Use listar_contas para ver as contas disponíveis.`);
|
|
833
|
+
}
|
|
834
|
+
// Preferir match exato; se ainda ambíguo, listar as opções
|
|
835
|
+
const exata = matches.find(c => String(c["Nome"] ?? c["NomeConta"] ?? "").toLowerCase() === termo);
|
|
836
|
+
const encontrada = exata ?? (matches.length === 1 ? matches[0] : null);
|
|
837
|
+
if (!encontrada) {
|
|
838
|
+
const nomes = matches.map(c => String(c["Nome"] ?? c["NomeConta"] ?? "")).join(", ");
|
|
839
|
+
throw new Error(`"${opts.nomeConta}" corresponde a ${matches.length} contas: ${nomes}. Informe um nome mais específico.`);
|
|
840
|
+
}
|
|
836
841
|
idContaResolvido = String(encontrada["Id"] ?? encontrada["IdConta"] ?? encontrada["id"] ?? encontrada["idConta"] ?? "");
|
|
837
842
|
}
|
|
838
843
|
let lancamentos;
|
|
@@ -863,8 +868,6 @@ export async function buscarLancamentos(opts) {
|
|
|
863
868
|
if (r.status !== 200)
|
|
864
869
|
throw new Error(`Erro ${r.status} ao buscar lançamentos (endpoint legado).`);
|
|
865
870
|
const raw = JSON.parse(r.text);
|
|
866
|
-
// O endpoint legado retorna { Lancamentos: [...], SaldosPorMes: [...], ... }
|
|
867
|
-
// Extraímos explicitamente o campo Lancamentos para não confundir com SaldosPorMes
|
|
868
871
|
if (Array.isArray(raw)) {
|
|
869
872
|
lancamentos = raw;
|
|
870
873
|
}
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
8
8
|
import { CallToolRequestSchema, ListToolsRequestSchema } from "@modelcontextprotocol/sdk/types.js";
|
|
9
9
|
import * as client from "./client.js";
|
|
10
10
|
import { openLoginUI } from "./login-server.js";
|
|
11
|
-
const server = new Server({ name: "next-finance-mcp", version: "0.9.
|
|
11
|
+
const server = new Server({ name: "next-finance-mcp", version: "0.9.3" }, { capabilities: { tools: {} } });
|
|
12
12
|
// ── Ferramentas ─────────────────────────────────────────────────────────────
|
|
13
13
|
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
14
14
|
tools: [
|
|
@@ -361,6 +361,6 @@ server.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
361
361
|
async function main() {
|
|
362
362
|
const transport = new StdioServerTransport();
|
|
363
363
|
await server.connect(transport);
|
|
364
|
-
console.error("NEXT Finance MCP server v0.9.
|
|
364
|
+
console.error("NEXT Finance MCP server v0.9.3 iniciado.");
|
|
365
365
|
}
|
|
366
366
|
main().catch((err) => { console.error("Erro fatal:", err); process.exit(1); });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "next-finance-mcp",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.3",
|
|
4
4
|
"mcpName": "io.github.paivapiovesan/next-finance",
|
|
5
5
|
"description": "MCP Server para o NEXT Finance (finance.net.br) — login via browser, listagem de carteiras, contas e lançamentos",
|
|
6
6
|
"type": "module",
|