Gosar

Gosar

Enables Claude to securely call the Gosar API on a user's behalf via OAuth 2.0 + PKCE, bridging Claude's MCP client with Gosar's authorization flow.

Category
访问服务器

README

Gosar MCP Server

An MCP server that lets Claude call the Gosar API on a user's behalf, authenticated via Gosar's OAuth 2.0 + PKCE flow.

It acts as a bridge:

  • To Claude (the MCP client), it behaves like a full OAuth authorization server — handling dynamic client registration and issuing its own short-lived tokens.
  • To Gosar, it is the single, pre-registered OAuth client (public, PKCE-only) that performs the real Authorization Code + PKCE exchange described in Gosar's integration guide.

Prerequisites

  • Python 3.11+
  • A Gosar OAuth client registered with the Gosar team (see "What we need from you" in the integration guide) — you need a client_id and an approved redirect URI.
  • ngrok (or similar) if you want to test against the real Gosar API — Gosar's redirect URI must be HTTPS and match exactly, and Claude also needs an HTTPS URL to connect a remote MCP server to.

1. Install dependencies

python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

2. Configure .env

Copy the values you have into .env at the project root:

# Real values from the Gosar team
GOSAR_API_BASE_URL=https://api.gosar.example
GOSAR_CLIENT_ID=your-registered-client-id
GOSAR_SCOPES=applications.read applications.write

# Your server's own public HTTPS URL (e.g. your ngrok URL). Gosar's registered
# redirect_uri must be exactly this + GOSAR_REDIRECT_PATH.
MCP_PUBLIC_BASE_URL=https://your-tunnel.ngrok-free.app
GOSAR_REDIRECT_PATH=/gosar/callback

MCP_HOST=0.0.0.0
MCP_PORT=8000

# Generate once and keep stable — see below
JWT_SIGNING_KEY=

Generate a signing key (Gosar is a public client with no secret, so this can't be derived automatically — it's required):

python -c "import secrets; print(secrets.token_urlsafe(32))"

Paste the output into JWT_SIGNING_KEY. Keep it the same across restarts, or every connected user gets logged out.

3. Expose your server over HTTPS (for real Gosar testing)

Claude and Gosar both require HTTPS. In a separate terminal:

ngrok http 8000

Copy the https://...ngrok-free.app URL into MCP_PUBLIC_BASE_URL in .env, and send {MCP_PUBLIC_BASE_URL}/gosar/callback to the Gosar team as your registered redirect URI.

4. Run the server

source .venv/bin/activate
python main.py

You should see:

Starting MCP server 'Gosar' with transport 'http' on http://0.0.0.0:8000/mcp
Uvicorn running on http://0.0.0.0:8000

Auto-reload on code changes

python main.py does not reload — mcp.run() blocks and owns its own uvicorn process, which can't be handed to a file-watching reloader. For development, run the ASGI app in gosar_mcp/asgi.py under uvicorn directly instead:

uvicorn gosar_mcp.asgi:app --reload --reload-include ".env" --host 0.0.0.0 --port 8000
  • --reload restarts the worker process whenever a .py file changes.
  • --reload-include ".env" also restarts it when you edit .env (uvicorn only watches Python files by default, and env vars are only read once at process startup, so without this flag a .env edit needs a manual restart).
  • Keep the port in sync with whatever your ngrok tunnel points at.

5. Sanity-check the OAuth wiring

With the server running, confirm discovery metadata is served:

curl -s http://127.0.0.1:8000/.well-known/oauth-authorization-server | python3 -m json.tool

You should see applications.read/applications.write in scopes_supported and S256 as the only PKCE method.

6. Connect it to Claude

In Claude's connector settings, add a remote MCP server pointing at:

https://your-tunnel.ngrok-free.app/mcp

Claude will register itself as an OAuth client against this server, redirect the user through consent, then through Gosar's real Google sign-in + consent screen, and land back here with an active connection. Ask Claude to call the whoami tool to confirm it's authenticated as the expected Gosar account.

Notes

  • Token storage (client registrations + encrypted upstream Gosar tokens) defaults to an OS-appropriate encrypted file store on disk — no extra setup needed for local dev. See gosar_mcp/auth.py for where to point this at a different backend in production.
  • gosar_mcp/tools.py's /applications endpoint paths are placeholders — the integration guide only specifies the OAuth layer, not the Applications REST API shape. Confirm the real paths/payloads with the Gosar team and adjust there.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选