Skip to content

Add MCP-specific Appwrite user agent#67

Merged
ChiragAgg5k merged 2 commits into
mainfrom
add-mcp-user-agent
Jul 8, 2026
Merged

Add MCP-specific Appwrite user agent#67
ChiragAgg5k merged 2 commits into
mainfrom
add-mcp-user-agent

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

  • add shared MCP header configuration for Appwrite SDK clients
  • set User-Agent to AppwriteMCP/{SERVER_VERSION} while preserving SDK platform details
  • cover API-key, introspection, and OAuth request client builders with unit tests

Testing

  • uv run --group dev ruff check src tests
  • uv run --group dev black --check src tests
  • uv run --group dev pyright
  • uv run python -m unittest discover -s tests/unit -v

@greptile-apps

greptile-apps Bot commented Jul 8, 2026

Copy link
Copy Markdown

Greptile Summary

This PR centralizes the Appwrite SDK client header configuration into a shared _configure_mcp_client_headers helper and sets a proper AppwriteMCP/{SERVER_VERSION} user-agent that preserves any platform tokens appended by the SDK, replacing the previous bare x-sdk-name: mcp header addition.

  • _configure_mcp_client_headers is called by all three client builders (build_client, build_introspection_client, build_client_for_request), correctly removing the SDK's own name token from the user-agent while keeping trailing platform details (e.g. Python version).
  • New unit tests cover all three builders and assert both the correct user-agent prefix and the absence of AppwritePythonSDK in the final header.

Confidence Score: 5/5

Safe to merge — the change is limited to header construction helpers and their tests, with no effect on request logic, auth, or data handling.

The refactoring is straightforward: a pure function replaces duplicated header-setting lines, all three client builders are updated consistently, and the new tests exercise each builder. The suffix-extraction logic correctly handles both the case where the SDK user-agent has a space-separated platform token and the case where it does not.

No files require special attention.

Important Files Changed

Filename Overview
src/mcp_server_appwrite/server.py Introduces _configure_mcp_client_headers helper that replaces the SDK's default user-agent prefix with AppwriteMCP/{SERVER_VERSION} while preserving any trailing platform tokens; all three client builders updated to use it.
tests/unit/test_server.py Adds assert_mcp_client_headers helper and three new tests covering build_client, build_introspection_client, and build_client_for_request for the new MCP user-agent and x-sdk-name header behaviour.

Reviews (2): Last reviewed commit: "Address MCP header helper review feedbac..." | Re-trigger Greptile

Comment thread src/mcp_server_appwrite/server.py Outdated
@ChiragAgg5k ChiragAgg5k merged commit cc980cf into main Jul 8, 2026
5 checks passed
@ChiragAgg5k ChiragAgg5k deleted the add-mcp-user-agent branch July 8, 2026 07:26
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