Skip to main content
Glama
mcp-template

mcp-template

by Edison-Watch

custom-mcps


Agent Prompt

Copy and paste this into your AI coding agent (Claude Code, Cursor, Copilot, etc.) to install:

Install the CLI and download the gmail-mcp skill:

uv tool install custom-mcps

curl -fsSL https://raw.githubusercontent.com/Edison-Watch/Custom-MCPs/main/scripts/install-skills.sh -o install-skills.sh
bash install-skills.sh && rm install-skills.sh

The official gmail-mcp agent skill is self-published on skills.sh. Install it directly with:

npx skills add Edison-Watch/Custom-MCPs

The skill's source of truth lives in skills/gmail-mcp/SKILL.md; make sync-skills mirrors it to the landing page's /.well-known/agent-skills/ discovery tree (digest-pinned in index.json).

Related MCP server: MCP Template

App Distribution

  • MCP server with OAuth

  • Claude and ChatGPT connectors

  • APIs and SDKs

  • Chat interfaces like iMessage and WhatsApp

  • A dashboard that uses the same MCP layer

  • Open source

Direction

This repo is being refactored in place from a single Gmail MCP into a polyglot monorepo of small, utilitarian, streamable-HTTP MCP servers that Edison hosts as first-party, open-source connectors - commodity capabilities (image preview & hosting, PDF, and more) wired cleanly for the AI era. New servers default to TypeScript on Cloudflare Workers (under servers/), while Python (MCP python-sdk 2.x) stays first-class for Gmail and heavy-dependency servers. Everything can be self-hosted or Edison-hosted with per-user auth.

Full plan - topology, runtime choice, MCP-UI, and the Edison auth/catalog integration - lives in docs/mcp_commodity_fleet_strategy.md.

Key Features

Feature

Stack

CLI (auto-discovery commands, global flags, shell completions, self-update)

Typer

MCP server (streamable HTTP at /mcp, services auto-registered as tools; stdio supported for local dev)

MCP Python SDK 2.x (MCPServer)

HTTP API server (also hosts /mcp)

FastAPI + Uvicorn

Auth

WorkOS + API keys

Payments

Stripe

Database + migrations

SQLAlchemy + Alembic

Config (YAML + .env)

Pydantic-settings

LLM inference + observability

DSPY + LiteLLM + LangFuse

Testing

pytest + TestTemplate

Lint / type / dead-code

Ruff + Vulture + ty + import-linter

Pre-commit (folder size, ai-writing, agent-config sync)

prek

Telemetry

Anonymous, opt-out

Architecture

One codebase, three interfaces. Write business logic once in services/ and it ships as a CLI subcommand, an MCP tool, and an HTTP route - same Pydantic input/output contract everywhere.

┌──────────────┐  ┌──────────────┐  ┌──────────────┐
│ src/cli/app  │  │ mcp_server/  │  │ api_server/  │   transport / interface
│  (Typer)     │  │ (MCPServer)  │  │ (FastAPI)    │
└──────┬───────┘  └──────┬───────┘  └──────┬───────┘
       │                 │                 │
       └─────────────────┼─────────────────┘
                         ▼
                 ┌───────────────┐
                 │  services/    │   pure @service functions
                 │  @service     │   (transport-agnostic)
                 └───────┬───────┘
                         ▼
                 ┌───────────────┐
                 │  models/      │   Pydantic I/O contracts
                 └───────┬───────┘
                         ▼
        ┌────────────┬───────┬────────────┬─────────────┐
        │ common/    │ db/   │ utils/llm/ │ src/utils/  │   shared infra
        │ (config)   │ (ORM) │ (DSPY)     │ (logs/theme)│
        └────────────┴───────┴────────────┴─────────────┘

MCP UI (optional)

Need elicitation, image output, or an iframe dashboard for an MCP tool? Add an opt-in enhancer in mcp_server/enhancers/. Enhancers wrap a service for the MCP transport only - the pure service stays untouched and CLI/API consumers are unaffected.

See mcp_server/MCP_UI_ARCHITECTURE.md for the full design.

Quick Start

