CPR MCP Server
This project provides a beginner-friendly Model Context Protocol (MCP) server implemented in TypeScript. The server exposes CPR (Cardiopulmonary Resuscitation) training resources — a structured lesson, a demonstration video link, and a reflective question — so that AI assistants and applications can pull trusted content on demand.
The server is transport-agnostic JSON-RPC over HTTP, making it easy to run locally or deploy to Render for wider access.
Features
✅ Structured CPR lesson covering danger checks, response, airway, breathing, compressions, and AED usage.
🎬 Demonstration video reference with guidance on what to watch for.
❓ Reflective check question so each interaction ends by confirming understanding.
📦 MCP-style JSON-RPC interface with
initialize,resources/*, andprompts/*methods.🌐 Built-in REST helpers (
/resources,/prompts) for quick manual testing.☁️ Render-ready with zero external dependencies.
Prerequisites
Node.js 18 or newer (comes with
npm).Git (for cloning the repository).
1. Clone the project
If you are starting from this template on a fresh machine, replace <your-fork-or-repo-url> with the repository address where you store your copy.
2. Install dependencies
The project only relies on TypeScript tooling, so installation is quick:
Tip: If you are working behind a proxy, configure
npm config set proxy http://...before running the command.
3. Run the MCP server locally
Development mode (TypeScript directly)
This command uses ts-node-dev so the server restarts automatically when you edit files. You will see a console message similar to:
Production build
npm run build emits compiled JavaScript into dist/, and npm start runs the compiled code with Node.js.
By default the server listens on port 3000. Override this by exporting PORT before running the server:
4. Explore the API
The server speaks JSON-RPC 2.0 at /mcp and also exposes helper endpoints for humans.
4.1 Quick health check
Response:
4.2 List MCP resources
4.3 Fetch the lesson via JSON-RPC
4.4 Get the question prompt
5. Deploy to Render
Render can host this server as a free web service.
Commit your changes and push them to a GitHub/GitLab repository.
Create a new Web Service on Render and connect your repository.
Choose the Node environment.
Set the Build Command to:
npm install && npm run buildSet the Start Command to:
npm startKeep the default
PORTenvironment variable that Render injects.(Optional) Add a health check hitting
/to ensure the service is ready.
When Render finishes deployment you will receive a public URL like https://cpr-mcp.onrender.com. Test it with the same curl commands, swapping localhost:3000 for your Render domain.
6. Customising the content
Edit
src/content/cprLesson.tsto update the lesson copy, link to a different video, or change the reflective question.Add more entries to
RESOURCESinsrc/resources.tsto expose additional articles, downloads, or checklists.Create new entries in
PROMPTSfor other pre-composed tutor responses your MCP client can reuse.
After making changes, rebuild (npm run build) and redeploy.
7. Next steps
Connect the MCP server to an MCP-compatible client (for example, a local AI assistant) by pointing it to the
/mcpendpoint.Expand the protocol support with additional methods such as
tools/listortools/callif your client expects them.Add automated tests for JSON-RPC handlers to keep the CPR content verified.
Happy learning, and remember: ensure the area is safe before you begin CPR!