Skip to content

Commit 97422ed

Browse files
author
Kyon Caldera
committed
refactor: change allow-write to read-only
1 parent 51c6fa1 commit 97422ed

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Add this to your MCP client configuration, replacing env variables to match the
3535
Optional arguments you can add:
3636
- `--service`: AWS service name for SigV4 signing (inferred from endpoint if not provided)
3737
- `--profile`: AWS profile to use (uses AWS_PROFILE environment variable if not provided)
38-
- `--allow-write`: Allow tools that require write permissions to be enabled (by default, only tools with the `readOnlyHint` annotation are enabled)
38+
- `--read-only`: Disable tools which require write permissions. (tools which DO NOT require write permissions are annotated `readOnlyHint`)
3939

4040
NOTE: `remote-server-url` should be your remote mcp server's URL (including the `/mcp` part). `service-code` should be the service code for your own mcp service, such as `eks-mcp`.
4141

@@ -58,7 +58,7 @@ Example with all options
5858
"<service-code>",
5959
"--profile",
6060
"default",
61-
"--allow-write"
61+
"--read-only"
6262
]
6363
}
6464
}

aws_mcp_proxy/mcp_proxy_manager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ class McpProxyManager:
2323

2424
logger = logging.getLogger(__name__)
2525

26-
def __init__(self, target_mcp: FastMCP, allow_write: bool = False):
26+
def __init__(self, target_mcp: FastMCP, read_only: bool = False):
2727
"""Initialize the MCP Proxy Manager.
2828
2929
Args:
3030
target_mcp: The target MCP server to add content to
31-
allow_write: Whether to allow tools that require write permissions
31+
read_only: Whether to allow tools that require write permissions
3232
"""
3333
self.target_mcp = target_mcp
34-
self.allow_write = allow_write
34+
self.read_only = read_only
3535

3636
async def add_proxy_content(self, proxy: FastMCP) -> None:
3737
"""Add tools, resources, and prompts from proxy to MCP server.
@@ -68,7 +68,7 @@ async def _add_tools(self, proxy: FastMCP) -> None:
6868
for tool_name, tool in tools.items():
6969
# Check the tool annotations and disable if needed
7070
annotations = tool.annotations
71-
if not self.allow_write:
71+
if self.read_only:
7272
# In readOnly mode, skip the tools with no readOnlyHint=True annotation
7373
if annotations and not annotations.readOnlyHint or not annotations:
7474
self.logger.info(f'Skipping tool {tool_name} needing write permissions')

aws_mcp_proxy/server.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ async def setup_mcp_mode(mcp: FastMCP, args) -> None:
6363
proxy = FastMCP.as_proxy(transport)
6464

6565
# Use McpProxyManager to add proxy content
66-
proxy_manager = McpProxyManager(mcp, args.allow_write)
66+
proxy_manager = McpProxyManager(mcp, args.read_only)
6767
await proxy_manager.add_proxy_content(proxy)
6868

6969

@@ -81,7 +81,7 @@ def parse_args():
8181
aws-mcp-proxy --endpoint https://eks-mcp.us-west-2.api.aws --service eks-mcp --profile default
8282
8383
# Run with write permissions enabled
84-
aws-mcp-proxy --endpoint https://eks-mcp.us-west-2.api.aws --allow-write
84+
aws-mcp-proxy --endpoint https://eks-mcp.us-west-2.api.aws --read-only
8585
""",
8686
)
8787

@@ -102,9 +102,9 @@ def parse_args():
102102
)
103103

104104
parser.add_argument(
105-
'--allow-write',
105+
'--read-only',
106106
action='store_true',
107-
help='Allow tools that require write permissions to be enabled',
107+
help='Disable tools which require write permissions',
108108
)
109109

110110
parser.add_argument(

0 commit comments

Comments
 (0)