HomeGemini CLI

Gemini CLI Configuration Guide with MCP Openapi

This documentation collects practical examples and quick tips to configure the mcp.openapi.com server within Gemini CLI. The integration between the Gemini (LLM) language model and the Openapi Marketplace API makes it possible to combine the power of natural language with access to always up-to-date data and services. This way, you can automate processes, enhance applications, and create customized solutions simply, quickly, and effectively.

With the steps described below, you will be able to:

  • Connect Gemini to MCP Openapi
  • Authenticate properly
  • Configure the working environment
  • Start querying the APIs through the model.

The goal is to provide you with a simple and clear setup so you can immediately leverage the capabilities of the Claude LLM in combination with the available APIs.

Official Sites


Openapi Requirements


Before starting to configure Gemini Desktop remember to:

Installation via npm (Node Package Manager)


Gemini CLI is available as an npm package. Below are the steps to install it on major operating systems:

Linux/macOS


1. Make sure you have Node.js and npm installed on your system. You can check with the following command:

node -v
npm -v	  

If not installed, download and install Node.js from the official website: https://nodejs.org/

2. Install Gemini CLI globally using npm:

npm install -g gemini-cli

3. Verify that the installation was successful by running:

gemini --version

Windows


1. Download and install Node.js from the official website: https://nodejs.org/

2. Open a terminal (for example, PowerShell or Command Prompt) and check that Node.js and npm are installed:

node -v
npm -v

3. Install Gemini CLI globally using npm:

npm install -g gemini-cli

4. Verify that the installation was successful by running:

gemini --version

Configuration


1. Create a json file named settings.json in the directory, based on your operating system:

  • Linux/macOS: the file must be located at ~/.gemini/settings.json
  • Windows: the file must be located at %USERPROFILE%\.gemini\settings.json

2. Insert the following code into the settings.json file and replace {OPENAPI_TOKEN} with a token generated via openapi.com:

