Skip to content

chore: auto-sync OpenAPI source to Gram (no manual uploads)#2959

Merged
tofikwest merged 3 commits into
mainfrom
chore/gram-mcp-source-sync
May 29, 2026
Merged

chore: auto-sync OpenAPI source to Gram (no manual uploads)#2959
tofikwest merged 3 commits into
mainfrom
chore/gram-mcp-source-sync

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented May 29, 2026

Why

Manually uploading the OpenAPI spec into Gram every time is an anti-pattern. This makes the hosted MCP's source auto-sync with the API.

What

  • gram.json — declarative Gram deployment pointing at the clean public spec (packages/docs/openapi.json, which has the deny-list applied — not the raw /api/docs-json).
  • .github/workflows/gram-sync.yml — runs gram push whenever packages/docs/openapi.json (or gram.json) changes on main, plus manual workflow_dispatch. New/changed endpoints flow into the hosted MCP automatically.

One-time setup required (then fully hands-off)

  1. In Gram → Settings → API Keys, create a provider-scoped API key.
  2. Add two GitHub repo secrets:
    • GRAM_API_KEY = that key
    • GRAM_PROJECT = your Gram project slug
  3. After merge, run the workflow once via Actions → "Sync MCP source to Gram" → Run workflow to push the first time.

Note

First workflow_dispatch run validates the CLI install/flags — if gram isn't found (PATH) or a flag needs adjusting, it's a one-line fix (normal CLI bring-up).

🤖 Generated with Claude Code


Summary by cubic

Automates syncing the hosted MCP in Gram with the clean public OpenAPI spec. Removes manual uploads by pushing updates from packages/docs/openapi.json via CI.

  • New Features

    • Added gram.json pointing to packages/docs/openapi.json (clean spec).
    • Added .github/workflows/gram-sync.yml to run gram push on changes or manual dispatch; exports GRAM_ORG and GRAM_PROJECT; sets least-privilege permissions: contents: read.
  • Migration

    • Create a provider-scoped API key in Gram and add the GRAM_API_KEY repo secret.
    • If needed, update GRAM_ORG/GRAM_PROJECT in the workflow, then run “Sync MCP source to Gram” once to seed.

Written for commit e53e2af. Summary will update on new commits.

Review in cubic

Adds gram.json (declarative Gram deployment pointing at the clean public spec packages/docs/openapi.json) + a workflow that runs 'gram push' whenever the spec changes on main (and on manual dispatch). Keeps the hosted MCP's tools in sync with the API automatically — no UI uploads. Requires repo secrets GRAM_API_KEY (provider-scoped Gram key) and GRAM_PROJECT (project slug).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment May 29, 2026 1:19am
comp-framework-editor Ready Ready Preview, Comment May 29, 2026 1:19am
portal Ready Ready Preview, Comment May 29, 2026 1:19am

Request Review

Comment thread .github/workflows/gram-sync.yml Fixed
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 2 files

Confidence score: 4/5

  • This PR is likely safe to merge, with one moderate security-hardening gap rather than a functional regression risk.
  • In .github/workflows/gram-sync.yml, the missing explicit permissions block can leave GITHUB_TOKEN with broader default access (often write), which increases blast radius if the workflow or dependencies are compromised.
  • Pay close attention to .github/workflows/gram-sync.yml - set least-privilege token permissions (for example, read-only contents) to reduce CI security risk.

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread .github/workflows/gram-sync.yml
Verified against the Gram CLI source (speakeasy-api/gram): 'gram push' requires --org (GRAM_ORG) in addition to --project; the installer drops the binary in /usr/local/bin (already on PATH), so the manual GITHUB_PATH line was wrong. Org+project slugs aren't secret (they're in the dashboard URL), so they're hardcoded as env; only GRAM_API_KEY stays a secret.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment thread .github/workflows/gram-sync.yml Fixed
Addresses cubic + CodeQL findings: the workflow only checks out the repo to push the spec, so it needs read-only contents access, not the default (often write) token permissions.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tofikwest
Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review it

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented May 29, 2026

@cubic-dev-ai review it

@tofikwest I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@tofikwest tofikwest merged commit a270dad into main May 29, 2026
9 of 11 checks passed
@tofikwest tofikwest deleted the chore/gram-mcp-source-sync branch May 29, 2026 01:19
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.66.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants