MCP_Crypto / mcp_servers /stdio_report_gen_server.py
Vladt-Tempest's picture
Prueba en HF
d3a578b
from mcp.server.fastmcp import FastMCP
import logging
import os
from typing import List
import anthropic
import sys
import asyncio
# Configure logging to only show errors
logging.basicConfig(level=logging.ERROR)
# Initialize FastMCP server for report generation
mcp = FastMCP("test_server")
print("[MCP] Servidor de generaci贸n de reportes iniciado y esperando peticiones...", file=sys.stderr)
# Initialize Anthropic client for report content generation
client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY")) # Usa variable de entorno
# System prompt to guide the LLM in generating financial reports
system_prompt = "You are a professional financial analyst. Generate a very short report based on following information regarding different companies."
@mcp.tool()
def get_current_stock_price(symbol: str) -> str:
print(f"[MCP] Petici贸n recibida: {symbol}", file=sys.stderr)
return f"Echo: {symbol}"
def run_report_server():
"""Start the report generation MCP server using stdio transport"""
mcp.run(transport="stdio")
if __name__ == "__main__":
run_report_server()