Content
# Tool List
[](https://opensource.org/licenses/MIT)
[](https://www.python.org/)
[](https://ollama.com/)
[](https://modelcontextprotocol.io/)
[](https://github.com/20eung/antigravity-ollama-setup)
[](https://github.com/20eung/antigravity-ollama-setup/releases)
Antigravity IDE (based on Google Gemini, a fork of VS Code) enables **global MCP + Skill settings** that automatically invoke local Ollama models when entering `@gemma` or `@qwen`.
## Table of Contents
- [How it Works](#how-it-works)
- [Prerequisites](#prerequisites)
- [Quick Installation](#quick-installation)
- [Manual Installation](#manual-installation)
- [Usage](#usage)
- [Verification](#verification)
- [Model Change](#model-change)
- [Troubleshooting](#troubleshooting)
- [Uninstallation](#uninstallation)
- [File Structure](#file-structure)
- [License](#license)
## How it Works
```
User Input: @gemma Hello!
↓
SKILL.md (pattern detection: starts with @gemma)
↓
MCP Tool Invocation: ask_gemma("Hello!")
↓
ollama_mcp.py (MCP Server, JSON-RPC 2.0 over stdio)
↓
Ollama REST API: http://localhost:11434/v1/chat/completions
↓
gemma4:e4b model response returned
```
**Key Components**
| File | Role |
|------|------|
| `mcp_config.json` | MCP Server registration |
| `ollama_mcp.py` | MCP Server implementation (ask_gemma / ask_qwen tools) |
| `skills/ollama-models/SKILL.md` | @mention pattern detection and tool invocation instructions |
All files are installed under `~/.gemini/antigravity/` and **work across all workspaces**.
## Prerequisites
- [Antigravity IDE](https://antigravity.dev) installed
- [Ollama](https://ollama.com/) installed and running
- Python 3.8 or higher (using standard libraries only, no external packages required)
- Models downloaded:
```bash
ollama pull gemma4:e2b
ollama pull qwen2.5:1.5b
```
> **Model Selection Criteria** — Response time must be within Antigravity's MCP internal timeout (approximately 30 seconds).
>
> | Model | Size | Response Speed | Recommended |
> |------|------|-----------|-----------|
> | gemma4:e2b | - | - | Recommended (`@gemma`) |
> | qwen2.5:1.5b | 1GB | ~19 seconds | Recommended (`@qwen`) |
> | gemma4:e4b | 10GB | ~117 seconds | Exceeds timeout |
> | qwen3.5:9b | 6.6GB | ~55 seconds | Exceeds timeout |
## Quick Installation
```bash
git clone https://github.com/20eung/antigravity-ollama-setup.git
cd antigravity-ollama-setup
bash setup.sh
```
`setup.sh` automatically handles:
- [x] Prerequisites check (python3, ollama, server running, models available)
- [x] Directory creation (`~/.gemini/antigravity/skills/ollama-models/`)
- [x] `ollama_mcp.py` copying and execution permission granting
- [x] `mcp_config.json` generation (overwrites existing file if present)
- [x] `SKILL.md` generation
## Manual Installation
**Step 1: Directory Creation**
```bash
mkdir -p ~/.gemini/antigravity/skills/ollama-models
```
**Step 2: MCP Server File Copying**
```bash
cp ollama_mcp.py ~/.gemini/antigravity/ollama_mcp.py
chmod +x ~/.gemini/antigravity/ollama_mcp.py
```
**Step 3: `mcp_config.json` Generation**
`~/.gemini/antigravity/mcp_config.json`
```json
{
"mcpServers": {
"ollama": {
"command": "python3",
"args": ["/Users/YOUR_USERNAME/.gemini/antigravity/ollama_mcp.py"]
}
}
}
```
> **`~` (tilde) not allowed** — `mcp_config.json` `args` are passed directly to the process without shell processing, so `~` is not expanded to the home directory. Use absolute paths.
>
> Verify absolute path:
> ```bash
> echo "$HOME/.gemini/antigravity/ollama_mcp.py"
> ```
**Step 4: `SKILL.md` Generation**
`~/.gemini/antigravity/skills/ollama-models/SKILL.md`
```markdown
---
name: ollama-models
description: Routes @gemma and @qwen mentions to local Ollama models using MCP tools.
---
When the user's message starts with `@gemma`:
1. Extract the text after `@gemma` as the prompt
2. Call the `ask_gemma` MCP tool with that prompt
3. Return the tool response directly without additional commentary
When the user's message starts with `@qwen`:
1. Extract the text after `@qwen` as the prompt
2. Call the `ask_qwen` MCP tool with that prompt
3. Return the tool response directly without additional commentary
```
**Step 5: Antigravity IDE Restart**
## Usage
In the Antigravity IDE chat window, enter messages starting with `@gemma` or `@qwen`.
```
@gemma Hello, introduce yourself
@qwen How to sort a list in Python?
@gemma explain recursion in simple terms
@qwen Explain the difference between Docker container and image
```
## Verification
1. Enter `@gemma` or `@qwen` in the chat
2. Verify the display at the Exploring stage:
```
MCP Tool: ollama / ask_gemma
```
3. Ollama model response is output in the chat
Verify active Ollama models:
```bash
ollama ps
```
## Model Change
Modify the constants at the top of `ollama_mcp.py`:
```python
MODEL_GEMMA = "gemma4:e2b" # Change to desired gemma series model
MODEL_QWEN = "qwen2.5:1.5b" # Change to desired qwen series model
```
> For responses within the Antigravity MCP timeout, **response time under 30 seconds** is recommended.
Restart Antigravity IDE for changes to take effect.
Verify available models:
```bash
ollama list
```
## Troubleshooting
| Symptom | Cause | Solution |
|------|------|------|
| `@gemma` input responds with Gemini | SKILL.md not recognized or IDE not restarted | Restart IDE completely |
| MCP tool invocation not displayed | `mcp_config.json` path error | Verify absolute path (`echo $HOME`) |
| `Ollama server connection failed` | Ollama server not running | Run `ollama serve` |
| `Model not found` error | Model not downloaded | Run `ollama pull gemma4:e4b` |
| Response too slow | Model size / hardware issue | Change to smaller model |
## Uninstallation
Remove all installed files.
```bash
# Remove MCP server file
rm -f ~/.gemini/antigravity/ollama_mcp.py
# Remove skill files
rm -rf ~/.gemini/antigravity/skills/ollama-models/
# Remove mcp_config.json (if only ollama entry is registered)
rm -f ~/.gemini/antigravity/mcp_config.json
```
> If other MCP servers are registered in `mcp_config.json`, do not remove the entire file; only remove the `ollama` entry.
Restart Antigravity IDE for complete removal.
## File Structure
```
antigravity-ollama-setup/
├── README.md # This document
├── setup.sh # Automatic installation script
└── ollama_mcp.py # MCP server implementation (using only Python standard libraries)
```
Global paths created after installation:
```
~/.gemini/antigravity/
├── mcp_config.json
├── ollama_mcp.py
└── skills/
└── ollama-models/
└── SKILL.md
```
## License
[MIT License](LICENSE)