Oauth2 Token Provider
БесплатноНе проверенActs as an authenticated proxy between AI IDEs and remote MCP endpoints, handling OAuth2 client_credentials token generation and transparently injecting bearer
Описание
Acts as an authenticated proxy between AI IDEs and remote MCP endpoints, handling OAuth2 client_credentials token generation and transparently injecting bearer tokens into all proxied requests.
README
A generic MCP (Model Context Protocol) server that acts as an authenticated proxy between AI IDEs and remote MCP endpoints. Handles OAuth2 client_credentials token generation internally and transparently injects bearer tokens into all proxied requests.
Features
- Transparent OAuth2 proxy — acquires, caches, and auto-refreshes tokens
- Dynamic tool discovery — no hardcoded tool schemas; discovers tools from the remote MCP endpoint
- Auto-retry on 401 — if a token expires mid-session, refreshes and retries once
- Startup health check — verifies remote MCP is reachable before connecting; fails fast with clear error messages
- Token persistence — caches tokens to disk at
~/.oauth2-token-provider/token.jsonto survive process restarts - Zero configuration in code — all settings via environment variables
- Supports SSE and JSON responses — handles both Streamable HTTP and plain JSON-RPC from the remote
Installation
npx mcp-oauth2-token-provider
Or install globally:
npm install -g mcp-oauth2-token-provider
Usage with Kiro / VS Code MCP
Add to your .kiro/settings/mcp.json (or equivalent):
{
"mcpServers": {
"my-remote-server": {
"command": "npx",
"args": ["mcp-oauth2-token-provider"],
"env": {
"REMOTE_MCP_URL": "https://your-server.com/mcp",
"OAUTH2_TOKEN_URL": "https://your-sso.com/token.oauth2",
"OAUTH2_CLIENT_ID": "your-client-id",
"OAUTH2_CLIENT_SECRET": "your-client-secret"
}
}
}
}
Environment Variables
| Variable | Required | Description |
|---|---|---|
REMOTE_MCP_URL |
Yes | The remote MCP endpoint URL to proxy to |
OAUTH2_TOKEN_URL |
Yes | OAuth2 token endpoint (client_credentials grant) |
OAUTH2_CLIENT_ID |
Yes | OAuth2 client ID |
OAUTH2_CLIENT_SECRET |
Yes | OAuth2 client secret |
OAUTH2_BASIC_USERNAME |
No | Basic auth username (for dual-credential SSO) |
OAUTH2_BASIC_PASSWORD |
No | Basic auth password (for dual-credential SSO) |
How It Works
AI IDE ←stdio→ [mcp-oauth2-token-provider] ←HTTP+Bearer→ [Remote MCP Server]
│
├─ Acquires OAuth2 token (client_credentials)
├─ Caches in memory + ~/.oauth2-token-provider/token.json
├─ Injects Bearer header on every request
├─ Auto-refreshes on expiry (60s safety margin)
└─ Retries once on 401 with fresh token
- On startup, verifies the remote MCP endpoint is reachable (sends MCP
initialize) - If remote is unreachable, exits with error (IDE shows "Failed" status)
- If healthy, connects to IDE via stdio and discovers tools from the remote
- All tool calls are proxied transparently with the bearer token
Token Caching
Tokens are cached in two layers:
- In-memory — fastest, lost on process restart
- On disk —
~/.oauth2-token-provider/token.json, survives restarts
The token is refreshed when:
- It's within 60 seconds of expiry
- A 401 response is received from the remote
Dual-Credential SSO (Optional)
Some SSO providers require both:
- A
client_id+client_secretin the request body - A Basic Auth header with service account credentials
Set OAUTH2_BASIC_USERNAME and OAUTH2_BASIC_PASSWORD to enable this pattern.
License
MIT
Установить Oauth2 Token Provider в Claude Desktop, Claude Code, Cursor
unyly install mcp-oauth2-token-providerСтавит в Claude Desktop, Claude Code, Cursor и VS Code — сам разбирается с npx, uvx и сборкой из исходников.
Впервые? Поставь CLI: curl -fsSL https://unyly.org/install | sh
Или настроить вручную
Выполни в терминале:
claude mcp add mcp-oauth2-token-provider -- npx -y github:codezerowork/mcp-oauth2-token-providerПошаговые гайды: как установить Oauth2 Token Provider
FAQ
Oauth2 Token Provider MCP бесплатный?
Да, Oauth2 Token Provider MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Oauth2 Token Provider?
Нет, Oauth2 Token Provider работает без API-ключей и переменных окружения.
Oauth2 Token Provider — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Oauth2 Token Provider в Claude Desktop, Claude Code или Cursor?
Открой Oauth2 Token Provider на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
автор: modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
автор: xuzexin-hzMCP-Agent
A simple, composable framework to build agents using Model Context Protocol by [LastMile AI](https://www.lastmileai.dev)
автор: lastmile-aiSpring AI MCP Client
Provides auto-configuration for MCP client functionality in Spring Boot applications.
mcp.natoma.ai
A Hosted MCP Platform to discover, install, manage and deploy MCP servers by [Natoma Labs](https://www.natoma.ai)
MCPHub
Website to list high quality MCP servers and reviews by real users. Also provide online chatbot for popular LLM models with MCP server support.
MCP Servers Rating and User Reviews
Website to rate MCP servers, write authentic user reviews, and [search engine for agent & mcp](http://www.deepnlp.org/search/agent)
mkinf
An Open Source registry of hosted MCP Servers to accelerate AI agent workflows.
Compare Oauth2 Token Provider with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории ai