uv sync                   # install deps
uv run edisonmcps --help       # see all CLI commands
uv run edisonmcps greet Alice  # run a command
uv run edisonmcps init my_command  # scaffold a new command

uv run edisonmcps-serve        # start the server (HTTP API + MCP at /mcp on one port)
uv run edisonmcps-mcp          # legacy: stdio MCP only, for local Claude Desktop / dev

Deploy

One-click deploy to Railway or Render (backend + managed Postgres, migrations run automatically). See deployment docs for the per-platform setup, the Railway template variable map, and OAuth/secret wiring.

CLI Usage

Global flags go before the subcommand:

Flag

Short

Description

--verbose

-v

Increase output verbosity

--quiet

-q

Suppress non-essential output

--debug

Show full tracebacks on error

--format

-f

Output format: table, json, plain

--dry-run

Preview actions without executing

--version

-V

Print version and exit

uv run edisonmcps --format json config show     # JSON output
uv run edisonmcps --dry-run greet Bob           # preview without executing
uv run edisonmcps --verbose greet Alice         # detailed output

Adding Commands

Drop a Python file in src/cli/commands/ and it is auto-discovered.

Single command - export a main() function:

# src/cli/commands/hello.py
from typing import Annotated
import typer

def main(name: Annotated[str, typer.Argument(help="Who to greet.")]) -> None:
    """Say hello."""
    typer.echo(f"Hello, {name}!")
uv run edisonmcps hello World   # Hello, World!

Subcommand group - export app = typer.Typer():

# src/cli/commands/db.py
import typer

app = typer.Typer()

@app.command()
def migrate() -> None:
    """Run migrations."""
    ...
uv run edisonmcps db migrate

Or scaffold with: uv run edisonmcps init my_command --desc "Does something".

Configuration

from common import global_config

# Access config values from common/global_config.yaml
global_config.example_parent.example_child

# Access secrets from .env
global_config.OPENAI_API_KEY

CLI config inspection:

uv run edisonmcps config show                           # full config
uv run edisonmcps config get llm_config.cache_enabled   # single value
uv run edisonmcps config set logging.verbose false      # write override

Full configuration docs

Credits

This software uses the following tools:

About the Core Contributors

Made with contrib.rocks.

Available Tools

50 tools
gmail_add_attachmentA

Attach one file to an existing Gmail draft and return the draft's full attachment list (each with attachment_id, filename, mime_type, size_bytes). Only the attachments change - body, subject, and recipients are preserved exactly. Pass the file as 'attachment' (filename + mime_type + base64 data_base64).

Inputs: draft_id (required), attachment (required), user_id. Returns: The draft's attachment list after an add/remove operation.

gmail_archive_threadC

Archive a Gmail thread by removing the INBOX label. Also marks the thread dismissed in the curation ledger. During a triage pass, continue on to the next uncurated or stale thread.

Inputs: thread_id (required), user_id. Returns: archived

gmail_composeA

Create a new Gmail draft from the given fields and open an interactive composer UI. Returns the draft's actual saved state - draft_id, thread_id, recipients, subject, a body_preview, and the attachment list (each with attachment_id, filename, mime_type, size_bytes) - so you can verify what was saved without a follow-up gmail_get_draft. To edit it afterward use gmail_update_draft, which preserves omitted fields and keeps attachments unless you clear them. ALWAYS use this tool instead of composing email text in chat - it creates a real Gmail draft where the user can review, edit, and send. When an interactive UI is rendered alongside the result, keep your text response brief since the user can edit in the UI.

Inputs: to (required), body (required), subject (required), cc, +4 more. Returns: cc, to, bcc, body, +4 more

gmail_composer.discardC

Delete the current draft.

Inputs: draft_id (required), user_id. Returns: discarded

gmail_composer.get_attachmentC

Fetch the raw base64 data for an attachment on a message.

Inputs: message_id (required), attachment_id (required), user_id. Returns: Raw bytes of a single attachment, fetched on demand. ``data_base64`` is standar…

gmail_composer.get_threadB

Fetch the full thread for display in the composer's thread panel.

Inputs: thread_id (required), user_id. Returns: draft, messages, thread_id

gmail_composer.refreshB

Re-fetch the current draft (used by the composer to poll for agent edits).

Inputs: draft_id (required), user_id. Returns: cc, to, bcc, body, +4 more

gmail_composer.save_draftC

Persist the current composer fields onto an existing Gmail draft.

Inputs: draft_id (required), cc, to, bcc, +4 more. Returns: cc, to, bcc, body, +4 more

gmail_composer.sendC

Persist composer fields then send the draft via Gmail.

Inputs: draft_id (required), cc, to, bcc, +4 more. Returns: sent_at, thread_id, message_id

gmail_connectC

Begin the Google OAuth flow to link a Gmail account

Inputs: user_id. Returns: state, auth_url

gmail_curate_inboxA

Rank recent inbox threads by a deterministic heuristic score and render the inbox dashboard. This is a quick provisional view, NOT the assistant's own triage: for 'what's important / triage my inbox', prefer inbox_get_curation (banked LLM verdicts + coverage), going deeper with inbox_search + inbox_save_curation when coverage shows uncurated/stale threads. When an interactive UI is rendered alongside the result, keep your text response brief (a one-line summary) since the user can browse details in the UI. Only elaborate if the user asks.

Inputs: limit, query, user_id. Returns: threads

gmail_discard_draftC

Delete a Gmail draft by id

Inputs: draft_id (required), user_id. Returns: discarded

gmail_disconnectB

Revoke and remove the user's linked Gmail account

Inputs: user_id. Returns: revoked

gmail_get_attachmentA

Fetch the raw base64 bytes of a single attachment or inline image on a Gmail message, identified by the message_id + attachment_id echoed by gmail_get_thread. Use this to pull one file on demand instead of loading every attachment into the thread payload. data_base64 is raw encoded bytes, not a rendered image - you cannot read an image's contents from it; on vision-capable MCP hosts, image attachments are additionally rendered into context as a viewable image.

Inputs: message_id (required), attachment_id (required), user_id. Returns: Raw bytes of a single attachment, fetched on demand. ``data_base64`` is standar…

gmail_get_draftC

Fetch a single Gmail draft by id

Inputs: draft_id (required), user_id. Returns: cc, to, bcc, body, +4 more

gmail_get_focused_emailB

Return the email thread the user is currently viewing in the inbox UI. Call this when the user asks about 'this email', 'the email I'm looking at', or references the currently open thread.

Inputs: user_id. Returns: from_, focused, subject, messages, +2 more

gmail_get_threadA

Fetch a Gmail thread by id with full message bodies. By default attachment/inline-image bytes are omitted (each attachment still carries filename, mime_type, size, attachment_id) to keep the payload small - fetch a file on demand with gmail_get_attachment. Pass include_attachment_data=true to inline bytes, or strip_quoted_replies=true to drop repeated quoted history. When an interactive UI is rendered alongside the result, keep your text response brief since the user can browse the conversation in the UI.

Inputs: thread_id (required), user_id, strip_quoted_replies, include_attachment_data. Returns: draft, messages, thread_id

gmail_inbox.archiveC

Archive a thread (removes the INBOX label).

Inputs: thread_id (required), user_id. Returns: archived

gmail_inbox.forwardC

Create a forward draft for a message in a thread.

Inputs: thread_id (required), body, subject, user_id. Returns: cc, to, bcc, body, +4 more

gmail_inbox.mark_doneC

Mark a thread as done (applies MCP/Done label, hides from curated inbox).

Inputs: thread_id (required), user_id. Returns: label_id, marked_done

gmail_inbox.mark_readB

Mark a thread as read (removes the UNREAD label).

Inputs: thread_id (required), user_id. Returns: marked_read

gmail_inbox.open_threadC

Fetch a single thread for the inbox reader app.

Inputs: thread_id (required), user_id. Returns: draft, messages, thread_id

gmail_inbox.refreshC

Re-run gmail_curate_inbox (called by the inbox reader app).

Inputs: limit, query, user_id. Returns: threads

gmail_inbox.replyC

Create a reply draft on a thread (the composer app opens it next).

Inputs: thread_id (required), body, subject, user_id. Returns: cc, to, bcc, body, +4 more

gmail_inbox.set_focusC

Store which thread the user is currently viewing (called by inbox UI).

Inputs: from_, subject, user_id, messages, +2 more. Returns: ok

gmail_inbox.unmark_doneC

Remove the done marker from a thread (undo mark-done).

Inputs: thread_id (required), user_id. Returns: unmarked_done

gmail_list_draftsB

List the user's Gmail drafts

Inputs: limit, user_id. Returns: drafts

gmail_list_inboxA

List recent inbox messages, optionally filtered by a Gmail search query. When the user asks to find or open a specific email, ALWAYS follow up by calling gmail_get_thread with the thread_id to render the full conversation in an interactive UI.

Inputs: limit, query, user_id. Returns: messages

gmail_mark_thread_doneB

Mark a Gmail thread as done by applying the MCP/Done label (hides from curated inbox). Also marks the thread dismissed in the curation ledger. During a triage pass, continue on to the next uncurated or stale thread.

Inputs: thread_id (required), user_id. Returns: label_id, marked_done

gmail_mark_thread_readB

Mark a Gmail thread as read by removing the UNREAD label

Inputs: thread_id (required), user_id. Returns: marked_read

gmail_remove_attachmentA

Remove one file from a Gmail draft by its attachment_id and return the draft's remaining attachment list. Only the attachments change - body, subject, and recipients are preserved exactly. The attachment_id comes from any prior draft response or gmail_get_draft.

Inputs: draft_id (required), attachment_id (required), user_id. Returns: The draft's attachment list after an add/remove operation.

gmail_reply_to_threadA

Create a reply draft on an existing Gmail thread. ALWAYS use this tool instead of composing reply text in chat - it creates a real Gmail draft and opens an interactive composer UI where the user can review, edit, and send. Pass your drafted reply in the 'body' parameter. Recipients are yours to control: pass 'to', 'cc', and/or 'bcc' (each a comma-separated address list) to set them explicitly. If you omit 'to', it defaults to the other party in the thread (never the account owner); omitted 'cc'/'bcc' are left unset. If every message in the thread is yours (no other participant to reply to), you must pass 'to' explicitly or the call errors. When an interactive UI is rendered alongside the result, keep your text response brief since the user can edit in the UI.

Inputs: thread_id (required), cc, to, bcc, +4 more. Returns: cc, to, bcc, body, +4 more

gmail_sendB

Send a previously-composed Gmail draft

Inputs: draft_id (required), user_id. Returns: sent_at, thread_id, message_id

gmail_statusC

Return whether the user has a linked Gmail account

Inputs: user_id. Returns: email, scopes, connected, granted_at

gmail_unmark_thread_doneB

Remove the MCP/Done label from a thread (undo mark-done)

Inputs: thread_id (required), user_id. Returns: unmarked_done

gmail_update_draftA

Patch fields on an existing Gmail draft and open an interactive composer UI. Non-destructive by default: any field you OMIT is left unchanged on the draft, and a field set to null is CLEARED - this holds for to, cc, bcc, subject, body, and attachments. Omit 'attachments' to keep every existing file untouched (so you can edit the body repeatedly without re-uploading); pass null or [] to drop them all. 'attachments' may mix new uploads (filename + mime_type + data_base64) with references to existing files ({attachment_id}) taken from a prior response, letting you preserve specific files by id. To add or remove a single file without touching the body, prefer gmail_add_attachment / gmail_remove_attachment. The returned draft echoes the saved state (recipients, subject, body_preview, and the full attachment list with ids/filenames/sizes). ALWAYS call this tool to write or edit draft content - NEVER compose email text as plain chat text. Pass your composed text in the 'body' parameter. Keep your chat response to one brief sentence since the user can edit in the UI.

Inputs: draft_id (required), cc, to, bcc, +4 more. Returns: cc, to, bcc, body, +4 more

gmail_watch_startC

Subscribe the user's Gmail inbox to push notifications

Inputs: user_id. Returns: watching, expiration, history_id

gmail_watch_stopC

Cancel the user's Gmail push-notification watch

Inputs: user_id. Returns: stopped

inbox_get_curationA

