GitLab · Capability

GitLab OAuth 2.0 API — Authorization

GitLab OAuth 2.0 API — Authorization. 2 operations. Lead operation: GitLab Authorize OAuth Application. Self-contained Naftiko capability covering one Gitlab business surface.

Run with Naftiko GitlabAuthorization

What You Can Do

GET
Authorizeoauth — GitLab Authorize OAuth Application
/v1/oauth/authorize
POST
Authorizedevice — GitLab Initiate Device Authorization Grant
/v1/oauth/authorize-device

MCP Tools

gitlab-authorize-oauth-application

GitLab Authorize OAuth Application

read-only idempotent
gitlab-initiate-device-authorization-grant

GitLab Initiate Device Authorization Grant

Capability Spec

oauth2-authorization.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: GitLab OAuth 2.0 API — Authorization
  description: 'GitLab OAuth 2.0 API — Authorization. 2 operations. Lead operation: GitLab Authorize OAuth Application. Self-contained
    Naftiko capability covering one Gitlab business surface.'
  tags:
  - Gitlab
  - Authorization
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    GITLAB_API_KEY: GITLAB_API_KEY
capability:
  consumes:
  - type: http
    namespace: oauth2-authorization
    baseUri: https://gitlab.com
    description: GitLab OAuth 2.0 API — Authorization business capability. Self-contained, no shared references.
    resources:
    - name: oauth-authorize
      path: /oauth/authorize
      operations:
      - name: authorizeoauth
        method: GET
        description: GitLab Authorize OAuth Application
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: client_id
          in: query
          type: string
          description: The application ID registered in GitLab.
          required: true
        - name: redirect_uri
          in: query
          type: string
          description: The URI to redirect to after authorization.
          required: true
        - name: response_type
          in: query
          type: string
          description: Must be set to code for the authorization code flow.
          required: true
        - name: state
          in: query
          type: string
          description: A random, unguessable string used to protect against CSRF attacks. Must be returned unchanged in the
            redirect response.
          required: true
        - name: scope
          in: query
          type: string
          description: Space-separated list of scopes to request. Available scopes include api, read_api, read_user, read_repository,
            write_repository, and others.
        - name: code_challenge
          in: query
          type: string
          description: A Base64 URL-encoded SHA-256 hash of the code_verifier. Required when using PKCE for public clients.
        - name: code_challenge_method
          in: query
          type: string
          description: The method used to generate the code_challenge. Must be S256.
        - name: root_namespace_id
          in: query
          type: integer
          description: Optional. Limits group access token creation to a specific namespace.
    - name: oauth-authorize_device
      path: /oauth/authorize_device
      operations:
      - name: authorizedevice
        method: POST
        description: GitLab Initiate Device Authorization Grant
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    authentication:
      type: bearer
      token: '{{env.GITLAB_API_KEY}}'
  exposes:
  - type: rest
    namespace: oauth2-authorization-rest
    port: 8080
    description: REST adapter for GitLab OAuth 2.0 API — Authorization. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/oauth/authorize
      name: oauth-authorize
      description: REST surface for oauth-authorize.
      operations:
      - method: GET
        name: authorizeoauth
        description: GitLab Authorize OAuth Application
        call: oauth2-authorization.authorizeoauth
        with:
          client_id: rest.client_id
          redirect_uri: rest.redirect_uri
          response_type: rest.response_type
          state: rest.state
          scope: rest.scope
          code_challenge: rest.code_challenge
          code_challenge_method: rest.code_challenge_method
          root_namespace_id: rest.root_namespace_id
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/oauth/authorize-device
      name: oauth-authorize-device
      description: REST surface for oauth-authorize_device.
      operations:
      - method: POST
        name: authorizedevice
        description: GitLab Initiate Device Authorization Grant
        call: oauth2-authorization.authorizedevice
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: oauth2-authorization-mcp
    port: 9090
    transport: http
    description: MCP adapter for GitLab OAuth 2.0 API — Authorization. One tool per consumed operation, routed inline through
      this capability's consumes block.
    tools:
    - name: gitlab-authorize-oauth-application
      description: GitLab Authorize OAuth Application
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: oauth2-authorization.authorizeoauth
      with:
        client_id: tools.client_id
        redirect_uri: tools.redirect_uri
        response_type: tools.response_type
        state: tools.state
        scope: tools.scope
        code_challenge: tools.code_challenge
        code_challenge_method: tools.code_challenge_method
        root_namespace_id: tools.root_namespace_id
      outputParameters:
      - type: object
        mapping: $.
    - name: gitlab-initiate-device-authorization-grant
      description: GitLab Initiate Device Authorization Grant
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: oauth2-authorization.authorizedevice
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.