fetchpet-mcp-server 0.1.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/README.md +181 -0
- package/build/index.integration-with-mock.js +166 -0
- package/build/index.js +129 -0
- package/package.json +53 -0
- package/shared/index.d.ts +5 -0
- package/shared/index.js +6 -0
- package/shared/logging.d.ts +20 -0
- package/shared/logging.js +34 -0
- package/shared/server.d.ts +135 -0
- package/shared/server.js +831 -0
- package/shared/tools.d.ts +8 -0
- package/shared/tools.js +403 -0
- package/shared/types.d.ts +105 -0
- package/shared/types.js +24 -0
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import type { FetchPetConfig, Claim, ClaimDetails, ClaimSubmissionData, ClaimSubmissionResult } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Fetch Pet client interface
|
|
5
|
+
* Defines all methods for interacting with the Fetch Pet insurance portal
|
|
6
|
+
*/
|
|
7
|
+
export interface IFetchPetClient {
|
|
8
|
+
/**
|
|
9
|
+
* Initialize the browser and log in to Fetch Pet
|
|
10
|
+
* Must be called before using other methods
|
|
11
|
+
*/
|
|
12
|
+
initialize(): Promise<void>;
|
|
13
|
+
/**
|
|
14
|
+
* Prepare a claim for submission by filling out the form
|
|
15
|
+
* Does NOT submit - just validates and returns what would be submitted
|
|
16
|
+
*/
|
|
17
|
+
prepareClaimToSubmit(petName: string, invoiceDate: string, invoiceAmount: string, providerName: string, claimDescription: string, invoiceFilePath?: string, medicalRecordsPath?: string): Promise<ClaimSubmissionData>;
|
|
18
|
+
/**
|
|
19
|
+
* Actually submit a prepared claim
|
|
20
|
+
* Requires user confirmation via token from prepareClaimToSubmit
|
|
21
|
+
*/
|
|
22
|
+
submitClaim(confirmationToken: string): Promise<ClaimSubmissionResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Get all claims (both active and historical)
|
|
25
|
+
*/
|
|
26
|
+
getClaims(): Promise<Claim[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Get detailed information about a specific claim
|
|
29
|
+
* Including EOB, invoice summaries, and downloads
|
|
30
|
+
*/
|
|
31
|
+
getClaimDetails(claimId: string): Promise<ClaimDetails>;
|
|
32
|
+
/**
|
|
33
|
+
* Get the current page URL
|
|
34
|
+
*/
|
|
35
|
+
getCurrentUrl(): Promise<string>;
|
|
36
|
+
/**
|
|
37
|
+
* Close the browser
|
|
38
|
+
*/
|
|
39
|
+
close(): Promise<void>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the configuration
|
|
42
|
+
*/
|
|
43
|
+
getConfig(): FetchPetConfig;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Fetch Pet client implementation using Playwright
|
|
47
|
+
*/
|
|
48
|
+
export declare class FetchPetClient implements IFetchPetClient {
|
|
49
|
+
private browser;
|
|
50
|
+
private context;
|
|
51
|
+
private page;
|
|
52
|
+
private config;
|
|
53
|
+
private isInitialized;
|
|
54
|
+
private pendingClaimData;
|
|
55
|
+
private pendingConfirmationToken;
|
|
56
|
+
private pendingTokenCreatedAt;
|
|
57
|
+
private static readonly TOKEN_EXPIRY_MS;
|
|
58
|
+
constructor(config: FetchPetConfig);
|
|
59
|
+
private ensureBrowser;
|
|
60
|
+
/**
|
|
61
|
+
* Extract claim data from active claim cards on the current page.
|
|
62
|
+
* The history tab uses extractHistoricalClaimsFromPage instead,
|
|
63
|
+
* due to a completely different DOM structure.
|
|
64
|
+
*/
|
|
65
|
+
private extractClaimsFromPage;
|
|
66
|
+
initialize(): Promise<void>;
|
|
67
|
+
prepareClaimToSubmit(petName: string, invoiceDate: string, invoiceAmount: string, providerName: string, claimDescription: string, invoiceFilePath?: string, medicalRecordsPath?: string): Promise<ClaimSubmissionData>;
|
|
68
|
+
private buildClaimResult;
|
|
69
|
+
submitClaim(confirmationToken: string): Promise<ClaimSubmissionResult>;
|
|
70
|
+
getClaims(): Promise<Claim[]>;
|
|
71
|
+
/**
|
|
72
|
+
* Extract claims from the History tab's table layout.
|
|
73
|
+
* History uses .claim-number-closed, .closed-claim-price, .claims-history-title
|
|
74
|
+
* which is completely different from the Active tab's .claim-card-data-list structure.
|
|
75
|
+
*/
|
|
76
|
+
private extractHistoricalClaimsFromPage;
|
|
77
|
+
/**
|
|
78
|
+
* Download a document by clicking its link, which opens a popup with a blob: iframe.
|
|
79
|
+
* Fetches the blob data from the popup and saves it to disk.
|
|
80
|
+
*/
|
|
81
|
+
private downloadDocumentFromPopup;
|
|
82
|
+
getClaimDetails(claimId: string): Promise<ClaimDetails>;
|
|
83
|
+
getCurrentUrl(): Promise<string>;
|
|
84
|
+
close(): Promise<void>;
|
|
85
|
+
getConfig(): FetchPetConfig;
|
|
86
|
+
}
|
|
87
|
+
export type ClientFactory = () => IFetchPetClient;
|
|
88
|
+
/**
|
|
89
|
+
* Callback invoked when background login fails
|
|
90
|
+
* @param error The error that caused login to fail
|
|
91
|
+
*/
|
|
92
|
+
export type LoginFailedCallback = (error: Error) => void;
|
|
93
|
+
export interface CreateMCPServerOptions {
|
|
94
|
+
version: string;
|
|
95
|
+
}
|
|
96
|
+
export declare function createMCPServer(options: CreateMCPServerOptions): {
|
|
97
|
+
server: Server<{
|
|
98
|
+
method: string;
|
|
99
|
+
params?: {
|
|
100
|
+
[x: string]: unknown;
|
|
101
|
+
_meta?: {
|
|
102
|
+
[x: string]: unknown;
|
|
103
|
+
progressToken?: string | number | undefined;
|
|
104
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
105
|
+
taskId: string;
|
|
106
|
+
} | undefined;
|
|
107
|
+
} | undefined;
|
|
108
|
+
} | undefined;
|
|
109
|
+
}, {
|
|
110
|
+
method: string;
|
|
111
|
+
params?: {
|
|
112
|
+
[x: string]: unknown;
|
|
113
|
+
_meta?: {
|
|
114
|
+
[x: string]: unknown;
|
|
115
|
+
progressToken?: string | number | undefined;
|
|
116
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
117
|
+
taskId: string;
|
|
118
|
+
} | undefined;
|
|
119
|
+
} | undefined;
|
|
120
|
+
} | undefined;
|
|
121
|
+
}, {
|
|
122
|
+
[x: string]: unknown;
|
|
123
|
+
_meta?: {
|
|
124
|
+
[x: string]: unknown;
|
|
125
|
+
progressToken?: string | number | undefined;
|
|
126
|
+
"io.modelcontextprotocol/related-task"?: {
|
|
127
|
+
taskId: string;
|
|
128
|
+
} | undefined;
|
|
129
|
+
} | undefined;
|
|
130
|
+
}>;
|
|
131
|
+
registerHandlers: (server: Server, clientFactory?: ClientFactory) => Promise<void>;
|
|
132
|
+
cleanup: () => Promise<void>;
|
|
133
|
+
startBackgroundLogin: (onFailed?: LoginFailedCallback) => void;
|
|
134
|
+
};
|
|
135
|
+
//# sourceMappingURL=server.d.ts.map
|