Skip to content

Commit f424bf1

Browse files
committed
docs(readme): add HTTP RESTful API streaming support documentation
1 parent 7b89097 commit f424bf1

2 files changed

Lines changed: 59 additions & 10 deletions

File tree

README.md

Lines changed: 45 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -201,14 +201,52 @@ Add this configuration to your MCP client to connect to the remote SSE server:
201201
}
202202
```
203203

204+
---
205+
206+
### HTTP RESTful API with Streaming Support
207+
208+
Finance MCP also supports HTTP RESTful API mode with streaming capabilities. This allows you to access flows directly via HTTP endpoints, not just through MCP protocol.
209+
210+
#### Step 1: Start HTTP Server
211+
212+
Start the Finance MCP server with HTTP backend:
213+
214+
```bash
215+
finance-mcp \
216+
config=default,stream_agent \
217+
backend=http \
218+
http.host=0.0.0.0 \
219+
http.port=8002 \
220+
llm.default.model_name=qwen3-30b-a3b-thinking-2507
221+
```
222+
223+
#### Step 2: Make Streaming HTTP Requests
224+
225+
All flows configured with `stream: true` will be exposed as streaming HTTP endpoints. Responses are streamed in real-time using Server-Sent Events (SSE) format.
226+
227+
Example: Request streaming deep research (inspired by [open_deep_research](https://github.com/langchain-ai/open_deep_research)):
228+
229+
```bash
230+
curl -X POST http://0.0.0.0:8002/langchain_deep_research \
231+
-H "Content-Type: application/json" \
232+
-d '{"query": "I want to learn about Kweichow Moutai stock"}'
233+
```
234+
235+
The response will be streamed in real-time, showing:
236+
- Thinking process and reasoning
237+
- Tool calls and intermediate results
238+
- Final comprehensive answer
239+
240+
**Note**: By default, this uses DashScope search, but you can replace it with other search backends (e.g., Tavily) by modifying the `stream_agent.yaml` configuration.
241+
204242
### Configuration Parameters
205243

206-
| Parameter | Description | Example |
207-
|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------|
208-
| `config` | Configuration files to load (comma-separated). Available: `default` (core flows), `ths` (TongHuaShun stock data), `stream_agent` (streaming agents), `external_mcp` (external MCP services) | `config=default,ths` |
209-
| `mcp.transport` | Transport mode: `stdio` (Claude Desktop), `sse` (web apps), `http` (RESTful), `streamable-http` | `mcp.transport=stdio` |
210-
| `mcp.host` | Host address (for sse/http transports only) | `mcp.host=0.0.0.0` |
211-
| `mcp.port` | Port number (for sse/http transports only) | `mcp.port=8001` |
244+
| Parameter | Description | Example |
245+
|--------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------|
246+
| `config` | Configuration files to load (comma-separated). Available: `default` (core flows), `ths` (TongHuaShun stock data), `stream_agent` (streaming agents), `external_mcp` (external MCP services) | `config=default,ths` |
247+
| `mcp.transport` | Transport mode: `stdio` (Claude Desktop), `sse` (web apps), `http` (RESTful), `streamable-http` | `mcp.transport=stdio` |
248+
| `mcp.host` | Host address (for sse/http transports only) | `mcp.host=0.0.0.0` |
249+
| `mcp.port` | Port number (for sse/http transports only) | `mcp.port=8001` |
212250
| `llm.default.model_name` | Default LLM model name (overrides config file) | `llm.default.model_name=qwen3-30b-a3b-thinking-2507` |
213251
| `disabled_flows` | JSON array of flow names to disable. **Tip**: Disable flows if you don't have the required API keys (e.g., `tavily_search` requires `TAVILY_API_KEY`) | `disabled_flows='["react_agent"]'` |
214252

@@ -225,7 +263,7 @@ Add this configuration to your MCP client to connect to the remote SSE server:
225263

226264
---
227265

228-
### Using with FastMCP Client (Service Mode)
266+
### Using with FastMCP Client
229267

230268
When running in Service Mode, you can also use the [FastMCP](https://gofastmcp.com/getting-started/welcome) Python client to directly access the server:
231269

test_op/test_project_http.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,21 @@ def test_http_service(endpoint: str, data: str) -> None:
8484

8585
def main() -> None:
8686
"""
87-
curl -X POST http://0.0.0.0:8002/conduct_research \
88-
-H "Content-Type: application/json" \
89-
-d '{"research_topic": "茅台怎么样?"}'
9087
Start the finance-mcp HTTP service and exercise selected endpoints.
88+
89+
Example: Streaming Deep Research
90+
91+
finance-mcp \
92+
config=default,stream_agent \
93+
backend=http \
94+
http.host=0.0.0.0 \
95+
http.port=8002 \
96+
llm.default.model_name=qwen3-30b-a3b-thinking-2507
97+
98+
curl -X POST http://0.0.0.0:8002/langchain_deep_research \
99+
-H "Content-Type: application/json" \
100+
-d '{"query": "茅台怎么样?"}'
101+
91102
"""
92103

93104
with FinanceMcpServiceRunner(

0 commit comments

Comments
 (0)