DataForSEO MCP server is an implementation of the Model Context Protocol that allows large language models (LLMs) like Gemini to interact with our APIs.
Note that MCP support is not yet available in the Gemini app. However, you can use MCP servers through the Gemini CLI (command-line interface). It’s an open-source AI agent that provides access to Gemini directly in your terminal and works with your built-in tools and local or remote MCP servers.
In this guide, we will focus on configuring the DataForSEO MCP server with the Gemini CLI.
To set everything up, you only need to:
➤ Install the Gemini CLI and authenticate with an API key.
➤ Connect the Gemini CLI to the DataForSEO MCP server.
Let’s go through the necessary steps one by one.
Prerequisites
Before we begin, make sure you have the following:
- DataForSEO API credentials API login and password).
- A Google API Key. You can obtain it from Google AI Studio. Just click “Create API Key” and save the value for later. Note: free tier has lower rate limits.
- Latest version of Node.js installed.
Installing the Gemini CLI
1 Install the Gemini CLI globally with:
npm install -g @google/gemini-cli
2 Specify your Gemini API key. Replace your_api_key
with your Google API Key obtained from Google AI Studio.
macOS/Linux
export GEMINI_API_KEY=your_api_key
Windows PowerShell
$env:GEMINI_API_KEY = "your_api_key"
Windows Command Prompt
set GEMINI_API_KEY="your_api_key"
3 Run the gemini
command on its own to start the interactive session. On the first run, it will ask to authenticate. Press “2” to use the Gemini API Key you specified earlier.
Configuring Gemini CLI to Use the DataForSEO MCP Server
1 Find your settings file.
The Gemini CLI uses a settings.json
file to manage its configuration, typically located by the following path:
~/.gemini/settings.json
on macOS/Linux;C:\Users\$your_user_name\.gemini\settings.json
on Windows.
2 Add MCP server config.
Open the settings.json
file and add a section to this file to tell Gemini where to find and how to start the DataForSEO MCP server. The full configuration should look like this:
{ "selectedAuthType": "gemini-api-key", "mcpServers": { "dataforseo": { "command": "npx", "args": ["-y", "dataforseo-mcp-server"], "env": { "DATAFORSEO_USERNAME": "your_username", "DATAFORSEO_PASSWORD": "your_password", "DATAFORSEO_SIMPLE_FILTER": "true" } } } }
Remember to replace your_username
and your_password
with your DataForSEO API login and password from here.
3 Verify the connection.
Restart the Gemini CLI (type /exit
, then run gemini
again) and it should automatically connect to the configured MCP server. You can check the status by running /mcp list
.
You should see the DataForSEO server listed with its available tools.
Using DataForSEO MCP with Gemini
Once the setup is complete, you can interact with the DataForSEO API through Gemini using natural language. The MCP server translates your requests into the appropriate API calls and returns the structured data to Gemini CLI.
For example, you could ask something like:
Using my DataForSEO tools, what is the search volume for 'generative AI' in the United States?
The Gemini model will recognize this as a request for data and use the configured DataForSEO MCP tool. Before making an API call, it will ask for your permission. Allow the execution by pressing the corresponding button.
Then the model will send a query to the DataForSEO API, and return the results back to you in a readable format.
Done! Now you have Gemini CLI connected to DataForSEO APIs via MCP and know how to use it.