Skip to content

feat(templates): support OAuth sign-in in the MCP server template - #14131

Merged
ChiragAgg5k merged 4 commits into
mainfrom
feat/mcp-server-oauth-template
Oct 5, 2026
Merged

ChiragAgg5k merged 4 commits into
mainfrom
feat/mcp-server-oauth-template

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 5, 2026 •

Copy link
Copy Markdown
Member

What

Updates the existing MCP server function template for its new OAuth mode (appwrite/templates#364): MCP clients sign users in through the project's OAuth2 server, and tools read Appwrite as the signed-in user.

Field Before After
scopes [] ['users.write'], so the function can create short-lived JWTs for the signed-in user
runtimes all Python (default python-3.9) Python 3.10+, newest first. The MCP SDK needs 3.10+, so the old default couldn't run
MCP_AUTH_MODE description none / bearer none / bearer / oauth
MCP_AUTH_SCOPES — new optional variable, e.g. openid tasks.read
instructions README link plus a link to the OAuth setup section
providerVersion 1.2.0 1.3.0

No schema or Console changes: it uses existing registry fields only. none stays the default.

Merge order

  1. feat(mcp-server): per-user sign-in with Appwrite OAuth2 templates#364 merged
  2. appwrite/templates tagged 1.3.0
  3. this PR

appwrite/templates 1.3.0 is released, so this is ready to merge.

Verification

  • Rendered in the production Console by intercepting the templates API with this entry. The drawer shows users.write, 2 runtimes (python-3.14, python-3.12), and 5 variables; the create screen defaults to python-3.14.
  • The template passes its 17-check end-to-end suite (OAuth discovery, client registration, PKCE, per-user rows, scope checks, pagination) on production with python-3.14 and python-3.12, and on staging.
  • php -l and Pint pass.

Related: appwrite-labs/cloud#6311

Grants users.write so OAuth mode can read as the signed-in user, adds MCP_AUTH_SCOPES, documents the oauth mode, and limits runtimes to Python 3.10+ (newest first) since the MCP SDK cannot run on 3.9.
@github-actions

github-actions Bot commented Oct 5, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → feat/mcp-server-oauth-template (after).

Metric Before After Change
🚀 Requests/sec 184.35 194.54 🟢 +5.5%
⏱️ Latency P50 93.16 ms 88.38 ms 🟢 -5.1%
⏱️ Latency P95 222.3 ms 213.44 ms ⚪ -4%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 88.38 213.44 12,426 194.54 -8.87
Account 173.01 332.04 654 10.87 -9.1
TablesDB 85.21 166.6 6,758 108.53 -12.94
Storage 81.46 180.89 3,270 53.86 -6.86
Functions 125.31 253.14 1,744 29.31 -18.65

Top API waits (after)

API request Max wait (ms)
account.name.update 634.94
account.prefs.update 527.34
functions.create 469.57
functions.delete 422.71
functions.variables.delete 390.28

@ChiragAgg5k
ChiragAgg5k marked this pull request as ready for review October 5, 2026 12:00
@ghost

ghost commented Oct 5, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The new runtime list preserves the minimum version, ordering, and deployment allow-list filtering; no concrete defects were found in the incremental changes.

Updates the MCP server template to release 1.3.0 with OAuth sign-in guidance, an optional OAuth scopes variable, and the users.write permission. Limits its runtimes to Python 3.10–3.14 in newest-first order, filtered by the deployment allow-list. Adds API regression coverage for the template's permission and runtime compatibility.

Latest changes: Replaces dynamic Python version filtering and sorting with an explicit newest-first list of Python 3.10–3.14 runtimes.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
app/config/templates/function.php Updates MCP OAuth metadata and release, grants users.write, and explicitly lists compatible Python runtimes newest first.
tests/e2e/Services/Functions/FunctionsCustomClientTest.php Adds MCP template API coverage for users.write, minimum Python version, and runtime ordering.

Reviewed the commits since c63add6 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Tier A · Looks good to merge. Summary

Comment thread app/config/templates/function.php Resolved
Asserts users.write and that every exposed runtime is Python 3.10+ in newest-first order.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Tier S · Looks good to merge. Summary

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 5, 2026
An explicit newest-first list reads at a glance instead of filtering and sorting the catalog.
@ChiragAgg5k
ChiragAgg5k merged commit ea0da7f into main Oct 5, 2026
53 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the feat/mcp-server-oauth-template branch October 5, 2026 12:37
abnegate added a commit that referenced this pull request Oct 5, 2026
Brings in #14056 (immutable TimeLimit API in packages/abuse) and #14131
(MCP server OAuth template).

Conflicts:
- app/controllers/shared/api.php: main's immutable flow (params array,
  withParams(), check()/peek() Result, reset()) with the train's request
  param encoding, which keeps falsy-but-set values such as "0" as abuse
  key params and skips values json_encode cannot encode, instead of
  main's empty() filter.
- packages/abuse/README.md: main's wording ("Utopia Abuse requires PHP
  8.5").
- packages/abuse/composer.json: main's dependency list with the train's
  utopia-php/database ^8.0 and utopia-php/query ^0.6.
- packages/abuse/tests/E2E/Appwrite/TablesDBTest.php: union of the
  train's owned-database fixture and cleanup with main's Adapter
  namespace and withParams()/check()->limited assertions.
- packages/abuse/src/Adapters/TimeLimit/Database.php: deleted, as main
  moved the adapter to src/Adapter/TimeLimit/Database.php; the train's
  database 8 schema port follows in a separate commit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant