Skip to content

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

Closed
maxisbey wants to merge 1 commit intomainfrom
simple-auth-client-cli-args
Closed

Replace environment variables with CLI arguments in simple-auth-client#1622
maxisbey wants to merge 1 commit intomainfrom
simple-auth-client-cli-args

Conversation

@maxisbey
Copy link
Copy Markdown
Contributor

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

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

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • 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

The simple-auth-client example previously used environment variables
(MCP_SERVER_PORT and MCP_TRANSPORT_TYPE) to configure the server URL
and transport type. This approach was inflexible and couldn't handle
arbitrary server URLs.

This change replaces the environment variables with command-line
arguments using argparse:
- --url: Specifies the full URL of the MCP server
- --transport: Specifies the transport type (streamable-http or sse)

Benefits:
- Users can now specify any server URL, not just localhost ports
- More intuitive and discoverable interface with --help
- Better follows CLI conventions

All documentation (both client and server READMEs) has been updated
to reflect the new command-line interface.
@maxisbey maxisbey added enhancement Request for a new feature that's not currently supported P3 Nice to haves, rare edge cases labels Nov 13, 2025
@maxisbey maxisbey closed this Mar 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Request for a new feature that's not currently supported P3 Nice to haves, rare edge cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant