gitlab-mcp-agent-server 0.2.8 → 0.2.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -44,9 +44,20 @@ class GitLabOAuthManager {
|
|
|
44
44
|
if (!this.options.autoLogin) {
|
|
45
45
|
throw new errors_1.ConfigurationError('OAuth token is missing. Enable GITLAB_OAUTH_AUTO_LOGIN or provide GITLAB_OAUTH_ACCESS_TOKEN.');
|
|
46
46
|
}
|
|
47
|
-
const
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
const start = await this.startOAuthAuthorization();
|
|
48
|
+
if (start.status === 'already_authorized') {
|
|
49
|
+
const token = this.tokenStore.read();
|
|
50
|
+
if (token?.accessToken) {
|
|
51
|
+
return token.accessToken;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (start.status === 'started' || start.status === 'in_progress') {
|
|
55
|
+
throw new errors_1.ConfigurationError(`OAuth authorization is required. Open: ${start.localEntryUrl} (or direct: ${start.authorizeUrl}), complete authorization, then retry the tool call.`);
|
|
56
|
+
}
|
|
57
|
+
if (start.status === 'waiting_other_process') {
|
|
58
|
+
throw new errors_1.ConfigurationError(`OAuth flow is running in another process for this instance. ${start.message} Lock: ${start.lockFilePath}`);
|
|
59
|
+
}
|
|
60
|
+
throw new errors_1.ConfigurationError(start.message);
|
|
50
61
|
}
|
|
51
62
|
async startOAuthAuthorization() {
|
|
52
63
|
const stored = this.tokenStore.read();
|
package/docs/USER_GUIDE.md
CHANGED
|
@@ -103,8 +103,10 @@ npx -y gitlab-mcp-agent-server
|
|
|
103
103
|
3. Если `GITLAB_OAUTH_OPEN_BROWSER=true` и окружение GUI доступно, браузер откроется автоматически.
|
|
104
104
|
4. Локальный URL `http://127.0.0.1:8787/` автоматически редиректит на GitLab OAuth.
|
|
105
105
|
5. Если браузер не может быть открыт, сервер печатает URL авторизации в лог.
|
|
106
|
-
6.
|
|
107
|
-
|
|
106
|
+
6. При первом вызове GitLab tool сервер вернет в ответе явную инструкцию с URL для OAuth.
|
|
107
|
+
После завершения авторизации повтори тот же tool-вызов.
|
|
108
|
+
7. После подтверждения в GitLab и callback на `http://127.0.0.1:8787/oauth/callback` токены сохраняются в token store для конкретного instance.
|
|
109
|
+
8. В браузере показывается feedback-страница:
|
|
108
110
|
- `Success`: токен сохранен, можно вернуться в ИИ-агент;
|
|
109
111
|
- `Error`: показана причина и кнопка повторного запуска OAuth.
|
|
110
112
|
|