Skip to main content
The Gemini CLI provides command-line access to Google’s Gemini AI models with MCP server support for enhanced capabilities.
Platform Support: macOS, Linux, Windows Transport Modes: Stdio (local) and HTTP (remote) Configuration: ~/.gemini/settings.json

Configuration File Location

Gemini CLI stores its MCP server configuration at:
~/.gemini/settings.json
Where ~ is your home directory.

Local (Stdio) Setup

Step 1: Install Gemini CLI (if not already installed)
# Follow installation instructions from Gemini CLI documentation
Step 2: Edit settings file Open ~/.gemini/settings.json and add the following to the mcpServers object:
{
  "mcpServers": {
    "ibmi-mcp": {
      "command": "npx",
      "args": ["@ibm/ibmi-mcp-server@latest", "-y", "--tools", "/absolute/path/to/tools"],
      "env": {
        "DB2i_HOST": "your-ibmi-host.com",
        "DB2i_USER": "your-username",
        "DB2i_PASS": "your-password",
        "DB2i_PORT": "8076",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}
The --tools path must be an absolute path, not relative.

Remote (HTTP) Setup

For connecting to a remote IBM i MCP Server: Step 1: Start remote server
# On server machine
npm run start:http
Step 2: Obtain access token
node get-access-token.js --verbose
Step 3: Edit settings file Add to ~/.gemini/settings.json:
{
  "mcpServers": {
    "ibmi-mcp": {
      "url": "http://localhost:3010/mcp",
      "type": "http",
      "headers": {
        "Authorization": "Bearer YOUR_ACCESS_TOKEN_HERE"
      }
    }
  }
}
Production: Replace http://localhost:3010 with your production server URL and use HTTPS.

Testing the Connection

After configuration:
# Start Gemini CLI
gemini

# Ask about available tools
> What tools are available?

# Test IBM i integration
> Show me the IBM i system status

Multiple Servers

You can configure multiple MCP servers for different purposes:
{
  "mcpServers": {
    "ibmi-dev": {
      "command": "npx",
      "args": ["@ibm/ibmi-mcp-server@latest", "-y", "--tools", "/path/to/dev-tools"],
      "env": {
        "DB2i_HOST": "dev-ibmi.company.com",
        "DB2i_USER": "devuser",
        "DB2i_PASS": "devpass",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    },
    "ibmi-prod": {
      "url": "https://prod-mcp.company.com/mcp",
      "type": "http",
      "headers": {
        "Authorization": "Bearer PROD_TOKEN"
      }
    }
  }
}

Troubleshooting

Solutions:
  • Verify ~/.gemini/settings.json exists and has valid JSON
  • Check that npx -y @ibm/ibmi-mcp-server@latest works from terminal
  • Ensure Node.js and npm are in PATH
  • Restart Gemini CLI after configuration changes
Solutions:
  • Verify tools path is absolute: /full/path/to/tools
  • Check YAML files are valid
  • Ensure IBM i credentials are correct
  • Verify Mapepire is running on IBM i
Solutions:
  • Confirm server is running with auth enabled
  • Verify token hasn’t expired
  • Get fresh token: node get-access-token.js --verbose
  • Check Authorization header format

Custom Toolsets

Load specific toolsets for focused workflows:
{
  "mcpServers": {
    "ibmi-performance": {
      "command": "npx",
      "args": [
        "@ibm/ibmi-mcp-server@latest", "-y",
        "--tools", "/path/to/tools",
        "--toolsets", "performance,monitoring"
      ],
      "env": {
        "DB2i_HOST": "your-ibmi-host.com",
        "DB2i_USER": "your-username",
        "DB2i_PASS": "your-password",
        "MCP_TRANSPORT_TYPE": "stdio"
      }
    }
  }
}

Next Steps

Additional Resources