@theyahia/alfa-bank-mcp 1.0.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 +21 -0
- package/README.md +40 -0
- package/dist/client.d.ts +24 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +91 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/accounts.d.ts +60 -0
- package/dist/tools/accounts.d.ts.map +1 -0
- package/dist/tools/accounts.js +35 -0
- package/dist/tools/accounts.js.map +1 -0
- package/dist/tools/payments.d.ts +57 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +34 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/references.d.ts +36 -0
- package/dist/tools/references.d.ts.map +1 -0
- package/dist/tools/references.js +29 -0
- package/dist/tools/references.js.map +1 -0
- package/dist/types.d.ts +84 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 theYahia
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @theyahia/alfa-bank-mcp
|
|
2
|
+
|
|
3
|
+
MCP server for Alfa-Bank Business API. Manage business accounts, create payment orders, view statements, check exchange rates, and access payroll registries.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx -y @theyahia/alfa-bank-mcp
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Environment Variables
|
|
12
|
+
|
|
13
|
+
| Variable | Required | Description |
|
|
14
|
+
|----------|----------|-------------|
|
|
15
|
+
| `ALFA_CLIENT_ID` | Yes | OAuth 2.0 client ID from Alfa-Bank developer portal |
|
|
16
|
+
| `ALFA_CLIENT_SECRET` | Yes | OAuth 2.0 client secret |
|
|
17
|
+
| `ALFA_BASE_URL` | No | API base URL (default: `https://partner.business.alfabank.ru`) |
|
|
18
|
+
|
|
19
|
+
## Tools
|
|
20
|
+
|
|
21
|
+
| Tool | Description |
|
|
22
|
+
|------|-------------|
|
|
23
|
+
| `list_accounts` | List all business accounts |
|
|
24
|
+
| `get_account_balance` | Get current balance for an account |
|
|
25
|
+
| `get_account_statement` | Get transactions for a date range |
|
|
26
|
+
| `create_payment_order` | Create a new payment order |
|
|
27
|
+
| `get_payment_status` | Check payment order status |
|
|
28
|
+
| `list_counterparties` | List saved business counterparties |
|
|
29
|
+
| `get_exchange_rates` | Get current exchange rates |
|
|
30
|
+
| `get_salary_registry` | Get payroll registries |
|
|
31
|
+
|
|
32
|
+
## Demo Prompts
|
|
33
|
+
|
|
34
|
+
1. "Show me all my Alfa-Bank business accounts and their balances"
|
|
35
|
+
2. "Create a payment of 150,000 RUB to account 40702810000000005678 at BIK 044525225 for consulting services"
|
|
36
|
+
3. "Get my account statement for March 2026 and summarize the biggest expenses"
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { AlfaAuthConfig, AlfaAccount, AlfaBalance, AlfaStatement, AlfaPaymentOrder, AlfaCounterparty, AlfaExchangeRate, AlfaSalaryRegistry } from "./types.js";
|
|
2
|
+
export declare class AlfaBankClient {
|
|
3
|
+
private config;
|
|
4
|
+
private accessToken;
|
|
5
|
+
private tokenExpiresAt;
|
|
6
|
+
constructor(config: AlfaAuthConfig);
|
|
7
|
+
private getAccessToken;
|
|
8
|
+
private request;
|
|
9
|
+
listAccounts(): Promise<AlfaAccount[]>;
|
|
10
|
+
getAccountBalance(accountId: string): Promise<AlfaBalance>;
|
|
11
|
+
getAccountStatement(accountId: string, dateFrom: string, dateTo: string): Promise<AlfaStatement>;
|
|
12
|
+
createPaymentOrder(params: {
|
|
13
|
+
fromAccount: string;
|
|
14
|
+
toAccount: string;
|
|
15
|
+
toBik: string;
|
|
16
|
+
amount: number;
|
|
17
|
+
purpose: string;
|
|
18
|
+
}): Promise<AlfaPaymentOrder>;
|
|
19
|
+
getPaymentStatus(paymentId: string): Promise<AlfaPaymentOrder>;
|
|
20
|
+
listCounterparties(): Promise<AlfaCounterparty[]>;
|
|
21
|
+
getExchangeRates(): Promise<AlfaExchangeRate[]>;
|
|
22
|
+
getSalaryRegistry(): Promise<AlfaSalaryRegistry[]>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EAEd,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,kBAAkB,EACnB,MAAM,YAAY,CAAC;AAKpB,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAiB;IAC/B,OAAO,CAAC,WAAW,CAAuB;IAC1C,OAAO,CAAC,cAAc,CAAa;gBAEvB,MAAM,EAAE,cAAc;YAIpB,cAAc;YAyBd,OAAO;IAwCf,YAAY,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;IAItC,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAO1D,mBAAmB,CACvB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,aAAa,CAAC;IAOnB,kBAAkB,CAAC,MAAM,EAAE;QAC/B,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAUvB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAO9D,kBAAkB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAIjD,gBAAgB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;IAI/C,iBAAiB,IAAI,OAAO,CAAC,kBAAkB,EAAE,CAAC;CAGzD"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
const MAX_RETRIES = 3;
|
|
2
|
+
const RETRY_BASE_DELAY = 1000;
|
|
3
|
+
export class AlfaBankClient {
|
|
4
|
+
config;
|
|
5
|
+
accessToken = null;
|
|
6
|
+
tokenExpiresAt = 0;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.config = config;
|
|
9
|
+
}
|
|
10
|
+
async getAccessToken() {
|
|
11
|
+
if (this.accessToken && Date.now() < this.tokenExpiresAt) {
|
|
12
|
+
return this.accessToken;
|
|
13
|
+
}
|
|
14
|
+
const resp = await fetch(`${this.config.baseUrl}/oauth/token`, {
|
|
15
|
+
method: "POST",
|
|
16
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
17
|
+
body: new URLSearchParams({
|
|
18
|
+
grant_type: "client_credentials",
|
|
19
|
+
client_id: this.config.clientId,
|
|
20
|
+
client_secret: this.config.clientSecret,
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
if (!resp.ok) {
|
|
24
|
+
throw new Error(`Auth failed: ${resp.status} ${await resp.text()}`);
|
|
25
|
+
}
|
|
26
|
+
const data = (await resp.json());
|
|
27
|
+
this.accessToken = data.access_token;
|
|
28
|
+
this.tokenExpiresAt = Date.now() + (data.expires_in - 60) * 1000;
|
|
29
|
+
return this.accessToken;
|
|
30
|
+
}
|
|
31
|
+
async request(method, path, body, attempt = 1) {
|
|
32
|
+
const token = await this.getAccessToken();
|
|
33
|
+
const resp = await fetch(`${this.config.baseUrl}${path}`, {
|
|
34
|
+
method,
|
|
35
|
+
headers: {
|
|
36
|
+
Authorization: `Bearer ${token}`,
|
|
37
|
+
"Content-Type": "application/json",
|
|
38
|
+
Accept: "application/json",
|
|
39
|
+
},
|
|
40
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
41
|
+
});
|
|
42
|
+
if (resp.status === 401) {
|
|
43
|
+
this.accessToken = null;
|
|
44
|
+
if (attempt <= 2) {
|
|
45
|
+
return this.request(method, path, body, attempt + 1);
|
|
46
|
+
}
|
|
47
|
+
throw new Error("Authentication failed after retry");
|
|
48
|
+
}
|
|
49
|
+
if (resp.status === 429 && attempt <= MAX_RETRIES) {
|
|
50
|
+
const delay = RETRY_BASE_DELAY * Math.pow(2, attempt - 1);
|
|
51
|
+
await new Promise((r) => setTimeout(r, delay));
|
|
52
|
+
return this.request(method, path, body, attempt + 1);
|
|
53
|
+
}
|
|
54
|
+
if (!resp.ok) {
|
|
55
|
+
const errorText = await resp.text();
|
|
56
|
+
throw new Error(`Alfa-Bank API error ${resp.status}: ${errorText}`);
|
|
57
|
+
}
|
|
58
|
+
return resp.json();
|
|
59
|
+
}
|
|
60
|
+
async listAccounts() {
|
|
61
|
+
return this.request("GET", "/api/v1/accounts");
|
|
62
|
+
}
|
|
63
|
+
async getAccountBalance(accountId) {
|
|
64
|
+
return this.request("GET", `/api/v1/accounts/${accountId}/balance`);
|
|
65
|
+
}
|
|
66
|
+
async getAccountStatement(accountId, dateFrom, dateTo) {
|
|
67
|
+
return this.request("GET", `/api/v1/accounts/${accountId}/statement?dateFrom=${dateFrom}&dateTo=${dateTo}`);
|
|
68
|
+
}
|
|
69
|
+
async createPaymentOrder(params) {
|
|
70
|
+
return this.request("POST", "/api/v1/payments", {
|
|
71
|
+
from_account: params.fromAccount,
|
|
72
|
+
to_account: params.toAccount,
|
|
73
|
+
to_bik: params.toBik,
|
|
74
|
+
amount: params.amount,
|
|
75
|
+
purpose: params.purpose,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
async getPaymentStatus(paymentId) {
|
|
79
|
+
return this.request("GET", `/api/v1/payments/${paymentId}`);
|
|
80
|
+
}
|
|
81
|
+
async listCounterparties() {
|
|
82
|
+
return this.request("GET", "/api/v1/counterparties");
|
|
83
|
+
}
|
|
84
|
+
async getExchangeRates() {
|
|
85
|
+
return this.request("GET", "/api/v1/exchange-rates");
|
|
86
|
+
}
|
|
87
|
+
async getSalaryRegistry() {
|
|
88
|
+
return this.request("GET", "/api/v1/salary/registry");
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 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,OAAO,IAAI,CAAC,OAAO,CAAqB,KAAK,EAAE,wBAAwB,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,gBAAgB;QACpB,OAAO,IAAI,CAAC,OAAO,CAAqB,KAAK,EAAE,wBAAwB,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,IAAI,CAAC,OAAO,CAAuB,KAAK,EAAE,yBAAyB,CAAC,CAAC;IAC9E,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { AlfaBankClient } from "./client.js";
|
|
5
|
+
import { listAccountsTool, getAccountBalanceTool, getAccountStatementTool, } from "./tools/accounts.js";
|
|
6
|
+
import { createPaymentOrderTool, getPaymentStatusTool, } from "./tools/payments.js";
|
|
7
|
+
import { listCounterpartiesTool, getExchangeRatesTool, getSalaryRegistryTool, } from "./tools/references.js";
|
|
8
|
+
const clientId = process.env.ALFA_CLIENT_ID;
|
|
9
|
+
const clientSecret = process.env.ALFA_CLIENT_SECRET;
|
|
10
|
+
const baseUrl = process.env.ALFA_BASE_URL || "https://partner.business.alfabank.ru";
|
|
11
|
+
if (!clientId || !clientSecret) {
|
|
12
|
+
console.error("Missing ALFA_CLIENT_ID or ALFA_CLIENT_SECRET environment variables");
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
const client = new AlfaBankClient({ clientId, clientSecret, baseUrl });
|
|
16
|
+
const server = new McpServer({
|
|
17
|
+
name: "alfa-bank-mcp",
|
|
18
|
+
version: "1.0.0",
|
|
19
|
+
});
|
|
20
|
+
// Register all tools
|
|
21
|
+
server.tool(listAccountsTool.name, listAccountsTool.description, listAccountsTool.inputSchema.shape, async () => listAccountsTool.handler(client));
|
|
22
|
+
server.tool(getAccountBalanceTool.name, getAccountBalanceTool.description, getAccountBalanceTool.inputSchema.shape, async (args) => getAccountBalanceTool.handler(client, args));
|
|
23
|
+
server.tool(getAccountStatementTool.name, getAccountStatementTool.description, getAccountStatementTool.inputSchema.shape, async (args) => getAccountStatementTool.handler(client, args));
|
|
24
|
+
server.tool(createPaymentOrderTool.name, createPaymentOrderTool.description, createPaymentOrderTool.inputSchema.shape, async (args) => createPaymentOrderTool.handler(client, args));
|
|
25
|
+
server.tool(getPaymentStatusTool.name, getPaymentStatusTool.description, getPaymentStatusTool.inputSchema.shape, async (args) => getPaymentStatusTool.handler(client, args));
|
|
26
|
+
server.tool(listCounterpartiesTool.name, listCounterpartiesTool.description, listCounterpartiesTool.inputSchema.shape, async () => listCounterpartiesTool.handler(client));
|
|
27
|
+
server.tool(getExchangeRatesTool.name, getExchangeRatesTool.description, getExchangeRatesTool.inputSchema.shape, async () => getExchangeRatesTool.handler(client));
|
|
28
|
+
server.tool(getSalaryRegistryTool.name, getSalaryRegistryTool.description, getSalaryRegistryTool.inputSchema.shape, async () => getSalaryRegistryTool.handler(client));
|
|
29
|
+
async function main() {
|
|
30
|
+
const transport = new StdioServerTransport();
|
|
31
|
+
await server.connect(transport);
|
|
32
|
+
console.error("Alfa-Bank MCP server running on stdio");
|
|
33
|
+
}
|
|
34
|
+
main().catch((err) => {
|
|
35
|
+
console.error("Fatal error:", err);
|
|
36
|
+
process.exit(1);
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBA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AC,WAAW,CAAC,KAAK,EACvC,KAAK,IAAI,EAAE,CAAC,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAClD,CAAC;AAEF,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,OAAO,CAAC,KAAK,CAAC,uCAAuC,CAAC,CAAC;AACzD,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,GAAG,CAAC,CAAC;IACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AlfaBankClient } from "../client.js";
|
|
3
|
+
export declare const listAccountsTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
7
|
+
handler: (client: AlfaBankClient) => Promise<{
|
|
8
|
+
content: {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
export declare const getAccountBalanceTool: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: z.ZodObject<{
|
|
18
|
+
account_id: z.ZodString;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
account_id: string;
|
|
21
|
+
}, {
|
|
22
|
+
account_id: string;
|
|
23
|
+
}>;
|
|
24
|
+
handler: (client: AlfaBankClient, args: {
|
|
25
|
+
account_id: string;
|
|
26
|
+
}) => Promise<{
|
|
27
|
+
content: {
|
|
28
|
+
type: "text";
|
|
29
|
+
text: string;
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
export declare const getAccountStatementTool: {
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
inputSchema: z.ZodObject<{
|
|
37
|
+
account_id: z.ZodString;
|
|
38
|
+
date_from: z.ZodString;
|
|
39
|
+
date_to: z.ZodString;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
account_id: string;
|
|
42
|
+
date_from: string;
|
|
43
|
+
date_to: string;
|
|
44
|
+
}, {
|
|
45
|
+
account_id: string;
|
|
46
|
+
date_from: string;
|
|
47
|
+
date_to: string;
|
|
48
|
+
}>;
|
|
49
|
+
handler: (client: AlfaBankClient, args: {
|
|
50
|
+
account_id: string;
|
|
51
|
+
date_from: string;
|
|
52
|
+
date_to: string;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
content: {
|
|
55
|
+
type: "text";
|
|
56
|
+
text: string;
|
|
57
|
+
}[];
|
|
58
|
+
}>;
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=accounts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.d.ts","sourceRoot":"","sources":["../../src/tools/accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,gBAAgB;;;;sBAKH,cAAc;;;;;;CAIvC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;;;;;;;sBAOR,cAAc,QAAQ;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;;;;;;CAIrE,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;sBAUxB,cAAc,QAChB;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;;;;;;CASnE,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const listAccountsTool = {
|
|
3
|
+
name: "list_accounts",
|
|
4
|
+
description: "List all business accounts in Alfa-Bank. Returns account numbers, currencies, types, and statuses.",
|
|
5
|
+
inputSchema: z.object({}),
|
|
6
|
+
handler: async (client) => {
|
|
7
|
+
const accounts = await client.listAccounts();
|
|
8
|
+
return { content: [{ type: "text", text: JSON.stringify(accounts, null, 2) }] };
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export const getAccountBalanceTool = {
|
|
12
|
+
name: "get_account_balance",
|
|
13
|
+
description: "Get the current balance of a specific Alfa-Bank business account by its ID.",
|
|
14
|
+
inputSchema: z.object({
|
|
15
|
+
account_id: z.string().describe("The unique account identifier"),
|
|
16
|
+
}),
|
|
17
|
+
handler: async (client, args) => {
|
|
18
|
+
const balance = await client.getAccountBalance(args.account_id);
|
|
19
|
+
return { content: [{ type: "text", text: JSON.stringify(balance, null, 2) }] };
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const getAccountStatementTool = {
|
|
23
|
+
name: "get_account_statement",
|
|
24
|
+
description: "Get account statement (transactions) for a date range. Returns credits, debits, opening/closing balance.",
|
|
25
|
+
inputSchema: z.object({
|
|
26
|
+
account_id: z.string().describe("The unique account identifier"),
|
|
27
|
+
date_from: z.string().describe("Start date in YYYY-MM-DD format"),
|
|
28
|
+
date_to: z.string().describe("End date in YYYY-MM-DD format"),
|
|
29
|
+
}),
|
|
30
|
+
handler: async (client, args) => {
|
|
31
|
+
const statement = await client.getAccountStatement(args.account_id, args.date_from, args.date_to);
|
|
32
|
+
return { content: [{ type: "text", text: JSON.stringify(statement, null, 2) }] };
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=accounts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accounts.js","sourceRoot":"","sources":["../../src/tools/accounts.ts"],"names":[],"mappings":"AAAA,OA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AAC,+BAA+B,CAAC;QAChE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iCAAiC,CAAC;QACjE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;KAC9D,CAAC;IACF,OAAO,EAAE,KAAK,EACZ,MAAsB,EACtB,IAAgE,EAChE,EAAE;QACF,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,mBAAmB,CAChD,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,SAAS,EACd,IAAI,CAAC,OAAO,CACb,CAAC;QACF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IAC5F,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AlfaBankClient } from "../client.js";
|
|
3
|
+
export declare const createPaymentOrderTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: z.ZodObject<{
|
|
7
|
+
from_account: z.ZodString;
|
|
8
|
+
to_account: z.ZodString;
|
|
9
|
+
to_bik: z.ZodString;
|
|
10
|
+
amount: z.ZodNumber;
|
|
11
|
+
purpose: z.ZodString;
|
|
12
|
+
}, "strip", z.ZodTypeAny, {
|
|
13
|
+
from_account: string;
|
|
14
|
+
to_account: string;
|
|
15
|
+
to_bik: string;
|
|
16
|
+
amount: number;
|
|
17
|
+
purpose: string;
|
|
18
|
+
}, {
|
|
19
|
+
from_account: string;
|
|
20
|
+
to_account: string;
|
|
21
|
+
to_bik: string;
|
|
22
|
+
amount: number;
|
|
23
|
+
purpose: string;
|
|
24
|
+
}>;
|
|
25
|
+
handler: (client: AlfaBankClient, args: {
|
|
26
|
+
from_account: string;
|
|
27
|
+
to_account: string;
|
|
28
|
+
to_bik: string;
|
|
29
|
+
amount: number;
|
|
30
|
+
purpose: string;
|
|
31
|
+
}) => Promise<{
|
|
32
|
+
content: {
|
|
33
|
+
type: "text";
|
|
34
|
+
text: string;
|
|
35
|
+
}[];
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
export declare const getPaymentStatusTool: {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
inputSchema: z.ZodObject<{
|
|
42
|
+
payment_id: z.ZodString;
|
|
43
|
+
}, "strip", z.ZodTypeAny, {
|
|
44
|
+
payment_id: string;
|
|
45
|
+
}, {
|
|
46
|
+
payment_id: string;
|
|
47
|
+
}>;
|
|
48
|
+
handler: (client: AlfaBankClient, args: {
|
|
49
|
+
payment_id: string;
|
|
50
|
+
}) => Promise<{
|
|
51
|
+
content: {
|
|
52
|
+
type: "text";
|
|
53
|
+
text: string;
|
|
54
|
+
}[];
|
|
55
|
+
}>;
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=payments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.d.ts","sourceRoot":"","sources":["../../src/tools/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;sBAYvB,cAAc,QAChB;QACJ,YAAY,EAAE,MAAM,CAAC;QACrB,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,MAAM,CAAC;QACf,MAAM,EAAE,MAAM,CAAC;QACf,OAAO,EAAE,MAAM,CAAC;KACjB;;;;;;CAWJ,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;;;;;;;sBAOP,cAAc,QAAQ;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE;;;;;;CAIrE,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const createPaymentOrderTool = {
|
|
3
|
+
name: "create_payment_order",
|
|
4
|
+
description: "Create a new payment order in Alfa-Bank. Transfers funds from one account to another using BIK and account number.",
|
|
5
|
+
inputSchema: z.object({
|
|
6
|
+
from_account: z.string().describe("Source account number"),
|
|
7
|
+
to_account: z.string().describe("Destination account number"),
|
|
8
|
+
to_bik: z.string().describe("Destination bank BIK (9 digits)"),
|
|
9
|
+
amount: z.number().positive().describe("Amount in minor units (kopeks)"),
|
|
10
|
+
purpose: z.string().describe("Payment purpose description"),
|
|
11
|
+
}),
|
|
12
|
+
handler: async (client, args) => {
|
|
13
|
+
const order = await client.createPaymentOrder({
|
|
14
|
+
fromAccount: args.from_account,
|
|
15
|
+
toAccount: args.to_account,
|
|
16
|
+
toBik: args.to_bik,
|
|
17
|
+
amount: args.amount,
|
|
18
|
+
purpose: args.purpose,
|
|
19
|
+
});
|
|
20
|
+
return { content: [{ type: "text", text: JSON.stringify(order, null, 2) }] };
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export const getPaymentStatusTool = {
|
|
24
|
+
name: "get_payment_status",
|
|
25
|
+
description: "Check the status of a previously created payment order by its ID.",
|
|
26
|
+
inputSchema: z.object({
|
|
27
|
+
payment_id: z.string().describe("The payment order ID"),
|
|
28
|
+
}),
|
|
29
|
+
handler: async (client, args) => {
|
|
30
|
+
const status = await client.getPaymentStatus(args.payment_id);
|
|
31
|
+
return { content: [{ type: "text", text: JSON.stringify(status, null, 2) }] };
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payments.js","sourceRoot":"","sources":["../../src/tools/payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,sB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K,EAAE,MAAsB,EAAE,IAA4B,EAAE,EAAE;QACtE,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QAC9D,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACzF,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { AlfaBankClient } from "../client.js";
|
|
3
|
+
export declare const listCounterpartiesTool: {
|
|
4
|
+
name: string;
|
|
5
|
+
description: string;
|
|
6
|
+
inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
7
|
+
handler: (client: AlfaBankClient) => Promise<{
|
|
8
|
+
content: {
|
|
9
|
+
type: "text";
|
|
10
|
+
text: string;
|
|
11
|
+
}[];
|
|
12
|
+
}>;
|
|
13
|
+
};
|
|
14
|
+
export declare const getExchangeRatesTool: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
18
|
+
handler: (client: AlfaBankClient) => Promise<{
|
|
19
|
+
content: {
|
|
20
|
+
type: "text";
|
|
21
|
+
text: string;
|
|
22
|
+
}[];
|
|
23
|
+
}>;
|
|
24
|
+
};
|
|
25
|
+
export declare const getSalaryRegistryTool: {
|
|
26
|
+
name: string;
|
|
27
|
+
description: string;
|
|
28
|
+
inputSchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
29
|
+
handler: (client: AlfaBankClient) => Promise<{
|
|
30
|
+
content: {
|
|
31
|
+
type: "text";
|
|
32
|
+
text: string;
|
|
33
|
+
}[];
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=references.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.d.ts","sourceRoot":"","sources":["../../src/tools/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,eAAO,MAAM,sBAAsB;;;;sBAKT,cAAc;;;;;;CAIvC,CAAC;AAEF,eAAO,MAAM,oBAAoB;;;;sBAKP,cAAc;;;;;;CAIvC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;;;sBAKR,cAAc;;;;;;CAIvC,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const listCounterpartiesTool = {
|
|
3
|
+
name: "list_counterparties",
|
|
4
|
+
description: "List all saved counterparties (business partners) in Alfa-Bank. Returns names, INN, KPP, BIK, and account numbers.",
|
|
5
|
+
inputSchema: z.object({}),
|
|
6
|
+
handler: async (client) => {
|
|
7
|
+
const counterparties = await client.listCounterparties();
|
|
8
|
+
return { content: [{ type: "text", text: JSON.stringify(counterparties, null, 2) }] };
|
|
9
|
+
},
|
|
10
|
+
};
|
|
11
|
+
export const getExchangeRatesTool = {
|
|
12
|
+
name: "get_exchange_rates",
|
|
13
|
+
description: "Get current currency exchange rates from Alfa-Bank, including buy/sell rates and Central Bank rate.",
|
|
14
|
+
inputSchema: z.object({}),
|
|
15
|
+
handler: async (client) => {
|
|
16
|
+
const rates = await client.getExchangeRates();
|
|
17
|
+
return { content: [{ type: "text", text: JSON.stringify(rates, null, 2) }] };
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export const getSalaryRegistryTool = {
|
|
21
|
+
name: "get_salary_registry",
|
|
22
|
+
description: "Get payroll (salary) registries from Alfa-Bank. Returns registry status, total amount, and employee count.",
|
|
23
|
+
inputSchema: z.object({}),
|
|
24
|
+
handler: async (client) => {
|
|
25
|
+
const registry = await client.getSalaryRegistry();
|
|
26
|
+
return { content: [{ type: "text", text: JSON.stringify(registry, null, 2) }] };
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=references.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"references.js","sourceRoot":"","sources":["../../src/tools/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,oHAAoH;IACtH,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,OAAO,EAAE,KAAK,EAAE,MAAsB,EAAE,EAAE;QACxC,MAAM,cAAc,GAAG,MAAM,MAAM,CAAC,kBAAkB,EAAE,CAAC;QACzD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACjG,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EACT,qGAAqG;IACvG,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,OAAO,EAAE,KAAK,EAAE,MAAsB,EAAE,EAAE;QACxC,MAAM,KAAK,GAAG,MAAM,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAC9C,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IACxF,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EACT,4GAA4G;IAC9G,WAAW,EAAE,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;IACzB,OAAO,EAAE,KAAK,EAAE,MAAsB,EAAE,EAAE;QACxC,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,iBAAiB,EAAE,CAAC;QAClD,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;IAC3F,CAAC;CACF,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
export interface AlfaAuthConfig {
|
|
2
|
+
clientId: string;
|
|
3
|
+
clientSecret: string;
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
}
|
|
6
|
+
export interface AlfaTokenResponse {
|
|
7
|
+
access_token: string;
|
|
8
|
+
token_type: string;
|
|
9
|
+
expires_in: number;
|
|
10
|
+
refresh_token?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface AlfaAccount {
|
|
13
|
+
id: string;
|
|
14
|
+
number: string;
|
|
15
|
+
currency: string;
|
|
16
|
+
name: string;
|
|
17
|
+
status: string;
|
|
18
|
+
type: string;
|
|
19
|
+
}
|
|
20
|
+
export interface AlfaBalance {
|
|
21
|
+
accountId: string;
|
|
22
|
+
amount: number;
|
|
23
|
+
currency: string;
|
|
24
|
+
date: string;
|
|
25
|
+
}
|
|
26
|
+
export interface AlfaStatementEntry {
|
|
27
|
+
id: string;
|
|
28
|
+
date: string;
|
|
29
|
+
amount: number;
|
|
30
|
+
currency: string;
|
|
31
|
+
purpose: string;
|
|
32
|
+
counterpartyName: string;
|
|
33
|
+
counterpartyAccount: string;
|
|
34
|
+
counterpartyBik: string;
|
|
35
|
+
direction: "CREDIT" | "DEBIT";
|
|
36
|
+
}
|
|
37
|
+
export interface AlfaStatement {
|
|
38
|
+
accountId: string;
|
|
39
|
+
dateFrom: string;
|
|
40
|
+
dateTo: string;
|
|
41
|
+
openingBalance: number;
|
|
42
|
+
closingBalance: number;
|
|
43
|
+
entries: AlfaStatementEntry[];
|
|
44
|
+
}
|
|
45
|
+
export interface AlfaPaymentOrder {
|
|
46
|
+
id: string;
|
|
47
|
+
status: string;
|
|
48
|
+
fromAccount: string;
|
|
49
|
+
toAccount: string;
|
|
50
|
+
toBik: string;
|
|
51
|
+
amount: number;
|
|
52
|
+
currency: string;
|
|
53
|
+
purpose: string;
|
|
54
|
+
createdAt: string;
|
|
55
|
+
}
|
|
56
|
+
export interface AlfaCounterparty {
|
|
57
|
+
id: string;
|
|
58
|
+
name: string;
|
|
59
|
+
inn: string;
|
|
60
|
+
kpp: string;
|
|
61
|
+
bik: string;
|
|
62
|
+
account: string;
|
|
63
|
+
}
|
|
64
|
+
export interface AlfaExchangeRate {
|
|
65
|
+
currencyFrom: string;
|
|
66
|
+
currencyTo: string;
|
|
67
|
+
buyRate: number;
|
|
68
|
+
sellRate: number;
|
|
69
|
+
cbRate: number;
|
|
70
|
+
date: string;
|
|
71
|
+
}
|
|
72
|
+
export interface AlfaSalaryRegistry {
|
|
73
|
+
id: string;
|
|
74
|
+
status: string;
|
|
75
|
+
totalAmount: number;
|
|
76
|
+
employeeCount: number;
|
|
77
|
+
createdAt: string;
|
|
78
|
+
}
|
|
79
|
+
export interface AlfaApiError {
|
|
80
|
+
code: string;
|
|
81
|
+
message: string;
|
|
82
|
+
details?: string;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,iBAAiB;IAChC,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AQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAC/B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@theyahia/alfa-bank-mcp",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "MCP server for Alfa-Bank Business API — accounts, payments, statements, exchange rates",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"alfa-bank-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"dev": "tsx src/index.ts",
|
|
13
|
+
"test": "vitest run",
|
|
14
|
+
"test:watch": "vitest",
|
|
15
|
+
"prepublishOnly": "npm run build"
|
|
16
|
+
},
|
|
17
|
+
"keywords": [
|
|
18
|
+
"mcp",
|
|
19
|
+
"mcp-server",
|
|
20
|
+
"alfa-bank",
|
|
21
|
+
"russian-api",
|
|
22
|
+
"banking",
|
|
23
|
+
"typescript"
|
|
24
|
+
],
|
|
25
|
+
"author": "theYahia",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
29
|
+
"zod": "^3.24.4"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/node": "^25.5.0",
|
|
33
|
+
"tsx": "^4.19.4",
|
|
34
|
+
"typescript": "^5.8.3",
|
|
35
|
+
"vitest": "^3.1.1"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"dist"
|
|
39
|
+
],
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=18"
|
|
42
|
+
}
|
|
43
|
+
}
|