setup_instructions.mdā¢4.37 kB
# Setup Instructions for Weather Info MCP Server
## Prerequisites
1. **Python 3.8+** installed and in PATH
2. **Gemini CLI** installed ([Installation Guide](https://ai.google.dev/gemini/docs/cli))
## Step-by-Step Setup
### 1. Install Python Dependencies
```bash
pip install -r requirements.txt
```
### 2. Start the FastAPI Weather Server
In Terminal 1:
```bash
python weather_api.py
```
The server will start on `http://localhost:8000`
Verify it's working:
- Open browser: http://localhost:8000/weather?city=London
- Or use curl: `curl http://localhost:8000/weather?city=Tokyo`
### 3. Configure Gemini CLI for MCP
#### Windows Configuration
1. Locate the Gemini CLI config directory:
```
%APPDATA%\Google\Gemini CLI\
```
2. Create or edit `mcp_config.json` in that directory
3. Add the following configuration (update the path to match your actual path):
```json
{
"mcpServers": {
"weather-info": {
"command": "python",
"args": ["B:\\MCp derver using FAST MCP\\mcp_server.py"],
"env": {}
}
}
}
```
**Important Path Notes:**
- Use absolute paths
- On Windows, use double backslashes `\\` or forward slashes `/`
- Example: `"B:/MCp derver using FAST MCP/mcp_server.py"` also works
#### macOS/Linux Configuration
1. Locate the config directory:
```
~/.config/google-gemini-cli/
```
2. Create `mcp_config.json`:
```json
{
"mcpServers": {
"weather-info": {
"command": "python3",
"args": ["/absolute/path/to/mcp_server.py"],
"env": {}
}
}
}
```
### 4. Restart Gemini CLI
After updating the configuration, restart any running Gemini CLI processes.
### 5. Verify MCP Integration
List available MCP servers and tools:
```bash
gemini mcp list
```
You should see:
- Server: `weather-info`
- Tools: `get_weather`, `get_weather_batch`, `check_api_health`
### 6. Test the Tools
#### Health Check
```bash
gemini mcp call weather-info check_api_health
```
#### Get Weather for One City
```bash
gemini mcp call weather-info get_weather --city "Tokyo"
```
#### Get Weather with Country
```bash
gemini mcp call weather-info get_weather --city "Paris" --country "France"
```
#### Get Weather for Multiple Cities
```bash
gemini mcp call weather-info get_weather_batch --cities "London,New York,Sydney"
```
## Troubleshooting
### MCP Server Not Found
**Problem:** `gemini mcp list` doesn't show weather-info
**Solutions:**
1. Check that the config file path is correct
2. Verify the Python script path is absolute and correct
3. Ensure Python is in your system PATH
4. Check for JSON syntax errors in the config file
5. Restart Gemini CLI after configuration changes
### Connection Error
**Problem:** Tools return "Cannot connect to weather API"
**Solutions:**
1. Ensure FastAPI server is running (`python weather_api.py`)
2. Verify it's running on port 8000
3. Check firewall settings if using a different host
### Python Not Found
**Problem:** Error about Python not being found
**Solutions:**
1. Use full path to Python in config:
- Windows: `"C:\\Python39\\python.exe"`
- macOS/Linux: `/usr/bin/python3`
2. Or ensure Python is in your system PATH
### Import Errors
**Problem:** MCP server fails with import errors
**Solutions:**
1. Verify all dependencies are installed: `pip install -r requirements.txt`
2. Check Python version: `python --version` (should be 3.8+)
3. Try using `python3` instead of `python` in the config
## Testing Without Gemini CLI
You can test the MCP server directly using the demo script:
```bash
python demo.py
```
This will test both the FastAPI endpoints and simulate MCP tool calls.
## Next Steps
Once everything is working:
1. Create your screen recording following `SCREEN_RECORDING_GUIDE.md`
2. Push to GitHub
3. Include the screen recording in your repository
4. Update README.md with your GitHub link
## Configuration File Examples
### Full Windows Example
```json
{
"mcpServers": {
"weather-info": {
"command": "python",
"args": [
"B:\\MCp derver using FAST MCP\\mcp_server.py"
],
"env": {
"PYTHONPATH": "B:\\MCp derver using FAST MCP"
}
}
}
}
```
### Full macOS/Linux Example
```json
{
"mcpServers": {
"weather-info": {
"command": "python3",
"args": [
"/home/user/weather-mcp/mcp_server.py"
],
"env": {}
}
}
}
```