@staticpayload/gemini-mcp 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/.env.example ADDED
@@ -0,0 +1,17 @@
1
+ # Google Cloud Project Configuration
2
+ PROJECT_ID=your-gcp-project-id
3
+
4
+ # Vertex AI Locations
5
+ LOCATION_GA=us-central1
6
+ LOCATION_PREVIEW=global
7
+
8
+ # Model Selection
9
+ MODEL_GA=gemini-2.0-flash-001
10
+ MODEL_PREVIEW=gemini-2.0-flash-exp-001
11
+
12
+ # Gemini CLI Configuration Directory (sandbox)
13
+ GEMINI_CONFIG_DIR=./sandbox/.gemini
14
+
15
+ # MCP Server Configuration
16
+ MCP_SERVER_PATH=./src/index.js
17
+ MCP_SERVER_NAME=gemini-mcp-local
@@ -0,0 +1,108 @@
1
+ # Gemini CLI Autonomous Setup
2
+
3
+ Automated configuration for running Gemini CLI with Vertex AI authentication and no interactive prompts.
4
+
5
+ ## Quick Start
6
+
7
+ 1. **Copy environment template:**
8
+ ```bash
9
+ cp .env.example .env
10
+ ```
11
+
12
+ 2. **Edit `.env` with your values:**
13
+ ```bash
14
+ PROJECT_ID=your-gcp-project-id
15
+ LOCATION_GA=us-central1
16
+ LOCATION_PREVIEW=global
17
+ MODEL_GA=gemini-2.0-flash-001
18
+ MODEL_PREVIEW=gemini-2.0-flash-exp-001
19
+ ```
20
+
21
+ 3. **Authenticate with gcloud:**
22
+ ```bash
23
+ gcloud auth application-default login
24
+ ```
25
+
26
+ 4. **Run setup:**
27
+ ```bash
28
+ ./setup-gemini.sh
29
+ ```
30
+
31
+ 5. **Use Gemini:**
32
+ ```bash
33
+ ./run-gemini.sh
34
+ ```
35
+
36
+ ## What It Does
37
+
38
+ - ✅ Configures Vertex AI authentication (no API keys)
39
+ - ✅ Disables all permission prompts (autonomous mode)
40
+ - ✅ Routes GA models to regional endpoints
41
+ - ✅ Routes Preview models to global endpoint
42
+ - ✅ Integrates local MCP server
43
+ - ✅ Uses sandbox directory to avoid macOS permission issues
44
+
45
+ ## Configuration Files
46
+
47
+ After running `setup-gemini.sh`:
48
+
49
+ ```
50
+ sandbox/.gemini/
51
+ ├── settings.json # Main Gemini CLI config
52
+ ├── model-router.json # Model routing rules
53
+ └── README.md # Configuration details
54
+ ```
55
+
56
+ ## Autonomous Permissions
57
+
58
+ All tools enabled without prompts:
59
+ - File operations (read/write/delete)
60
+ - Shell command execution
61
+ - Web fetching
62
+
63
+ ## Model Selection
64
+
65
+ **GA Model (regional):**
66
+ ```bash
67
+ ./run-gemini.sh -m gemini-2.0-flash-001
68
+ ```
69
+
70
+ **Preview Model (global):**
71
+ ```bash
72
+ ./run-gemini.sh -m gemini-2.0-flash-exp-001
73
+ ```
74
+
75
+ ## Environment Variables
76
+
77
+ | Variable | Description | Example |
78
+ |----------|-------------|---------|
79
+ | `PROJECT_ID` | GCP project ID | `my-project-123` |
80
+ | `LOCATION_GA` | Region for GA models | `us-central1` |
81
+ | `LOCATION_PREVIEW` | Location for preview | `global` |
82
+ | `MODEL_GA` | Default GA model | `gemini-2.0-flash-001` |
83
+ | `MODEL_PREVIEW` | Preview model | `gemini-2.0-flash-exp-001` |
84
+ | `GEMINI_CONFIG_DIR` | Config directory | `./sandbox/.gemini` |
85
+ | `MCP_SERVER_PATH` | Local MCP server | `./src/index.js` |
86
+
87
+ ## Troubleshooting
88
+
89
+ **Authentication error:**
90
+ ```bash
91
+ gcloud auth application-default login
92
+ gcloud config set project YOUR_PROJECT_ID
93
+ ```
94
+
95
+ **Permission denied:**
96
+ ```bash
97
+ chmod +x setup-gemini.sh run-gemini.sh
98
+ ```
99
+
100
+ **MCP server not found:**
101
+ Check `MCP_SERVER_PATH` in `.env` points to valid file.
102
+
103
+ ## Security Notes
104
+
105
+ - `.env` contains sensitive data (gitignored)
106
+ - Uses gcloud application-default credentials
107
+ - No API keys stored in config files
108
+ - Sandbox directory isolated from system config
package/README.md CHANGED
@@ -7,7 +7,7 @@
7
7
 
