@insightsentry/mcp 1.4.38 → 1.4.40
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 +64 -0
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +507 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/dist/stream-output.d.ts +20 -0
- package/dist/stream-output.d.ts.map +1 -0
- package/dist/stream-output.js +203 -0
- package/dist/stream-output.js.map +1 -0
- package/dist/tool-definitions.d.ts.map +1 -1
- package/dist/tool-definitions.js +44 -3
- package/dist/tool-definitions.js.map +1 -1
- package/dist/websocket-contract.d.ts +70 -0
- package/dist/websocket-contract.d.ts.map +1 -0
- package/dist/websocket-contract.js +269 -0
- package/dist/websocket-contract.js.map +1 -0
- package/dist/websocket-stream.d.ts +27 -0
- package/dist/websocket-stream.d.ts.map +1 -0
- package/dist/websocket-stream.js +482 -0
- package/dist/websocket-stream.js.map +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -72,6 +72,8 @@ insight get_quotes --codes "NASDAQ:AAPL,NASDAQ:MSFT"
|
|
|
72
72
|
insight get_symbol_series --symbol "NASDAQ:AAPL" --bar_type day --dp 30
|
|
73
73
|
insight screen_stocks --fields "close,volume,market_cap" --exchanges "NYSE,NASDAQ" --sortBy market_cap --sortOrder desc
|
|
74
74
|
insight download_history --symbol "NASDAQ:AAPL" --bar_type day --from 2024-01-01 --to 2024-06-30 --output_dir ./history
|
|
75
|
+
insight stream_live --symbols "NASDAQ:AAPL,NASDAQ:MSFT" --type both --bar_type minute --bar_interval 1
|
|
76
|
+
insight stream_newsfeed --output_file ./news.ndjson --append
|
|
75
77
|
```
|
|
76
78
|
|
|
77
79
|
Symbol codes must use `EXCHANGE:SYMBOL` format. Use `search_symbols` before calling symbol tools.
|
|
@@ -90,6 +92,62 @@ All API tools support:
|
|
|
90
92
|
insight get_symbol_series --symbol "NASDAQ:AAPL" --bar_type day --store csv --output_file ./aapl.csv
|
|
91
93
|
```
|
|
92
94
|
|
|
95
|
+
### WebSocket Streams
|
|
96
|
+
|
|
97
|
+
The long-running WebSocket commands are available through the terminal CLI:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# Use the same settings for every symbol
|
|
101
|
+
insight stream_live --symbols "NASDAQ:AAPL,NASDAQ:MSFT" --type quote
|
|
102
|
+
|
|
103
|
+
# Use different settings per symbol
|
|
104
|
+
insight stream_live \
|
|
105
|
+
--subscriptions '[{"code":"NASDAQ:AAPL","type":"series","bar_type":"minute","bar_interval":5},{"code":"NASDAQ:MSFT","type":"quote"}]'
|
|
106
|
+
|
|
107
|
+
# Collect 100 data messages, then disconnect successfully
|
|
108
|
+
insight stream_live --symbols "NASDAQ:AAPL" --type quote --max_messages 100
|
|
109
|
+
|
|
110
|
+
# Stream all news to stdout
|
|
111
|
+
insight stream_newsfeed
|
|
112
|
+
|
|
113
|
+
# Append filtered news to a file and also emit it to stdout
|
|
114
|
+
insight stream_newsfeed --content "earnings" --related_symbols "NASDAQ:AAPL" \
|
|
115
|
+
--output_file ./news.ndjson --append --tee
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
In an interactive terminal, run `insight stream_live` or choose it from the no-argument command
|
|
119
|
+
picker to use a short guided setup for subscriptions and output. Supplying any stream flags uses
|
|
120
|
+
non-interactive flag mode and never prompts.
|
|
121
|
+
|
|
122
|
+
Each received JSON message is written as one NDJSON line. With `--output_file`, the file is replaced
|
|
123
|
+
unless `--append` is set; `--tee` also writes the same lines to stdout. Connection status, retries,
|
|
124
|
+
and local errors are written to stderr, so stdout remains valid NDJSON and can be piped safely:
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
insight stream_live --symbols "NASDAQ:AAPL" --type quote | jq -c .
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
The CLI answers WebSocket control pings, reconnects with bounded exponential backoff, and resends
|
|
131
|
+
the complete request after reconnecting. It does not reconnect when the server returns an error that
|
|
132
|
+
requires user action; that error is retained in the NDJSON output and reported on stderr before the
|
|
133
|
+
command exits unsuccessfully. Advanced subscription JSON rejects unknown fields instead of silently
|
|
134
|
+
discarding them. Press Ctrl+C to close gracefully after queued file output is finalized.
|
|
135
|
+
|
|
136
|
+
Use `--duration_seconds` or `--max_messages` for a bounded run that drains queued output, disconnects,
|
|
137
|
+
and exits successfully. The message limit counts quote, series, or news data—not connection status or
|
|
138
|
+
market-data timestamp frames—and continues across reconnects. `--max_reconnect_attempts 0` disables
|
|
139
|
+
automatic reconnects.
|
|
140
|
+
|
|
141
|
+
Newsfeed connections replay up to 10 recent matching items before streaming new items. Reconnecting
|
|
142
|
+
can therefore repeat items already written; consumers should deduplicate by `link`, or by
|
|
143
|
+
`published_at`, `source`, and `title` when no link is present. Content terms are matched with OR,
|
|
144
|
+
while populated `source`, `related_symbols`, and `content` filters are combined with AND.
|
|
145
|
+
|
|
146
|
+
Quote updates can be sparse. Merge updates by `code` when maintaining a current quote snapshot.
|
|
147
|
+
|
|
148
|
+
Run `insight stream_live --help` or `insight stream_newsfeed --help` for every flag. WebSocket
|
|
149
|
+
streaming is CLI-only and is not registered as a long-running MCP tool.
|
|
150
|
+
|
|
93
151
|
## Tools
|
|
94
152
|
|
|
95
153
|
Auth and files:
|
|
@@ -100,6 +158,8 @@ Auth and files:
|
|
|
100
158
|
| `download_history` | Download date ranges to JSON/CSV files |
|
|
101
159
|
| `get_symbol_history` | Same as `download_history`; downloads history to files |
|
|
102
160
|
| `render_chart` | Render Chart.js configs as PNG images |
|
|
161
|
+
| `stream_live` | Stream real-time market data as NDJSON |
|
|
162
|
+
| `stream_newsfeed` | Stream financial news as NDJSON |
|
|
103
163
|
|
|
104
164
|
Market data:
|
|
105
165
|
|
|
@@ -108,6 +168,10 @@ Market data:
|
|
|
108
168
|
| `search_symbols` | Find valid `EXCHANGE:SYMBOL` codes |
|
|
109
169
|
| `get_quotes` | Latest quotes |
|
|
110
170
|
| `get_symbol_series` | Recent OHLCV series |
|
|
171
|
+
| `get_symbol_history_period` | Intraday history for a specific period |
|
|
172
|
+
| `get_sip_quotes` | Latest SIP quotes |
|
|
173
|
+
| `get_sip_series` | Recent SIP market-data series |
|
|
174
|
+
| `get_sip_history` | SIP intraday history for a specific period |
|
|
111
175
|
| `get_symbol_info` | Symbol metadata |
|
|
112
176
|
| `get_symbol_session` | Trading hours and session details |
|
|
113
177
|
| `get_symbol_contracts` | Futures contract list |
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import type { ChartConfiguration } from "chart.js";
|
|
2
2
|
import { type AuthStatus } from "./auth-status.js";
|
|
3
|
+
import { type StreamOutput, type StreamOutputOptions } from "./stream-output.js";
|
|
3
4
|
import { type ToolDefinition } from "./tool-definitions.js";
|
|
4
5
|
import { type LatestVersionProvider } from "./version-status.js";
|
|
6
|
+
import { type RunWebSocketStreamOptions, type StreamRunResult } from "./websocket-stream.js";
|
|
5
7
|
export { coerceArgs } from "./arg-coercion.js";
|
|
6
8
|
interface ParsedArgs {
|
|
7
9
|
toolName: string | null;
|
|
8
10
|
args: Record<string, string>;
|
|
11
|
+
valuelessArgs: string[];
|
|
9
12
|
help: boolean;
|
|
10
13
|
version: boolean;
|
|
11
14
|
}
|
|
@@ -14,6 +17,7 @@ export declare function buildVersion(): string;
|
|
|
14
17
|
export declare function buildHelp(): string;
|
|
15
18
|
export declare function buildDownloadHistoryHelp(commandName?: string): string;
|
|
16
19
|
export declare function buildRenderChartHelp(): string;
|
|
20
|
+
export declare function buildStreamHelp(commandName: string): string;
|
|
17
21
|
export declare function buildToolHelp(tool: ToolDefinition): string;
|
|
18
22
|
type RequestFn = (method: string, pathTemplate: string, params: Record<string, any>) => Promise<any>;
|
|
19
23
|
type RunCommandFn = (command: string, args: string[]) => Promise<{
|
|
@@ -38,6 +42,11 @@ interface CliIO {
|
|
|
38
42
|
selectTool?: (options: ToolSelectionOption[]) => Promise<string | null>;
|
|
39
43
|
isInteractive?: boolean;
|
|
40
44
|
getAuthStatus?: () => AuthStatus;
|
|
45
|
+
getApiKey?: () => string | undefined;
|
|
46
|
+
createStreamOutput?: (options: StreamOutputOptions) => Promise<StreamOutput>;
|
|
47
|
+
runStream?: (options: RunWebSocketStreamOptions) => Promise<StreamRunResult>;
|
|
48
|
+
streamSignal?: AbortSignal;
|
|
49
|
+
getStreamSignalExitCode?: () => number | undefined;
|
|
41
50
|
}
|
|
42
51
|
interface ToolSelectionOption {
|
|
43
52
|
name: string;
|
package/dist/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAInD,OAAO,EAAE,KAAK,UAAU,EAAyC,MAAM,kBAAkB,CAAC;AAsB1F,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,KAAK,cAAc,EAAmB,MAAM,uBAAuB,CAAC;AAE7E,OAAO,EAKL,KAAK,qBAAqB,EAC3B,MAAM,qBAAqB,CAAC;AAO7B,OAAO,EACL,KAAK,yBAAyB,EAE9B,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAyI/C,UAAU,UAAU;IAClB,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAgB,SAAS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