Created
July 16, 2025 13:43
-
-
Save berkorbay/bff166dd6ac3469befb2cf053d091aa7 to your computer and use it in GitHub Desktop.
EPTR2 MCP Server v0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from typing import Any | |
| import httpx | |
| from mcp.server.fastmcp import FastMCP | |
| from eptr2.main import eptr_w_tgt_wrapper, EPTR2 | |
| import pandas as pd | |
| # Initialize FastMCP server | |
| mcp = FastMCP("eptr2") | |
| eptr = eptr_w_tgt_wrapper() | |
| @mcp.tool() | |
| async def get_mcp(start_date: str, end_date: str) -> str: | |
| """Get market clearing price (MCP) or (in Turkish) piyasa takas fiyatı (PTF) for a given start and end date. | |
| Args: | |
| start_date: The start date (format: YYYY-MM-DD) for the MCP / PTF query. | |
| end_date: The end date (format: YYYY-MM-DD) for the MCP / PTF query. | |
| """ | |
| df = eptr.call("mcp", start_date=start_date, end_date=end_date) | |
| l = df[["date", "price"]].to_dict(orient="records") | |
| l2 = [f"Date: {x['date']}, Price: {x['price']}" for x in l] | |
| return "\n---\n".join(l2) | |
| if __name__ == "__main__": | |
| # Initialize and run the server | |
| mcp.run(transport="stdio") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment