Support
Set up the Stack Internal Community MCP server with GitLab Duo.
Applies to:
Free
Basic
Business
Enterprise

Overview

This guide shows you how to connect GitLab Duo to your Stack Internal Community site through the Model Context Protocol (MCP). Duo can use the connection to find questions, answers, and articles, and use other tools your site permits.

Stack Overflow supports local GitLab Duo MCP configuration only.

This guide covers GitLab Duo as an MCP client. Your Community MCP server remains hosted with your Community site. Learn more in the MCP Server Quickstart Guide.

You'll use https://[your_site].stackenterprise.co/mcp as the connection URL. Stack Internal Community uses Streamable HTTP and browser sign-in with OAuth and Proof Key for Code Exchange (PKCE). Don't enter a GitLab personal access token or a shared static token. Learn more in the MCP Server Quickstart Guide.

Before you begin

Make sure you have the following:

  • A Community account with access to the content you need, and MCP access enabled for your site.
  • A GitLab account with Duo Agent Platform enabled and the required usage entitlement. For local use, use a project in a group namespace where you have the Developer, Maintainer, or Owner role. See GitLab Duo Agent Platform prerequisites for more info.
  • An installed, signed-in GitLab IDE extension. Use a current supported release; GitLab documents full MCP configuration support from GitLab for VS Code 6.35.6 and the JetBrains GitLab Duo plugin 3.14.0. See GitLab MCP clients for more info.

Enable the Community MCP server

A Community site administrator completes this step. The server is enabled by default, but your organization may have turned it off.

  1. Sign in to Community as an administrator.
  2. Open your site's MCP administration page at https://[your_site].stackenterprise.co/enterprise/mcp.
  3. Set Enable MCP Server to On.

Replace [your_site] with your site's subdomain. Enabling MCP automatically registers its API service application. You can view it by clicking Admin settings, then API. Learn more in the Configure the MCP Server article.

Allow external tools in GitLab

Ask your GitLab group administrator to allow external MCP tools with the following steps. On GitLab.com, open the top-level group's Settings, then GitLab Duo, then Change configuration. On Self-Managed, open Settings, then General, and expand GitLab Duo features. Enable Allow external MCP tools and save. Learn more about GitLab MCP clients.

Set up GitLab Duo on your computer

Add the Community connection to GitLab Duo's settings.

  1. In VS Code, run GitLab MCP: Open User Settings (JSON). For JetBrains, use ~/.gitlab/duo/mcp.json on macOS or Linux, or %APPDATA%\GitLab\duo\mcp.json on Windows. Environment overrides can change these paths.
  2. Add this entry under mcpServers, preserving any existing entries. Replace [your_site] with your site's subdomain.
{
  "mcpServers": {
    "stack-internal-community": {
      "type": "http",
      "url": "https://[your_site].stackenterprise.co/mcp"
    }
  }
}
  1. Save the file and restart your IDE. For project-only configuration, use .gitlab/duo/mcp.json in the workspace; it overrides the same server in user settings. Learn more about GitLab configuration.
  2. Open GitLab Duo Agentic Chat and ask it to search Community. Complete the browser sign-in with your Community account and approve the connection. OAuth access follows your Community permissions. Learn more about Community authentication.

The example leaves tool pre-approval unset. Review tool requests when Duo presents them. Learn more about GitLab tool approval.

Check the connection

Start a new chat and try a request about content you can already open in Community. For example:

"Use the Stack Internal Community MCP server to search for our deployment process. Open the most relevant question or article, summarize the guidance, and link to each source."

Confirm that Duo calls a Community tool and returns content you can open. A general answer without a tool result doesn't verify the connection. The Community tools include search, get_question, and get_article; available actions follow your site configuration and permissions. Review proposed posts and edits before approving them. Learn more in the MCP Server Quickstart Guide.

Troubleshoot the connection

Use these checks if Duo cannot connect or retrieve the expected content:

  • Wrong address or transport Use your Community site's /mcp endpoint and HTTP. Community doesn't support SSE. The separate Stack Internal platform uses a different server address.
  • Sign-in or registration fails Let the MCP client register itself and complete browser authorization. Don't copy the API service application ID from the Community administration page into the client's OAuth settings. If registration remains invalid, contact support. Learn more in the MCP Server Architecture article.
  • Access expires Community uses short-lived tokens. Complete sign-in again when prompted. Don't replace OAuth with a permanent bearer token. Learn more in the Configure the MCP Server article.
  • Expected content is missing Check that you can open the content with the same Community account, then try a more specific search. MCP follows your existing permissions. Learn more in the MCP Server Frequently Asked Questions (FAQ) article.

For help, contact Stack Overflow Support. Include your GitLab offering and version, IDE and extension version, and the error text. Omit passwords and access tokens.

https://doc-automation.netlify.app/pdfs/docs/community/enterprise/integrations_and_api/mcp_server/gitlab_duo.pdf

Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article