Skip to content

Instantly share code, notes, and snippets.

@berkorbay
Created July 16, 2025 13:43
Show Gist options
  • Save berkorbay/bff166dd6ac3469befb2cf053d091aa7 to your computer and use it in GitHub Desktop.
Save berkorbay/bff166dd6ac3469befb2cf053d091aa7 to your computer and use it in GitHub Desktop.
EPTR2 MCP Server v0
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