Chapter 12 · MCP Creation MCP Track CLI Project

TestCase MCP Server: your test suite becomes a tool your LLM can call.

A real FastMCP server over a 478-row VWO test-case CSV. Fifteen search and filter tools, three resources, two QA prompt templates, and a write path that appends new cases back to the CSV, usable from Claude Desktop, Cursor, Claude Code or MCP Inspector.

01 What students build

tc_mcp.py: a single-file MCP server that loads testcases_vwo_100.csv (478 rows in practice) into memory and exposes it over stdio. The LLM can page through cases, filter by priority, module, label, owner, status or sprint, run free-text search across summaries and steps, pull aggregate stats, and append a brand-new test case that persists to the CSV with an auto-generated TC-00### id.

15 Tools

From list_test_cases and get_test_case to a multi-filter search_test_cases that ANDs priority, module, label, owner and free text.

Resources + Prompts

testcases://all, testcases://stats and a testcases://{id} template, plus review_test_case and suggest_regression_pack prompt templates.

A Write Path

add_test_case appends to the CSV and updates the in-memory cache, so students see an MCP server that changes state, not just reads it.

02 Architecture

LLM ClientClaude · Cursor · Inspector
──▶
MCP · stdiotools/call JSON
──▶
tc_mcp.pyFastMCP · 15 tools
──▶
In-memory cache478 parsed rows
──▶
CSV on diskread + append
tools: list · get · search ×7 · discover ×4 · stats · add · resources: all, stats, {id} · prompts ×2

03 Live demo (simulated with sample data)

This is a UI walkthrough with pre-baked sample data so you can feel the server without a client. In the course you run the real thing: python tc_mcp.py over stdio, inspected via npx @modelcontextprotocol/inspector.

python tc_mcp.py · stdio demo · sample data

04 Inputs & outputs

What goes in

  • testcases_vwo_100.csv: 478 rows with steps, labels, owners, sprints
  • Natural-language asks from any MCP client
  • Tool arguments: priority P0-P3, module, label, owner, status, sprint
  • New test-case fields for the add_test_case write tool

What comes out

  • Filtered, paginated test-case records as structured JSON
  • Aggregate stats: counts by priority, module, status, label
  • Auto-generated TC-00### ids for appended cases, persisted to CSV
  • Rendered prompts: senior-QA review, focused regression pack
  • Resource reads: testcases://all, testcases://stats, testcases://TC-00003

05 How it's built

Load the CSV once at startup, parsing pipe-separated labels and double-pipe-separated steps into proper Python lists.
Wrap each query pattern as a FastMCP tool with typed parameters and docstrings, so the LLM knows exactly when to call which.
Build search_test_cases as the power tool: AND-combined filters plus free-text search across summary, steps and expected result.
Add discovery tools (list_priorities, list_modules, list_labels, list_owners) so the model never guesses valid filter values.
Implement add_test_case: validate fields, auto-generate the next TC-00### id, append to CSV, refresh the cache.
Expose resources and prompt templates, then wire the server into MCP Inspector and Claude Desktop config for daily use.

06 Tech stack

Python · FastMCPMCP over stdiocsv stdlib478-row VWO datasetMCP InspectorClaude Desktop / Cursor / Claude CodeTools · Resources · PromptsCSV write-back