Skip to content

Commit 466c182

Browse files
committed
ft: add option to run as server
1 parent 107b362 commit 466c182

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

main.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import json
33
import logging
44
from typing import Dict, Any, Optional
5+
import asyncio
56

67
from fastmcp import FastMCP
78
from pydantic import BaseModel, Field
@@ -565,6 +566,16 @@ async def calculate_token_amount_from_dollars(
565566
}
566567

567568

569+
async def run_as_server():
570+
await mcp.run_async(
571+
transport="http",
572+
host="127.0.0.1",
573+
port=8080,
574+
)
575+
576+
def run_standard_server():
577+
mcp.run()
578+
568579
if __name__ == "__main__":
569580
try:
570581
config = get_config()
@@ -576,7 +587,8 @@ async def calculate_token_amount_from_dollars(
576587
log_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'hyperliquid_mcp.log')
577588
logger.info(f"Logs will be written to: {log_path}")
578589

579-
mcp.run()
590+
# run_standard_server()
591+
asyncio.run(run_standard_server())
580592
except Exception as e:
581593
logger.error(f"Failed to start server: {e}")
582594
print(f"Failed to start server: {e}")

0 commit comments

Comments
 (0)