Skip to content

Restore MCP authoring tools with write scopes - #464

Merged
arseniycodes merged 12 commits into
mainfrom
ash/restore-mcp-write-tools
Aug 12, 2026
Merged

Restore MCP authoring tools with write scopes#464
arseniycodes merged 12 commits into
mainfrom
ash/restore-mcp-write-tools

Conversation

@arseniycodes

@arseniycodes arseniycodes commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Summary

  • advertise and grant mcp:write alongside mcp:read for normal OAuth connections
  • preserve explicit read-only connections and give them instructions that only reference available tools
  • disclose write access on the OAuth consent screen
  • cover OAuth discovery, scope resolution, tool exposure, and instruction/tool consistency

Existing OAuth connections that hold only mcp:read remain read-only and must reconnect to grant the new write scope.

Validation

  • pnpm --filter @superlog/api test (629 passed)
  • pnpm --filter @superlog/api typecheck
  • pnpm --filter @superlog/web typecheck
  • pnpm --filter @superlog/web build
  • pnpm worktree:verify
  • live OAuth discovery returned mcp:read and mcp:write

Summary by cubic

Restores MCP authoring tools behind mcp:write and makes OAuth scopes explicit with transactional refresh rotation. Defaults to mcp:read mcp:write, keeps legacy tokens read-only, updates discovery, consent, and in-app instructions.

  • New Features

    • OAuth discovery advertises mcp:read and mcp:write on /.well-known/oauth-protected-resource and /.well-known/oauth-authorization-server.
    • Scope handling: defaults to mcp:read mcp:write when omitted; mcp:write requires mcp:read; rejects unsupported scopes with reason-tagged logs.
    • Refresh grants: allow narrowing; reject escalation (error-level); preserve current scope when omitted; rotate refresh tokens transactionally with single-claim checks, return invalid_grant on reuse, roll back on issuance errors, and log failures.
    • Legacy tokens: null/blank stored scopes normalize to mcp:read; emit one-time per-token legacy normalization with bounded memory; unscoped personal tokens keep full tool access.
    • Server/UI: write tools only when both scopes are present; read-only sessions expose only read tools and show read-only instructions; consent clarifies read vs write access, project/org scope, and external MCP integration management.
  • Migration

    • Existing OAuth tokens with mcp:read only or no/blank stored scope stay read-only; reconnect to grant mcp:write.
    • Unscoped personal tokens retain full tool access.

Written for commit 07725bf. Summary will update on new commits.

Review in cubic

@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 warning

Comment thread apps/api/src/mcp/scope-authorization.ts Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 74ad678254

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/api/src/mcp/scope-authorization.ts

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 6 files

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

Fix all with cubic | Re-trigger cubic

Comment thread apps/api/src/mcp/scope-authorization.ts
@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 warning

Comment thread apps/api/src/mcp/index.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. What shall we delve into next?

Reviewed commit: d95ce5ab92

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

All clear — no observability concerns found.

SREs will thank you.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31ba0ea823

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/api/src/mcp/scope-authorization.ts Outdated
@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

All clear — no observability concerns found.

SREs will thank you.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7c9e79b97c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/api/src/mcp/scope-authorization.ts
@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 warning

Comment thread apps/api/src/mcp/scope-authorization.ts

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 83f13fc2f6

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/OauthConsent.tsx Outdated

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 3 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread apps/api/src/mcp/oauth.ts
@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

All clear — no observability concerns found.

Sharp signals!

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bb50b15365

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/OauthConsent.tsx

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 4 files (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread apps/api/src/mcp/index.ts
@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 warning

Comment thread apps/api/src/mcp/oauth.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 🎉

Reviewed commit: f78944ccf3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 blocking
  • 1 warning

Comment thread apps/api/src/mcp/oauth.ts
Comment thread apps/api/src/mcp/oauth.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 66f5d9fca1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 blocking

Comment thread apps/api/src/mcp/oauth.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: f89c14fdca

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 blocking

Comment thread apps/api/src/mcp/oauth.ts Outdated
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 24121cad29

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

  • 1 warning

Comment thread apps/api/src/mcp/oauth.ts
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep them coming!

Reviewed commit: 66f6e0c08b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

All reported issues were addressed across 1 file (changes from recent commits).

Tip: Review your code locally with the cubic CLI to iterate faster.

Fix all with cubic | Re-trigger cubic

Comment thread apps/api/src/mcp/oauth.ts Outdated
@arseniycodes

Copy link
Copy Markdown
Contributor Author

@codex review

@superlog-app superlog-app Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Observability review

All clear — no observability concerns found.

Happy debugging!

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 07725bf79c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@arseniycodes
arseniycodes merged commit e4d4337 into main Aug 12, 2026
7 checks passed
@arseniycodes
arseniycodes deleted the ash/restore-mcp-write-tools branch August 12, 2026 12:06
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