Skip to content

Aembit supports the official GitLab MCP server, which lets AI Agent: A software workload that authenticates to systems, requests credentials, and accesses resources, either on behalf of a person or on its own. Aembit secures AI agents with the same identity-first model it uses for any workload. User-driven agents such as Claude Desktop also carry a blended identity that ties access to both the user and the agent.Learn more access GitLab project data through Model Context Protocol: A standard protocol for AI agent and server interactions that defines how AI assistants communicate with external tools and data sources.Learn more(opens in new tab) tools.

This page describes how to configure GitLab as an MCP Server: A server that implements the Model Context Protocol to provide tools, resources, or data to AI agents and MCP clients.Learn more(opens in new tab) behind the Aembit MCP Identity Gateway: A component that brokers MCP traffic between MCP clients and target MCP servers, validating authorization and presenting Aembit-managed credentials on each request.Learn more. Each user authenticates with their own GitLab identity, and the Gateway injects their token into MCP requests.

This guide builds the Gateway-to-Server Policy: The Access Policy that authorizes the MCP Identity Gateway to access an MCP server on behalf of authenticated users—the Gateway itself is the Client Workload. Also called right-side auth; each MCP server behind the Gateway needs its own.Learn more—the second of the two Access Policy: Access Policies define, enforce, and audit access between Client and Server Workloads by cryptographically verifying workload identity and contextual factors rather than relying on static secrets.Learn more the MCP Identity Gateway requires. You create the first, the Client-to-Gateway Policy: The Access Policy that validates which MCP client can connect to the MCP Identity Gateway and authenticates users through your Identity Provider. Also called left-side auth; you create one per MCP client and Gateway combination.Learn more, during Gateway setup.

Before you begin, ensure you have the following:

  • The Owner role for a GitLab.com top-level group, which is what enabling the MCP server requires
  • A configured Aembit MCP Identity Gateway

Before you configure GitLab, review these requirements and behaviors specific to GitLab’s MCP server.

  • Use User-Based Auth. Aembit supports User-Based Auth for GitLab.
  • GitLab.com only. Aembit verified this configuration against GitLab.com. GitLab also offers the MCP server on GitLab Self-Managed and GitLab Dedicated, which Aembit hasn’t tested.
  • The MCP server is a GitLab Beta feature. GitLab can change the server’s behavior between releases.
  • Request the mcp scope alone. GitLab rejects the authorization request when the scope list includes offline_access.

GitLab turns the MCP server off by default, so a group Owner enables it on the top-level group before users can authenticate.

  1. In GitLab, open the top-level group and go to Settings > General.
  2. Expand Permissions and group features.
  3. In the MCP client access section, select Allow connection to GitLab.
  4. Click Save changes.

Register a GitLab OAuth application and use its application ID and secret in the MCP User-Based Access Token Credential Provider: Credential Providers obtain the specific access credentials—such as API keys, OAuth tokens, or temporary cloud credentials—that Client Workloads need to authenticate to Server Workloads.Learn more.

  1. Log in to your Aembit Tenant: Aembit Tenants serve as isolated, dedicated environments within Aembit that provide complete separation of administrative domains and security configurations.Learn more.

  2. Go to Credential Providers and click + New.

  3. Enter a Name and select MCP User-Based Access Token as the Credential Type.

  4. Set MCP Server URL to https://gitlab.com/api/v4/mcp and click Discover to populate the OAuth URLs.

  5. Copy the read-only Callback URL. Keep this Credential Provider form open while you register the application in GitLab.

  6. In GitLab, open your top-level group and go to Settings > Applications.

  7. Enter a Name and set Redirect URI to the exact Callback URL you copied from Aembit.

  8. Select the mcp scope and click Save application.

  9. Copy the Application ID and Secret from GitLab. Store the secret securely. GitLab shows the secret only immediately after application creation. Copy it before you leave the page.

  10. Return to the same Aembit Credential Provider form and enter the following values:

    FieldValue
    Client IdThe GitLab Application ID
    Client SecretThe GitLab Secret
    Scopesmcp
    PKCE RequiredOn
  11. Click Save.

  12. Compare the saved Credential Provider’s Callback URL with the GitLab application’s Redirect URI. If they differ, update the application’s Redirect URI to match the saved Callback URL.

When you create the Access Policy that grants MCP Identity Gateway access to GitLab, use the Select Existing tab. Select the Credential Provider you saved here and click Use Selected. Don’t create another Credential Provider: its Callback URL won’t match the GitLab application’s Redirect URI. Don’t run Discover again after entering the application credentials, because it overwrites them.

For details, see GitLab’s Create a group-owned application.

Each user authorizes access to GitLab when they first connect through MCP Identity Gateway. The MCP User-Based Access Token Credential Provider has no administrator Authorize step.

  1. Go to Server Workloads in the left sidebar and click + New.

  2. Configure the following fields:

    FieldValue
    NameA user-friendly name
    Hostgitlab.com
    Application ProtocolMCP
    Port443 with TLS
    URL Path/api/v4/mcp
    Authentication methodHTTP Authentication
    Authentication schemeBearer
  3. Click Save.

On the Select Existing tab, select the Credential Provider you saved during GitLab setup and click Use Selected. The linked setup procedure describes creating a new Credential Provider. Reuse yours so its Callback URL matches GitLab’s Redirect URI.

This section creates the Gateway-to-Server Access Policy, which authorizes MCP Identity Gateway to access GitLab on behalf of authenticated users.

Create an Access Policy linking MCP Identity Gateway (as the Client Workload: Client Workloads represent AI agents, software applications, scripts, or automated processes that initiate access requests to Server Workloads. They can act on behalf of a user under blended identity or operate autonomously, as when one service calls another.Learn more), the Credential Provider you created, and the Server Workload for GitLab.

For step-by-step instructions, including the Client Workload settings that identify MCP Identity Gateway, see Create the gateway-to-server Access Policy.

After a user authorizes access, the Aembit AI Access Authorized page lists the GitLab MCP Server as Ready. The AI agent can then call GitLab MCP tools through the Gateway.