8
8
  <h1 align="center">
9
9
  <br>
10
- ✦ gemini-cli-mcp
10
+ @staticpayload/gemini-mcp
11
11
  <br>
12
12
  </h1>
13
13
 
@@ -20,6 +20,7 @@
20
20
  <a href="#-tools">Tools</a> •
21
21
  <a href="#-usage">Usage</a> •
22
22
  <a href="#-configuration">Configuration</a> •
23
+ <a href="#-autonomous-setup">Autonomous Setup</a> •
23
24
  <a href="#-how-it-works">How It Works</a>
24
25
  </p>
25
26
 
@@ -34,7 +35,7 @@
34
35
  │ │ │
35
36
  │ ▼ │
36
37
  │ ┌─────────────────────────────────────┐ │
37
- │ │ gemini-cli-mcp │ │
38
+ │ │ @staticpayload/gemini-mcp │ │
38
39
  │ │ ┌─────────┐ ┌─────────┐ ┌───────┐ │ │
39
40
  │ │ │ prompt │ │ models │ │ raw │ │ ◄── MCP Tools │
40
41
  │ │ └────┬────┘ └────┬────┘ └───┬───┘ │ │
@@ -98,7 +99,7 @@ gemini
98
99
  ### Run the MCP Server
99
100
 
100
101
  ```bash
101
- npx gemini-cli-mcp
102
+ npx @staticpayload/gemini-mcp
102
103
  ```
103
104
 
104
105
  That's it. The server starts and waits for MCP connections via stdio.
@@ -145,7 +146,7 @@ Add to your Claude configuration (`~/.claude/config.json`):
145
146
  "mcpServers": {
146
147
  "gemini": {
147
148
  "command": "npx",
148
- "args": ["gemini-cli-mcp"]
149
+ "args": ["@staticpayload/gemini-mcp"]
149
150
  }
150
151
  }
151
152
  }
@@ -154,7 +155,7 @@ Add to your Claude configuration (`~/.claude/config.json`):
154
155
  ### With Claude CLI
155
156
 
156
157
  ```bash
157
- claude mcp add gemini -- npx gemini-cli-mcp
158
+ claude mcp add gemini -- npx @staticpayload/gemini-mcp
158
159
  ```
159
160
 
160
161
  ### With Cursor / Windsurf
@@ -165,7 +166,7 @@ Add to your MCP settings:
165
166
  {
166
167
  "gemini": {
167
168
  "command": "npx",
168
- "args": ["gemini-cli-mcp"]
169
+ "args": ["@staticpayload/gemini-mcp"]
169
170
  }
170
171
  }
171
172
  ```
@@ -195,6 +196,40 @@ gcloud auth ← Application default credentials
195
196
 
196
197
  ---
197
198
 
199
+ ## 🤖 Autonomous Setup
200
+
201
+ For production deployments with **Vertex AI authentication** and **zero interactive prompts**, use the automated setup:
202
+
203
+ ```bash
204
+ # 1. Copy environment template
205
+ cp .env.example .env
206
+
207
+ # 2. Edit .env with your GCP project
208
+ # PROJECT_ID=your-gcp-project-id
209
+
210
+ # 3. Authenticate with gcloud
211
+ gcloud auth application-default login
212
+
213
+ # 4. Run automated setup
214
+ ./setup-gemini.sh
215
+
216
+ # 5. Use Gemini autonomously
217
+ ./run-gemini.sh
218
+ ```
219
+
220
+ **Features:**
221
+ - ✅ Vertex AI authentication (no API keys)
222
+ - ✅ No permission prompts for file/shell/web operations
223
+ - ✅ GA/Preview model routing
224
+ - ✅ MCP server integration
225
+ - ✅ Sandbox directory (avoids macOS permission issues)
226
+
227
+ **See [GEMINI_SETUP.md](./GEMINI_SETUP.md) for complete documentation.**
228
+
229
+ ---
230
+
231
+ ---
232
+
198
233
  ## 🔬 How It Works
199
234
 
200
235
  ```
