Labsco
MarkAndersonIX logo

MCP Project Setup

โ˜… 1

from MarkAndersonIX

A starter project with setup instructions and example MCP servers, including a weather server.

๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

MCP Project Setup

This document outlines the steps to set up the mcp project environment.

1. Create Conda Environment

Create a new conda environment named mcp with Python 3.12:

Copy & paste โ€” that's it
conda create -n mcp python=3.12 -y

6. Connecting with Proxy Session Token

Copy the provided session token from CLI, click on the provided link, paste in Configuration -> Proxy Session Token, click connect.

7. Inspect hello_world tool

Click on Tools in the top menu bar. "hello_world" should be listed with a parameter "name". Input your name and click "Run Tool". The tool should succeed and return a greeting.

9. Weather Server

mcp_weather.py exposes a tool to get current weather data from OpenWeatherMap.

Before running: Ensure you have set your OPENWEATHER_API_KEY in the .env file:

Copy & paste โ€” that's it
OPENWEATHER_API_KEY=YOUR_API_KEY_HERE

To run the weather server manually:

Copy & paste โ€” that's it
conda run -n mcp fastmcp dev mcp_weather.py:mcp

To run tests for the weather tool:

Copy & paste โ€” that's it
uv run mcp_weather.py --test

10. Integrating with Gemini CLI

To allow the Gemini CLI to automatically start and connect to your mcp_weather server, you need to configure its settings.json file.

  1. Locate settings.json: The settings.json file is typically located at:

    • Linux/macOS: ~/.gemini/settings.json
    • Windows: %APPDATA%\gemini\settings.json

    If the file or directory does not exist, create them.

  2. Add mcpServers entry: Add the following entry to the mcpServers section in your settings.json file. Replace /mnt/d/Projects/_sandbox/mcp/ with the absolute path to your mcp project directory.

    Copy & paste โ€” that's it
    {
      "mcpServers": {
        "weather_server": {
          "command": "uv",
          "args": [
            "run",
            "/mnt/d/Projects/_sandbox/mcp/mcp_weather.py"
          ],
          "cwd": "/mnt/d/Projects/_sandbox/mcp",
          "timeout": 10000
        }
      }
    }

    Once configured, when you run gemini, the CLI will automatically start your mcp_weather.py server and make its get_current_weather tool available to the Gemini model.

References