uber-mcp 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. uber_mcp-0.1.2/.dockerignore +15 -0
  2. uber_mcp-0.1.2/.github/workflows/ci.yml +38 -0
  3. uber_mcp-0.1.2/.github/workflows/pypi.yml +38 -0
  4. uber_mcp-0.1.2/.github/workflows/release.yml +178 -0
  5. uber_mcp-0.1.2/.gitignore +21 -0
  6. uber_mcp-0.1.2/AGENTS.md +47 -0
  7. uber_mcp-0.1.2/CONTRIBUTING.md +45 -0
  8. uber_mcp-0.1.2/Dockerfile +43 -0
  9. uber_mcp-0.1.2/Dockerfile.login +65 -0
  10. uber_mcp-0.1.2/LICENSE +21 -0
  11. uber_mcp-0.1.2/Makefile +10 -0
  12. uber_mcp-0.1.2/PKG-INFO +355 -0
  13. uber_mcp-0.1.2/README.md +328 -0
  14. uber_mcp-0.1.2/SECURITY.md +10 -0
  15. uber_mcp-0.1.2/THIRD_PARTY_NOTICES +35 -0
  16. uber_mcp-0.1.2/docs/DESIGN.md +82 -0
  17. uber_mcp-0.1.2/docs/uber-web-api.md +125 -0
  18. uber_mcp-0.1.2/pyproject.toml +78 -0
  19. uber_mcp-0.1.2/requirements-login.lock +988 -0
  20. uber_mcp-0.1.2/requirements-runtime.lock +911 -0
  21. uber_mcp-0.1.2/scripts/build-image.sh +29 -0
  22. uber_mcp-0.1.2/scripts/promote-image.sh +25 -0
  23. uber_mcp-0.1.2/scripts/source-identity.py +54 -0
  24. uber_mcp-0.1.2/scripts/sync-operations.py +171 -0
  25. uber_mcp-0.1.2/scripts/test.sh +37 -0
  26. uber_mcp-0.1.2/src/uber_login/__init__.py +9 -0
  27. uber_mcp-0.1.2/src/uber_login/__main__.py +3 -0
  28. uber_mcp-0.1.2/src/uber_login/app.py +218 -0
  29. uber_mcp-0.1.2/src/uber_login/logins.py +215 -0
  30. uber_mcp-0.1.2/src/uber_login/window.py +147 -0
  31. uber_mcp-0.1.2/src/uber_mcp/__init__.py +9 -0
  32. uber_mcp-0.1.2/src/uber_mcp/__main__.py +10 -0
  33. uber_mcp-0.1.2/src/uber_mcp/account.py +100 -0
  34. uber_mcp-0.1.2/src/uber_mcp/auth.py +44 -0
  35. uber_mcp-0.1.2/src/uber_mcp/booking.py +390 -0
  36. uber_mcp-0.1.2/src/uber_mcp/cli.py +228 -0
  37. uber_mcp-0.1.2/src/uber_mcp/config.py +157 -0
  38. uber_mcp-0.1.2/src/uber_mcp/errors.py +115 -0
  39. uber_mcp-0.1.2/src/uber_mcp/fsio.py +102 -0
  40. uber_mcp-0.1.2/src/uber_mcp/login_client.py +86 -0
  41. uber_mcp-0.1.2/src/uber_mcp/logs.py +57 -0
  42. uber_mcp-0.1.2/src/uber_mcp/operations.json +19 -0
  43. uber_mcp-0.1.2/src/uber_mcp/places.py +196 -0
  44. uber_mcp-0.1.2/src/uber_mcp/rides.py +201 -0
  45. uber_mcp-0.1.2/src/uber_mcp/server.py +451 -0
  46. uber_mcp-0.1.2/src/uber_mcp/session.py +313 -0
  47. uber_mcp-0.1.2/src/uber_mcp/state.py +176 -0
  48. uber_mcp-0.1.2/src/uber_mcp/trips.py +78 -0
  49. uber_mcp-0.1.2/src/uber_mcp/uber.py +216 -0
  50. uber_mcp-0.1.2/tests/conftest.py +123 -0
  51. uber_mcp-0.1.2/tests/fixtures/README.md +21 -0
  52. uber_mcp-0.1.2/tests/fixtures/uber.py +182 -0
  53. uber_mcp-0.1.2/tests/test_booking.py +216 -0
  54. uber_mcp-0.1.2/tests/test_login_safety.py +59 -0
  55. uber_mcp-0.1.2/tests/test_rides.py +88 -0
  56. uber_mcp-0.1.2/tests/test_safety.py +94 -0
  57. uber_mcp-0.1.2/tests/test_server.py +150 -0
  58. uber_mcp-0.1.2/tests/test_session.py +98 -0
  59. uber_mcp-0.1.2/tests/test_transport.py +123 -0
  60. uber_mcp-0.1.2/uv.lock +1633 -0
