_scurity

Setting up Gemini with Cycode MCP

This is a quick getting up and running wth Google Gemini and Cycode’s MCP server. Assumes MacOS.

Gemini

brew install gemini-cli

Authenticating

I’m authenticating using the Vertex AI Authentication so I need to have the gcloud CLI tool installed, which mean a certain version of Python is needed. Ensure you have Python 3.11 installed as 3.12 and above have removed the imp module that gcloud uses. You’ll see this error:

Traceback (most recent call last):
  File "/Users/ismisepaul/opt/google-cloud-sdk/lib/gcloud.py", line 132, in <module>
    main()
    ~~~~^^
  File "/Users/ismisepaul/opt/google-cloud-sdk/lib/gcloud.py", line 90, in main
    from googlecloudsdk.core.util import encoding
  File "/Users/ismisepaul/opt/google-cloud-sdk/lib/googlecloudsdk/__init__.py", line 23, in <module>
    from googlecloudsdk.core.util import importing
  File "/Users/ismisepaul/opt/google-cloud-sdk/lib/googlecloudsdk/core/util/importing.py", line 23, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'

Fix:

brew install python@3.11

Add the following line (check the location is correct)

vim ~/.zshrc

export CLOUDSDK_PYTHON="/opt/homebrew/opt/python@3.11/bin/python3.11"

Install

brew install google-cloud-sdk

Authenticate

gcloud auth application-default login

Setup environment variables for authentication

mkdir -p ~/.gemini
cat > ~/.gemini/.env <<'EOF'
GOOGLE_CLOUD_PROJECT=<YOUR_GCLOUD_PROJECT_NAME>
GOOGLE_GENAI_USE_VERTEXAI=true
GOOGLE_CLOUD_LOCATION=global
EOF
# Test connection
gemini -m gemini-2.5-flash -p "ping"

Cycode

Install the CLI

brew install cycode

Authenticate

cycode auth

Create the MCP settings.json

vim .gemini/settings.json

Add the following to the file, replacing with your secrets and environment details

{
  "mcpServers": {
    "cycode": {
      "command": "uvx",
      "args": ["cycode", "mcp"],
      "env": {
        "CYCODE_CLIENT_ID": "<CYCODE-tenantId>",
        "CYCODE_CLIENT_SECRET": "your-cycode-secret-key",
        "CYCODE_API_URL": "https://api.cycode.com",
        "CYCODE_APP_URL": "https://app.cycode.com"
      }
    }
  }
}

Ensure uv is installed to ensure Gemini can communicate to the MCP server

bew install uv

Start the server

cycode mcp 

Verify

gemini mcp list
Configured MCP servers:

✓ cycode: uvx cycode mcp (stdio) - Connected

Running an SCA Scan

Create a project folder

mkdir -p gemini-projects/cycode
cd gemini-projects/cycode

Pull an open source project

git clone https://github.com/elastic/synthetics.git

Run the SCA tool

# Interactive Gemini Session
gemini
# Run Cycode SCA Scan
cycode_sca_scan directory=/Users/pmccann/IdeaProjects/elastic/synthetics