@insightsentry/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/README.md +137 -0
- package/bin/insightsentry-mcp.js +2 -0
- package/dist/api-client.d.ts +6 -0
- package/dist/api-client.d.ts.map +1 -0
- package/dist/api-client.js +92 -0
- package/dist/api-client.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +122 -0
- package/dist/index.js.map +1 -0
- package/dist/resources.d.ts +9 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +2693 -0
- package/dist/resources.js.map +1 -0
- package/dist/tool-definitions.d.ts +10 -0
- package/dist/tool-definitions.d.ts.map +1 -0
- package/dist/tool-definitions.js +309 -0
- package/dist/tool-definitions.js.map +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# @insightsentry/mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for the [InsightSentry](https://insightsentry.com) financial data API.
|
|
4
|
+
|
|
5
|
+
Gives AI assistants direct access to real-time and historical market data for equities, futures, options, crypto, forex, and more — plus comprehensive documentation resources for building applications with the InsightSentry API and WebSocket feeds.
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
### Prerequisites
|
|
10
|
+
|
|
11
|
+
Get your API key from the [InsightSentry Dashboard](https://insightsentry.com/dashboard).
|
|
12
|
+
|
|
13
|
+
### Claude Desktop
|
|
14
|
+
|
|
15
|
+
Add to your `claude_desktop_config.json`:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"insightsentry": {
|
|
21
|
+
"command": "npx",
|
|
22
|
+
"args": ["@insightsentry/mcp"],
|
|
23
|
+
"env": {
|
|
24
|
+
"INSIGHTSENTRY_API_KEY": "your-api-key"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Claude Code
|
|
32
|
+
|
|
33
|
+
Add to `.mcp.json` in your project root:
|
|
34
|
+
|
|
35
|
+
```json
|
|
36
|
+
{
|
|
37
|
+
"mcpServers": {
|
|
38
|
+
"insightsentry": {
|
|
39
|
+
"command": "npx",
|
|
40
|
+
"args": ["@insightsentry/mcp"],
|
|
41
|
+
"env": {
|
|
42
|
+
"INSIGHTSENTRY_API_KEY": "your-api-key"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Available Tools (28)
|
|
50
|
+
|
|
51
|
+
### Market Data
|
|
52
|
+
| Tool | Description |
|
|
53
|
+
|------|-------------|
|
|
54
|
+
| `get_symbol_series` | Recent OHLCV data (up to 30k bars) with real-time option |
|
|
55
|
+
| `get_symbol_history` | Deep historical data (20+ years) |
|
|
56
|
+
| `get_quotes` | Real-time quotes for up to 10 symbols |
|
|
57
|
+
| `get_symbol_info` | Symbol metadata (type, sector, market cap, etc.) |
|
|
58
|
+
| `get_symbol_session` | Trading session details and hours |
|
|
59
|
+
| `get_symbol_contracts` | Futures contract list with settlement dates |
|
|
60
|
+
|
|
61
|
+
### Search
|
|
62
|
+
| Tool | Description |
|
|
63
|
+
|------|-------------|
|
|
64
|
+
| `search_symbols` | Search for symbols across all asset classes |
|
|
65
|
+
|
|
66
|
+
### Fundamentals
|
|
67
|
+
| Tool | Description |
|
|
68
|
+
|------|-------------|
|
|
69
|
+
| `get_symbol_fundamentals` | Company fundamentals (valuation, profitability, balance sheet) |
|
|
70
|
+
| `get_fundamentals_series` | Historical fundamental indicators |
|
|
71
|
+
| `get_fundamentals_meta` | Available fundamental/technical indicator IDs |
|
|
72
|
+
|
|
73
|
+
### Options
|
|
74
|
+
| Tool | Description |
|
|
75
|
+
|------|-------------|
|
|
76
|
+
| `list_options` | List available option contracts |
|
|
77
|
+
| `get_options_expiration` | Option chain by expiration date |
|
|
78
|
+
| `get_options_strike` | Option chain by strike price |
|
|
79
|
+
|
|
80
|
+
### Screeners
|
|
81
|
+
| Tool | Description |
|
|
82
|
+
|------|-------------|
|
|
83
|
+
| `screen_stocks` | Filter stocks with custom criteria |
|
|
84
|
+
| `screen_etfs` | Filter ETFs with custom criteria |
|
|
85
|
+
| `screen_bonds` | Filter bonds with custom criteria |
|
|
86
|
+
| `screen_crypto` | Filter crypto with custom criteria |
|
|
87
|
+
| `get_stock_screener_params` | Available stock screener fields |
|
|
88
|
+
| `get_etf_screener_params` | Available ETF screener fields |
|
|
89
|
+
| `get_bond_screener_params` | Available bond screener fields |
|
|
90
|
+
| `get_crypto_screener_params` | Available crypto screener fields |
|
|
91
|
+
|
|
92
|
+
### Calendar
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `get_dividends` | Dividend calendar |
|
|
96
|
+
| `get_earnings` | Earnings calendar |
|
|
97
|
+
| `get_ipos` | IPO calendar |
|
|
98
|
+
| `get_events` | Economic events calendar |
|
|
99
|
+
|
|
100
|
+
### News & Documents
|
|
101
|
+
| Tool | Description |
|
|
102
|
+
|------|-------------|
|
|
103
|
+
| `get_newsfeed` | Financial news with keyword filtering |
|
|
104
|
+
| `get_documents` | List SEC filings and transcripts |
|
|
105
|
+
| `get_document` | Get specific document content |
|
|
106
|
+
|
|
107
|
+
## Documentation Resources
|
|
108
|
+
|
|
109
|
+
The MCP server also provides documentation resources that AI assistants can read to help you build applications:
|
|
110
|
+
|
|
111
|
+
| Resource | Content |
|
|
112
|
+
|----------|---------|
|
|
113
|
+
| `insightsentry://docs/rest-api` | Complete REST API reference |
|
|
114
|
+
| `insightsentry://docs/websocket` | WebSocket API: connection, subscriptions, data formats, code examples |
|
|
115
|
+
| `insightsentry://docs/screener` | Screener API: field discovery and filtering |
|
|
116
|
+
| `insightsentry://docs/options` | Options API: chains, Greeks, option codes |
|
|
117
|
+
| `insightsentry://docs/futures-history` | Futures historical data and contract month logic |
|
|
118
|
+
|
|
119
|
+
## Online Documentation
|
|
120
|
+
|
|
121
|
+
- API Docs: https://insightsentry.com/docs
|
|
122
|
+
- WebSocket Live Demo: https://insightsentry.com/test/realtime
|
|
123
|
+
- News Feed Demo: https://insightsentry.com/test/newsfeed
|
|
124
|
+
- OpenAPI Spec: https://insightsentry.com/openapi.json
|
|
125
|
+
|
|
126
|
+
## Development
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
npm install
|
|
130
|
+
npm run generate # Generate tool definitions from OpenAPI spec
|
|
131
|
+
npm run build # Generate + compile TypeScript
|
|
132
|
+
npm run dev # Run with tsx (no build needed)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## License
|
|
136
|
+
|
|
137
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.d.ts","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AA+BA,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAS;gBAEX,MAAM,EAAE,MAAM;IAIpB,OAAO,CACX,MAAM,EAAE,MAAM,EACd,YAAY,EAAE,MAAM,EACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAC1B,OAAO,CAAC,GAAG,CAAC;CAoEhB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const BASE_URL = "https://api.insightsentry.com";
|
|
2
|
+
// Symbol code must be EXCHANGE:SYMBOL format (e.g., NASDAQ:AAPL)
|
|
3
|
+
const SYMBOL_CODE_PATTERN = /^[A-Z0-9_./-]+:[A-Z0-9_./!-]+$/;
|
|
4
|
+
// Parameter names that expect a symbol code
|
|
5
|
+
const SYMBOL_PARAM_NAMES = new Set(["symbol", "code", "codes"]);
|
|
6
|
+
function validateSymbolParams(params) {
|
|
7
|
+
for (const [key, value] of Object.entries(params)) {
|
|
8
|
+
if (!SYMBOL_PARAM_NAMES.has(key) || !value)
|
|
9
|
+
continue;
|
|
10
|
+
const codes = key === "codes"
|
|
11
|
+
? String(value).split(",")
|
|
12
|
+
: [String(value)];
|
|
13
|
+
for (const code of codes) {
|
|
14
|
+
const trimmed = code.trim();
|
|
15
|
+
if (!SYMBOL_CODE_PATTERN.test(trimmed)) {
|
|
16
|
+
return (`Invalid symbol code "${trimmed}". InsightSentry uses EXCHANGE:SYMBOL format (e.g., NASDAQ:AAPL, NYSE:TSLA, BINANCE:BTCUSDT, CME_MINI:NQ1!). ` +
|
|
17
|
+
`Use the search_symbols tool to find the correct symbol code for any asset. ` +
|
|
18
|
+
`Example: search_symbols({ query: "${trimmed}" })`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
export class ApiClient {
|
|
25
|
+
apiKey;
|
|
26
|
+
constructor(apiKey) {
|
|
27
|
+
this.apiKey = apiKey;
|
|
28
|
+
}
|
|
29
|
+
async request(method, pathTemplate, params) {
|
|
30
|
+
// Validate symbol codes before making the request
|
|
31
|
+
const symbolError = validateSymbolParams(params);
|
|
32
|
+
if (symbolError) {
|
|
33
|
+
throw new Error(symbolError);
|
|
34
|
+
}
|
|
35
|
+
// Separate path params from query/body params
|
|
36
|
+
const pathParamNames = [
|
|
37
|
+
...pathTemplate.matchAll(/\{(\w+)\}/g),
|
|
38
|
+
].map((m) => m[1]);
|
|
39
|
+
let path = pathTemplate;
|
|
40
|
+
const remaining = {};
|
|
41
|
+
for (const [key, value] of Object.entries(params)) {
|
|
42
|
+
if (value === undefined || value === null)
|
|
43
|
+
continue;
|
|
44
|
+
if (pathParamNames.includes(key)) {
|
|
45
|
+
path = path.replace(`{${key}}`, encodeURIComponent(String(value)));
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
remaining[key] = value;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
const headers = {
|
|
52
|
+
Authorization: `Bearer ${this.apiKey}`,
|
|
53
|
+
"Content-Type": "application/json",
|
|
54
|
+
};
|
|
55
|
+
let url = `${BASE_URL}${path}`;
|
|
56
|
+
const init = { method, headers };
|
|
57
|
+
if (method === "GET") {
|
|
58
|
+
const searchParams = new URLSearchParams();
|
|
59
|
+
for (const [key, value] of Object.entries(remaining)) {
|
|
60
|
+
if (value !== undefined && value !== null) {
|
|
61
|
+
searchParams.set(key, String(value));
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const qs = searchParams.toString();
|
|
65
|
+
if (qs)
|
|
66
|
+
url += `?${qs}`;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
init.body = JSON.stringify(remaining);
|
|
70
|
+
}
|
|
71
|
+
const response = await fetch(url, init);
|
|
72
|
+
if (!response.ok) {
|
|
73
|
+
const text = await response.text().catch(() => "");
|
|
74
|
+
let errorMessage;
|
|
75
|
+
try {
|
|
76
|
+
const errorJson = JSON.parse(text);
|
|
77
|
+
errorMessage =
|
|
78
|
+
errorJson.message || errorJson.error || JSON.stringify(errorJson);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
errorMessage = text || `HTTP ${response.status} ${response.statusText}`;
|
|
82
|
+
}
|
|
83
|
+
throw new Error(`API error (${response.status}): ${errorMessage}`);
|
|
84
|
+
}
|
|
85
|
+
const contentType = response.headers.get("content-type") || "";
|
|
86
|
+
if (contentType.includes("application/json")) {
|
|
87
|
+
return response.json();
|
|
88
|
+
}
|
|
89
|
+
return response.text();
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=api-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api-client.js","sourceRoot":"","sources":["../src/api-client.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AAEjD,iEAAiE;AACjE,MAAM,mBAAmB,GAAG,gCAAgC,CAAC;AAE7D,4CAA4C;AAC5C,MAAM,kBAAkB,GAAG,IAAI,GAA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.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { ApiClient } from "./api-client.js";
|
|
4
|
+
import { toolDefinitions } from "./tool-definitions.js";
|
|
5
|
+
import { docResources } from "./resources.js";
|
|
6
|
+
const INSTRUCTIONS = `You are connected to the InsightSentry financial data API. You have access to real-time and historical market data for equities, futures, options, crypto, forex, and more.
|
|
7
|
+
|
|
8
|
+
## IMPORTANT: Symbol Code Format
|
|
9
|
+
InsightSentry uses EXCHANGE:SYMBOL format for all symbol codes. This is NOT the same as ticker symbols used by brokers or Google Finance.
|
|
10
|
+
|
|
11
|
+
**ALWAYS use \`search_symbols\` first** to find the correct code before calling any other tool. Do NOT guess symbol codes.
|
|
12
|
+
|
|
13
|
+
Examples of correct codes:
|
|
14
|
+
- NASDAQ:AAPL (not just "AAPL")
|
|
15
|
+
- NYSE:TSLA (not "TSLA")
|
|
16
|
+
- BINANCE:BTCUSDT (not "BTC" or "BTCUSD")
|
|
17
|
+
- CME_MINI:NQ1! (not "NQ" or "/NQ")
|
|
18
|
+
- OPRA:AAPL260417P325.0 (option codes)
|
|
19
|
+
- COMEX:GC1! (not "GC" or "GOLD")
|
|
20
|
+
|
|
21
|
+
If you're unsure about a symbol code, search for it: \`search_symbols({ query: "apple" })\`
|
|
22
|
+
|
|
23
|
+
## Common Workflows
|
|
24
|
+
|
|
25
|
+
### "Get me data on a stock/crypto/asset"
|
|
26
|
+
1. \`search_symbols\` — **Always start here.** Find the correct EXCHANGE:SYMBOL code.
|
|
27
|
+
2. Then use any combination of:
|
|
28
|
+
- \`get_quotes\` — Current price, change, bid/ask, volume (up to 10 symbols at once)
|
|
29
|
+
- \`get_symbol_series\` — OHLCV bars (minute/hour/day, up to 30k bars, with real-time option)
|
|
30
|
+
- \`get_symbol_info\` — Metadata: sector, industry, market cap, P/E, dividends, splits, option chains
|
|
31
|
+
- \`get_symbol_fundamentals\` — Deep fundamentals: valuation, profitability, balance sheet, income statement
|
|
32
|
+
|
|
33
|
+
### "Screen/filter the market"
|
|
34
|
+
1. \`get_stock_screener_params\` (or etf/bond/crypto) — Discover available fields, exchanges, countries
|
|
35
|
+
2. \`screen_stocks\` (or etf/bond/crypto) — POST with fields, filters, sorting. Returns paginated results (1000/page).
|
|
36
|
+
|
|
37
|
+
### "Options analysis"
|
|
38
|
+
1. \`search_symbols\` — Find the underlying
|
|
39
|
+
2. \`list_options\` — Get available option contracts
|
|
40
|
+
3. \`get_options_expiration\` or \`get_options_strike\` — Get chain with Greeks (delta, gamma, theta, vega, IV)
|
|
41
|
+
4. \`get_quotes\` — Real-time option quotes (use the OPRA:... option code)
|
|
42
|
+
5. \`get_symbol_series\` — Historical option price data
|
|
43
|
+
|
|
44
|
+
### "What's happening in the market?"
|
|
45
|
+
- \`get_newsfeed\` — Latest financial news (filter by keywords)
|
|
46
|
+
- \`get_earnings\` — Upcoming/recent earnings
|
|
47
|
+
- \`get_dividends\` — Dividend calendar
|
|
48
|
+
- \`get_ipos\` — IPO calendar
|
|
49
|
+
- \`get_events\` — Economic events calendar
|
|
50
|
+
|
|
51
|
+
### "Deep historical / futures data"
|
|
52
|
+
- \`get_symbol_history\` — 20+ years of data (requires start_date in YYYY-MM format, returns one month at a time)
|
|
53
|
+
- \`get_symbol_contracts\` — List futures contracts with settlement dates
|
|
54
|
+
- For extensive futures history, use specific contract codes (e.g., CME_MINI:NQH2024), not continuous (CME_MINI:NQ1!)
|
|
55
|
+
|
|
56
|
+
### "SEC filings and transcripts"
|
|
57
|
+
1. \`get_documents\` — List available filings for a symbol
|
|
58
|
+
2. \`get_document\` — Read a specific document's content
|
|
59
|
+
|
|
60
|
+
### "Help the user build an app with our API"
|
|
61
|
+
Read the documentation resources for comprehensive guides:
|
|
62
|
+
- \`insightsentry://docs/rest-api\` — Full REST API reference with all endpoints
|
|
63
|
+
- \`insightsentry://docs/websocket\` — WebSocket connection, authentication, subscriptions, data formats, Python/JS examples
|
|
64
|
+
- \`insightsentry://docs/screener\` — Screener field discovery and filtering patterns
|
|
65
|
+
- \`insightsentry://docs/options\` — Option chains, Greeks, code format explained
|
|
66
|
+
- \`insightsentry://docs/futures-history\` — Futures contract month logic
|
|
67
|
+
|
|
68
|
+
## Key Concepts
|
|
69
|
+
- **Symbol format**: Always \`EXCHANGE:SYMBOL\` (e.g., NASDAQ:AAPL, BINANCE:BTCUSDT, CME_MINI:NQ1!)
|
|
70
|
+
- **Option codes**: \`OPRA:AAPL260417P325.0\` = OPRA exchange, AAPL, expires 2026-04-17, Put, $325 strike
|
|
71
|
+
- **Screeners**: First GET to discover fields, then POST to filter. Fields are case-insensitive.
|
|
72
|
+
- **Time series**: \`bar_type\` (tick/second/minute/hour/day/week/month) + \`bar_interval\` (1-1440). Use \`dp\` to control data points (default 3000, max 30000).
|
|
73
|
+
- **WebSocket**: For real-time streaming, read the websocket resource. Two endpoints: /live (market data) and /newsfeed (news).
|
|
74
|
+
`;
|
|
75
|
+
const apiKey = process.env.INSIGHTSENTRY_API_KEY;
|
|
76
|
+
if (!apiKey) {
|
|
77
|
+
console.error("Error: INSIGHTSENTRY_API_KEY environment variable is required.\n" +
|
|
78
|
+
"Get your API key from https://insightsentry.com/dashboard");
|
|
79
|
+
process.exit(1);
|
|
80
|
+
}
|
|
81
|
+
const client = new ApiClient(apiKey);
|
|
82
|
+
const server = new McpServer({ name: "insightsentry", version: "1.0.0" }, { instructions: INSTRUCTIONS });
|
|
83
|
+
// Register all API tools with Zod schemas for type-safe parameter validation
|
|
84
|
+
for (const tool of toolDefinitions) {
|
|
85
|
+
server.tool(tool.name, tool.description, tool.schema, async (args) => {
|
|
86
|
+
try {
|
|
87
|
+
const result = await client.request(tool.method, tool.pathTemplate, args);
|
|
88
|
+
const content = typeof result === "string"
|
|
89
|
+
? result
|
|
90
|
+
: JSON.stringify(result, null, 2);
|
|
91
|
+
return {
|
|
92
|
+
content: [{ type: "text", text: content }],
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
catch (error) {
|
|
96
|
+
return {
|
|
97
|
+
content: [
|
|
98
|
+
{ type: "text", text: `Error: ${error.message}` },
|
|
99
|
+
],
|
|
100
|
+
isError: true,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
// Register documentation resources
|
|
106
|
+
for (const doc of docResources) {
|
|
107
|
+
server.resource(doc.name, doc.uri, { mimeType: doc.mimeType, description: doc.description }, async () => ({
|
|
108
|
+
contents: [
|
|
109
|
+
{ uri: doc.uri, mimeType: doc.mimeType, text: doc.content },
|
|
110
|
+
],
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
// Start the server
|
|
114
|
+
async function main() {
|
|
115
|
+
const transport = new StdioServerTransport();
|
|
116
|
+
await server.connect(transport);
|
|
117
|
+
}
|
|
118
|
+
main().catch((error) => {
|
|
119
|
+
console.error("Fatal error:", error);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
});
|
|
122
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoEpB,CAAC;AAEF,MA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