Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mcp_proxy_for_aws/middleware/tool_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async def on_list_tools(
"""Filter tools based on read only flag."""
# Get list of FastMCP Components
tools = await call_next(context)
self.logger.info(f'Filtering tools for read only: {self.read_only}')
self.logger.info('Filtering tools for read only: %s', self.read_only)

# If not read only, return the list of tools as is
if not self.read_only:
Expand All @@ -49,7 +49,7 @@ async def on_list_tools(
read_only_hint = getattr(annotations, 'readOnlyHint', False)
if not read_only_hint:
# Skip tools that don't have readOnlyHint=True
self.logger.info(f'Skipping tool {tool.name} needing write permissions')
self.logger.info('Skipping tool %s needing write permissions', tool.name)
continue

filtered_tools.append(tool)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ force-exclude = true

[tool.ruff.lint]
exclude = ["__init__.py"]
select = ["C", "D", "E", "F", "I", "W"]
select = ["C", "D", "E", "F", "G", "I", "W"]
ignore = ["C901", "E501", "E741", "F402", "F823", "D100", "D106"]

[tool.ruff.lint.isort]
Expand Down
8 changes: 6 additions & 2 deletions tests/integ/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,14 @@ def _build_endpoint_environment_remote_configuration():

region_name = os.environ.get('AWS_REGION')
if not region_name:
logger.warn('AWS_REGION param not set. Defaulting to us-east-1')
logger.warning('AWS_REGION param not set. Defaulting to us-east-1')
region_name = 'us-east-1'

logger.info(f'Starting server with config - {remote_endpoint_url=} and {region_name=}')
logger.info(
'Starting server with config - remote_endpoint_url=%s and region_name=%s',
remote_endpoint_url,
region_name,
)

return RemoteMCPServerConfiguration(
endpoint=remote_endpoint_url,
Expand Down
2 changes: 1 addition & 1 deletion tests/integ/mcp/simple_mcp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def build_mcp_client(endpoint: str, region_name: str) -> fastmcp.Client:


async def _basic_elicitation_handler(message: str, response_type: type, params, context):
logger.info(f'Server asks: {message} with response_type {response_type}')
logger.info('Server asks: %s with response_type %s', message, response_type)

# Usually the Handler would expect an user Input to control flow via Accept, Decline, Cancel
# But in this Integ test we only care that an Elicitation request went through the handler
Expand Down
6 changes: 3 additions & 3 deletions tests/integ/test_proxy_dynamic_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ async def test_proxy_reflects_tool_addition(mcp_client: fastmcp.Client, is_using
initial_tools = await mcp_client.list_tools()
initial_tool_names = [tool.name for tool in initial_tools]

logger.info(f'Initial tools: {initial_tool_names}')
logger.info('Initial tools: %s', initial_tool_names)

# Verify 'multiply' tool doesn't exist yet
assert 'multiply' not in initial_tool_names, 'multiply tool should not exist initially'

# Act - Trigger backend to dynamically add a new tool
logger.info('Calling add_tool_multiply to add a new tool to the backend')
add_result = await mcp_client.call_tool('add_tool_multiply', {})
logger.info(f'Backend response: {add_result}')
logger.info('Backend response: %s', add_result)

# Get updated tool list
updated_tools = await mcp_client.list_tools()
updated_tool_names = [tool.name for tool in updated_tools]

logger.info(f'Updated tools: {updated_tool_names}')
logger.info('Updated tools: %s', updated_tool_names)

# Assert
# The proxy should reflect the newly added tool
Expand Down