Read banked inbox triage from the curation ledger. Cheap: no email bodies are fetched and no reasoning is run - it returns judgments the assistant already made (bucket, importance, summary, suggested action) plus a coverage count of curated / stale / uncurated threads in the inbox. Call this FIRST for any 'what's important / triage my inbox' request. If coverage shows many uncurated or stale threads and the user wants a thorough pass, go deeper with inbox_search + inbox_save_curation; otherwise answer directly from these banked verdicts.

Inputs: limit, state, bucket, user_id, +2 more. Returns: records, coverage

inbox_save_curationA

Bank your triage judgments for one or more threads into the curation ledger so they are not re-reasoned next time. Call this after reading and reasoning over threads (typically from inbox_search) - pass a batch of per-thread verdicts (bucket, importance, a short summary, suggested action, optional reasoning/confidence). Each write stamps the thread's current Gmail historyId so the verdict stays valid until the thread changes. This is what makes the next inbox_get_curation near-free.

Inputs: user_id, judgments, curator_version. Returns: saved, thread_ids

settings.getA

Fetch the current settings snapshot for the Settings app.

Inputs: user_id. Returns: watching, gmail_email, subscriptions, push_available, +2 more

settings.rotate_secretC

Issue a new signing secret for a webhook subscription.

Inputs: subscription_id (required), user_id. Returns: id, secret

settings.subscribeC

Register a webhook endpoint (returns the one-time signing secret).

Inputs: url (required), user_id, event_types. Returns: id, url, active, secret, +1 more

settings.unsubscribeC

Deactivate a webhook subscription.

Inputs: subscription_id (required), user_id. Returns: unsubscribed

webhook_listB

List the caller's webhook subscriptions (secrets are never returned)

Inputs: user_id. Returns: subscriptions

webhook_rotate_secretB

Issue a new signing secret for a subscription (invalidates the old one)

Inputs: subscription_id (required), user_id. Returns: id, secret

webhook_settingsC

Open your settings: Gmail connection status and webhook subscriptions

Inputs: user_id. Returns: watching, gmail_email, subscriptions, push_available, +2 more

webhook_subscribeC

Register an HTTPS endpoint to receive signed webhook events

Inputs: url (required), user_id, event_types. Returns: id, url, active, secret, +1 more

webhook_unsubscribeC

Deactivate a webhook subscription so it stops receiving events

Inputs: subscription_id (required), user_id. Returns: unsubscribed

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.5/5.0

    Scored across 50 tools

    Disambiguation1/5

    Many tools are near-duplicates with different names: gmail_archive_thread and gmail_inbox.archive, gmail_mark_thread_done and gmail_inbox.mark_done, gmail_composer.send and gmail_send, settings.subscribe and webhook_subscribe. An agent cannot reliably tell which variant is appropriate for a given request.

    Naming Consistency1/5

    Naming is a mix of dot-separated app namespaces (gmail_inbox.set_focus, gmail_composer.save_draft), flat snake_case names (gmail_archive_thread, webhook_subscribe), and inconsistent verb orders. The same operation appears as both gmail_mark_thread_done and gmail_inbox.mark_done, so there is no predictable pattern.

    Tool Count1/5

    At 50 tools, the surface is far too large for the apparent Gmail-plus-webhooks scope. Many tools are aliases for the same underlying actions split across UI and headless variants, and the set could likely be reduced by more than half.

    Completeness4/5

    The underlying workflows are well covered: Gmail connection, inbox reading and triage, draft compose/send/discard, attachments, reply/forward, archive/done/read, watch, a curation ledger, and webhook settings. Minor gaps like permanent trash or expanded label management exist but are not severe.

    Maintenance

    ActivityActive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      Not graded
      quality
      D
      maintenance
      A foundational template for building MCP servers in Python using Streamable HTTP transport. Provides example implementations of tools, resources, and prompts to help developers create custom MCP integrations for AI assistants.
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      A production-ready Python template for building MCP servers with enterprise features including registry integration, configuration management, structured logging, and extensible patterns for tools, resources, and prompts.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A production-grade, extensible Python template for building Model Context Protocol servers with support for Streamable HTTP and stdio transports. It provides a structured framework for implementing tools, resources, and prompts with built-in authentication, observability, and background task management.
      11
      MIT