@@ -0,0 +1,15 @@
1
+ .git
2
+ .github
3
+ .venv
4
+ .deps
5
+ .artifacts
6
+ **/__pycache__
7
+ **/.pytest_cache
8
+ **/.ruff_cache
9
+ **/*.pyc
10
+ tests
11
+ scripts
12
+ docs
13
+ cookies.txt
14
+ *.cookies.txt
15
+ .env
@@ -0,0 +1,38 @@
1
+ name: CI
2
+
3
+ on:
4
+ pull_request:
5
+ push:
6
+ branches: [main]
7
+ workflow_dispatch:
8
+ workflow_call:
9
+
10
+ permissions:
11
+ contents: read
12
+
13
+ concurrency:
14
+ group: ci-${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }}
15
+ cancel-in-progress: ${{ github.event_name == 'pull_request' }}
16
+
17
+ jobs:
18
+ test:
19
+ runs-on: ubuntu-latest
20
+ timeout-minutes: 20
21
+ steps:
22
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
23
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
24
+ - run: make check
25
+
26
+ # Windows and macOS: stdio, file locking, paths.
27
+ portability:
28
+ strategy:
29
+ fail-fast: false
30
+ matrix:
31
+ os: [windows-latest, macos-latest]
32
+ runs-on: ${{ matrix.os }}
33
+ timeout-minutes: 20
34
+ steps:
35
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
36
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
37
+ - run: uv sync --locked
38
+ - run: uv run --frozen pytest
@@ -0,0 +1,38 @@
1
+ name: PyPI
2
+ # A vX.Y.Z tag builds the wheel and sdist from the tagged tree and uploads them to PyPI as
3
+ # `uber-mcp` with trusted publishing (OIDC through the `pypi` environment; no token is
4
+ # stored). Tag pushes upload once the repository variable PYPI_PUBLISH is `true`; until then,
5
+ # or to retry, run it by hand on the tag: `gh workflow run pypi.yml --ref vX.Y.Z`. Files that
6
+ # are already on PyPI are skipped, so a repeated run is harmless.
7
+ on:
8
+ push:
9
+ tags: ['v*.*.*']
10
+ workflow_dispatch: {}
11
+
12
+ permissions: {}
13
+
14
+ concurrency:
15
+ group: pypi-${{ github.ref }}
16
+ cancel-in-progress: false
17
+
18
+ jobs:
19
+ publish:
20
+ if: github.ref_type == 'tag' && (github.event_name == 'workflow_dispatch' || vars.PYPI_PUBLISH == 'true')
21
+ runs-on: ubuntu-latest
22
+ timeout-minutes: 10
23
+ environment: pypi
24
+ permissions:
25
+ contents: read
26
+ id-token: write
27
+ steps:
28
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
29
+ with:
30
+ persist-credentials: false
31
+ - uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
32
+ - name: Build
33
+ run: |
34
+ version="$(python3 -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
35
+ [ "${GITHUB_REF_NAME#v}" = "$version" ] || { echo "tag $GITHUB_REF_NAME is not version $version" >&2; exit 1; }
36
+ uv build
37
+ - name: Upload
38
+ run: uv publish --trusted-publishing always --check-url https://pypi.org/simple/
@@ -0,0 +1,178 @@
1
+ name: Release
2
+ # A v1.2.3 tag: run the tests on the tagged commit, build the server image (Dockerfile, amd64 and arm64) and the
3
+ # login browser image (Dockerfile.login, amd64), smoke-test both, push them to GHCR and publish a GitHub release.
4
+ # Only the built-in token is used.
5
+ #
6
+ # Every build first publishes a permanent :sha-<12> candidate; a tag release promotes that exact digest to the
7
+ # semver tag and :latest (scripts/promote-image.sh refuses to move an existing tag).
8
+ #
9
+ # v1.2.3 tag -> :sha-<12> + :1.2.3 + :latest, and a GitHub release
10
+ # workflow_dispatch -> :sha-<12> (never moves semver or latest)
11
+ on:
12
+ push:
13
+ tags: ['v*.*.*']
14
+ workflow_dispatch: {}
15
+
16
+ permissions: {}
17
+
18
+ # GitHub can deliver one tag push twice: the runs of a ref queue one behind the other, and a
19
+ # run whose tag already has a GitHub release (the last job) stops at `released`.
20
+ concurrency:
21
+ group: release-${{ github.ref }}
22
+ cancel-in-progress: false
23
+
24
+ jobs:
25
+ released:
26
+ runs-on: ubuntu-latest
27
+ timeout-minutes: 5
28
+ permissions:
29
+ contents: read
30
+ outputs:
31
+ done: ${{ steps.check.outputs.done }}
32
+ steps:
33
+ - id: check
34
+ env:
35
+ GH_TOKEN: ${{ github.token }}
36
+ TAG: ${{ github.ref_name }}
37
+ run: |
38
+ done=false
39
+ if [ "$GITHUB_REF_TYPE" = tag ] && gh release view "$TAG" --repo "$GITHUB_REPOSITORY" >/dev/null 2>&1; then
40
+ done=true
41
+ echo "$TAG is already released: nothing to do"
42
+ fi
43
+ echo "done=$done" >> "$GITHUB_OUTPUT"
44
+
45
+ ci:
46
+ needs: released
47
+ if: needs.released.outputs.done != 'true'
48
+ uses: ./.github/workflows/ci.yml
49
+ permissions:
50
+ contents: read
51
+
52
+ images:
53
+ needs: ci
54
+ runs-on: ubuntu-latest
55
+ timeout-minutes: 30
56
+ permissions:
57
+ contents: read
58
+ packages: write
59
+ outputs:
60
+ version: ${{ steps.v.outputs.version }}
61
+ env:
62
+ # zstd layers: faster to decompress on the pulling host; Docker >= 23 pulls them.
63
+ ZSTD_PUSH: type=registry,compression=zstd,compression-level=3,force-compression=true,oci-mediatypes=true
64
+ REG: ghcr.io/${{ github.repository_owner }}
65
+ SERVER_IMAGE: uber-mcp-server
66
+ LOGIN_IMAGE: uber-mcp-login-browser
67
+ SOURCE_URL: ${{ github.server_url }}/${{ github.repository }}
68
+ steps:
69
+ - uses: actions/checkout@93cb6efe18208431cddfb8368fd83d5badbf9bfd # v5
70
+ - name: Log in to GHCR
71
+ uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
72
+ with:
73
+ registry: ghcr.io
74
+ username: ${{ github.actor }}
75
+ password: ${{ secrets.GITHUB_TOKEN }}
76
+ - uses: docker/setup-qemu-action@v3
77
+ - uses: docker/setup-buildx-action@v3
78
+ - name: Compute version
79
+ id: v
80
+ run: |
81
+ if [ "${{ github.event_name }}" = push ] && [ "${{ github.ref_type }}" = tag ]; then
82
+ V="${GITHUB_REF_NAME#v}"
83
+ LATEST=true
84
+ grep -qx "version = \"$V\"" pyproject.toml || { echo "ERROR: tag $GITHUB_REF_NAME != pyproject version" >&2; exit 1; }
85
+ else
86
+ V="sha-$(git rev-parse --short=12 HEAD)"
87
+ LATEST=false
88
+ fi
89
+ BUILD_REF="sha-$(git rev-parse --short=12 HEAD)"
90
+ echo "version=$V" >> "$GITHUB_OUTPUT"
91
+ echo "build_ref=$BUILD_REF" >> "$GITHUB_OUTPUT"
92
+ echo "latest=$LATEST" >> "$GITHUB_OUTPUT"
93
+ echo "Building candidate: $BUILD_REF; release ref: $V"
94
+ - name: Build + push server image
95
+ id: server
96
+ env:
97
+ BUILD_REF: ${{ steps.v.outputs.build_ref }}
98
+ VCS_REF: ${{ github.sha }}
99
+ run: |
100
+ set -euo pipefail
101
+ BUILD_DATE="$(git show -s --format=%cI "$VCS_REF")"
102
+ candidate="$REG/$SERVER_IMAGE:$BUILD_REF"
103
+ PLATFORMS=linux/amd64,linux/arm64 \
104
+ bash scripts/build-image.sh "$candidate" Dockerfile "$VCS_REF" "$BUILD_DATE" "$REG/$SERVER_IMAGE:buildcache"
105
+ digest="$(docker buildx imagetools inspect "$candidate" --format '{{json .Manifest}}' | jq -er .digest)"
106
+ image="$REG/$SERVER_IMAGE@$digest"
107
+ docker pull -q "$image" >/dev/null
108
+ # Smoke: the server builds with a sealed session and booking caps without a network, refuses HTTP
109
+ # without a bearer, and answers its own health check (the image's HEALTHCHECK) on a read-only root as uid 1000.
110
+ docker run --rm --network none --read-only --tmpfs /tmp --tmpfs /state:uid=1000 \
111
+ -e UBER_SESSION_KEY=AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA= -e UBER_MAX_FARE='USD 80' -e UBER_MAX_FARE_24H='USD 200' \
112
+ --entrypoint python "$image" -c 'from uber_mcp.server import UberService, create_server; from uber_mcp.config import Settings; s = Settings.from_env(); assert s.booking_enabled and create_server(UberService(s)).name == "uber"'
113
+ rc=0
114
+ timeout 120 docker run --rm --network none --read-only --tmpfs /tmp --tmpfs /state:uid=1000 "$image" || rc=$?
115
+ [ "$rc" = 1 ] || { echo "ERROR: expected a refusal without MCP_BEARER_TOKEN, got exit $rc" >&2; exit 1; }
116
+ name="smoke-$BUILD_REF"
117
+ docker run -d --name "$name" --network none --read-only --tmpfs /tmp --tmpfs /state:uid=1000 \
118
+ -e MCP_BEARER_TOKEN=smoke-token-0123456789abcdef "$image" >/dev/null
119
+ trap 'docker rm -f "$name" >/dev/null 2>&1 || true' EXIT
120
+ for _ in $(seq 30); do docker exec "$name" uber-mcp health && break; sleep 1; done
121
+ docker exec "$name" uber-mcp health || { docker logs "$name" >&2; exit 1; }
122
+ echo "digest=$digest" >> "$GITHUB_OUTPUT"
123
+ - name: Build + push login browser image
124
+ id: login
125
+ env:
126
+ BUILD_REF: ${{ steps.v.outputs.build_ref }}
127
+ VCS_REF: ${{ github.sha }}
128
+ run: |
129
+ set -euo pipefail
130
+ BUILD_DATE="$(git show -s --format=%cI "$VCS_REF")"
131
+ candidate="$REG/$LOGIN_IMAGE:$BUILD_REF"
132
+ bash scripts/build-image.sh "$candidate" Dockerfile.login "$VCS_REF" "$BUILD_DATE" "$REG/$LOGIN_IMAGE:buildcache"
133
+ digest="$(docker buildx imagetools inspect "$candidate" --format '{{json .Manifest}}' | jq -er .digest)"
134
+ docker pull -q "$REG/$LOGIN_IMAGE@$digest" >/dev/null
135
+ image="$REG/$LOGIN_IMAGE@$digest"
136
+ # Smoke: the browser, display, remote-desktop server, viewer and CJK fonts are there; the service
137
+ # refuses to start without its bearer; it never runs as root.
138
+ docker run --rm --network none --entrypoint sh "$image" -c '
139
+ set -e
140
+ [ "$(id -u)" = 1000 ]
141
+ python -c "import uber_login.app, uber_login.logins, uber_login.window, patchright"
142
+ command -v Xvfb >/dev/null && command -v x11vnc >/dev/null
143
+ ls /ms-patchright | grep -q chromium
144
+ [ -f /opt/novnc/vnc.html ] && [ -f /opt/novnc/core/rfb.js ]
145
+ ls /usr/share/fonts/opentype/noto/ | grep -q CJK'
146
+ rc=0
147
+ timeout 60 docker run --rm --network none "$image" || rc=$?
148
+ [ "$rc" = 1 ] || { echo "ERROR: expected a refusal without UBER_LOGIN_TOKEN, got exit $rc" >&2; exit 1; }
149
+ echo "digest=$digest" >> "$GITHUB_OUTPUT"
150
+ - name: Promote verified immutable refs
151
+ env:
152
+ V: ${{ steps.v.outputs.version }}
153
+ PUBLISH_LATEST: ${{ steps.v.outputs.latest }}
154
+ SERVER_DIGEST: ${{ steps.server.outputs.digest }}
155
+ LOGIN_DIGEST: ${{ steps.login.outputs.digest }}
156
+ run: |
157
+ set -euo pipefail
158
+ for pair in "$SERVER_IMAGE:$SERVER_DIGEST" "$LOGIN_IMAGE:$LOGIN_DIGEST"; do
159
+ name="${pair%%:*}"; digest="${pair#*:}"
160
+ bash scripts/promote-image.sh "$REG/$name" "$digest" "$V"
161
+ if [ "$PUBLISH_LATEST" = true ]; then
162
+ docker buildx imagetools create --prefer-index=false --tag "$REG/$name:latest" "$REG/$name@$digest"
163
+ [ "$(docker buildx imagetools inspect "$REG/$name:latest" --format '{{json .Manifest}}' | jq -r .digest)" = "$digest" ]
164
+ fi
165
+ done
166
+
167
+ github-release:
168
+ needs: images
169
+ if: github.event_name == 'push' && github.ref_type == 'tag'
170
+ runs-on: ubuntu-latest
171
+ timeout-minutes: 5
172
+ permissions:
173
+ contents: write
174
+ steps:
175
+ - env:
176
+ GH_TOKEN: ${{ github.token }}
177
+ TAG: ${{ github.ref_name }}
178
+ run: gh release create "$TAG" --repo "$GITHUB_REPOSITORY" --verify-tag --title "$TAG" --generate-notes
@@ -0,0 +1,21 @@
1
+ # secrets and local state
2
+ cookies.txt
3
+ *.cookies.txt
4
+ .env
5
+
6
+ # python
7
+ .venv/
8
+ __pycache__/
9
+ *.py[cod]
10
+ *.egg-info/
11
+ dist/
12
+ build/
13
+ .pytest_cache/
14
+ .ruff_cache/
15
+
16
+ # gate
17
+ .deps/
18
+ .artifacts/
19
+ # saved sessions and local state
20
+ session*.json
21
+ session.bin
@@ -0,0 +1,47 @@
1
+ # Working on uber-mcp
2
+
3
+ Instructions for contributors and coding agents. `AGENTS.md` is the only agent instruction file.
4
+
5
+ **This repository is public.** Never commit personal data or anything about a particular deployment: no real names,
6
+ email addresses, phone numbers or account details, no recorded payloads from a real Uber account, no addresses,
7
+ places, coordinates, trips, fares, drivers, plates or payment methods, no host names, networks or infrastructure of
8
+ where it runs, and no anecdotes about who used it when. Deployment-specific configuration and runbooks belong with the
9
+ deployment, not here. This applies to code comments, docs, tests, fixtures and commit messages alike.
10
+
11
+ ## Verify
12
+
13
+ `make bootstrap`, then `make check`: ruff, the format check, the lock-consistency check (`requirements-runtime.lock`
14
+ and `requirements-login.lock` must equal `uv export` of `uv.lock`; run `make lock` after a dependency change) and
15
+ pytest, with a source-bound receipt under `.artifacts/`. Documentation-only changes need `git diff --check` and link
16
+ checks.
17
+
18
+ Tests never reach Uber: `tests/conftest.py` puts a fake Uber behind the real `Transport`, answering each GraphQL
19
+ operation the way [docs/uber-web-api.md](docs/uber-web-api.md) describes. Fixtures are synthetic
20
+ (`tests/fixtures/README.md`): shaped like Uber's responses, with invented values.
21
+
22
+ ## Boundaries
23
+
24
+ - `tests/test_safety.py` is the safety boundary: a new Uber host, a new GraphQL operation (read or money), a network
25
+ import outside `uber.py` and `login_client.py` (and `cli.py`'s local health check), or a money operation named or
26
+ sent anywhere but `booking.py` is a deliberate change there, never a side effect. `uber_request_ride` and
27
+ `uber_cancel_ride` are the only tools not marked read-only, and they are marked destructive.
28
+ - **Booking lives only in `booking.py`.** `TripRequest` and `TripCancel` go out only through
29
+ `Uber.graphql(..., money=True)` from there, and only after a preview, a single-use confirm token bound to the
30
+ preview's arguments, a fresh price no higher than the approved one, both caps, the freeze check and the
31
+ one-ride-at-a-time check, with every attempt in `audit.jsonl`. Weakening any of these, or adding a way to book
32
+ around them (scheduled rides, tips, other payment flows), is a design change: argue it in the pull request.
33
+ - An outcome that may have reached Uber is `outcome_unknown`, never retried by the server.
34
+ - `tests/test_login_safety.py`: the sign-in window shows only Uber's pages (and Google's or Apple's sign-in) and
35
+ automates nothing on them: no click, keystroke, fill or form call exists in `src/uber_login`. The login service's
36
+ API needs its bearer and the person's view needs its per-sign-in token.
37
+ - Tool results never carry exception text or cookies; errors use the fixed `NEXT_STEP` table in `errors.py`. Logs
38
+ never carry tool arguments (places), cookie values or Uber's error text.
39
+ - `operations.json` holds Uber's own GraphQL documents, refreshed with `scripts/sync-operations.py`; never hand-write
40
+ a document Uber's web apps do not send.
41
+ - Live checks against Uber: only your own account, a handful of paced read-only calls, nothing they return is
42
+ committed. Never request or cancel a ride in a check, test or experiment, and never with someone else's account.
43
+
44
+ ## Releases
45
+
46
+ A `vX.Y.Z` tag whose version matches `pyproject.toml` runs `.github/workflows/release.yml`: the tests, then both
47
+ images (smoke-tested, pushed to GHCR, promoted from an immutable `:sha-<12>` candidate) and a GitHub release.
@@ -0,0 +1,45 @@
1
+ # Contributing
2
+
3
+ Thanks for helping. Issues and pull requests are welcome, especially when Uber changes its web API and a tool starts
4
+ failing with `schema_changed`.
5
+
6
+ ## Setup
7
+
8
+ ```sh
9
+ git clone https://github.com/benjamin-di/uber-mcp-server
10
+ cd uber-mcp-server
11
+ make bootstrap # uv sync --locked
12
+ make check # lint, format, lock consistency, tests
13
+ ```
14
+
15
+ `uv run uber-mcp --help` runs your checkout. To try it against Uber, sign in with
16
+ `uv run --extra login uber-mcp login` and use a separate `UBER_STATE_DIR` for development. Leave `UBER_MAX_FARE` and
17
+ `UBER_MAX_FARE_24H` unset while developing: booking then stays off.
18
+
19
+ When Uber renames an operation or a field, `uv run python scripts/sync-operations.py` reads the current GraphQL
20
+ documents from Uber's own web apps (with the signed-in session of `UBER_STATE_DIR`) and rewrites
21
+ `src/uber_mcp/operations.json`; it names any operation it can no longer find.
22
+
23
+ ## Rules
24
+
25
+ - **No personal data.** Never commit real account data, recorded payloads from a signed-in session, cookies, names,
26
+ email addresses, phone numbers, places, coordinates, trips, fares or payment details, in code, tests, fixtures,
27
+ docs or commit messages. Fixtures are synthetic (`tests/fixtures/README.md`).
28
+ - **Tests never contact Uber.** Model new behaviour in the fakes (`tests/conftest.py`, `tests/fixtures/uber.py`) and
29
+ document what you observed in [docs/uber-web-api.md](docs/uber-web-api.md).
30
+ - **The safety boundary is deliberate.** Adding an Uber host or GraphQL operation, or anything that could book,
31
+ cancel or pay outside `src/uber_mcp/booking.py` and its preview, confirm and cap checks, means changing
32
+ `tests/test_safety.py` on purpose and explaining why in the pull request.
33
+ - Keep tool outputs stable: fields may be added, not renamed or removed, without a major version.
34
+ - Be gentle with Uber when testing live: only your own account, a handful of read-only requests, and commit nothing
35
+ they return. Never request or cancel a ride to test something.
36
+
37
+ AGENTS.md has the same rules for coding agents.
38
+
39
+ ## How changes land
40
+
41
+ Each release of this repository is exported from a private working repository as one
42
+ `Release X.Y.Z` commit, so pull requests are not merged here: the next release would replace
43
+ them. When a change fits, the maintainer applies it there, credits you in the release notes
44
+ and closes the pull request with a link to the release that contains it. Issues are welcome;
45
+ answers are best effort.
@@ -0,0 +1,43 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ # uber-mcp: the MCP server over streamable HTTP at :8000/mcp (needs MCP_BEARER_TOKEN). It runs as uid 1000 and
3
+ # works on a read-only root filesystem; /state (a volume) keeps the session (sealed under UBER_SESSION_KEY), the
4
+ # budget, the pause, booking previews, the 24-hour spend and the audit log.
5
+ FROM ghcr.io/astral-sh/uv:0.9.26@sha256:9a23023be68b2ed09750ae636228e903a54a05ea56ed03a934d00fe9fbeded4b AS uv
6
+
7
+ FROM python:3.12.13-slim-trixie@sha256:57cd7c3a7a273101a6485ba99423ee568157882804b1124b4dd04266317710de
8
+
9
+ ENV PYTHONDONTWRITEBYTECODE=1 \
10
+ PYTHONUNBUFFERED=1 \
11
+ HOME=/tmp \
12
+ UBER_STATE_DIR=/state
13
+
14
+ # Locked dependencies first, so a code-only release reuses this layer.
15
+ COPY requirements-runtime.lock /tmp/requirements-runtime.lock
16
+ RUN --mount=from=uv,source=/uv,target=/usr/local/bin/uv \
17
+ --mount=type=cache,target=/root/.cache/uv \
18
+ uv pip install --system --compile-bytecode --require-hashes -r /tmp/requirements-runtime.lock \
19
+ && rm /tmp/requirements-runtime.lock
20
+
21
+ WORKDIR /app
22
+ COPY pyproject.toml README.md LICENSE THIRD_PARTY_NOTICES ./
23
+ COPY src ./src
24
+ RUN --mount=from=uv,source=/uv,target=/usr/local/bin/uv \
25
+ uv pip install --system --compile-bytecode --no-deps . \
26
+ && rm -rf /app/src \
27
+ && install -d -o 1000 -g 1000 -m 0700 /state
28
+
29
+ ARG VCS_REF=unknown
30
+ ARG BUILD_DATE=unknown
31
+ ARG SOURCE_URL=https://github.com/benjamin-di/uber-mcp-server
32
+ LABEL org.opencontainers.image.title="uber-mcp" \
33
+ org.opencontainers.image.description="Unofficial MCP server for Uber rides" \
34
+ org.opencontainers.image.licenses="MIT" \
35
+ org.opencontainers.image.source="${SOURCE_URL}" \
36
+ org.opencontainers.image.revision="${VCS_REF}" \
37
+ org.opencontainers.image.created="${BUILD_DATE}"
38
+
39
+ EXPOSE 8000
40
+ USER 1000:1000
41
+ HEALTHCHECK --interval=60s --timeout=5s --start-period=2m --start-interval=2s CMD ["uber-mcp", "health"]
42
+ ENTRYPOINT ["uber-mcp"]
43
+ CMD ["serve", "--host", "0.0.0.0", "--port", "8000"]
@@ -0,0 +1,65 @@
1
+ # syntax=docker/dockerfile:1.7
2
+ # uber-mcp-login: the browser a person signs in to Uber with (src/uber_login), shown to them through noVNC on its
3
+ # view page. A virtual display (Xvfb), a remote-desktop server on loopback (x11vnc), patchright's Chromium and CJK
4
+ # fonts (Uber shows the rider's language). It never automates the sign-in (tests/test_login_safety.py).
5
+ FROM ghcr.io/astral-sh/uv:0.9.26@sha256:9a23023be68b2ed09750ae636228e903a54a05ea56ed03a934d00fe9fbeded4b AS uv
6
+
7
+ FROM python:3.12.13-slim-trixie@sha256:57cd7c3a7a273101a6485ba99423ee568157882804b1124b4dd04266317710de
8
+
9
+ ENV PYTHONDONTWRITEBYTECODE=1 \
10
+ PYTHONUNBUFFERED=1 \
11
+ PLAYWRIGHT_BROWSERS_PATH=/ms-patchright \
12
+ HOME=/home/login \
13
+ UBER_LOGIN_NOVNC=/opt/novnc
14
+
15
+ COPY --from=uv /uv /usr/local/bin/
16
+
17
+ RUN apt-get update \
18
+ && apt-get install -y --no-install-recommends \
19
+ ca-certificates \
20
+ curl \
21
+ dumb-init \
22
+ fonts-noto-cjk \
23
+ x11vnc \
24
+ xvfb \
25
+ && rm -rf /var/lib/apt/lists/*
26
+
27
+ # noVNC's own viewer (static files only; the WebSocket bridge is the service's, behind each sign-in's view token).
28
+ ARG NOVNC_VERSION=1.6.0
29
+ ARG NOVNC_SHA256=5066103959ef4e9b10f37e5a148627360dd8414e4cf8a7db92bdbd022e728aaa
30
+ RUN curl --fail --silent --show-error --location \
31
+ "https://github.com/novnc/noVNC/archive/refs/tags/v${NOVNC_VERSION}.tar.gz" -o /tmp/novnc.tar.gz \
32
+ && printf '%s /tmp/novnc.tar.gz\n' "${NOVNC_SHA256}" | sha256sum --check --status \
33
+ && mkdir -p /opt/novnc \
34
+ && tar -xzf /tmp/novnc.tar.gz -C /opt/novnc --strip-components=1 \
35
+ "noVNC-${NOVNC_VERSION}/app" "noVNC-${NOVNC_VERSION}/core" "noVNC-${NOVNC_VERSION}/vendor" \
36
+ "noVNC-${NOVNC_VERSION}/vnc.html" \
37
+ && rm /tmp/novnc.tar.gz
38
+
39
+ # Locked dependencies first, so a code-only release reuses the Chromium layer.
40
+ COPY requirements-login.lock /tmp/requirements-login.lock
41
+ RUN uv pip install --system --compile-bytecode --require-hashes -r /tmp/requirements-login.lock \
42
+ && patchright install --with-deps chromium \
43
+ && rm -rf /var/lib/apt/lists/* /tmp/requirements-login.lock \
44
+ && useradd --uid 1000 --home-dir /home/login --shell /usr/sbin/nologin login \
45
+ && install -d -o 1000 -g 1000 -m 0700 /home/login
46
+
47
+ WORKDIR /app
48
+ COPY pyproject.toml README.md LICENSE THIRD_PARTY_NOTICES ./
49
+ COPY src ./src
50
+ RUN uv pip install --system --compile-bytecode --no-deps . && rm -rf /app/src
51
+
52
+ ARG VCS_REF=unknown
53
+ ARG BUILD_DATE=unknown
54
+ ARG SOURCE_URL=https://github.com/benjamin-di/uber-mcp-server
55
+ LABEL org.opencontainers.image.title="uber-mcp-login" \
56
+ org.opencontainers.image.description="The browser a person signs in to Uber with, for uber-mcp on a server" \
57
+ org.opencontainers.image.licenses="MIT" \
58
+ org.opencontainers.image.source="${SOURCE_URL}" \
59
+ org.opencontainers.image.revision="${VCS_REF}" \
60
+ org.opencontainers.image.created="${BUILD_DATE}"
61
+
62
+ EXPOSE 8080
63
+ USER 1000:1000
64
+ ENTRYPOINT ["dumb-init", "--"]
65
+ CMD ["python", "-m", "uber_login"]
uber_mcp-0.1.2/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 benjamin-di
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ .PHONY: bootstrap check lock
2
+ bootstrap:
3
+ uv sync --locked
4
+ check:
5
+ ./scripts/test.sh
6
+ # After editing dependencies in pyproject.toml: refresh uv.lock and the images' hash locks.
7
+ lock:
8
+ uv lock
9
+ uv export --frozen --no-dev --no-emit-project --no-header --quiet -o requirements-runtime.lock
10
+ uv export --frozen --no-dev --extra login --no-emit-project --no-header --quiet -o requirements-login.lock