Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 13, 2025

The Atlassian MCP access tokens expired (~3300s) and were not refreshed, breaking tool calls after an hour.

  • Behavior changes

    • Persist expires_in from OAuth exchanges into accessTokenExpiresAt and clear it when tokens are removed.
    • Auto-refresh upstream OAuth tokens via MCPHubOAuthProvider when missing or within 60s of expiry, reusing stored refresh tokens when providers omit new ones.
  • Tests

    • Added deterministic unit tests covering expiry-triggered refresh and cached-token reuse.

Example:

// Access token auto-refreshes when near expiry
const provider = new MCPHubOAuthProvider('atlassian-work', {
  url: 'https://mcp.atlassian.com/v1/sse',
  oauth: {
    clientId: 'client-id',
    accessToken: 'old-access',
    refreshToken: 'refresh-token',
    accessTokenExpiresAt: Date.now() + 30_000, // within threshold
  },
});

await provider.tokens(); // refreshes and returns fresh access/refresh tokens
Original prompt

This section details on the original issue you should resolve

<issue_title>Atlassian MCP (official) 没有及时刷新 access_token</issue_title>
<issue_description>Bug Description / 问题描述
What happened? / 发生了什么?
我的 Atlassian MCP (official) 能正常授权,但是 3300 秒后 access_token 失效 MCPHub 便不再刷新令牌,直到手动重载 MCP。

Steps to Reproduce / 复现步骤

  1. 添加 Atlassian MCP https://mcp.atlassian.com/v1/sse
  2. 等待一个小时
  3. 运行任意一个 tool

Expected Behavior / 预期行为
What should happen? / 应该发生什么?
Tool 能够正常调用,因为令牌已经刷新。

Environment / 运行环境

  • Running on / 运行方式: Docker
  • Version / 版本: 0.11.4

Screenshots / 截图
If relevant, add screenshots / 如果有帮助的话,请添加截图

Additional Info / 补充信息
Any other details? / 还有其他信息吗?

Image

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix access token not refreshing in Atlassian MCP Proactive OAuth token refresh for Atlassian MCP servers Dec 13, 2025
Copilot AI requested a review from samanhappy December 13, 2025 14:57
@samanhappy samanhappy marked this pull request as ready for review December 14, 2025 07:48
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.

Atlassian MCP (official) 没有及时刷新 access_token

2 participants