Skip to content

Commit 742a5da

Browse files
RahulHereRahulHere
authored andcommitted
Use server.config settings by default in run_example.sh (#4)
Changed run_example.sh to use server.config settings instead of forcing --no-auth mode. Auth behavior is now controlled by the auth_disabled setting in server.config.
1 parent 15cc408 commit 742a5da

File tree

3 files changed

+30
-20
lines changed

3 files changed

+30
-20
lines changed

build.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,8 @@ echo -e "${GREEN}Run examples:${NC}"
244244
echo -e " ${YELLOW}python3 examples/client_example.py${NC}"
245245
echo ""
246246
echo -e "${GREEN}Run Auth MCP Server example:${NC}"
247-
echo -e " ${YELLOW}cd examples/auth && ./run_example.sh${NC} # Development mode (no auth)"
248-
echo -e " ${YELLOW}cd examples/auth && ./run_example.sh --no-auth${NC} # Explicit no-auth mode"
247+
echo -e " ${YELLOW}cd examples/auth && ./run_example.sh${NC} # Uses server.config settings"
248+
echo -e " ${YELLOW}cd examples/auth && ./run_example.sh --no-auth${NC} # Override to disable auth"
249249
echo -e " ${YELLOW}cd examples/auth && ./run_example.sh --help${NC} # Show all options"
250250
echo ""
251251
echo -e " Test endpoints:"

examples/auth/run_example.sh

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
2323
echo "Auth MCP Server Example"
2424
echo ""
2525
echo "Usage:"
26-
echo " ./run_example.sh Run with auth enabled (requires OAuth config)"
27-
echo " ./run_example.sh --no-auth Run without auth (development mode)"
26+
echo " ./run_example.sh Run using server.config settings"
27+
echo " ./run_example.sh --no-auth Override config to disable auth"
2828
echo " ./run_example.sh --help Show this help"
2929
echo ""
3030
echo "Options:"
31-
echo " --no-auth Disable OAuth authentication (for development/testing)"
31+
echo " --no-auth Disable OAuth authentication (overrides server.config)"
3232
echo " --host HOST Bind to specific host (default: 0.0.0.0)"
3333
echo " --port PORT Listen on specific port (default: 3001)"
3434
echo ""
3535
echo "Configuration:"
36-
echo " Edit server.config to configure OAuth settings"
36+
echo " Edit server.config to configure OAuth settings (auth_disabled=true/false)"
3737
echo " See server.config.example for all available options"
3838
echo ""
3939
echo "Test endpoints:"
@@ -79,13 +79,8 @@ if [ -d "${NATIVE_LIB}" ]; then
7979
fi
8080

8181
echo -e "${GREEN}Starting Auth MCP Server...${NC}"
82+
echo -e "Configuration: ${YELLOW}server.config${NC}"
8283
echo ""
8384

84-
# Default to --no-auth if no arguments provided (for easier development)
85-
if [ $# -eq 0 ]; then
86-
echo -e "${YELLOW}Tip: Running with --no-auth for development. Use './run_example.sh' with OAuth config for production.${NC}"
87-
echo ""
88-
exec python3 -m py_auth_mcp_server --no-auth
89-
else
90-
exec python3 -m py_auth_mcp_server "$@"
91-
fi
85+
# Run server with arguments (uses server.config by default)
86+
exec python3 -m py_auth_mcp_server "$@"

examples/auth/server.config

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,33 @@
1-
# Auth MCP Server Configuration - Development
2-
# Authentication disabled for local development
1+
# Auth MCP Server Configuration
2+
# This file follows the same format as the C++ auth example
33

44
# Server settings
55
host=0.0.0.0
66
port=3001
7-
server_url=http://localhost:3001
7+
# server_url=https://marni-nightcapped-nonmeditatively.ngrok-free.dev
8+
9+
# OAuth/IDP settings
10+
# Uncomment and configure for Keycloak or other OAuth provider
11+
client_id=oauth_0a650b79c5a64c3b920ae8c2b20599d9
12+
client_secret=6BiU2beUi2wIBxY3MUBLyYqoWKa4t0U_kJVm9mvSOKw
13+
auth_server_url=https://auth-test.gopher.security/realms/gopher-mcp-auth
14+
oauth_authorize_url=https://api-test.gopher.security/oauth/authorize
15+
16+
# Direct OAuth endpoint URLs (optional, derived from auth_server_url if not set)
17+
# jwks_uri=https://keycloak.example.com/realms/mcp/protocol/openid-connect/certs
18+
# issuer=https://keycloak.example.com/realms/mcp
19+
# oauth_authorize_url=https://keycloak.example.com/realms/mcp/protocol/openid-connect/auth
20+
# oauth_token_url=https://keycloak.example.com/realms/mcp/protocol/openid-connect/token
821

922
# Scopes
10-
allowed_scopes=openid profile email mcp:read mcp:admin
23+
exchange_idps=oauth-idp-714982830194556929-google
24+
allowed_scopes=openid profile email scope-001
1125

1226
# Cache settings
1327
jwks_cache_duration=3600
1428
jwks_auto_refresh=true
1529
request_timeout=30
1630

17-
# Auth bypass mode (enabled for development)
18-
auth_disabled=true
31+
# Auth bypass mode (for development/testing)
32+
# Set to true to disable authentication
33+
auth_disabled=false

0 commit comments

Comments
 (0)