Skip to content

Commit b26dd61

Browse files
authored
fix: do not normalize the user provided endpoint (#7)
1 parent dad2315 commit b26dd61

File tree

3 files changed

+1
-56
lines changed

3 files changed

+1
-56
lines changed

aws_mcp_proxy/server.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
from aws_mcp_proxy.utils import (
3232
create_transport_with_sigv4,
3333
determine_service_name,
34-
normalize_endpoint_url,
3534
)
3635
from fastmcp.server.server import FastMCP
3736
from typing import Any
@@ -57,11 +56,8 @@ async def setup_mcp_mode(mcp: FastMCP, args) -> None:
5756
)
5857
logger.info('Running in MCP mode')
5958

60-
# Normalize endpoint URL
61-
endpoint_url = normalize_endpoint_url(args.endpoint)
62-
6359
# Create transport with SigV4 authentication
64-
transport = create_transport_with_sigv4(endpoint_url, service, profile)
60+
transport = create_transport_with_sigv4(args.endpoint, service, profile)
6561

6662
# Create proxy with the transport
6763
proxy = FastMCP.as_proxy(transport)

aws_mcp_proxy/utils.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -51,22 +51,6 @@ def client_factory(
5151
)
5252

5353

54-
def normalize_endpoint_url(endpoint: str, path: str = '/mcp') -> str:
55-
"""Normalize endpoint URL by ensuring it has the correct path.
56-
57-
Args:
58-
endpoint: The base endpoint URL
59-
path: The path to append (defaults to '/mcp')
60-
61-
Returns:
62-
Normalized endpoint URL
63-
"""
64-
endpoint_url = endpoint.rstrip('/')
65-
if not endpoint_url.endswith(path):
66-
endpoint_url += path
67-
return endpoint_url
68-
69-
7054
def determine_service_name(endpoint: str, service: Optional[str] = None) -> str:
7155
"""Validate and determine the service name.
7256

tests/test_utils.py

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
from aws_mcp_proxy.utils import (
1919
create_transport_with_sigv4,
2020
determine_service_name,
21-
normalize_endpoint_url,
2221
)
2322
from fastmcp.client.transports import StreamableHttpTransport
2423
from unittest.mock import MagicMock, patch
@@ -85,40 +84,6 @@ def test_create_transport_with_sigv4_no_profile(self, mock_create_sigv4_client):
8584
assert result is not None
8685

8786

88-
class TestNormalizeEndpointUrl:
89-
"""Test cases for normalize_endpoint_url function (lines 151-153)."""
90-
91-
def test_normalize_endpoint_url_default_path(self):
92-
"""Test normalizing endpoint URL with default /mcp path."""
93-
endpoint = 'https://eks-mcp.us-west-2.api.aws'
94-
result = normalize_endpoint_url(endpoint)
95-
assert result == 'https://eks-mcp.us-west-2.api.aws/mcp'
96-
97-
def test_normalize_endpoint_url_custom_path(self):
98-
"""Test normalizing endpoint URL with custom path."""
99-
endpoint = 'https://eks-mcp.us-west-2.api.aws'
100-
result = normalize_endpoint_url(endpoint, '/api/v1')
101-
assert result == 'https://eks-mcp.us-west-2.api.aws/api/v1'
102-
103-
def test_normalize_endpoint_url_trailing_slash(self):
104-
"""Test normalizing endpoint URL that already has trailing slash."""
105-
endpoint = 'https://eks-mcp.us-west-2.api.aws/'
106-
result = normalize_endpoint_url(endpoint)
107-
assert result == 'https://eks-mcp.us-west-2.api.aws/mcp'
108-
109-
def test_normalize_endpoint_url_already_has_path(self):
110-
"""Test normalizing endpoint URL that already has the path."""
111-
endpoint = 'https://eks-mcp.us-west-2.api.aws/mcp'
112-
result = normalize_endpoint_url(endpoint)
113-
assert result == 'https://eks-mcp.us-west-2.api.aws/mcp'
114-
115-
def test_normalize_endpoint_url_different_existing_path(self):
116-
"""Test normalizing endpoint URL that has a different existing path."""
117-
endpoint = 'https://eks-mcp.us-west-2.api.aws/api'
118-
result = normalize_endpoint_url(endpoint)
119-
assert result == 'https://eks-mcp.us-west-2.api.aws/api/mcp'
120-
121-
12287
class TestValidateRequiredArgs:
12388
"""Test cases for validate_service_name function."""
12489

0 commit comments

Comments
 (0)