AI Voice Assistant MCP Server

AI Voice Assistant MCP Server

Enables a voice-enabled AI assistant to call 7 built-in MCP tools including calculator, web search (DuckDuckGo), weather (wttr.in), date/time, and local file read/write/list operations, integrating with Gemini 2.0 Flash for tool-calling conversations.

Category
Visit Server

README

AI Voice Assistant with MCP Tool Calling

A fully free, end-to-end voice-enabled AI assistant built with Python.

Component Technology
🧠 AI Brain Google Gemini API (gemini-2.0-flash) β€” free tier
πŸŽ™οΈ Speech-to-Text Google Web Speech API via SpeechRecognition β€” free
πŸ”Š Text-to-Speech pyttsx3 (offline) β€” free
πŸ› οΈ Tool Calling Model Context Protocol (MCP) β€” free
πŸ” Web Search DuckDuckGo β€” free, no key needed
🌀️ Weather wttr.in REST API β€” free, no key needed

Features

  • πŸŽ™οΈ Voice Input β€” speak naturally; the assistant understands you
  • πŸ”Š Voice Output β€” responses are read aloud via offline TTS
  • πŸ€– Gemini AI β€” context-aware, multi-turn conversation
  • πŸ› οΈ 7 MCP Tools available to the AI:
    1. Calculator β€” safe math expression evaluator
    2. Web Search β€” DuckDuckGo (no API key)
    3. Weather β€” real-time via wttr.in (no API key)
    4. Date/Time β€” current date and time
    5. Read File β€” read any local file
    6. Write File β€” write/append to a local file
    7. List Directory β€” browse local folders
  • πŸ’¬ Multi-turn memory β€” remembers conversation context
  • ⌨️ Text mode β€” works without a microphone (--text flag)

Prerequisites

  • Python 3.11+
  • A free Gemini API key β€” get one at https://aistudio.google.com/app/apikey
  • Internet connection (for speech recognition, Gemini API, and web tools)
  • Microphone (optional β€” text mode works without one)

Installation

1. Clone / download the project

# If using git:
git clone <your-repo-url>
cd "AI voice assistant"

# Or just open the folder in your terminal
cd "C:\Users\sasid\Downloads\AI voice assistant"

2. Create and activate a virtual environment (recommended)

python -m venv .venv

# Windows:
.venv\Scripts\activate

# macOS / Linux:
source .venv/bin/activate

3. Install PyAudio (Windows β€” required for microphone)

PyAudio on Windows needs a pre-built binary. The easiest way:

pip install pipwin
pipwin install pyaudio

Or download the correct .whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pyaudio and install with:

pip install PyAudio‑0.2.14‑cpXX‑cpXX‑win_amd64.whl

4. Install remaining dependencies

pip install -r requirements.txt

5. Set your Gemini API key

Option A β€” .env file (recommended):

copy .env.example .env
# Then open .env and replace "your_gemini_api_key_here" with your actual key

Option B β€” edit config.py directly:

Open config.py and change:

GEMINI_API_KEY: str = os.getenv("GEMINI_API_KEY", "YOUR_GEMINI_API_KEY_HERE")

to:

GEMINI_API_KEY: str = "your_actual_api_key"

Running

Voice mode (default β€” microphone + TTS)

python main.py

Text-only mode (no microphone needed)

python main.py --text

List available TTS voices

python main.py --list-voices

Example Interactions

You say What happens
"What's the weather in Tokyo?" Calls get_weather MCP tool β†’ speaks result
"Calculate 2 to the power of 32" Calls calculator tool β†’ speaks 4294967296
"Search for the latest Python news" Calls web_search β†’ summarises top results
"What day is today?" Calls get_datetime β†’ speaks date & time
"Read the file notes.txt" Calls read_file β†’ speaks file contents
"Write 'Hello World' to test.txt" Calls write_file β†’ creates/updates file
"Reset conversation" Clears chat history
"Goodbye" / "Exit" Exits the assistant

Project Structure

AI voice assistant/
β”œβ”€β”€ main.py          # Entry point β€” CLI, banner, main loop
β”œβ”€β”€ assistant.py     # Gemini + MCP integration (agentic tool-call loop)
β”œβ”€β”€ speech.py        # SpeechRecognition (STT) + pyttsx3 (TTS)
β”œβ”€β”€ mcp_server.py    # MCP tool server with 7 built-in tools
β”œβ”€β”€ config.py        # All settings and API key placeholder
β”œβ”€β”€ requirements.txt # Python dependencies
β”œβ”€β”€ .env.example     # API key template
└── README.md        # This file

Customisation

Change the AI's personality

Edit SYSTEM_PROMPT in config.py.

Adjust microphone sensitivity

Edit MIC_ENERGY_THRESHOLD in config.py (lower = more sensitive).

Change TTS voice or speed

Edit TTS_RATE and TTS_VOICE_PREFERENCE in config.py. Run python main.py --list-voices to see available voice names.

Add more MCP tools

Open mcp_server.py, add a new function, then register it in list_tools() and call_tool().


Gemini Free Tier Limits

Limit Value
Requests per minute 15
Tokens per day 1,000,000
Cost $0

Get your key at: https://aistudio.google.com/app/apikey


Troubleshooting

"No module named 'pyaudio'" β†’ See PyAudio installation step above.

"Could not understand audio" β†’ Speak clearly; adjust MIC_ENERGY_THRESHOLD lower in config.py.

"Speech recognition service error" β†’ Check your internet connection (Google Web Speech API requires internet).

Gemini 429 / rate limit error β†’ You've hit the free tier limit. Wait a minute and try again.

Assistant doesn't speak / TTS silent β†’ Check system audio / volume. Try python main.py --list-voices to verify pyttsx3 works.


License

MIT β€” free to use, modify, and distribute.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured