File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
#!/usr/bin/env python
2
+ import os
2
3
from mcp_polygon import server
3
4
4
- if __name__ == "__main__" :
5
+ # Ensure the server process doesn't exit immediately when run as an MCP server
6
+ def start_server ():
7
+ polygon_api_key = os .environ .get ("POLYGON_API_KEY" , "" )
8
+ if not polygon_api_key :
9
+ print ("Warning: POLYGON_API_KEY environment variable not set." )
10
+ else :
11
+ print ("Starting Polygon MCP server with API key configured." )
12
+
5
13
server .run ()
14
+
15
+ if __name__ == "__main__" :
16
+ start_server ()
Original file line number Diff line number Diff line change @@ -790,6 +790,9 @@ async def list_stock_financials(
790
790
except Exception as e :
791
791
return {"error" : str (e )}
792
792
793
+ # Directly expose the MCP server object
794
+ # It will be run from entrypoint.py
795
+
793
796
def run ():
794
- """Entry point for the server."""
795
- asyncio . run ( poly_mcp .run () )
797
+ """Run the Polygon MCP server."""
798
+ poly_mcp .run ()
You can’t perform that action at this time.
0 commit comments