diff --git a/mapbox/compat.py b/mapbox/compat.py
index baf551f..a46774e 100644
--- a/mapbox/compat.py
+++ b/mapbox/compat.py
@@ -4,7 +4,4 @@ import itertools
 import sys
 
 
-if sys.version_info < (3,):
-    map = itertools.imap
-else:
-    map = map
+map = itertools.imap if sys.version_info < (3,) else map
diff --git a/mapbox/scripts/cli.py b/mapbox/scripts/cli.py
index 7a9f867..5159758 100644
--- a/mapbox/scripts/cli.py
+++ b/mapbox/scripts/cli.py
@@ -23,12 +23,27 @@ def configure_logging(verbosity):
 @click.group()
 @cligj.verbose_opt
 @cligj.quiet_opt
+@click.option('--access-token', help="Your Mapbox access token.")
 @click.version_option(version=mapbox.__version__, message='%(version)s')
 @click.pass_context
-def main_group(ctx, verbose, quiet):
-    """Command line interface to Mapbox web services.
+def main_group(ctx, verbose, quiet, access_token):
+    """This is the command line interface to Mapbox web services.
+
+    Mapbox web services require an access token. Your token is shown
+    on the https://www.mapbox.com/developers/api/ page when you are
+    logged in. The token can be provided on the command line
+
+      $ mbx --access-token MY_TOKEN ...
+
+    or as an environment variable.
+
+    \b
+      $ export MapboxAccessToken=MY_TOKEN
+      $ mbx ...
+
     """
     verbosity = verbose - quiet
     configure_logging(verbosity)
     ctx.obj = {}
     ctx.obj['verbosity'] = verbosity
+    ctx.obj['access_token'] = access_token
diff --git a/mapbox/scripts/geocoder.py b/mapbox/scripts/geocoder.py
index 3348b7f..4705242 100644
--- a/mapbox/scripts/geocoder.py
+++ b/mapbox/scripts/geocoder.py
@@ -34,15 +34,14 @@ def coords_from_query(query):
 
 @click.command(short_help="Geocode an address or coordinates.")
 @click.argument('query', default='-', required=False)
-@click.option('--access-token', help="Your access token")
 @click.option(
     '--forward/--reverse',
     default=True,
     help="Perform a forward or reverse geocode. [default: forward]")
 @click.pass_context
-def geocode(ctx, query, access_token, forward):
-    """Get coordinates for an address (forward geocoding) or addresses
-    for coordinates (reverse geocoding)
+def geocode(ctx, query, forward):
+    """This command gets coordinates for an address (forward mode) or
+    addresses for coordinates (reverse mode).
 
     In forward (the default) mode the query argument shall be an address
     such as '1600 pennsylvania ave nw'.
@@ -57,6 +56,8 @@ def geocode(ctx, query, access_token, forward):
     """
     verbosity = (ctx.obj and ctx.obj.get('verbosity')) or 2
     logger = logging.getLogger('mapbox')
+
+    access_token = (ctx.obj and ctx.obj.get('access_token')) or None
     geocoder = mapbox.Geocoder(access_token=access_token)
 
     if forward:

Move --access-token option from command to group
New commands won't have to implement the option if it's on the group.

This means `mbx --access-token MY_TOKEN geocode` instead of `mbx geocode --access-token MY_TOKEN`.

Support for the token environment variable will be unchanged.
diff --git a/tests/test_cli.py b/tests/test_cli.py
index ad1a75d..278edfe 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -41,7 +41,7 @@ def test_cli_geocode_fwd():
     runner = CliRunner()
     result = runner.invoke(
         main_group,
-        ['geocode', '--forward', '1600 pennsylvania ave nw', '--access-token', 'bogus'])
+        ['--access-token', 'bogus', 'geocode', '--forward', '1600 pennsylvania ave nw'])
     assert result.exit_code == 0
     assert result.output == '{"query": ["1600", "pennsylvania", "ave", "nw"]}\n'
 
@@ -81,7 +81,7 @@ def test_cli_geocode_reverse():
     runner = CliRunner()
     result = runner.invoke(
         main_group,
-        ['geocode', '--reverse', '--access-token', 'pk.test'],
+        ['--access-token', 'pk.test', 'geocode', '--reverse'],
         input=','.join([str(x) for x in coords]))
     assert result.exit_code == 0
     assert result.output == '{"query": %s}\n' % json.dumps(coords)

pip install -e .[test]
parse_log_pytest
requirements.txt
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
certifi==2025.1.31
charset-normalizer==3.4.1
click==8.1.8
click-plugins==1.1.1
cligj==0.7.2
coverage==7.8.0
coveralls==4.0.1
docopt==0.6.2
exceptiongroup==1.2.2
idna==3.10
iniconfig==2.1.0
-e git+https://github.com/mapbox/mapbox-sdk-py.git@7859e5abc3ad69a001a24bb9ae66dcdd38da064c#egg=mapbox
packaging==24.2
pluggy==1.5.0
pytest==8.3.5
pytest-cov==6.0.0
PyYAML==6.0.2
requests==2.32.3
responses==0.25.7
tomli==2.2.1
uritemplate==4.1.1
uritemplate.py==3.0.2
urllib3==2.3.0

name: mapbox-sdk-py
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - certifi==2025.1.31
      - charset-normalizer==3.4.1
      - click==8.1.8
      - click-plugins==1.1.1
      - cligj==0.7.2
      - coverage==7.8.0
      - coveralls==4.0.1
      - docopt==0.6.2
      - exceptiongroup==1.2.2
      - idna==3.10
      - iniconfig==2.1.0
      - packaging==24.2
      - pluggy==1.5.0
      - pytest==8.3.5
      - pytest-cov==6.0.0
      - pyyaml==6.0.2
      - requests==2.32.3
      - responses==0.25.7
      - tomli==2.2.1
      - uritemplate==4.1.1
      - uritemplate-py==3.0.2
      - urllib3==2.3.0
prefix: /opt/conda/envs/mapbox-sdk-py

tests/test_cli.py::test_cli_geocode_fwd
tests/test_cli.py::test_coords_from_query_csv tests/test_cli.py::test_coords_from_query_ws tests/test_cli.py::test_cli_geocode_reverse tests/test_cli.py::test_cli_geocode_reverse_env_token tests/test_cli.py::test_cli_geocode_rev_unauthorized
tests/test_cli.py::test_iter_query_string tests/test_cli.py::test_iter_query_file tests/test_cli.py::test_coords_from_query_json tests/test_cli.py::test_cli_geocode_fwd_env_token tests/test_cli.py::test_cli_geocode_unauthorized
mapbox/compat.py mapbox/scripts/cli.py mapbox/scripts/geocoder.py
mapbox/compat.py mapbox/scripts/cli.py mapbox/scripts/geocoder.py