Skip to content

feat(mcp): add OAuth2 authorization for the MCP server - #1580

Merged
realcodesiman merged 7 commits into
mainfrom
realcodesiman/mcp-support-oauth2
Oct 29, 2026
Merged

realcodesiman merged 7 commits into
mainfrom
realcodesiman/mcp-support-oauth2

Conversation

@realcodesiman

Copy link
Copy Markdown
Contributor

Summary

  • Let MCP clients authorize through the standard OAuth2 authorization-code flow instead of pasting a workspace API token.
  • The MCP server now accepts OAuth access tokens alongside existing workspace tokens.

Changes

  • packages/database: new OauthApplication, OauthConsent, OauthAccessToken schema, relations, repositories, and migration 20260922102520_add_oauth_provider_tables (migration not applied; needs review).
  • packages/business: new mcp-oauth service with tests.
  • packages/auth: OAuth provider wiring in the auth server.
  • apps/builder: /.well-known/* discovery routes, /oauth/authorize, /oauth/sign-in, consent page and action, public-route and rate-limit updates, workspace-token auth middleware support, and i18n keys for all locales.
  • apps/mcp-server: OAuth token introspection and server wiring, env example, README.
  • docs/mcp-oauth.md and workspace API token docs.

Test plan

  • pnpm lint
  • pnpm --filter builder check-types
  • pnpm --filter mcp-server check-types (or the mcp-server package name)
  • Review migration SQL, then run pnpm --filter @chatbotx.io/database db:migrate
  • Manual: connect an MCP client via OAuth, approve consent, call a tool

@github-actions github-actions Bot added the feature New feature or request label Oct 29, 2026
@realcodesiman
realcodesiman force-pushed the realcodesiman/mcp-support-oauth2 branch from 24bb832 to cc5e773 Compare October 29, 2026 07:34
Add an OAuth provider (applications, consents, access tokens) so MCP
clients can authorize via the standard authorization-code flow instead of
pasting a workspace API token. The MCP server introspects OAuth access
tokens alongside existing workspace tokens.
@realcodesiman
realcodesiman force-pushed the realcodesiman/mcp-support-oauth2 branch from 4543916 to 7680868 Compare October 29, 2026 08:28
@realcodesiman
realcodesiman merged commit 6bf916a into main Oct 29, 2026
14 checks passed
@realcodesiman
realcodesiman deleted the realcodesiman/mcp-support-oauth2 branch October 29, 2026 09:05
hello-jackytruong referenced this pull request in hello-jackytruong/ChatWorkAI Nov 22, 2026
* feat(mcp): add OAuth2 authorization for the MCP server

Add an OAuth provider (applications, consents, access tokens) so MCP
clients can authorize via the standard authorization-code flow instead of
pasting a workspace API token. The MCP server introspects OAuth access
tokens alongside existing workspace tokens.

* fix(mcp): harden OAuth2 authorization

* fix(mcp): use structured token introspection logging

* fix(mcp): resolve rebase conflicts

* fix(database): index oauth provider foreign keys

* fix(worker): remove duplicate scheduler import

* fix(mcp): update OAuth test mocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant