Upload news_quote_mcp.py
Browse files
MarketandStockMCP/news_quote_mcp.py
CHANGED
|
@@ -703,4 +703,22 @@ def test_company_news_tool(symbol: str, from_date: str, to_date: str) -> str:
|
|
| 703 |
# server_name=host,
|
| 704 |
# server_port=port,
|
| 705 |
# share=False
|
| 706 |
-
# )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 703 |
# server_name=host,
|
| 704 |
# server_port=port,
|
| 705 |
# share=False
|
| 706 |
+
# )
|
| 707 |
+
|
| 708 |
+
|
| 709 |
+
if __name__ == "__main__":
|
| 710 |
+
import sys
|
| 711 |
+
|
| 712 |
+
# Check for API key in environment variable
|
| 713 |
+
env_api_key = os.getenv("FINNHUB_API_KEY")
|
| 714 |
+
if env_api_key:
|
| 715 |
+
set_api_key(env_api_key)
|
| 716 |
+
print("✅ API Key loaded from environment variable")
|
| 717 |
+
|
| 718 |
+
# Run as MCP server (standalone mode for chat_direct.py)
|
| 719 |
+
print("▶️ Starting MarketandStockMCP Server...")
|
| 720 |
+
print("📡 MCP server will listen on port 7870")
|
| 721 |
+
print("✅ Available tools: get_quote, get_market_news, get_company_news")
|
| 722 |
+
|
| 723 |
+
# Run MCP server with SSE transport on port 7870
|
| 724 |
+
mcp.run(transport="sse", port=7870)
|