@crscreditapi/finstack-mcp-server 0.8.0-8468b06 → 0.9.0-6062c00
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/README.md +8 -0
- package/dist/api/copai.api.d.ts +56 -0
- package/dist/api/copai.api.js +15 -0
- package/dist/handlers/copai.handler.d.ts +6 -0
- package/dist/handlers/copai.handler.js +9 -0
- package/dist/handlers/index.js +2 -0
- package/dist/tools/copai.tools.d.ts +5 -0
- package/dist/tools/copai.tools.js +22 -0
- package/dist/tools/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,6 +16,7 @@ MCP server exposing CRS B2B (Finstack) customer data over the [Model Context Pro
|
|
|
16
16
|
| `finstack_get_customer_cohort` | Bulk, paginated list of all customers with portal status, account type, and sales opportunities (type + stage). For cohort/tracker refreshes instead of per-customer summary calls. Optional `status` / `stage` filters. |
|
|
17
17
|
| `finstack_get_leadiq_analytics` | System-wide LeadsIQ analytics for a trailing window: totals vs previous period, the complete list of customers that pulled (revenue desc), entitled/active/invited split, and enrolled-but-never-pulled accounts. |
|
|
18
18
|
| `finstack_get_leadiq_customer` | One customer's LeadsIQ detail: enrollment state, window/YTD/lifetime stats, match rate and append hit rates, most commonly used pull filters, recent pulls. |
|
|
19
|
+
| `finstack_get_cop_ai_analytics` | Credit Order Pro AI summary & chat usage for a trailing window: totals, per-customer activity (reports, summaries, opens, questions, ratings, Bedrock cost) and who currently has the feature enabled. |
|
|
19
20
|
| `finstack_get_product_catalog` | The CRS product catalog: code, status, vendor, names, description, base cost / default price, inquiry type, FCRA, platforms, add-ons and permissible purposes. Optional exact `code` / `status` / `vendor` filters plus free-text `query`. |
|
|
20
21
|
| `finstack_get_vendors` | Look up who to contact at an external vendor/partner (credit bureaus and data vendors like Equifax, TransUnion, Experian, CIC). OR-matches `query` across company, name, role, notes, location, and specialty tags; optional `connection` degree filter. |
|
|
21
22
|
|
|
@@ -181,6 +182,13 @@ All parameters optional. `page` defaults to `1`; `per_page` defaults to `500`, c
|
|
|
181
182
|
|
|
182
183
|
Identify the customer with either `customer_code` or `user_id`; `days` is optional (default `30`) and only scopes the `period` block. Returns `{customer, entitlement, contacts, period, year_to_date, lifetime, top_filters, recent_pulls}`. `top_filters[]` aggregates each pull's submitted form filters (dashboard formatting) with per-filter usage share and most common values.
|
|
183
184
|
|
|
185
|
+
### `finstack_get_cop_ai_analytics`
|
|
186
|
+
|
|
187
|
+
```json
|
|
188
|
+
{ "days": 30 }
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
`days` is optional (default `7`, clamped server-side to 1–92; the window ends yesterday). Returns `{period, totals, customers, enabled_customers}`. `customers[]` lists every account with activity in the window, most reports first: `reports` are successful credit reports on products carrying the AI add-on, `summaries` the AI summaries generated (`precomputed` of them right after the order), `opened` how many a user actually looked at, `questions` chat messages answered with `up`/`down` ratings, and `cost` the Bedrock spend in USD. `enabled_customers[]` is who has the feature on right now (id, name, product codes, `enabled_at`), regardless of activity. Counts only; report and chat content is never exposed.
|
|
184
192
|
### `finstack_get_product_catalog`
|
|
185
193
|
|
|
186
194
|
```json
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credit Order Pro AI summary & chat usage against the mware-portal API.
|
|
3
|
+
*
|
|
4
|
+
* Same numbers the #cop-ai-usage Slack digest posts: per customer, the
|
|
5
|
+
* successful credit reports on products that carry the AI add-on, the
|
|
6
|
+
* summaries generated (precomputed vs on click), how many were opened,
|
|
7
|
+
* chat questions with thumbs up/down, and the Bedrock cost in USD. Counts
|
|
8
|
+
* only — the portal never exposes report or chat content here.
|
|
9
|
+
*/
|
|
10
|
+
import type { ApiClient } from './client.js';
|
|
11
|
+
export interface CopAiCustomerRow {
|
|
12
|
+
customer: string;
|
|
13
|
+
reports: number;
|
|
14
|
+
summaries: number;
|
|
15
|
+
precomputed: number;
|
|
16
|
+
opened: number;
|
|
17
|
+
questions: number;
|
|
18
|
+
up: number;
|
|
19
|
+
down: number;
|
|
20
|
+
/** Bedrock cost in USD (Haiku 4.5 list price). */
|
|
21
|
+
cost: number;
|
|
22
|
+
}
|
|
23
|
+
export interface CopAiTotals {
|
|
24
|
+
reports: number;
|
|
25
|
+
summaries: number;
|
|
26
|
+
precomputed: number;
|
|
27
|
+
opened: number;
|
|
28
|
+
/** Opened summaries as a percentage of generated summaries. */
|
|
29
|
+
opened_pct: number;
|
|
30
|
+
questions: number;
|
|
31
|
+
up: number;
|
|
32
|
+
down: number;
|
|
33
|
+
cost: number;
|
|
34
|
+
/** Customers with at least one enabled report in the window. */
|
|
35
|
+
customers: number;
|
|
36
|
+
}
|
|
37
|
+
export interface CopAiEnabledCustomer {
|
|
38
|
+
id: number;
|
|
39
|
+
name: string;
|
|
40
|
+
/** Billing product codes carrying the add-on, e.g. ["EXP1101", "TUC1101"]. */
|
|
41
|
+
products: string[];
|
|
42
|
+
enabled_at: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface CopAiAnalyticsDigest {
|
|
45
|
+
period: {
|
|
46
|
+
start_date: string;
|
|
47
|
+
end_date: string;
|
|
48
|
+
days: number;
|
|
49
|
+
};
|
|
50
|
+
totals: CopAiTotals;
|
|
51
|
+
/** Every customer with activity in the window, most reports first. */
|
|
52
|
+
customers: CopAiCustomerRow[];
|
|
53
|
+
/** Who has the feature switched on right now, regardless of activity. */
|
|
54
|
+
enabled_customers: CopAiEnabledCustomer[];
|
|
55
|
+
}
|
|
56
|
+
export declare function getCopAiAnalytics(client: ApiClient, days?: number): Promise<CopAiAnalyticsDigest>;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export async function getCopAiAnalytics(client, days) {
|
|
2
|
+
const secret = process.env.FINSTACK_CHATBASE_SECRET;
|
|
3
|
+
if (!secret) {
|
|
4
|
+
throw new Error('FINSTACK_CHATBASE_SECRET must be set');
|
|
5
|
+
}
|
|
6
|
+
const params = new URLSearchParams();
|
|
7
|
+
if (days !== undefined) {
|
|
8
|
+
params.set('days', String(days));
|
|
9
|
+
}
|
|
10
|
+
const response = await client.get(`/api/v1/chatbase/cop_ai_analytics?${params}`, { 'X-Chatbase-Secret': secret });
|
|
11
|
+
if (response.status !== 'success' || !response.data) {
|
|
12
|
+
throw new Error(response.message || 'Failed to fetch Credit Order Pro AI analytics');
|
|
13
|
+
}
|
|
14
|
+
return response.data;
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credit Order Pro AI tool handlers
|
|
3
|
+
*/
|
|
4
|
+
import { getClient } from '../api/client.js';
|
|
5
|
+
import { getCopAiAnalytics } from '../api/copai.api.js';
|
|
6
|
+
export async function handleGetCopAiAnalytics(args) {
|
|
7
|
+
const client = getClient(args.environment ?? 'prod');
|
|
8
|
+
return getCopAiAnalytics(client, args.days);
|
|
9
|
+
}
|
package/dist/handlers/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { handleGetCopAiAnalytics } from './copai.handler.js';
|
|
1
2
|
import { handleGetCustomerCohort, handleGetCustomerInvoices, handleGetCustomerPricingConfig, handleGetCustomerRevenue, handleGetCustomerSummary, handleGetCustomerUsers, handleGetPricingAddendumText, handleSearchCustomer, } from './customer.handler.js';
|
|
2
3
|
import { handleGetLeadiqAnalytics, handleGetLeadiqCustomer, } from './leadiq.handler.js';
|
|
3
4
|
import { handleGetProductCatalog } from './product.handler.js';
|
|
@@ -16,6 +17,7 @@ export const handlers = {
|
|
|
16
17
|
finstack_get_customer_users: wrap(handleGetCustomerUsers),
|
|
17
18
|
finstack_get_leadiq_analytics: wrap(handleGetLeadiqAnalytics),
|
|
18
19
|
finstack_get_leadiq_customer: wrap(handleGetLeadiqCustomer),
|
|
20
|
+
finstack_get_cop_ai_analytics: wrap(handleGetCopAiAnalytics),
|
|
19
21
|
finstack_get_product_catalog: wrap(handleGetProductCatalog),
|
|
20
22
|
finstack_get_vendors: wrap(handleGetVendors),
|
|
21
23
|
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export const copAiTools = [
|
|
2
|
+
{
|
|
3
|
+
name: 'finstack_get_cop_ai_analytics',
|
|
4
|
+
description: 'Usage of the Credit Order Pro AI summary & chat (early-access feature on the customer portal) for a trailing window. Returns totals (reports on AI-enabled products, summaries generated and how many were precomputed, opened count and opened_pct, chat questions, thumbs up/down, Bedrock cost in USD, active customers), customers[] — every account with activity in the window, most reports first, with the same fields — and enabled_customers[] — who currently has the add-on switched on, with their product codes and when it was enabled. Use for questions like "how is the AI summary beta going" (totals + customers[]), "who has enabled AI summary" (enabled_customers[]), "is anyone using the chat" (questions), or "what does the AI feature cost us per week" (totals.cost). Counts only; report and chat content is never exposed.',
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: 'object',
|
|
7
|
+
properties: {
|
|
8
|
+
days: {
|
|
9
|
+
type: 'number',
|
|
10
|
+
description: 'Trailing window in days ending yesterday, 1-92 (default 7; values outside the range are clamped server-side). Use 30 for "last month".',
|
|
11
|
+
minimum: 1,
|
|
12
|
+
maximum: 92,
|
|
13
|
+
},
|
|
14
|
+
environment: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Target environment: "prod" (default) or "dev"',
|
|
17
|
+
enum: ['dev', 'prod'],
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
];
|
package/dist/tools/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
+
import { copAiTools } from './copai.tools.js';
|
|
1
2
|
import { customerTools } from './customer.tools.js';
|
|
2
3
|
import { leadiqTools } from './leadiq.tools.js';
|
|
3
4
|
import { productTools } from './product.tools.js';
|
|
4
5
|
import { vendorTools } from './vendor.tools.js';
|
|
5
6
|
export const tools = [
|
|
6
7
|
...customerTools,
|
|
8
|
+
...copAiTools,
|
|
7
9
|
...leadiqTools,
|
|
8
10
|
...productTools,
|
|
9
11
|
...vendorTools,
|