@@ -216,7 +251,7 @@ The server is a thin translation layer—all heavy lifting happens in Gemini CLI
216
251
  ## 🏗️ Architecture
217
252
 
218
253
  ```
219
- gemini-cli-mcp/
254
+ @staticpayload/gemini-mcp/
220
255
  ├── src/
221
256
  │ └── index.js # MCP server (single file, ~300 lines)
222
257
  ├── package.json # npm package with bin entry
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staticpayload/gemini-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "MCP server that bridges Google's Gemini CLI to any MCP-compatible AI assistant",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
@@ -43,6 +43,9 @@
43
43
  "files": [
44
44
  "src/**/*",
45
45
  "README.md",
46
- "LICENSE"
46
+ "LICENSE",
47
+ ".env.example",
48
+ "setup-gemini.sh",
49
+ "GEMINI_SETUP.md"
47
50
  ]
48
51
  }
@@ -0,0 +1,310 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ # ============================================================================
5
+ # Gemini CLI Autonomous Configuration Setup
6
+ # ============================================================================
7
+ # This script configures Gemini CLI to run fully autonomously with:
8
+ # - Vertex AI authentication (no API keys)
9
+ # - No interactive permission prompts
10
+ # - Support for GA and Preview models
11
+ # - Custom MCP server integration
12
+ # - Sandbox directory to avoid macOS permission issues
13
+ # ============================================================================
14
+
15
+ # Colors for output
16
+ RED='\033[0;31m'
17
+ GREEN='\033[0;32m'
18
+ YELLOW='\033[1;33m'
19
+ NC='\033[0m' # No Color
20
+
21
+ log_info() {
22
+ echo -e "${GREEN}[INFO]${NC} $1"
23
+ }
24
+
25
+ log_warn() {
26
+ echo -e "${YELLOW}[WARN]${NC} $1"
27
+ }
28
+
29
+ log_error() {
30
+ echo -e "${RED}[ERROR]${NC} $1"
31
+ }
32
+
33
+ # ============================================================================
34
+ # Load Configuration from .env
35
+ # ============================================================================
36
+
37
+ if [ ! -f .env ]; then
38
+ log_error ".env file not found. Copy .env.example to .env and configure it."
39
+ exit 1
40
+ fi
41
+
42
+ # Load environment variables
43
+ set -a
44
+ source .env
45
+ set +a
46
+
47
+ # Validate required variables
48
+ REQUIRED_VARS=(
49
+ "PROJECT_ID"
50
+ "LOCATION_GA"
51
+ "LOCATION_PREVIEW"
52
+ "MODEL_GA"
53
+ "MODEL_PREVIEW"
54
+ "GEMINI_CONFIG_DIR"
55
+ )
56
+
57
+ for var in "${REQUIRED_VARS[@]}"; do
58
+ if [ -z "${!var:-}" ]; then
59
+ log_error "Required variable $var is not set in .env"
60
+ exit 1
61
+ fi
62
+ done
63
+
64
+ log_info "Configuration loaded from .env"
65
+
66
+ # ============================================================================
67
+ # Setup Sandbox Directory
68
+ # ============================================================================
69
+
70
+ log_info "Creating sandbox directory: $GEMINI_CONFIG_DIR"
71
+ mkdir -p "$GEMINI_CONFIG_DIR"
72
+
73
+ # ============================================================================
74
+ # Generate Gemini CLI Settings
75
+ # ============================================================================
76
+
77
+ SETTINGS_FILE="$GEMINI_CONFIG_DIR/settings.json"
78
+
79
+ log_info "Generating Gemini CLI settings: $SETTINGS_FILE"
80
+
81
+ cat > "$SETTINGS_FILE" <<EOF
82
+ {
83
+ "auth": {
84
+ "method": "vertexai"
85
+ },
86
+ "vertexai": {
87
+ "projectId": "${PROJECT_ID}",
88
+ "location": "${LOCATION_GA}"
89
+ },
90
+ "model": "${MODEL_GA}",
91
+ "tools": {
92
+ "fileOperations": {
93
+ "enabled": true,
94
+ "requirePermission": false
95
+ },
96
+ "shellExecution": {
97
+ "enabled": true,
98
+ "requirePermission": false
99
+ },
100
+ "webFetch": {
101
+ "enabled": true,
102
+ "requirePermission": false
103
+ }
104
+ },
105
+ "mcpServers": {}
106
+ }
107
+ EOF
108
+
109
+ log_info "Settings file created with autonomous permissions"
110
+
111
+ # ============================================================================
112
+ # Generate Model Router Configuration
113
+ # ============================================================================
114
+
115
+ ROUTER_FILE="$GEMINI_CONFIG_DIR/model-router.json"
116
+
117
+ log_info "Generating model router: $ROUTER_FILE"
118
+
119
+ cat > "$ROUTER_FILE" <<EOF
120
+ {
121
+ "models": {
122
+ "${MODEL_GA}": {
123
+ "location": "${LOCATION_GA}",
124
+ "type": "ga"
125
+ },
126
+ "${MODEL_PREVIEW}": {
127
+ "location": "${LOCATION_PREVIEW}",
128
+ "type": "preview"
129
+ }
130
+ },
131
+ "defaultModel": "${MODEL_GA}"
132
+ }
133
+ EOF
134
+
135
+ log_info "Model router configured for GA and Preview models"
136
+
137
+ # ============================================================================
138
+ # Configure MCP Server (if path provided)
139
+ # ============================================================================
140
+
141
+ if [ -n "${MCP_SERVER_PATH:-}" ] && [ -f "${MCP_SERVER_PATH}" ]; then
142
+ log_info "Configuring MCP server: ${MCP_SERVER_NAME:-gemini-mcp}"
143
+
144
+ # Update settings.json with MCP server
145
+ cat > "$SETTINGS_FILE" <<EOF
146
+ {
147
+ "auth": {
148
+ "method": "vertexai"
149
+ },
150
+ "vertexai": {
151
+ "projectId": "${PROJECT_ID}",
152
+ "location": "${LOCATION_GA}"
153
+ },
154
+ "model": "${MODEL_GA}",
155
+ "tools": {
156
+ "fileOperations": {
157
+ "enabled": true,
158
+ "requirePermission": false
159
+ },
160
+ "shellExecution": {
161
+ "enabled": true,
162
+ "requirePermission": false
163
+ },
164
+ "webFetch": {
165
+ "enabled": true,
166
+ "requirePermission": false
167
+ }
168
+ },
169
+ "mcpServers": {
170
+ "${MCP_SERVER_NAME:-gemini-mcp}": {
171
+ "command": "node",
172
+ "args": ["$(pwd)/${MCP_SERVER_PATH}"],
173
+ "env": {}
174
+ }
175
+ }
176
+ }
177
+ EOF
178
+
179
+ log_info "MCP server integrated into Gemini CLI configuration"
180
+ else
181
+ log_warn "MCP_SERVER_PATH not set or file not found, skipping MCP integration"
182
+ fi
183
+
184
+ # ============================================================================
185
+ # Generate Helper Scripts
186
+ # ============================================================================
187
+
188
+ # Script to run Gemini with sandbox config
189
+ GEMINI_WRAPPER="./run-gemini.sh"
190
+
191
+ log_info "Creating Gemini wrapper script: $GEMINI_WRAPPER"
192
+
193
+ cat > "$GEMINI_WRAPPER" <<'EOF'
194
+ #!/usr/bin/env bash
195
+ set -euo pipefail
196
+
197
+ # Load .env
198
+ if [ -f .env ]; then
199
+ set -a
200
+ source .env
201
+ set +a
202
+ fi
203
+
204
+ # Export Vertex AI environment
205
+ export GOOGLE_GENAI_USE_VERTEXAI=true
206
+ export GOOGLE_CLOUD_PROJECT="${PROJECT_ID}"
207
+ export GOOGLE_CLOUD_LOCATION="${LOCATION_GA}"
208
+
209
+ # Point Gemini to sandbox config
210
+ export GEMINI_CONFIG_DIR="${GEMINI_CONFIG_DIR}"
211
+
212
+ # Run Gemini CLI
213
+ exec gemini "$@"
214
+ EOF
215
+
216
+ chmod +x "$GEMINI_WRAPPER"
217
+
218
+ log_info "Gemini wrapper created: $GEMINI_WRAPPER"
219
+
220
+ # ============================================================================
221
+ # Generate README for Configuration
222
+ # ============================================================================
223
+
224
+ CONFIG_README="$GEMINI_CONFIG_DIR/README.md"
225
+
226
+ cat > "$CONFIG_README" <<EOF
227
+ # Gemini CLI Autonomous Configuration
228
+
229
+ This directory contains Gemini CLI configuration for autonomous operation.
230
+
231
+ ## Configuration Files
232
+
233
+ - \`settings.json\` — Main Gemini CLI settings
234
+ - \`model-router.json\` — Model routing for GA vs Preview
235
+
236
+ ## Settings
237
+
238
+ | Setting | Value |
239
+ |---------|-------|
240
+ | Project ID | \`${PROJECT_ID}\` |
241
+ | GA Location | \`${LOCATION_GA}\` |
242
+ | Preview Location | \`${LOCATION_PREVIEW}\` |
243
+ | GA Model | \`${MODEL_GA}\` |
244
+ | Preview Model | \`${MODEL_PREVIEW}\` |
245
+
246
+ ## Autonomous Permissions
247
+
248
+ All tools are enabled without permission prompts:
249
+ - ✅ File operations
250
+ - ✅ Shell execution
251
+ - ✅ Web fetch
252
+
253
+ ## Usage
254
+
255
+ Run Gemini with this configuration:
256
+
257
+ \`\`\`bash
258
+ ./run-gemini.sh
259
+ \`\`\`
260
+
261
+ Or manually:
262
+
263
+ \`\`\`bash
264
+ export GEMINI_CONFIG_DIR="${GEMINI_CONFIG_DIR}"
265
+ export GOOGLE_GENAI_USE_VERTEXAI=true
266
+ export GOOGLE_CLOUD_PROJECT="${PROJECT_ID}"
267
+ gemini
268
+ \`\`\`
269
+
270
+ ## MCP Server
271
+
272
+ ${MCP_SERVER_PATH:+MCP server configured: \`${MCP_SERVER_NAME}\`}
273
+ ${MCP_SERVER_PATH:+Path: \`${MCP_SERVER_PATH}\`}
274
+ EOF
275
+
276
+ log_info "Configuration README created: $CONFIG_README"
277
+
278
+ # ============================================================================
279
+ # Verify gcloud Authentication
280
+ # ============================================================================
281
+
282
+ log_info "Verifying gcloud authentication..."
283
+
284
+ if ! gcloud auth application-default print-access-token &>/dev/null; then
285
+ log_warn "gcloud application-default credentials not found"
286
+ log_info "Run: gcloud auth application-default login"
287
+ else
288
+ log_info "gcloud authentication verified ✓"
289
+ fi
290
+
291
+ # ============================================================================
292
+ # Summary
293
+ # ============================================================================
294
+
295
+ echo ""
296
+ log_info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
297
+ log_info "Gemini CLI Configuration Complete!"
298
+ log_info "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"
299
+ echo ""
300
+ echo "Configuration directory: ${GEMINI_CONFIG_DIR}"
301
+ echo "Wrapper script: ${GEMINI_WRAPPER}"
302
+ echo ""
303
+ echo "To run Gemini:"
304
+ echo " ${GEMINI_WRAPPER}"
305
+ echo ""
306
+ echo "To use a preview model:"
307
+ echo " ${GEMINI_WRAPPER} -m ${MODEL_PREVIEW}"
308
+ echo ""
309
+ log_info "All tools are enabled without permission prompts"
310
+ echo ""