interactive_trading_bot / crypto_news_scraper_server.py
samsonleegh's picture
Upload 10 files
80fa9cc verified
from mcp.server.fastmcp import FastMCP
from crypto_news_scraper import scrape_crypto_news
import pandas as pd
from dotenv import load_dotenv
load_dotenv(override=True)
mcp = FastMCP("cryptopanic_news_server")
@mcp.tool()
async def get_crypto_news(urls: list = None, num_entries: int = 10) -> str:
"""Scrape and aggregate the latest cryptocurrency news articles from multiple RSS feeds.
Args:
urls: Optional list of RSS feed URLs to scrape.
- Accepts a list of strings, each being a valid RSS feed URL.
- Example: ["https://cointelegraph.com/rss", "https://cryptopotato.com/feed/"].
- If set to None, defaults to:
[
"https://cointelegraph.com/rss",
"https://cryptopotato.com/feed/",
"https://cryptonews.com/news/feed/"
].
num_entries: The maximum number of news entries to retrieve per feed.
- Defaults to 10.
- Example: setting num_entries=5 retrieves the 5 most recent articles per source.
"""
return scrape_crypto_news(urls=None, num_entries=10).to_string()
if __name__ == "__main__":
mcp.run(transport='stdio')