server.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. """Pure MCP server over stdio."""
  2. from mcp.server.fastmcp import FastMCP
  3. import services
  4. from mcp_tools import MCP_TOOLS
  5. mcp = FastMCP("crypto-mcp")
  6. @mcp.tool()
  7. async def get_price(symbol: str):
  8. return await services.get_price(symbol)
  9. @mcp.tool()
  10. async def get_ohlcv(symbol: str, timeframe: str = "1h", limit: int = 100):
  11. return await services.get_ohlcv(symbol, timeframe, limit)
  12. @mcp.tool()
  13. async def get_indicator(symbol: str, indicator: str, timeframe: str = "1h", params: dict | None = None):
  14. return await services.get_indicator(symbol, indicator, timeframe, params or {})
  15. @mcp.tool()
  16. async def get_market_snapshot(symbol: str):
  17. return await services.get_market_snapshot(symbol)
  18. @mcp.tool()
  19. async def get_top_movers(limit: int = 10):
  20. return await services.get_top_movers(limit)
  21. @mcp.tool()
  22. async def get_capabilities():
  23. return await services.get_capabilities()
  24. @mcp.tool()
  25. async def get_regime(symbol: str, timeframe: str = "1h"):
  26. return await services.get_regime(symbol, timeframe)
  27. if __name__ == "__main__":
  28. mcp.run()