python-sdk icon indicating copy to clipboard operation
python-sdk copied to clipboard

Replace environment variables with CLI arguments in simple-auth-client

Open maxisbey opened this issue 1 month ago • 0 comments

Summary

Replaces environment variables with command-line arguments in the simple-auth-client example, providing a more flexible and intuitive interface for specifying server URLs and transport types.

Motivation and Context

The simple-auth-client previously used environment variables (MCP_SERVER_PORT and MCP_TRANSPORT_TYPE) to configure connection settings. This approach had limitations:

  • Could only specify localhost ports, not arbitrary URLs
  • Less discoverable for users (no --help option)
  • Didn't follow standard CLI conventions

This change replaces environment variables with proper command-line arguments using argparse, allowing users to specify full server URLs and making the interface more intuitive.

How Has This Been Tested?

  • Verified the --help output displays correctly
  • Code passes ruff formatting and linting checks
  • Code passes pyright type checking
  • Pre-commit hooks pass successfully

Breaking Changes

Yes - users will need to update how they invoke the client:

Before:

MCP_SERVER_PORT=8001 MCP_TRANSPORT_TYPE=streamable-http uv run mcp-simple-auth-client

After:

uv run mcp-simple-auth-client --url http://localhost:8001/mcp --transport streamable-http

However, this is an example client, not a production tool, so the impact should be minimal.

Types of changes

  • [x] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to change)
  • [x] Documentation update

Checklist

  • [x] I have read the MCP Documentation
  • [x] My code follows the repository's style guidelines
  • [x] New and existing tests pass locally
  • [x] I have added appropriate error handling
  • [x] I have added or updated documentation as needed

Additional context

Changes include:

  • Updated main.py to use argparse with --url and --transport arguments
  • Updated simple-auth-client README.md with new usage examples
  • Updated simple-auth server README.md to reference the new CLI interface
  • Removed unused os import from main.py

maxisbey avatar Nov 13 '25 11:11 maxisbey