Docs
Search docs...⌘K

Gemini Enterprise

Connect Gemini Enterprise to the hosted Ahrefs MCP server with OAuth 2.0. OAuth lets you grant access without sharing your Ahrefs password or providing an Ahrefs API/MCP key.

Follow Google's official setup guide to create a Custom MCP Server data store. Use the Ahrefs credentials and configuration below.

Get your OAuth credentials

Ahrefs uses OAuth Dynamic Client Registration (DCR) to issue a client ID and secret for each registration.

Run this command in a terminal to register Gemini Enterprise with Ahrefs:

curl -X POST https://api.ahrefs.com/mcp/register \
  -H 'Content-Type: application/json' \
  -d '{
    "client_name": "Gemini Enterprise",
    "redirect_uris": ["https://vertexaisearch.cloud.google.com/oauth-redirect"],
    "token_endpoint_auth_method": "client_secret_post",
    "grant_types": ["authorization_code"],
    "response_types": ["code"]
  }'

The redirect_uris value comes from the Before you begin section of Google's guide.

Ahrefs returns a response like this:

{
  "client_id": "v2Ky...",
  "client_secret": "MvEP...",
  "redirect_uris": ["https://vertexaisearch.cloud.google.com/oauth-redirect"],
  "token_endpoint_auth_method": "client_secret_post",
  "grant_types": ["authorization_code"],
  "response_types": ["code"],
  "client_name": "Gemini Enterprise",
  "scope": "apiv3-mcp"
}

Use the client_id and client_secret from your response, not the example. Do not share the client secret or commit it to source control.

Configure the connection in Gemini Enterprise

In the Google Cloud console, open the Custom MCP Server configuration for your Gemini Enterprise app. Select OAuth 2.0 under Authentication settings.

Gemini Enterprise limits each custom MCP server data store to 100 enabled tools, which Google calls actions. Review the Ahrefs tool groups and modes before you choose which tools to enable.

The example below uses essentials. If you choose a different group or mode, use its MCP server URL instead.

FieldValue
MCP Server URLhttps://api.ahrefs.com/mcp/mcp?tools=essentials
Authorization URLhttps://app.ahrefs.com/web/oauth/authorize
Authorization URL ParametersLeave blank.
Token URLhttps://ahrefs.com/oauth/token
Client IDThe client_id from your registration response.
Client SecretThe client_secret from your registration response.
Scopesapiv3-mcp
Enable PKCE SupportSelect this option.
Use HTTP Basic AuthenticationClear this option.

Gemini Enterprise selects the Use HTTP Basic Authentication checkbox by default. Clear it so that Gemini Enterprise sends the credentials in the token request body, as client_secret_post requires.

  1. Click Verify Auth.
  2. Sign in to Ahrefs if prompted.
  3. Approve the requested access.
  4. Return to Gemini Enterprise and click Continue.
  5. Follow Google's guide to finish creating the data store.
  6. Follow Google's steps to enable actions for the Ahrefs tools that you want to use.