Skip to content

Commit 81c9050

Browse files
xOxDjoedursun
authored andcommitted
Enable basic transport configuration
1 parent 0bd5b4a commit 81c9050

File tree

5 files changed

+209
-183
lines changed

5 files changed

+209
-183
lines changed

README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,20 @@ Make sure you complete the various fields.
9494
```
9595
</details>
9696

97+
## Transport Configuration
98+
99+
By default, STDIO transport is used.
100+
101+
To configure [SSE](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse) or [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http), set the `MCP_PROTOCOL` environment variable.
102+
103+
Example:
104+
105+
```bash
106+
MCP_PROTOCOL=streamable-http \
107+
POLYGON_API_KEY=<your_api_key_here> \
108+
uv run entrypoint.py
109+
```
110+
97111
## Usage Examples
98112

99113
Once integrated, you can prompt Claude to access Polygon.io data:

entrypoint.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ def start_server():
1010
else:
1111
print("Starting Polygon MCP server with API key configured.")
1212

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

1517
if __name__ == "__main__":
1618
start_server()

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ description = "A MCP server project"
55
readme = "README.md"
66
requires-python = ">=3.10"
77
dependencies = [
8-
"mcp[cli]>=1.4.1",
8+
"mcp[cli]>=1.9.3",
99
"polygon-api-client>=1.14.5",
1010
]
1111
[[project.authors]]

src/mcp_polygon/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -936,6 +936,6 @@ async def list_treasury_yields(
936936
# Directly expose the MCP server object
937937
# It will be run from entrypoint.py
938938

939-
def run():
939+
def run(transport):
940940
"""Run the Polygon MCP server."""
941-
poly_mcp.run()
941+
poly_mcp.run(transport)

0 commit comments

Comments
 (0)