File size: 1,109 Bytes
d3a578b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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()