{
  "mcpServers": {
    "OpenapiMcpServer": {
      "httpUrl": "https://mcp.openapi.com",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

Save the file and check that Gemini CLI is configured correctly by running:

gemini --help

Quick Test


If you want to run a quick test, you can directly edit the sample settings.json file located in the .gemini directory of this repository. It is not necessary to copy it into your home directory. Make sure to replace {OPENAPI_TOKEN} with a valid token generated via openapi.com:

{
  "mcpServers": {
    "OpenapiMcpServer": {
      "httpUrl": "https://mcp.openapi.com",
      "headers": {
        "Authorization": "Bearer YOUR_TOKEN"
      }
    }
  }
}

After editing the file, you can run the gemini command directly from this directory to check that the MCP of openapi.com is enabled.

Usage Example

List of available commands


Run the following command to start Gemini CLI and display the list of available commands:

gemini --help

Start in CLI mode and authentication


To start the client in CLI mode, simply run the command:

gemini

The client will start, and the first time you will be asked to authenticate:

 ███            █████████  ██████████ ██████   ██████ █████ ██████   █████ █████
░░░███         ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
  ░░░███      ███     ░░░  ░███  █ ░  ░███░█████░███  ░███  ░███░███ ░███  ░███
    ░░░███   ░███          ░██████    ░███░░███ ░███  ░███  ░███░░███░███  ░███
     ███░    ░███    █████ ░███░░█    ░███ ░░░  ░███  ░███  ░███ ░░██████  ░███
   ███░      ░░███  ░░███  ░███ ░   █ ░███      ░███  ░███  ░███  ░░█████  ░███
 ███░         ░░█████████  ██████████ █████     █████ █████ █████  ░░█████ █████
░░░            ░░░░░░░░░  ░░░░░░░░░░ ░░░░░     ░░░░░ ░░░░░ ░░░░░    ░░░░░ ░░░░░

Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. /help for more information.
╭─────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                         │
│ Get started                                                                             │
│                                                                                         │
│ How would you like to authenticate for this project?                                    │
│                                                                                         │
│ ● 1. Login with Google                                                                  │
│   2. Use Gemini API Key                                                                 │
│   3. Vertex AI                                                                          │
│                                                                                         │
│ Authentication timed out. Please try again.                                             │
│                                                                                         │
│ (Use Enter to select)                                                                   │
│                                                                                         │
│ Terms of Services and Privacy Notice for Gemini CLI                                     │
│                                                                                         │
│ https://github.com/google-gemini/gemini-cli/blob/main/docs/tos-privacy.md               │
│                                                                                         │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
~/Openapi/McpGeminiCli     no sandbox (see /docs)        gemini-2.5-pro (100% context left)

For authentication modes, refer to the Gemini CLI documentation:

Once authentication is completed, it will no longer be required later.

Now we are ready:

 ███            █████████  ██████████ ██████   ██████ █████ ██████   █████ █████
░░░███         ███░░░░░███░░███░░░░░█░░██████ ██████ ░░███ ░░██████ ░░███ ░░███
  ░░░███      ███     ░░░  ░███  █ ░  ░███░█████░███  ░███  ░███░███ ░███  ░███
    ░░░███   ░███          ░██████    ░███░░███ ░███  ░███  ░███░░███░███  ░███
     ███░    ░███    █████ ░███░░█    ░███ ░░░  ░███  ░███  ░███ ░░██████  ░███
   ███░      ░░███  ░░███  ░███ ░   █ ░███      ░███  ░███  ░███  ░░█████  ░███
 ███░         ░░█████████  ██████████ █████     █████ █████ █████  ░░█████ █████

░░░            ░░░░░░░░░  ░░░░░░░░░░ ░░░░░     ░░░░░ ░░░░░ ░░░░░    ░░░░░ ░░░░░

Tips for getting started:
1. Ask questions, edit files, or run commands.
2. Be specific for the best results.
3. /help for more information.

Using: 1 GEMINI.md file | 1 MCP server (ctrl+t to view)
╭─────────────────────────────────────────────────────────────────────────────────────────╮
│ >   Type your message or @path/to/file                                                  │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
~/Openapi/McpGeminiCli     no sandbox (see /docs)        gemini-2.5-pro (100% context left)

Check connection to mcp.openapi.com


Notice the notification "1 MCP server (ctrl+t to view)" in the client's welcome screen. By pressing the suggested key combination, the command will run:

/mcp desc 

which will display the context provided by the MCP server, and by pressing it a second time, the list of available tools on the MCP server will be shown, i.e., the output of the command:

/mcp nodesc

  🟢 OpenapiMcpServer - Ready (29 tools)
    Tools:
    - check_email_advanced
    - check_email_start
    - check_ip_advanced
    - check_IT_fiscal_code
    - check_license_plate
    - check_mobile_advanced
    - check_mobile_start
    - check_url_advanced
    - find_IT_istat_by_comune_name
    - find_IT_municipalities_by_zip
    - find_IT_municipality_by_istat
    - geocode
    - get_company_IT_advanced
    - get_company_IT_full
    - get_company_IT_legal_forms_list
    - get_company_IT_search
    - get_company_IT_start
    - get_company_WW_top
    - get_IT_metropolitan_cities_list
    - get_IT_provinces_list
    - get_IT_regions_list
    - get_italian_company_official_document
    - get_italian_company_official_documents_list
    - get_risk_IT_creditscore_top
    - get_suppressed_italian_municipalities
    - get_today_exchange_rates
    - post_risk_WW_kyc_full
    - reverse_geocode
    - send_sms

Let’s start using Openapi with Gemini: currency conversion


If you have correctly entered the generated Token, you can start interacting naturally with the integrated services of Openapi.com through the Gemini language model. In this demo, the Gemini-2.5-pro model has been selected. For more details on the available models, their costs, and availability, refer to the client documentation.

Let’s ask the model a simple question: "I have 12 euros in my pocket, how much are they worth in dollars today?"

╭──────────────────────────────────────────────────────────╮
│  > I have 12 euros in my pocket, how much are they worth  │
│    in dollars today?                                     │
╰──────────────────────────────────────────────────────────╯

After a few moments, the model will select the correct service to answer the question accurately, minimizing the risk of hallucinations.

 ╭─────────────────────────────────────────────────────────────────────────────────────────╮
 │ ?  get_today_exchange_rates (OpenapiMcpServer MCP Server) get_today_exchange_rates … ←  │
 │                                                                                         │
 │   MCP Server: OpenapiMcpServer                                                          │
 │   Tool: get_today_exchange_rates                                                        │
 │                                                                                         │
 │ Allow execution of MCP tool "get_today_exchange_rates" from server "Openap…             │
 │                                                                                         │
 │ ● 1. Yes, allow once                                                                    │
 │   2. Yes, always allow tool "get_today_exchange_rates" from server "Openap…             │
 │   3. Yes, always allow all tools from server "OpenapiMcpServer"                         │
 │   4. No, suggest changes (esc)                                                          │
 │                                                                                         │
 ╰─────────────────────────────────────────────────────────────────────────────────────────╯
⠏ Waiting for user confirmation...

Authorization is requested to execute the call to a specific MCP tool of mcp.openapi.com (in this example, "get_today_exchange_rates"). Authorization can be granted as one-time or permanent.

 ╭────────────────────────────────────────────────────────────────────────────────────────────╮
 │ ✔ get_today_exchange_rates (OpenapiMcpServer MCP Server) get_today_exchange_rates (Open…  │
 │                                                                                            │
 │    {"EUR":1,"USD":1.1675,...}                                                             │
 ╰────────────────────────────────────────────────────────────────────────────────────────────╯
✦ Today 12 euros are worth 14.01 dollars. The exchange rate is 1 EUR = 1.1675 USD.

Let’s move on to a more advanced example: retrieve the list of companies with economic and geographic parameters.


Let’s request company information based on some parameters: "How many Joint Stock Companies (SPA) with a turnover of more than 10 million are located in the province of Terni (Italian city)?"

╭───────────────────────────────────────────────────────────────────────────────────╮
│  > how many SPAs are there with turnover above 10 million in the province of Terni?│
╰───────────────────────────────────────────────────────────────────────────────────╯

 ╭────────────────────────────────────────────────────────────────────────────────────────────╮
 │ ✔ get_company_IT_search (OpenapiMcpServer MCP Server) get_company_IT_search (OpenapiMcp…  │
 │                                                                                            │
 │    {"data":[],"count":27,"cost":0.027,"success":true,"message":"","error":null}            │
 ╰────────────────────────────────────────────────────────────────────────────────────────────╯
✦ With the province set to "TR", there are 27 SPAs with a turnover above 10 million.

In this example, the "dryRun" property of the company.openapi.com API was automatically set. This option allows you to get a free count ("count") and a cost estimate ("cost") related to the specified criteria, without actually extracting the dataset.

Let’s create a detailed company report


Do you want detailed data about a single company? No problem — with a simple prompt ("make me an HTML report of Openapi spa") it is possible to obtain not only the data but also a company report with registry, financial, and organizational information.

╭───────────────────────────────────────────────────────╮
│  > make me an HTML report of Openapi spa              │
╰───────────────────────────────────────────────────────╯

Since only the company name was provided in the request, the system first performs a search to retrieve the VAT number.

Once the company VAT number is obtained, the IT-advanced service of the company.openapi.com API is queried.

After gaining access to the desired company data, the model proceeds to generate a report in HTML format, which will be written to disk in the directory from which the "gemini" command was executed.

Did you encounter problems during the request?


Make sure you have followed these steps:

  • Activate the services you want to use in the Openapi Console.
  • Generate a token and link it to the services you want to use.
  • Insert the token into the Claude configuration file.
  • Place the configuration file in the correct folder.
  • Top up your credit if you are using paid services.

For any issues, contact us for support!

And now it’s your turn!

Would you like to tell us how you used MCP? Don’t hesitate to contact us!