Interview Coach MCP
by abhishekzipp
README.md
# Interview Coach MCP
[](https://github.com/abhishekzipp/interview-coach-mcp/actions/workflows/ci.yml)


An MCP server that runs mock technical interviews from your own study guides.
It asks you questions on DSA, low-level design and AI engineering, grades your answers with Gemini, and remembers your scores so the next session starts with your weakest topics.
## Why
Reading notes feels like progress, but interviews test recall. This server turns a folder of markdown notes into an interviewer that:
- asks one question at a time, grounded in your notes
- grades the answer against the same notes, with strengths, gaps and a model answer
- tracks a score per topic in SQLite and points you at what you have not practised yet
## How it works
```
MCP client (Cursor, Claude Desktop, ...)
│ prompt: mock_interview
▼
┌──────────────── interview-coach ─────────────────┐
│ get_progress ──► SQLite (db/coach.db) │
│ generate_question ─┐ │
│ grade_answer ──────┴─► Gemini ◄── topic notes │
│ (structured output) │
│ interview://topics ◄── data/guides/*.md │
└──────────────────────────────────────────────────┘
```
The `mock_interview` prompt drives the loop:
1. `get_progress` for the chosen guide.
2. Suggest 3 topics: unseen first, then lowest average score.
3. **You pick a topic and a difficulty.**
4. `generate_question` writes the question. Key points stay hidden.
5. **You answer.**
6. `grade_answer` grades it and saves the score.
7. **You choose: another topic, a harder question, or stop.**
The user decides at every step. The model never picks a topic or moves on by itself.
Core parts:
- **Study guides:** 8 markdown guides in `data/guides/`. Each `## ` heading is one topic.
- **Grounding:** every question and grade uses only the notes of that topic.
- **Structured output:** Gemini returns `Question` and `Grade` Pydantic models. The score is checked to be 0-10.
- **SQLite:** every graded answer is saved, so `get_progress` can rank topics.
## Project structure
```
interview-coach-mcp/
├── data/guides/ # 8 markdown study guides, 124 topics
├── src/interview_coach/
│ ├── server.py # creates the FastMCP app and mounts the routers
│ ├── client.py # terminal interview app (MCP client)
│ ├── evals.py # runs the grading evaluation
│ ├── config/settings.py # pydantic-settings, reads .env
│ ├── routers/
│ │ ├── tools.py # get_progress, generate_question, grade_answer
│ │ ├── resources.py # interview://topics, interview://topics/{guide}/{slug}
│ │ └── prompts.py # mock_interview
│ └── app/
│ ├── models.py # Pydantic models: Topic, Question, Grade, TopicProgress
│ ├── guides.py # splits each guide into topics on "## " headings
│ ├── coach.py # Gemini calls with structured output
│ ├── gemini.py # Gemini client, traced by Opik when a key is set
│ ├── evaluation.py # eval dataset model and scoring
│ └── database.py # SQLite: save attempts, read progress
├── data/evals/ # 24 graded answers for the evaluation
├── tests/
├── Dockerfile
└── docker-compose.yml
```
The routers only register MCP components. All logic lives in `app/`, so it can be tested without an MCP client. The course template also has `tools/`, `resources/`, `prompts/` and `utils/` folders. This project is small enough that `app/` covers them.
## Setup
### Requirements
- [uv](https://docs.astral.sh/uv/getting-started/installation/)
- A Gemini API key
- Docker (optional)
### Install
```bash
git clone https://github.com/abhishekzipp/interview-coach-mcp.git
cd interview-coach-mcp
uv sync
cp .env.sample .env
```
Then put your key in `.env`.
### Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
| `GEMINI_API_KEY` | yes | | Get a free key at [Google AI Studio](https://aistudio.google.com/apikey). |
| `GEMINI_MODEL` | no | `gemini-3.8-flash` | Any Gemini model that supports structured output. |
| `OPIK_API_KEY` | no | | Turns on tracing. Get a free key at [Opik](https://www.comet.com/opik). |
| `OPIK_WORKSPACE` | no | | Your Opik workspace name. |
| `DATABASE_PATH` | no | `db/coach.db` | Where the SQLite file is stored. |
| `GUIDES_DIR` | no | `data/guides` | Folder of markdown guides. |
Never commit `.env`. It is in `.gitignore`.
### Run
```bash
uv run interview-coach
```
The server talks over stdio, so it waits silently for a client. To try it in a browser with the MCP Inspector:
```bash
uv run fastmcp dev src/interview_coach/server.py
```
### Connect from Cursor
Add this to `~/.cursor/mcp.json`:
```json
{
"mcpServers": {
"interview-coach": {
"command": "uv",
"args": [
"--directory",
"/absolute/path/to/interview-coach-mcp",
"run",
"interview-coach"
],
"env": {
"GEMINI_API_KEY": "your-gemini-api-key"
}
}
}
}
```
Then type `/mock_interview` in the chat and pass a guide name, for example `lld`.
### Run with Docker
```bash
docker compose build
docker compose run --rm -T interview-coach
```
Scores are kept in the `coach-db` volume. To connect Cursor to the container:
```json
{
"mcpServers": {
"interview-coach": {
"command": "docker",
"args": [
"compose",
"-f",
"/absolute/path/to/interview-coach-mcp/docker-compose.yml",
"run",
"--rm",
"-T",
"interview-coach"
]
}
}
}
```
## MCP reference
### Tools
| Tool | Parameters | Returns |
|---|---|---|
| `get_progress` | `guide`: guide name, for example `dsa` | Attempts and average score per topic, unseen and weakest first |
| `generate_question` | `topic_id`, `difficulty`: `easy`, `medium` or `hard` | `question` and `key_points` |
| `grade_answer` | `topic_id`, `question`, `answer` | `score` (0-10), `strengths`, `gaps`, `model_answer`. Saves the score. |
### Resources
| URI | Content |
|---|---|
| `interview://topics` | Every topic id and title |
| `interview://topics/{guide}/{slug}` | The notes for one topic, for example `interview://topics/dsa/binary-search` |
### Prompts
| Prompt | Parameters | Workflow |
|---|---|---|
| `mock_interview` | `guide` | The 7-step loop in [How it works](#how-it-works) |
### Guides
`dsa`, `lld`, `ml`, `deep_learning`, `transformers`, `llms`, `nlp_rag`, `llm_evals`.
To add your own, drop a markdown file in `data/guides/`. Each `## ` heading becomes a topic. The file name becomes the guide name.
## Required features
| Feature | Where |
|---|---|
| FastMCP server in Python | `src/interview_coach/server.py` |
| Meaningful MCP tools | 3 tools in `routers/tools.py` |
| Prompt with an agentic workflow and user input | `mock_interview` in `routers/prompts.py`. The user picks the topic, answers, and decides what happens next. |
| Public GitHub repository | This repo |
| uv project on Python 3.14 | `pyproject.toml`, `.python-version`, `uv.lock` |
| Organised `src/` structure | See [Project structure](#project-structure) |
| Settings with pydantic-settings | `config/settings.py` |
| `.env.sample` with fake values | `.env.sample` |
## Custom features
| Feature | What it does | Run it |
|---|---|---|
| Opik observability | Every Gemini call is traced in Opik with the prompt, the structured output, token usage and latency. | Set `OPIK_API_KEY` |
| Evaluation layer | 24 hand-graded answers (strong, partial and wrong) across all 8 guides. A custom evaluator checks that `grade_answer` scores each one inside its expected band. | `uv run interview-coach-eval` |
| MCP client app | A terminal interview that connects to the server over stdio. It plans each round itself: it ranks topics with `get_progress`, picks the difficulty from your past scores, then asks, grades and loops. | `uv run interview-coach-cli dsa` |
| Code quality and DevOps | ruff lint and format, pre-commit hooks, GitHub Actions CI, Dockerfile and docker-compose. | `uv run pre-commit run --all-files` |
### Observability
Add `OPIK_API_KEY` and `OPIK_WORKSPACE` to `.env`. The server then wraps the Gemini client with Opik's `track_genai`, and each `generate_question` and `grade_answer` call shows up as a trace in the `interview-coach` project. Without the key, tracing is off.
### Evaluation
```bash
uv run interview-coach-eval
```
Example of the output format (the numbers depend on the model):
```
PASS score 9 expected 7-10 dsa/binary-search
FAIL score 4 expected 0-3 dsa/graphs
...
In band: 88% of 24 samples
Mean band error: 0.21 points
```
- **In band:** the share of answers the grader scored inside the expected range.
- **Mean band error:** how many points, on average, a score falls outside its range.
- The command exits with code 1 if fewer than 80% of answers are in band, so it can gate a change to a prompt or a model.
### Terminal client
```bash
uv run interview-coach-cli lld
```
The client starts the server itself. Its rules for picking a difficulty:
| Topic history | Difficulty |
|---|---|
| Never practised | easy |
| Average below 7 | medium |
| Average 7 or more | hard |
## Development
```bash
uv run pre-commit install
uv run ruff check .
uv run ruff format --check .
uv run pytest
```
All checks pass in CI on every push.
## Troubleshooting
| Problem | Fix |
|---|---|
| `gemini_api_key Field required` on start | `.env` is missing or has no `GEMINI_API_KEY`. |
| `Unknown topic` from a tool | Read `interview://topics` and use an id from that list. |
| Cursor shows no tools | Use an absolute path in `--directory`, then restart Cursor. |
| `404 model not found` | Set `GEMINI_MODEL` to a model your key can use. |
## License
[MIT](LICENSE)
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues