@insightsentry/mcp 1.4.39 → 1.4.41
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 +77 -1
- package/dist/cli.d.ts +9 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +423 -4
- package/dist/cli.js.map +1 -1
- package/dist/index.js +9 -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/websocket-collector.d.ts +25 -0
- package/dist/websocket-collector.d.ts.map +1 -0
- package/dist/websocket-collector.js +224 -0
- package/dist/websocket-collector.js.map +1 -0
- package/dist/websocket-contract.d.ts +71 -0
- package/dist/websocket-contract.d.ts.map +1 -0
- package/dist/websocket-contract.js +272 -0
- package/dist/websocket-contract.js.map +1 -0
- package/dist/websocket-schemas.d.ts +85 -0
- package/dist/websocket-schemas.d.ts.map +1 -0
- package/dist/websocket-schemas.js +177 -0
- package/dist/websocket-schemas.js.map +1 -0
- package/dist/websocket-stream.d.ts +28 -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/dist/websocket-tools.d.ts +9 -0
- package/dist/websocket-tools.d.ts.map +1 -0
- package/dist/websocket-tools.js +88 -0
- package/dist/websocket-tools.js.map +1 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -55,6 +55,16 @@ Use `npx` in your MCP config:
|
|
|
55
55
|
The MCP server also falls back to the key saved by `insight login` when `INSIGHTSENTRY_API_KEY` is not set.
|
|
56
56
|
Set `INSIGHTSENTRY_CONFIG_DIR` to force the CLI and MCP server to read the same saved-login directory when they run with different home directories.
|
|
57
57
|
|
|
58
|
+
### Bounded live collection for AI agents
|
|
59
|
+
|
|
60
|
+
The MCP server exposes `collect_live` and `collect_newsfeed`. Both return structured JSON and stop
|
|
61
|
+
after 20 data messages or 10 seconds by default. Calls can request up to 100 messages or 60 seconds;
|
|
62
|
+
whichever limit is reached first ends the collection. A fixed response-size limit may stop a call
|
|
63
|
+
earlier; check `stop_reason`. The structured result includes `activated`, while the text response is
|
|
64
|
+
a short summary so message data is not duplicated. If the subscription does not activate before the
|
|
65
|
+
duration limit, the call returns `activation_timeout`. Use the CLI commands below for continuous
|
|
66
|
+
terminal streaming.
|
|
67
|
+
|
|
58
68
|
## CLI Usage
|
|
59
69
|
|
|
60
70
|
```bash
|
|
@@ -72,6 +82,8 @@ insight get_quotes --codes "NASDAQ:AAPL,NASDAQ:MSFT"
|
|
|
72
82
|
insight get_symbol_series --symbol "NASDAQ:AAPL" --bar_type day --dp 30
|
|
73
83
|
insight screen_stocks --fields "close,volume,market_cap" --exchanges "NYSE,NASDAQ" --sortBy market_cap --sortOrder desc
|
|
74
84
|
insight download_history --symbol "NASDAQ:AAPL" --bar_type day --from 2024-01-01 --to 2024-06-30 --output_dir ./history
|
|
85
|
+
insight stream_live --symbols "NASDAQ:AAPL,NASDAQ:MSFT" --type both --bar_type minute --bar_interval 1 --max_messages 100 --duration_seconds 30
|
|
86
|
+
insight stream_newsfeed --output_file ./news.ndjson --append --duration_seconds 30
|
|
75
87
|
```
|
|
76
88
|
|
|
77
89
|
Symbol codes must use `EXCHANGE:SYMBOL` format. Use `search_symbols` before calling symbol tools.
|
|
@@ -90,7 +102,69 @@ All API tools support:
|
|
|
90
102
|
insight get_symbol_series --symbol "NASDAQ:AAPL" --bar_type day --store csv --output_file ./aapl.csv
|
|
91
103
|
```
|
|
92
104
|
|
|
93
|
-
|
|
105
|
+
### WebSocket Streams
|
|
106
|
+
|
|
107
|
+
The long-running WebSocket commands are available through the terminal CLI:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
# Use the same settings for every symbol
|
|
111
|
+
insight stream_live --symbols "NASDAQ:AAPL,NASDAQ:MSFT" --type quote \
|
|
112
|
+
--max_messages 100 --duration_seconds 30
|
|
113
|
+
|
|
114
|
+
# Use different settings per symbol
|
|
115
|
+
insight stream_live \
|
|
116
|
+
--subscriptions '[{"code":"NASDAQ:AAPL","type":"series","bar_type":"minute","bar_interval":5},{"code":"NASDAQ:MSFT","type":"quote"}]' \
|
|
117
|
+
--duration_seconds 60
|
|
118
|
+
|
|
119
|
+
# Collect 100 data messages, then disconnect successfully
|
|
120
|
+
insight stream_live --symbols "NASDAQ:AAPL" --type quote --max_messages 100
|
|
121
|
+
|
|
122
|
+
# Stream all news to stdout
|
|
123
|
+
insight stream_newsfeed --max_messages 20 --duration_seconds 30
|
|
124
|
+
|
|
125
|
+
# Append filtered news to a file and also emit it to stdout
|
|
126
|
+
insight stream_newsfeed --content "earnings" --related_symbols "NASDAQ:AAPL" \
|
|
127
|
+
--output_file ./news.ndjson --append --tee --duration_seconds 60
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
In an interactive terminal, run `insight stream_live` or choose it from the no-argument command
|
|
131
|
+
picker to use a short guided setup for subscriptions and output. Supplying any stream flags uses
|
|
132
|
+
non-interactive flag mode and never prompts.
|
|
133
|
+
|
|
134
|
+
Each received JSON message is written as one NDJSON line. With `--output_file`, the file is replaced
|
|
135
|
+
unless `--append` is set; `--tee` also writes the same lines to stdout. Connection status, retries,
|
|
136
|
+
and local errors are written to stderr, so stdout remains valid NDJSON and can be piped safely:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
insight stream_live --symbols "NASDAQ:AAPL" --type quote \
|
|
140
|
+
--max_messages 20 --duration_seconds 30 --quiet | jq -c .
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
The CLI answers WebSocket control pings, reconnects with bounded exponential backoff, and resends
|
|
144
|
+
the complete request after reconnecting. It does not reconnect when the server returns an error that
|
|
145
|
+
requires user action; that error is retained in the NDJSON output and reported on stderr before the
|
|
146
|
+
command exits unsuccessfully. Advanced subscription JSON rejects unknown fields instead of silently
|
|
147
|
+
discarding them. Press Ctrl+C to close gracefully after queued file output is finalized.
|
|
148
|
+
|
|
149
|
+
Use `--duration_seconds` or `--max_messages` for a bounded run that drains queued output, disconnects,
|
|
150
|
+
and exits successfully. The message limit counts quote, series, or news data—not connection status or
|
|
151
|
+
market-data timestamp frames—and continues across reconnects. `--max_reconnect_attempts 0` disables
|
|
152
|
+
automatic reconnects.
|
|
153
|
+
|
|
154
|
+
Use `--quiet` to suppress WebSocket connection and status diagnostics. Preflight errors still use
|
|
155
|
+
stderr, received server error frames remain in NDJSON, and failures retain a non-zero exit code.
|
|
156
|
+
|
|
157
|
+
Newsfeed connections replay up to 10 recent matching items before streaming new items. Reconnecting
|
|
158
|
+
can therefore repeat items already written; consumers should deduplicate by `link`, or by
|
|
159
|
+
`published_at`, `source`, and `title` when no link is present. Content terms are matched with OR,
|
|
160
|
+
while populated `source`, `related_symbols`, and `content` filters are combined with AND.
|
|
161
|
+
|
|
162
|
+
Quote updates can be sparse. Merge updates by `code` when maintaining a current quote snapshot.
|
|
163
|
+
|
|
164
|
+
Run `insight stream_live --help` or `insight stream_newsfeed --help` for every flag. Continuous
|
|
165
|
+
WebSocket streaming is CLI-only; use the bounded MCP collection tools from an AI client.
|
|
166
|
+
|
|
167
|
+
## MCP Tools
|
|
94
168
|
|
|
95
169
|
Auth and files:
|
|
96
170
|
|
|
@@ -112,6 +186,8 @@ Market data:
|
|
|
112
186
|
| `get_sip_quotes` | Latest SIP quotes |
|
|
113
187
|
| `get_sip_series` | Recent SIP market-data series |
|
|
114
188
|
| `get_sip_history` | SIP intraday history for a specific period |
|
|
189
|
+
| `collect_live` | Collect a bounded sample of live quotes or series |
|
|
190
|
+
| `collect_newsfeed` | Collect a bounded sample of live financial news |
|
|
115
191
|
| `get_symbol_info` | Symbol metadata |
|
|
116
192
|
| `get_symbol_session` | Trading hours and session details |
|
|
117
193
|
| `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;AAY7B,OAAO,EACL,KAAK,yBAAyB,EAE9B,KAAK,eAAe,EACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAuD/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,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA6CpD;AAED,wBAAgB,YAAY,IAAI,MAAM,CAErC;AAED,wBAAgB,SAAS,IAAI,MAAM,CA4DlC;AAED,wBAAgB,wBAAwB,CAAC,WAAW,SAA2B,GAAG,MAAM,CA8BvF;AAED,wBAAgB,oBAAoB,IAAI,MAAM,CAe7C;AAED,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAqE3D;AAmHD,wBAAgB,aAAa,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAsC1D;AAkCD,KAAK,SAAS,GAAG,CACf,MAAM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