Skip to content

Commit f8518c8

Browse files
committed
Add benzinga endpoints
1 parent 44d7438 commit f8518c8

File tree

5 files changed

+743
-44
lines changed

5 files changed

+743
-44
lines changed

entrypoint.py

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
#!/usr/bin/env python
22
import os
3+
from typing import Literal
34
from mcp_polygon import server
45

6+
def transport() -> Literal['stdio', 'sse', 'streamable-http']:
7+
"""
8+
Determine the transport type for the MCP server.
9+
Defaults to 'stdio' if not set in environment variables.
10+
"""
11+
mcp_transport_str = os.environ.get("MCP_TRANSPORT", "stdio")
12+
13+
# These are currently the only supported transports
14+
supported_transports: dict[str, Literal['stdio', 'sse', 'streamable-http']] = {
15+
'stdio': 'stdio',
16+
'sse': 'sse',
17+
'streamable-http': 'streamable-http'
18+
}
19+
20+
return supported_transports.get(mcp_transport_str, 'stdio')
21+
522
# Ensure the server process doesn't exit immediately when run as an MCP server
623
def start_server():
724
polygon_api_key = os.environ.get("POLYGON_API_KEY", "")
@@ -10,9 +27,7 @@ def start_server():
1027
else:
1128
print("Starting Polygon MCP server with API key configured.")
1229

13-
mcp_transport = os.environ.get("MCP_TRANSPORT") or "stdio"
14-
15-
server.run(mcp_transport)
30+
server.run(transport=transport())
1631

1732
if __name__ == "__main__":
1833
start_server()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ readme = "README.md"
66
requires-python = ">=3.10"
77
dependencies = [
88
"mcp[cli]>=1.9.3",
9-
"polygon-api-client>=1.14.5",
9+
"polygon-api-client>=1.15.3",
1010
]
1111
[[project.authors]]
1212
name = "Polygon"

src/mcp_polygon/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .server import run
22

3-
__all__ = ['run']
3+
__all__ = ["run"]

0 commit comments

Comments
 (0)