mcp_server
# Python MCP Agent Chatbot
An Agentic AI classroom project built completely in Python. Groq handles model reasoning while a local MCP server supplies tools.
## Architecture
`Browser -> FastAPI (Python) -> Groq -> MCP Client -> MCP Server (Python) -> Tool`
## Files
- `app.py` — FastAPI web backend, Groq agent loop, and MCP client
- `mcp_server.py` — Python MCP server containing three tools
- `test_mcp.py` — MCP discovery and tool-call test
- `index.html` — browser chat interface
- `pyproject.toml` — Python dependencies
## Run on Windows
```powershell
uv sync --cache-dir .uv-cache
uv run --cache-dir .uv-cache uvicorn app:app --reload
```
Open <http://127.0.0.1:8000>.
MCP ko Groq API call ke baghair test karne ke liye:
```powershell
uv run --cache-dir .uv-cache python test_mcp.py
```
Try these questions:
- `25 * 8 + 10 calculate karo`
- `Karachi mein abhi kya time hai?`
- `Ahmed ki attendance kya hai?`
## MCP flow
1. Functions in `mcp_server.py` are registered with `@mcp.tool()`.
2. `app.py` launches that MCP server as a local Python subprocess using stdio.
3. The MCP client calls `list_tools()` so Groq can see the available tools.
4. Groq selects a tool and generates its arguments.
5. The MCP client calls `call_tool()` and returns the tool result to Groq.
6. Groq converts the result into a natural-language answer.
The `.env` file contains the Groq key and is intentionally excluded from Git.
TDQS
Scored across 3 tools
The three tools serve entirely different purposes—arithmetic, time lookup, and student information—with no overlap in functionality. Each tool has a clear, distinct scope that leaves no ambiguity for an agent.
All tool names follow a consistent verb-first pattern: 'calculate', 'get_current_time', and 'find_student' each start with an imperative verb and use snake_case. This makes the naming predictable and uniform across the set.
With only three tools, the count is on the low end but still within the acceptable range for a utility-focused server. Each tool is self-contained and earns its place, though the server feels sparse for a general-purpose name like 'mcp_server'.
Each tool provides a complete single operation for its own small domain (e.g., calculate handles arithmetic, get_current_time handles timezone queries), but there are no supporting or related operations. The lack of a cohesive theme makes it unclear if coverage is adequate, and there are potential gaps like missing timezone listing or student CRUD beyond find.