Skip to main content

Quick Demo: MCP, OpenAPI, API-first

This example shows how to:

  • Define a simple OpenAPI schema
  • Implement a minimal MCP-compliant API
  • Run and test locally

1. Define OpenAPI Schema

openapi: 3.1.0
info:
title: Quick Demo API
version: 1.0.0
paths:
/ping:
get:
summary: Ping endpoint
operationId: ping
responses:
'200':
description: Pong
content:
application/json:
schema:
type: object
properties:
pong:
type: boolean

2. Implement the Endpoint

// Minimal Express example
const express = require('express');
const app = express();
app.get('/ping', (req, res) => {
res.json({ pong: true });
});
app.listen(3000, () => console.log('Quick Demo API running on port 3000'));

3. Test the API

curl http://localhost:3000/ping
# { "pong": true }
tip

You can extend this demo by adding context, authentication, or more endpoints following MCP and OpenAPI best practices.

Further Reading