Fix gtasks OAuth scope handling and add ArgoCD docs to RAG
- gtasks: Add force_reauth option to recover from invalid_scope errors - rag-search: Index ArgoCD documentation for semantic search 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -29,17 +29,26 @@ TOKEN_PATH = Path.home() / ".gmail-mcp/tasks_token.json"
|
|||||||
CREDS_PATH = Path.home() / ".gmail-mcp/credentials.json"
|
CREDS_PATH = Path.home() / ".gmail-mcp/credentials.json"
|
||||||
|
|
||||||
|
|
||||||
def get_credentials():
|
def get_credentials(force_reauth: bool = False):
|
||||||
"""Get or refresh Google credentials for Tasks API."""
|
"""Get or refresh Google credentials for Tasks API.
|
||||||
|
|
||||||
|
If ``force_reauth`` is True, skip refresh and run a new OAuth flow.
|
||||||
|
This is useful when a stored refresh token is bound to a different
|
||||||
|
scope set and refresh keeps failing with invalid_scope.
|
||||||
|
"""
|
||||||
creds = None
|
creds = None
|
||||||
|
|
||||||
if TOKEN_PATH.exists():
|
if TOKEN_PATH.exists():
|
||||||
creds = Credentials.from_authorized_user_file(str(TOKEN_PATH), SCOPES)
|
creds = Credentials.from_authorized_user_file(str(TOKEN_PATH), SCOPES)
|
||||||
|
|
||||||
if not creds or not creds.valid:
|
if not creds or not creds.valid or force_reauth:
|
||||||
if creds and creds.expired and creds.refresh_token:
|
if not force_reauth and creds and creds.expired and creds.refresh_token:
|
||||||
creds.refresh(Request())
|
try:
|
||||||
else:
|
creds.refresh(Request())
|
||||||
|
except Exception:
|
||||||
|
creds = None
|
||||||
|
|
||||||
|
if not creds or not creds.valid:
|
||||||
if not CREDS_PATH.exists():
|
if not CREDS_PATH.exists():
|
||||||
return None
|
return None
|
||||||
flow = InstalledAppFlow.from_client_secrets_file(str(CREDS_PATH), SCOPES)
|
flow = InstalledAppFlow.from_client_secrets_file(str(CREDS_PATH), SCOPES)
|
||||||
@@ -168,7 +177,9 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
if "--auth" in sys.argv:
|
if "--auth" in sys.argv:
|
||||||
print("Starting Tasks API authentication...")
|
print("Starting Tasks API authentication...")
|
||||||
creds = get_credentials()
|
# Force a fresh OAuth flow so we can recover from invalid_scope
|
||||||
|
# errors caused by stale refresh tokens.
|
||||||
|
creds = get_credentials(force_reauth=True)
|
||||||
if creds:
|
if creds:
|
||||||
print(f"✅ Authentication successful! Token saved to {TOKEN_PATH}")
|
print(f"✅ Authentication successful! Token saved to {TOKEN_PATH}")
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -9,6 +9,15 @@
|
|||||||
"glob": "**/*.md",
|
"glob": "**/*.md",
|
||||||
"version": "main",
|
"version": "main",
|
||||||
"last_indexed": "2026-01-04T23:27:40.175671"
|
"last_indexed": "2026-01-04T23:27:40.175671"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "argocd",
|
||||||
|
"name": "ArgoCD Documentation",
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://github.com/argoproj/argo-cd.git",
|
||||||
|
"path": "docs/",
|
||||||
|
"glob": "**/*.md",
|
||||||
|
"last_indexed": "2026-01-05T01:04:53.930441"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user