@flowsight/mcp-server 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 +155 -0
- package/dist/api-client.d.ts +100 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +98 -0
- package/dist/api-client.js.map +1 -0
- package/dist/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +24 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +49 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +12 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +231 -0
- package/dist/tools.js.map +1 -0
- package/package.json +53 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 FlowSight
|
|
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,155 @@
|
|
|
1
|
+
# @flowsight/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [FlowSight](https://flowsight.pro) — expose payment observability tools to AI assistants like Claude, GPT, and any MCP-compatible client.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
FLOWSIGHT_API_KEY=fs_live_... npx @flowsight/mcp-server
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Tools
|
|
12
|
+
|
|
13
|
+
The server exposes 4 tools:
|
|
14
|
+
|
|
15
|
+
| Tool | Description |
|
|
16
|
+
|------|-------------|
|
|
17
|
+
| `flowsight_send_event` | Send a payment event for tracking |
|
|
18
|
+
| `flowsight_query_events` | Query events with filters (processor, status, time range) |
|
|
19
|
+
| `flowsight_get_flow` | Get a complete payment flow by ID |
|
|
20
|
+
| `flowsight_list_processors` | List supported payment processors |
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
|
|
24
|
+
### Claude Desktop
|
|
25
|
+
|
|
26
|
+
Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json` on macOS, `%APPDATA%\Claude\claude_desktop_config.json` on Windows):
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"flowsight": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["@flowsight/mcp-server"],
|
|
34
|
+
"env": {
|
|
35
|
+
"FLOWSIGHT_API_KEY": "fs_live_your_api_key_here"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Restart Claude Desktop. You'll see FlowSight tools available in the tools menu.
|
|
43
|
+
|
|
44
|
+
### OpenClaw / Other MCP Clients
|
|
45
|
+
|
|
46
|
+
Any MCP client that supports stdio transport can use this server:
|
|
47
|
+
|
|
48
|
+
```json
|
|
49
|
+
{
|
|
50
|
+
"command": "npx",
|
|
51
|
+
"args": ["@flowsight/mcp-server"],
|
|
52
|
+
"env": {
|
|
53
|
+
"FLOWSIGHT_API_KEY": "fs_live_..."
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Custom Base URL
|
|
59
|
+
|
|
60
|
+
For self-hosted FlowSight or development:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"env": {
|
|
65
|
+
"FLOWSIGHT_API_KEY": "fs_test_...",
|
|
66
|
+
"FLOWSIGHT_BASE_URL": "http://localhost:8080"
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
| Environment Variable | Required | Default | Description |
|
|
74
|
+
|---------------------|----------|---------|-------------|
|
|
75
|
+
| `FLOWSIGHT_API_KEY` | ✅ | — | Your FlowSight API key |
|
|
76
|
+
| `FLOWSIGHT_BASE_URL` | — | `https://ingest.flowsight.pro` | API base URL |
|
|
77
|
+
| `FLOWSIGHT_TIMEOUT_MS` | — | `30000` | Request timeout in ms |
|
|
78
|
+
|
|
79
|
+
## Tool Details
|
|
80
|
+
|
|
81
|
+
### flowsight_send_event
|
|
82
|
+
|
|
83
|
+
Send a payment lifecycle event.
|
|
84
|
+
|
|
85
|
+
**Parameters:**
|
|
86
|
+
- `event_type` (required) — `payment.started`, `payment.completed`, `payment.failed`, `payment.retried`, `refund.started`, `refund.completed`, `refund.failed`
|
|
87
|
+
- `flow_id` (required) — UUID grouping related events
|
|
88
|
+
- `transaction_id` (required) — Processor transaction ID
|
|
89
|
+
- `processor` (required) — `stripe`, `paypal`, `adyen`, `redsys`
|
|
90
|
+
- `amount` (required) — Amount in smallest currency unit (cents)
|
|
91
|
+
- `currency` (required) — ISO 4217 code (USD, EUR, GBP)
|
|
92
|
+
- `status` — `succeeded`, `failed`, `pending`, `cancelled`
|
|
93
|
+
- `latency_ms` — Processor response time
|
|
94
|
+
- `error_code` — Error code for failed payments
|
|
95
|
+
- `error_message` — Error message for failed payments
|
|
96
|
+
- `context` — Key-value metadata
|
|
97
|
+
|
|
98
|
+
### flowsight_query_events
|
|
99
|
+
|
|
100
|
+
Query events with optional filters.
|
|
101
|
+
|
|
102
|
+
**Parameters:**
|
|
103
|
+
- `processor` — Filter by processor
|
|
104
|
+
- `status` — Filter by status
|
|
105
|
+
- `event_type` — Filter by event type
|
|
106
|
+
- `from` / `to` — ISO 8601 time range
|
|
107
|
+
- `page` / `limit` — Pagination (default: page 1, 20 per page)
|
|
108
|
+
|
|
109
|
+
### flowsight_get_flow
|
|
110
|
+
|
|
111
|
+
Get all events in a payment flow.
|
|
112
|
+
|
|
113
|
+
**Parameters:**
|
|
114
|
+
- `flow_id` (required) — The flow UUID to look up
|
|
115
|
+
|
|
116
|
+
### flowsight_list_processors
|
|
117
|
+
|
|
118
|
+
List supported payment processors and their webhook configurations. No parameters.
|
|
119
|
+
|
|
120
|
+
## Example Conversations
|
|
121
|
+
|
|
122
|
+
> "Show me all failed payments in the last hour"
|
|
123
|
+
|
|
124
|
+
The AI will call `flowsight_query_events` with `status: "failed"` and appropriate time range.
|
|
125
|
+
|
|
126
|
+
> "What happened with flow abc-123?"
|
|
127
|
+
|
|
128
|
+
The AI will call `flowsight_get_flow` with `flow_id: "abc-123"` and display the payment timeline.
|
|
129
|
+
|
|
130
|
+
> "Track a $49.99 Stripe payment"
|
|
131
|
+
|
|
132
|
+
The AI will call `flowsight_send_event` with the payment details.
|
|
133
|
+
|
|
134
|
+
## Development
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Install dependencies
|
|
138
|
+
npm install
|
|
139
|
+
|
|
140
|
+
# Run in development mode
|
|
141
|
+
FLOWSIGHT_API_KEY=fs_test_... npm run dev
|
|
142
|
+
|
|
143
|
+
# Build
|
|
144
|
+
npm run build
|
|
145
|
+
|
|
146
|
+
# Run tests
|
|
147
|
+
npm test
|
|
148
|
+
|
|
149
|
+
# Type check
|
|
150
|
+
npm run typecheck
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
MIT — [FlowSight](https://flowsight.pro)
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module api-client
|
|
3
|
+
* Lightweight HTTP client for the FlowSight API.
|
|
4
|
+
* Used by MCP tools to call FlowSight endpoints.
|
|
5
|
+
*/
|
|
6
|
+
import type { Config } from './config.js';
|
|
7
|
+
export interface ApiResponse<T = unknown> {
|
|
8
|
+
ok: boolean;
|
|
9
|
+
status: number;
|
|
10
|
+
data: T;
|
|
11
|
+
}
|
|
12
|
+
export interface PaymentEvent {
|
|
13
|
+
event_id?: string;
|
|
14
|
+
event_type: string;
|
|
15
|
+
timestamp?: string;
|
|
16
|
+
flow_id: string;
|
|
17
|
+
transaction_id: string;
|
|
18
|
+
processor: string;
|
|
19
|
+
amount: number;
|
|
20
|
+
currency: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
latency_ms?: number;
|
|
23
|
+
payment_method?: Record<string, unknown>;
|
|
24
|
+
error?: {
|
|
25
|
+
code: string;
|
|
26
|
+
category: string;
|
|
27
|
+
message: string;
|
|
28
|
+
processor_code?: string;
|
|
29
|
+
retriable: boolean;
|
|
30
|
+
};
|
|
31
|
+
processor_response?: Record<string, unknown>;
|
|
32
|
+
context?: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
export interface EventsQueryParams {
|
|
35
|
+
page?: number;
|
|
36
|
+
limit?: number;
|
|
37
|
+
processor?: string;
|
|
38
|
+
status?: string;
|
|
39
|
+
event_type?: string;
|
|
40
|
+
from?: string;
|
|
41
|
+
to?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface EventsResponse {
|
|
44
|
+
events: PaymentEvent[];
|
|
45
|
+
total: number;
|
|
46
|
+
page: number;
|
|
47
|
+
limit: number;
|
|
48
|
+
}
|
|
49
|
+
export interface FlowResponse {
|
|
50
|
+
flow_id: string;
|
|
51
|
+
events: PaymentEvent[];
|
|
52
|
+
summary?: {
|
|
53
|
+
status: string;
|
|
54
|
+
total_events: number;
|
|
55
|
+
first_event: string;
|
|
56
|
+
last_event: string;
|
|
57
|
+
amount: number;
|
|
58
|
+
currency: string;
|
|
59
|
+
processor: string;
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export interface IngestResponse {
|
|
63
|
+
accepted: number;
|
|
64
|
+
rejected: number;
|
|
65
|
+
errors: Array<{
|
|
66
|
+
index: number;
|
|
67
|
+
event_id: string;
|
|
68
|
+
code: string;
|
|
69
|
+
message: string;
|
|
70
|
+
}>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* FlowSight API client for the MCP server.
|
|
74
|
+
*/
|
|
75
|
+
export declare class FlowSightApiClient {
|
|
76
|
+
private readonly baseUrl;
|
|
77
|
+
private readonly apiKey;
|
|
78
|
+
private readonly timeoutMs;
|
|
79
|
+
constructor(config: Config);
|
|
80
|
+
/**
|
|
81
|
+
* Send payment events to FlowSight.
|
|
82
|
+
*/
|
|
83
|
+
sendEvents(events: PaymentEvent[]): Promise<ApiResponse<IngestResponse>>;
|
|
84
|
+
/**
|
|
85
|
+
* Query events with filters.
|
|
86
|
+
*/
|
|
87
|
+
queryEvents(params: EventsQueryParams): Promise<ApiResponse<EventsResponse>>;
|
|
88
|
+
/**
|
|
89
|
+
* Get a payment flow by ID.
|
|
90
|
+
*/
|
|
91
|
+
getFlow(flowId: string): Promise<ApiResponse<FlowResponse>>;
|
|
92
|
+
/**
|
|
93
|
+
* List configured processors.
|
|
94
|
+
*/
|
|
95
|
+
listProcessors(): Promise<ApiResponse<{
|
|
96
|
+
processors: string[];
|
|
97
|
+
}>>;
|
|
98
|
+
private request;
|
|
99
|
+
}
|
|
100
|
+
//# sourceMappingURL=api-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,WAAW,WAAW,CAAC,CAAC,GAAG,OAAO;IACtC,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,CAAC,CAAC;CACT;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACzC,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,SAAS,EAAE,OAAO,CAAC;KACpB,CAAC;IACF,kBAAkB,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,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AE,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAI9E;;OAEG;IACG,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAclF;;OAEG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;IAIjE;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;QAAE,UAAU,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;YAYxD,OAAO;CAkCtB"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module api-client
|
|
3
|
+
* Lightweight HTTP client for the FlowSight API.
|
|
4
|
+
* Used by MCP tools to call FlowSight endpoints.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* FlowSight API client for the MCP server.
|
|
8
|
+
*/
|
|
9
|
+
export class FlowSightApiClient {
|
|
10
|
+
baseUrl;
|
|
11
|
+
apiKey;
|
|
12
|
+
timeoutMs;
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, '');
|
|
15
|
+
this.apiKey = config.apiKey;
|
|
16
|
+
this.timeoutMs = config.timeoutMs;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Send payment events to FlowSight.
|
|
20
|
+
*/
|
|
21
|
+
async sendEvents(events) {
|
|
22
|
+
return this.request('POST', '/v1/events', { events });
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Query events with filters.
|
|
26
|
+
*/
|
|
27
|
+
async queryEvents(params) {
|
|
28
|
+
const qs = new URLSearchParams();
|
|
29
|
+
if (params.page)
|
|
30
|
+
qs.set('page', String(params.page));
|
|
31
|
+
if (params.limit)
|
|
32
|
+
qs.set('limit', String(params.limit));
|
|
33
|
+
if (params.processor)
|
|
34
|
+
qs.set('processor', params.processor);
|
|
35
|
+
if (params.status)
|
|
36
|
+
qs.set('status', params.status);
|
|
37
|
+
if (params.event_type)
|
|
38
|
+
qs.set('event_type', params.event_type);
|
|
39
|
+
if (params.from)
|
|
40
|
+
qs.set('from', params.from);
|
|
41
|
+
if (params.to)
|
|
42
|
+
qs.set('to', params.to);
|
|
43
|
+
const query = qs.toString();
|
|
44
|
+
return this.request('GET', `/v1/events${query ? '?' + query : ''}`);
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get a payment flow by ID.
|
|
48
|
+
*/
|
|
49
|
+
async getFlow(flowId) {
|
|
50
|
+
return this.request('GET', `/v1/flows/${encodeURIComponent(flowId)}`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* List configured processors.
|
|
54
|
+
*/
|
|
55
|
+
async listProcessors() {
|
|
56
|
+
// The processors list comes from the API's supported processors.
|
|
57
|
+
// If no dedicated endpoint exists, return the known set.
|
|
58
|
+
return {
|
|
59
|
+
ok: true,
|
|
60
|
+
status: 200,
|
|
61
|
+
data: {
|
|
62
|
+
processors: ['stripe', 'paypal', 'adyen', 'redsys'],
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
async request(method, path, body) {
|
|
67
|
+
const url = `${this.baseUrl}${path}`;
|
|
68
|
+
const controller = new AbortController();
|
|
69
|
+
const timeout = setTimeout(() => controller.abort(), this.timeoutMs);
|
|
70
|
+
try {
|
|
71
|
+
const headers = {
|
|
72
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
73
|
+
'X-FlowSight-SDK': 'flowsight-mcp/1.0.0',
|
|
74
|
+
'Accept': 'application/json',
|
|
75
|
+
};
|
|
76
|
+
const init = {
|
|
77
|
+
method,
|
|
78
|
+
headers,
|
|
79
|
+
signal: controller.signal,
|
|
80
|
+
};
|
|
81
|
+
if (body) {
|
|
82
|
+
headers['Content-Type'] = 'application/json';
|
|
83
|
+
init.body = JSON.stringify(body);
|
|
84
|
+
}
|
|
85
|
+
const res = await fetch(url, init);
|
|
86
|
+
const data = await res.json();
|
|
87
|
+
return { ok: res.ok, status: res.status, data };
|
|
88
|
+
}
|
|
89
|
+
catch (err) {
|
|
90
|
+
const message = err instanceof Error ? err.message : 'Unknown error';
|
|
91
|
+
throw new Error(`FlowSight API request failed: ${method} ${path} — ${message}`);
|
|
92
|
+
}
|
|
93
|
+
finally {
|
|
94
|
+
clearTimeout(timeout);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAsEH;;GAEG;AACH,MAAM,OAAO,kBAAkB;IACZ,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,SAAS,CAAS;IAEnC,YAAY,MAAc;QACxB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACjD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;IACpC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,UAAU,CAAC,MAAsB;QACrC,OAAO,IAAI,CAAC,OAAO,CAAiB,MAAM,EAAE,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,WAAW,CAAC,MAAyB;QACzC,MAAM,EAAE,GAAG,IAAI,eAAe,EAAE,CAAC;QACjC,IAAI,MAAM,CAAC,IAAI;YAAE,EAAE,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;QACrD,IAAI,MAAM,CAAC,KAAK;YAAE,EAAE,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CA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/dist/config.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module config
|
|
3
|
+
* Configuration for the FlowSight MCP server.
|
|
4
|
+
* All config comes from environment variables.
|
|
5
|
+
*/
|
|
6
|
+
export interface Config {
|
|
7
|
+
/** FlowSight API key (fs_live_... or fs_test_...) */
|
|
8
|
+
apiKey: string;
|
|
9
|
+
/** FlowSight API base URL */
|
|
10
|
+
baseUrl: string;
|
|
11
|
+
/** Request timeout in milliseconds */
|
|
12
|
+
timeoutMs: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Load configuration from environment variables.
|
|
16
|
+
* @throws If FLOWSIGHT_API_KEY is not set.
|
|
17
|
+
*/
|
|
18
|
+
export declare function loadConfig(): Config;
|
|
19
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,MAAM;IACrB,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,6BAA6B;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;CACnB;AAKD;;;GAGG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAcnC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module config
|
|
3
|
+
* Configuration for the FlowSight MCP server.
|
|
4
|
+
* All config comes from environment variables.
|
|
5
|
+
*/
|
|
6
|
+
const DEFAULT_BASE_URL = 'https://ingest.flowsight.pro';
|
|
7
|
+
const DEFAULT_TIMEOUT_MS = 30_000;
|
|
8
|
+
/**
|
|
9
|
+
* Load configuration from environment variables.
|
|
10
|
+
* @throws If FLOWSIGHT_API_KEY is not set.
|
|
11
|
+
*/
|
|
12
|
+
export function loadConfig() {
|
|
13
|
+
const apiKey = process.env.FLOWSIGHT_API_KEY;
|
|
14
|
+
if (!apiKey) {
|
|
15
|
+
throw new Error('FLOWSIGHT_API_KEY environment variable is required.\n' +
|
|
16
|
+
'Get your API key at https://app.flowsight.pro/settings');
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
apiKey,
|
|
20
|
+
baseUrl: process.env.FLOWSIGHT_BASE_URL ?? DEFAULT_BASE_URL,
|
|
21
|
+
timeoutMs: parseInt(process.env.FLOWSIGHT_TIMEOUT_MS ?? '', 10) || DEFAULT_TIMEOUT_MS,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAWH,MAAM,gBAAgB,GAAG,8BAA8B,CAAC;AACxD,MAAM,kBAAkB,GAAG,MAAM,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;IAC7C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,uDAAuD;YACvD,wDAAwD,CACzD,CAAC;IACJ,CAAC;IAED,OAAO;QACL,MAAM;QACN,OAAO,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,gBAAgB;QAC3D,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,kBAAkB;KACtF,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @module index
|
|
4
|
+
* FlowSight MCP Server entry point.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* FLOWSIGHT_API_KEY=fs_live_... npx @flowsight/mcp-server
|
|
8
|
+
*
|
|
9
|
+
* Or in Claude Desktop config:
|
|
10
|
+
* {
|
|
11
|
+
* "mcpServers": {
|
|
12
|
+
* "flowsight": {
|
|
13
|
+
* "command": "npx",
|
|
14
|
+
* "args": ["@flowsight/mcp-server"],
|
|
15
|
+
* "env": { "FLOWSIGHT_API_KEY": "fs_live_..." }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
*/
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @module index
|
|
4
|
+
* FlowSight MCP Server entry point.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* FLOWSIGHT_API_KEY=fs_live_... npx @flowsight/mcp-server
|
|
8
|
+
*
|
|
9
|
+
* Or in Claude Desktop config:
|
|
10
|
+
* {
|
|
11
|
+
* "mcpServers": {
|
|
12
|
+
* "flowsight": {
|
|
13
|
+
* "command": "npx",
|
|
14
|
+
* "args": ["@flowsight/mcp-server"],
|
|
15
|
+
* "env": { "FLOWSIGHT_API_KEY": "fs_live_..." }
|
|
16
|
+
* }
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
*/
|
|
20
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
21
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
22
|
+
import { loadConfig } from './config.js';
|
|
23
|
+
import { FlowSightApiClient } from './api-client.js';
|
|
24
|
+
import { registerTools } from './tools.js';
|
|
25
|
+
async function main() {
|
|
26
|
+
// Load configuration from environment
|
|
27
|
+
const config = loadConfig();
|
|
28
|
+
// Create API client
|
|
29
|
+
const apiClient = new FlowSightApiClient(config);
|
|
30
|
+
// Create MCP server
|
|
31
|
+
const server = new McpServer({
|
|
32
|
+
name: 'flowsight',
|
|
33
|
+
version: '1.0.0',
|
|
34
|
+
});
|
|
35
|
+
// Register all tools
|
|
36
|
+
registerTools(server, apiClient);
|
|
37
|
+
// Connect via stdio transport (for Claude Desktop / MCP clients)
|
|
38
|
+
const transport = new StdioServerTransport();
|
|
39
|
+
await server.connect(transport);
|
|
40
|
+
// Log to stderr (stdout is reserved for MCP protocol)
|
|
41
|
+
console.error('FlowSight MCP server started');
|
|
42
|
+
console.error(` API: ${config.baseUrl}`);
|
|
43
|
+
console.error(` Key: ${config.apiKey.slice(0, 12)}...`);
|
|
44
|
+
}
|
|
45
|
+
main().catch((err) => {
|
|
46
|
+
console.error('Fatal:', err instanceof Error ? err.message : err);
|
|
47
|
+
process.exit(1);
|
|
48
|
+
});
|
|
49
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,KAAK,UAAU,IAAI;IACjB,sCAAsC;IACtC,MAAM,MAAM,GAAG,UAAU,EAAE,CAAC;IAE5B,oBAAoB;IACpB,MAAM,SAAS,GAAG,IAAI,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAEjD,oBAAoB;IACpB,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;QAC3B,IAAI,EAAE,WAAW;QACjB,OAAO,EAAE,OAAO;KACjB,CAAC,CAAC;IAEH,qBAAqB;IACrB,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEjC,iEAAiE;IACjE,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,sDAAsD;IACtD,OAAO,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAC9C,OAAO,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;IAC1C,OAAO,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAClE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module tools
|
|
3
|
+
* MCP tool definitions for FlowSight.
|
|
4
|
+
* Each tool wraps a FlowSight API operation.
|
|
5
|
+
*/
|
|
6
|
+
import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
7
|
+
import type { FlowSightApiClient } from './api-client.js';
|
|
8
|
+
/**
|
|
9
|
+
* Register all FlowSight tools on the MCP server.
|
|
10
|
+
*/
|
|
11
|
+
export declare function registerTools(server: McpServer, client: FlowSightApiClient): void;
|
|
12
|
+
//# sourceMappingURL=tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACzE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D;;GAEG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAKjF"}
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @module tools
|
|
3
|
+
* MCP tool definitions for FlowSight.
|
|
4
|
+
* Each tool wraps a FlowSight API operation.
|
|
5
|
+
*/
|
|
6
|
+
import { z } from 'zod';
|
|
7
|
+
/**
|
|
8
|
+
* Register all FlowSight tools on the MCP server.
|
|
9
|
+
*/
|
|
10
|
+
export function registerTools(server, client) {
|
|
11
|
+
registerSendEvent(server, client);
|
|
12
|
+
registerQueryEvents(server, client);
|
|
13
|
+
registerGetFlow(server, client);
|
|
14
|
+
registerListProcessors(server, client);
|
|
15
|
+
}
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// flowsight_send_event
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
function registerSendEvent(server, client) {
|
|
20
|
+
server.registerTool('flowsight_send_event', {
|
|
21
|
+
title: 'Send Payment Event',
|
|
22
|
+
description: 'Send a payment event to FlowSight for tracking and analysis. ' +
|
|
23
|
+
'Use this to report payment lifecycle events (started, completed, failed, retried, refunds).',
|
|
24
|
+
inputSchema: z.object({
|
|
25
|
+
event_type: z.enum([
|
|
26
|
+
'payment.started',
|
|
27
|
+
'payment.completed',
|
|
28
|
+
'payment.failed',
|
|
29
|
+
'payment.retried',
|
|
30
|
+
'refund.started',
|
|
31
|
+
'refund.completed',
|
|
32
|
+
'refund.failed',
|
|
33
|
+
]).describe('Payment lifecycle event type'),
|
|
34
|
+
flow_id: z.string().describe('UUID grouping related events into a payment flow'),
|
|
35
|
+
transaction_id: z.string().describe('Processor transaction/payment-intent ID'),
|
|
36
|
+
processor: z.enum(['stripe', 'paypal', 'adyen', 'redsys']).describe('Payment processor'),
|
|
37
|
+
amount: z.number().int().min(0).describe('Amount in smallest currency unit (e.g. cents)'),
|
|
38
|
+
currency: z.string().length(3).describe('ISO 4217 currency code (e.g. USD, EUR)'),
|
|
39
|
+
status: z.enum(['succeeded', 'failed', 'pending', 'cancelled']).optional().describe('Payment status'),
|
|
40
|
+
latency_ms: z.number().int().min(0).optional().describe('Processor response time in ms'),
|
|
41
|
+
error_code: z.string().optional().describe('Error code for failed payments'),
|
|
42
|
+
error_message: z.string().optional().describe('Error message for failed payments'),
|
|
43
|
+
context: z.record(z.string()).optional().describe('Arbitrary key-value metadata'),
|
|
44
|
+
}),
|
|
45
|
+
}, async (params) => {
|
|
46
|
+
const event = {
|
|
47
|
+
event_type: params.event_type,
|
|
48
|
+
flow_id: params.flow_id,
|
|
49
|
+
transaction_id: params.transaction_id,
|
|
50
|
+
processor: params.processor,
|
|
51
|
+
amount: params.amount,
|
|
52
|
+
currency: params.currency.toUpperCase(),
|
|
53
|
+
status: params.status,
|
|
54
|
+
latency_ms: params.latency_ms,
|
|
55
|
+
context: params.context,
|
|
56
|
+
};
|
|
57
|
+
if (params.error_code || params.error_message) {
|
|
58
|
+
event.error = {
|
|
59
|
+
code: params.error_code ?? 'unknown',
|
|
60
|
+
category: 'unknown',
|
|
61
|
+
message: params.error_message ?? 'Unknown error',
|
|
62
|
+
retriable: false,
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
try {
|
|
66
|
+
const res = await client.sendEvents([event]);
|
|
67
|
+
if (!res.ok) {
|
|
68
|
+
return {
|
|
69
|
+
content: [{ type: 'text', text: `Error sending event: HTTP ${res.status} — ${JSON.stringify(res.data)}` }],
|
|
70
|
+
isError: true,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return {
|
|
74
|
+
content: [{
|
|
75
|
+
type: 'text',
|
|
76
|
+
text: `✓ Event sent successfully.\nAccepted: ${res.data.accepted}, Rejected: ${res.data.rejected}` +
|
|
77
|
+
(res.data.errors?.length ? `\nErrors: ${JSON.stringify(res.data.errors)}` : ''),
|
|
78
|
+
}],
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
catch (err) {
|
|
82
|
+
return {
|
|
83
|
+
content: [{ type: 'text', text: `Failed to send event: ${err instanceof Error ? err.message : 'Unknown error'}` }],
|
|
84
|
+
isError: true,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// ---------------------------------------------------------------------------
|
|
90
|
+
// flowsight_query_events
|
|
91
|
+
// ---------------------------------------------------------------------------
|
|
92
|
+
function registerQueryEvents(server, client) {
|
|
93
|
+
server.registerTool('flowsight_query_events', {
|
|
94
|
+
title: 'Query Payment Events',
|
|
95
|
+
description: 'Query payment events from FlowSight with optional filters. ' +
|
|
96
|
+
'Returns paginated results with event details.',
|
|
97
|
+
inputSchema: z.object({
|
|
98
|
+
processor: z.enum(['stripe', 'paypal', 'adyen', 'redsys']).optional().describe('Filter by processor'),
|
|
99
|
+
status: z.enum(['succeeded', 'failed', 'pending', 'cancelled']).optional().describe('Filter by status'),
|
|
100
|
+
event_type: z.enum([
|
|
101
|
+
'payment.started', 'payment.completed', 'payment.failed', 'payment.retried',
|
|
102
|
+
'refund.started', 'refund.completed', 'refund.failed',
|
|
103
|
+
]).optional().describe('Filter by event type'),
|
|
104
|
+
from: z.string().optional().describe('Start time (ISO 8601)'),
|
|
105
|
+
to: z.string().optional().describe('End time (ISO 8601)'),
|
|
106
|
+
page: z.number().int().min(1).optional().describe('Page number (default 1)'),
|
|
107
|
+
limit: z.number().int().min(1).max(100).optional().describe('Results per page (default 20, max 100)'),
|
|
108
|
+
}),
|
|
109
|
+
}, async (params) => {
|
|
110
|
+
try {
|
|
111
|
+
const res = await client.queryEvents({
|
|
112
|
+
processor: params.processor,
|
|
113
|
+
status: params.status,
|
|
114
|
+
event_type: params.event_type,
|
|
115
|
+
from: params.from,
|
|
116
|
+
to: params.to,
|
|
117
|
+
page: params.page,
|
|
118
|
+
limit: params.limit,
|
|
119
|
+
});
|
|
120
|
+
if (!res.ok) {
|
|
121
|
+
return {
|
|
122
|
+
content: [{ type: 'text', text: `Error querying events: HTTP ${res.status} — ${JSON.stringify(res.data)}` }],
|
|
123
|
+
isError: true,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
const { events, total, page, limit } = res.data;
|
|
127
|
+
const lines = [
|
|
128
|
+
`Found ${total} events (page ${page}, ${limit} per page)`,
|
|
129
|
+
'',
|
|
130
|
+
];
|
|
131
|
+
for (const ev of events) {
|
|
132
|
+
lines.push(`• ${ev.event_type} | ${ev.processor} | ${ev.status ?? 'unknown'} | ` +
|
|
133
|
+
`${ev.amount} ${ev.currency} | ${ev.transaction_id} | ${ev.timestamp ?? ''}`);
|
|
134
|
+
if (ev.error) {
|
|
135
|
+
lines.push(` ⚠ Error: ${ev.error.code} — ${ev.error.message}`);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
139
|
+
}
|
|
140
|
+
catch (err) {
|
|
141
|
+
return {
|
|
142
|
+
content: [{ type: 'text', text: `Failed to query events: ${err instanceof Error ? err.message : 'Unknown error'}` }],
|
|
143
|
+
isError: true,
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// ---------------------------------------------------------------------------
|
|
149
|
+
// flowsight_get_flow
|
|
150
|
+
// ---------------------------------------------------------------------------
|
|
151
|
+
function registerGetFlow(server, client) {
|
|
152
|
+
server.registerTool('flowsight_get_flow', {
|
|
153
|
+
title: 'Get Payment Flow',
|
|
154
|
+
description: 'Retrieve a complete payment flow by its flow ID. ' +
|
|
155
|
+
'Shows all events in the payment lifecycle (started → completed/failed → refunded).',
|
|
156
|
+
inputSchema: z.object({
|
|
157
|
+
flow_id: z.string().describe('The flow ID (UUID) to look up'),
|
|
158
|
+
}),
|
|
159
|
+
}, async (params) => {
|
|
160
|
+
try {
|
|
161
|
+
const res = await client.getFlow(params.flow_id);
|
|
162
|
+
if (!res.ok) {
|
|
163
|
+
return {
|
|
164
|
+
content: [{ type: 'text', text: `Error fetching flow: HTTP ${res.status} — ${JSON.stringify(res.data)}` }],
|
|
165
|
+
isError: true,
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
const { flow_id, events, summary } = res.data;
|
|
169
|
+
const lines = [`Payment Flow: ${flow_id}`, ''];
|
|
170
|
+
if (summary) {
|
|
171
|
+
lines.push(`Status: ${summary.status}`, `Processor: ${summary.processor}`, `Amount: ${summary.amount} ${summary.currency}`, `Events: ${summary.total_events}`, `First: ${summary.first_event}`, `Last: ${summary.last_event}`, '');
|
|
172
|
+
}
|
|
173
|
+
lines.push('Timeline:');
|
|
174
|
+
for (const ev of events) {
|
|
175
|
+
lines.push(` ${ev.timestamp ?? '?'} | ${ev.event_type} | ${ev.status ?? ''}` +
|
|
176
|
+
(ev.latency_ms ? ` | ${ev.latency_ms}ms` : ''));
|
|
177
|
+
if (ev.error) {
|
|
178
|
+
lines.push(` ⚠ ${ev.error.code}: ${ev.error.message}`);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
return {
|
|
185
|
+
content: [{ type: 'text', text: `Failed to get flow: ${err instanceof Error ? err.message : 'Unknown error'}` }],
|
|
186
|
+
isError: true,
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
// ---------------------------------------------------------------------------
|
|
192
|
+
// flowsight_list_processors
|
|
193
|
+
// ---------------------------------------------------------------------------
|
|
194
|
+
function registerListProcessors(server, client) {
|
|
195
|
+
server.registerTool('flowsight_list_processors', {
|
|
196
|
+
title: 'List Payment Processors',
|
|
197
|
+
description: 'List all payment processors supported by FlowSight. ' +
|
|
198
|
+
'Shows which processors can be used with webhook adapters and SDK events.',
|
|
199
|
+
inputSchema: z.object({}),
|
|
200
|
+
}, async () => {
|
|
201
|
+
try {
|
|
202
|
+
const res = await client.listProcessors();
|
|
203
|
+
const processors = res.data.processors;
|
|
204
|
+
const lines = [
|
|
205
|
+
`FlowSight supports ${processors.length} payment processors:`,
|
|
206
|
+
'',
|
|
207
|
+
...processors.map((p) => {
|
|
208
|
+
const info = processorInfo[p] ?? { name: p, webhook: 'Unknown' };
|
|
209
|
+
return `• ${info.name} (${p}) — Webhook: ${info.webhook}`;
|
|
210
|
+
}),
|
|
211
|
+
'',
|
|
212
|
+
'To set up webhooks, configure each processor to POST to:',
|
|
213
|
+
' POST /v1/webhooks/{processor}/{tenant-slug}',
|
|
214
|
+
];
|
|
215
|
+
return { content: [{ type: 'text', text: lines.join('\n') }] };
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
return {
|
|
219
|
+
content: [{ type: 'text', text: `Failed to list processors: ${err instanceof Error ? err.message : 'Unknown error'}` }],
|
|
220
|
+
isError: true,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
const processorInfo = {
|
|
226
|
+
stripe: { name: 'Stripe', webhook: 'Stripe-Signature header (HMAC-SHA256)' },
|
|
227
|
+
paypal: { name: 'PayPal', webhook: 'PAYPAL-TRANSMISSION-SIG header (HMAC-SHA256)' },
|
|
228
|
+
adyen: { name: 'Adyen', webhook: 'HMAC in additionalData.hmacSignature (HMAC-SHA256)' },
|
|
229
|
+
redsys: { name: 'Redsys', webhook: '3DES-CBC + HMAC-SHA256 on Ds_MerchantParameters' },
|
|
230
|
+
};
|
|
231
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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gBAC1D,+CAA+C;aAChD,CAAC;YAEF,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC;QACjE,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC;gBACvH,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC;AAED,MAAM,aAAa,GAAsD;IACvE,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,uCAAuC,EAAE;IAC5E,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,8CAA8C,EAAE;IACnF,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,oDAAoD,EAAE;IACvF,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,iDAAiD,EAAE;CACvF,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@flowsight/mcp-server",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "FlowSight MCP server — expose payment observability tools to AI assistants",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "FlowSight <sdk@flowsight.pro>",
|
|
7
|
+
"homepage": "https://flowsight.pro",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "https://github.com/flowsight/mcp-server.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"mcp",
|
|
14
|
+
"model-context-protocol",
|
|
15
|
+
"payments",
|
|
16
|
+
"observability",
|
|
17
|
+
"flowsight",
|
|
18
|
+
"ai",
|
|
19
|
+
"claude"
|
|
20
|
+
],
|
|
21
|
+
"type": "module",
|
|
22
|
+
"main": "./dist/index.js",
|
|
23
|
+
"types": "./dist/index.d.ts",
|
|
24
|
+
"bin": {
|
|
25
|
+
"flowsight-mcp": "./dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"dist",
|
|
29
|
+
"README.md",
|
|
30
|
+
"LICENSE"
|
|
31
|
+
],
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18.0.0"
|
|
34
|
+
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsc",
|
|
37
|
+
"dev": "tsx src/index.ts",
|
|
38
|
+
"start": "node dist/index.js",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"test": "vitest run",
|
|
41
|
+
"test:watch": "vitest"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
45
|
+
"zod": "^3.23.0"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
48
|
+
"@types/node": "^22.0.0",
|
|
49
|
+
"tsx": "^4.19.0",
|
|
50
|
+
"typescript": "^5.7.0",
|
|
51
|
+
"vitest": "^1.6.0"
|
|
52
|
+
}
|
|
53
|
+
}
|