yeabwang/demo_mcp_server
If you are the rightful owner of demo_mcp_server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project is a boilerplate for running a local MCP server integrated with the Groq LLM API, designed for testing and orchestrating LLM workflows.
Demo MCP Server with Groq LLM Integration
This is a simple boilerplate project for running a local MCP (Model-Context Protocol) server and interacting with it using the Groq API (Llama 3, Gemma, etc.). Useful for testing tool integration, agent workflows, and LLM orchestration.
Contents
File | Description |
---|---|
weather.py | Defines an MCP tool called get_weather |
groq_client.py | Calls the Groq API and optionally the MCP server |
main.py | Entry point for test/debug |
requirements.txt | Python package dependencies |
pyproject.toml | Project metadata and optional config |
Prerequisites
- Python 3.11 or higher
pipx
anduv
(for clean Python environments)- Groq API key from https://console.groq.com
- Unix shell or Git Bash on Windows
Setup
1. Clone the repository
git clone https://github.com/yourname/demo_mcp_server.git
cd demo_mcp_server
2. Create and activate the virtual environment
uv venv
source .venv/Scripts/activate # Windows (Git Bash)
# or
source .venv/bin/activate # macOS/Linux
3. Install dependencies
uv pip install -r requirements.txt
Environment Variables
Create a .env
file with your Groq API key and model:
GROQ_API_KEY=your-groq-api-key
GROQ_MODEL=llama3-70b-8192
Other valid model values include:
mixtral-8x7b-32768
gemma-7b-it
Running the MCP Server
Start the MCP server (tool defined in weather.py
):
python weather.py
This exposes one tool:
@mcp.tool()
async def get_weather(location: str) -> str:
return "Today is sunny"
It will be available at http://localhost:8000/mcp
.
Running the Groq Client
This runs a test LLM prompt using your Groq credentials:
python groq_client.py
It will:
- Send a prompt to the Groq API
- Optionally connect to the MCP tool if needed
Project Structure
demo_mcp_server/
āāā .env
āāā weather.py
āāā groq_client.py
āāā main.py
āāā requirements.txt
āāā pyproject.toml
āāā uv.lock
Notes
- You can add more tools by decorating them with
@mcp.tool()
.