Skip to content

Commit 4bb252b

Browse files
committed
Adding internal gateway auth
Signed-off-by: Eran Ifrach <[email protected]>
1 parent 9bc8fb8 commit 4bb252b

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
SNOWFLAKE_DATABASE = os.environ.get("SNOWFLAKE_DATABASE")
1717
SNOWFLAKE_SCHEMA = os.environ.get("SNOWFLAKE_SCHEMA")
1818
SNOWFLAKE_WAREHOUSE = os.environ.get("SNOWFLAKE_WAREHOUSE", "DEFAULT")
19+
INTERNAL_GATEWAY = os.environ.get("INTERNAL_GATEWAY", "false")
1920

2021
# Snowflake token handling - for stdio transport, get from environment
2122
# For other transports, it will be retrieved from request context in tools layer

src/tools.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from mcp.server.fastmcp import FastMCP
55

6-
from config import MCP_TRANSPORT, SNOWFLAKE_TOKEN
6+
from config import MCP_TRANSPORT, SNOWFLAKE_TOKEN, INTERNAL_GATEWAY
77
from database import (
88
execute_snowflake_query,
99
format_snowflake_row,
@@ -18,7 +18,7 @@
1818

1919
def get_snowflake_token(mcp: FastMCP) -> Optional[str]:
2020
"""Get Snowflake token from either config (stdio) or request headers (non-stdio)"""
21-
if MCP_TRANSPORT == "stdio":
21+
if MCP_TRANSPORT == "stdio" or INTERNAL_GATEWAY.lower() == "true":
2222
return SNOWFLAKE_TOKEN
2323
else:
2424
try:

0 commit comments

Comments
 (0)