Spaces:
Sleeping
Sleeping
File size: 869 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 |
from mcp.server.fastmcp import FastMCP
import logging
# Configure logging to only show errors
logging.basicConfig(level=logging.ERROR)
# Initialize FastMCP server for saving reports
mcp = FastMCP("save-report")
@mcp.tool()
async def save_report(report: str, file_name: str="report.md") -> None:
"""
Save the generated financial report to a file
Args:
report (str): The report content to be saved
file_name (str): The filename to save the report to. Defaults to "report.md"
"""
# Append the report content to the specified file
with open(file_name, "a") as file:
file.write(report + "\n")
print("Report saved successfully!")
def run_save_report_server():
"""Start the report saving MCP server using stdio transport"""
mcp.run(transport="stdio")
if __name__ == "__main__":
run_save_report_server() |