MCP Project Setup
A starter project with setup instructions and example MCP servers, including a weather server.
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:
conda create -n mcp python=3.12 -y
2. Install uv
Install the uv package manager using the following command:
curl -LsSf https://astral.sh/uv/install.sh | sh
3. Install fastmcp
Install the fastmcp package using uv in the mcp environment:
conda run -n mcp uv pip install fastmcp
4. Verify Installation
Confirm the fastmcp installation by running the following command:
conda run -n mcp fastmcp version
5. Running the Hello World Server
mcp_hello.py is a "hello world" type mcp server. You can run the MCP inspector for it using the following command:
conda run -n mcp fastmcp dev mcp_hello.py:mcp
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.
8. Running Resource Tests
mcp_resources.py defines MCP resources. You can run tests for these resources using the --test argument:
uv run mcp_resources.py --test
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:
OPENWEATHER_API_KEY=YOUR_API_KEY_HERE
To run the weather server manually:
conda run -n mcp fastmcp dev mcp_weather.py:mcp
To run tests for the weather tool:
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.
-
Locate
settings.json: Thesettings.jsonfile is typically located at:- Linux/macOS:
~/.gemini/settings.json - Windows:
%APPDATA%\gemini\settings.json
If the file or directory does not exist, create them.
- Linux/macOS:
-
Add
mcpServersentry: Add the following entry to themcpServerssection in yoursettings.jsonfile. Replace/mnt/d/Projects/_sandbox/mcp/with the absolute path to yourmcpproject directory.{ "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 yourmcp_weather.pyserver and make itsget_current_weathertool available to the Gemini model.
References
- Gemini CLI Configuration: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/configuration.md - For information on setting up MCP with the Gemini CLI.
- FastMCP: https://github.com/jlowin/fastmcp - The FastMCP library used for building MCP servers.
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Claude Code Bridge
A bridge server connecting Claude Desktop with the Claude Code agent API.
REPL MCP Server
A universal REPL session manager supporting Python, Node.js, Ruby, and more, with session management and LLM-assisted recovery.
MCP-scala
A Model Context Protocol server implementation written in Scala 3.
Root Signals
Equip AI agents with evaluation and self-improvement capabilities with Root Signals.
OPNsense MCP Server
A comprehensive MCP server for managing OPNsense firewalls, offering over 300 tools for configuration and monitoring.
Emcee
An MCP server for any web application with an OpenAPI specification, connecting AI models to external tools and data services.
Remote MCP Server Authless Test
An example of deploying a remote MCP server on Cloudflare Workers without authentication.
Micronaut Fun
It exposes Micronaut framework documentation and guides as MCP resources, it offers tools to search the docs and prompts to help you write tests and perform tasks in an idiomatic way
Tmux MCP Server
Provides persistent shell execution through tmux sessions.
Plugged.in
A comprehensive proxy that combines multiple MCP servers into a single MCP. It provides discovery and management of tools, prompts, resources, and templates across servers, plus a playground for debugging when building MCP servers.