MCP Payments Desk
by krityaailabs
README.md
# MCP Payments Desk
The working code from **"What is MCP? | Completely Explained in 28 Minutes"** by Kritya AI Labs (chapter 9, *Build your own MCP server in Python*, at 19:33).
It is a small MCP server for a bank's support assistant. A customer asks *"My payment to my landlord failed this morning. What happened, and will I get my money back?"* and the assistant answers from real tools and real policy instead of guessing.
The same three building blocks, in a second sector, are in [`healthcare_desk/`](healthcare_desk/server.py).
It runs on the current protocol, the stateless **2026-07-28** revision the video covers in chapter 8, with the official MCP Python SDK **2.3.0**.
> **Following along with the video?** The code on screen uses the SDK's older names: `from mcp.server.fastmcp import FastMCP` and `mcp = FastMCP(...)`. In SDK 2.x these became `from mcp.server.mcpserver import MCPServer` and `mcp = MCPServer(...)`. Everything else (the decorators, the docstrings, `mcp.run()`) is exactly as shown. The old import fails on today's `pip install mcp`, so use the code in this repo.
> **All data in this repo is made up for the demo.** The payments, the refund policy, the appointment slots and the discharge guidelines are samples. They are not any real bank's or hospital's data or policy, and nothing here is financial or medical advice.
## What's inside
| Building block | Payments desk | Healthcare desk |
|-|-|-|
| **Tool** (the model can call it) | `get_payment_status(reference)` | `find_open_slots(department)` |
| **Resource** (read-only knowledge) | `policy://refunds`: refund and dispute policy | `guidelines://discharge`: discharge guidelines |
| **Prompt** (a reusable template) | `dispute_reply(name)`: a calm, compliant reply | `patient_summary(doctor_notes)`: a patient-friendly summary |
Two things the video points out, which you can see in the code:
- **The docstring is not decoration.** It becomes the tool description that the model reads.
- **The type hints become the JSON schema.** `reference: str` turns into `{"reference": {"type": "string"}}`, and the SDK builds it for you.
## Quick start
You need Python 3.10 or newer.
```bash
git clone https://github.com/krityaailabs/mcp-payments-desk.git
cd mcp-payments-desk
python -m venv .venv
```
Activate the virtual environment:
```bash
# Windows
.venv\Scripts\activate
# macOS / Linux
source .venv/bin/activate
```
Install and check that everything works:
```bash
pip install -r requirements.txt
python tests/smoke_test.py
```
The smoke test starts each server, checks it speaks protocol 2026-07-28, lists its tools, resources and prompts, and calls each one once. It ends with `All checks passed.`
## Test it with the MCP Inspector
The Inspector is a small web tool from the MCP project. It connects to your server, lists what it offers, and lets you call each piece by hand. Always test here before you plug a server into an AI app.
You need Node.js 22.23.4, 24.22.1 or 26.12.1 or newer. From the repo root, with the virtual environment active:
```bash
npx @modelcontextprotocol/inspector@2.17.0 --config inspector/mcp.json --server payments-desk
```
Open the link it prints, connect, then try the `get_payment_status` tool with the reference `PAY-1042`.
Use the config file, not just `python payments_desk/server.py`. The Inspector talks the older protocol unless it is told otherwise, and [`inspector/mcp.json`](inspector/mcp.json) sets `"protocolEra": "modern"` so it speaks 2026-07-28. For the healthcare server, use `--server healthcare-desk`.
No browser? Add `--cli` and a method, for example:
```bash
npx @modelcontextprotocol/inspector@2.17.0 --cli --config inspector/mcp.json --server payments-desk --method tools/call --tool-name get_payment_status --tool-arg reference=PAY-1042
```
Sample references to try: `PAY-1042` (failed), `PAY-1043` (completed), `PAY-1044` (pending). Anything else returns `not found`.
## Add it to your AI app
Each app has a small JSON config with the command that starts your server. Ready-made examples are in [`config/`](config/):
| App | Example file | Where it goes |
|-|-|-|
| Claude Desktop | [`claude_desktop_config.json`](config/claude_desktop_config.json) | Settings → Developer → Edit Config |
| Cursor | [`cursor_mcp.json`](config/cursor_mcp.json) | `.cursor/mcp.json` in your project |
| VS Code (Copilot) | [`vscode_mcp.json`](config/vscode_mcp.json) | `.vscode/mcp.json` in your project |
Replace `C:/path/to/mcp-payments-desk` with where you cloned the repo. Point `command` at the Python **inside `.venv`**, so the app uses the Python that has `mcp` installed. On macOS and Linux that is `.venv/bin/python`.
Restart the app. Then ask it *"Why did my payment PAY-1042 fail?"* and watch it call your code.
The server answers both the 2026-07-28 protocol and the older handshake, so it works with apps that have not moved to the new revision yet.
For everything else that changed between SDK 1.x and 2.x, see the [official migration guide](https://py.sdk.modelcontextprotocol.io/v2/migration/).
## Before you use this pattern for real
- **Start read-only.** Checking a status is safe. Moving money or changing a patient record is not. Those actions belong behind strong authentication and an explicit human approval.
- **Don't mirror your whole API one to one.** Design tools around the tasks users actually want done. Five well-described tools beat fifty confusing ones, because every tool description takes up space in the model's context window and makes it harder for the model to pick the right one.
- **Treat tool descriptions as security-sensitive.** The model reads them, and the user never does. The video's *security traps* chapter (23:37) explains why.
## Project layout
```
payments_desk/server.py the server from the video
healthcare_desk/server.py the same pattern for healthcare
config/ host config examples
inspector/mcp.json MCP Inspector config, set to the 2026-07-28 protocol
tests/smoke_test.py starts each server over stdio, checks the protocol and calls every piece
requirements.txt
```
## License
[MIT](LICENSE) © 2026 Kritya AI Labs
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues