feat: initial gdocs-daily-mcp-remote codebase #1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "288-initial-codebase"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Initial codebase for gdocs-daily-mcp-remote -- a single-tool MCP remote server that reads Google Docs daily notes (named MM-DD-YYYY) via OAuth 2.0 over Streamable HTTP.
Changes
src/gdocs_daily_mcp_remote/server.py-- FastMCP instance withget_daily_notetool, Google OAuth config via mcp-remote-auth, ContextVar-based per-request access token injection, /metrics endpointsrc/gdocs_daily_mcp_remote/gdocs_client.py-- Google Docs/Drive API wrapper using httpx directly (no google-api-python-client). Searches Drive by title, extracts doc content as Markdown with heading/list/bold formattingsrc/gdocs_daily_mcp_remote/__main__.py-- Entry point forpython -m gdocs_daily_mcp_remotepyproject.toml-- Package config with mcp-remote-auth, httpx, uvicorn dependenciesDockerfile.k8s-- Container image following gmail-mcp-remote pattern.woodpecker.yaml-- CI pipeline: ruff lint/format check + kaniko build-and-push.env.example-- Environment variable templaterequirements.txt-- Pip requirements mirror of pyproject.toml dependenciesDesign Decisions
_setup_gdocs_clientcallback refreshes the Google access token from the stored refresh_token and sets it on a ContextVar. The tool reads it directly. No monkey-patching needed.#levels, bullets as-with nesting indentation, bold as**.Test Plan
get_daily_notetoolReview Checklist
Related Notes
None -- new repo, no existing notes.
Related
Closes forgejo_admin/pal-e-platform#288
QA Review -- PR #1
Architecture & Pattern Compliance
The codebase correctly follows the mcp-remote-auth pattern established by gmail-mcp-remote and gcal-mcp-remote. Key pattern elements verified:
The decision to define the tool directly on the FastMCP instance (no inner provider package, no client_patch.py) is sound for a single-tool server.
Findings
1. [nit] server.py: mid-module imports with noqa comments
The
from mcp_remote_auth import ...andfrom starlette ...imports are placed mid-module after the tool definition. This matches the gmail-mcp-remote pattern (which does it because it must apply the monkey-patch before importing mcp), but here there is no ordering constraint -- the tool uses a lazy import internally. These could be moved to the top of the file for cleaner style. However, since it matches the established pattern across the other remotes, this is acceptable as-is.2. [nit] gdocs_client.py: title injection in Drive query
search_document_by_titlebuilds the Drive API query with an f-string:name='{title}'. If a daily note title ever contained a single quote, this would break the query. For MM-DD-YYYY date strings this is not a real risk, but a note in the docstring or a simple escape (title.replace("'", "\\'")) would harden it.3. [ok] ContextVar pattern
The ContextVar approach for per-request access token is clean and correct. The
_setup_gdocs_clientcallback refreshes via synchronous httpx (matching the gmail-mcp-remote pattern whereset_client_for_requestalso uses sync httpx.post), and the tool reads it async. This works because mcp-remote-auth calls setup_client_for_request synchronously before the tool handler runs.4. [ok] Async httpx in gdocs_client.py
Using
httpx.AsyncClientfor the Google API calls is correct since the tool handler is async.5. [ok] CI pipeline
Woodpecker YAML is well-formed. ruff check + format on PR, kaniko build on main push. Matches the gmail-mcp-remote pattern exactly (with repo name swapped).
6. [ok] Dockerfile
Follows the two-stage pip install pattern (requirements.txt first for layer caching, then full package install). EXPOSE 8000 matches the CMD default.
No Blockers
All findings are nits or observations. The code is clean, follows established patterns, and passes ruff lint/format.
VERDICT: APPROVED
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.