When the user asks a finance question, execute the current script.
What this skill does
- Execute a local Node script, and via
fetch()initiate a SSE/streaming request, and output the content returned by the server in real time. - Send the user's question as
--promptto the Agent interface (message/stream), and extract from the streamagentResult.valueto facilitate aggregation of the answer by the upper layer.
One-time configuration
- Ensure Node.js 18+ is installed (comes with
fetch)。 - Configure environment variables (PowerShell example):
$env:FINANCE_STREAM_API_URL="https://YOUR_ENDPOINT_HERE"
$env:FINANCE_STREAM_API_KEY="YOUR_KEY_IF_NEEDED"
API Key lookup rules (referencing the approach of wind-mcp-skill)
The script will look for the Key in the following priority order (as long as one is matched, it will be used):
- Command-line argument:
--api-key <KEY> - Environment variable:
FINANCE_STREAM_API_KEY - Current skill configuration:
.cursor/skills/finance-stream-fetch/config.json(JSON:{"finance_stream_api_key":"..."}) - Global configuration:
%USERPROFILE%\.finance-stream-fetch\config(dotenv:FINANCE_STREAM_API_KEY=...)
If the interface does not require authentication, the Key can be left unconfigured (the script will omit the Authorization request header).
Usage (Agent workflow)
When the user asks a finance question:
- Directly use the user's question as
--prompt。 - Execute:
node .cursor/skills/finance-stream-fetch/scripts/stream-fetch.mjs --prompt "<USER_QUESTION>"
- After the streaming output ends, organize the answer to the user based on the output content.
Notes
- If the interface returns SSE (Server-Sent Events), the script will parse the
data:line and try to parse it as JSON as much as possible; if parsing fails, it will skip that event and continue. - If
FINANCE_STREAM_API_KEYis set (or--api-keyis passed), it will send inAuthorization: Bearer <key>mode. - On Windows PowerShell, it is recommended to wrap the prompt directly in double quotes:
node .cursor/skills/finance-stream-fetch/scripts/stream-fetch.mjs --prompt "分析一下茅台股票情况"