MCP Hub
Back to servers

Petstore MCP Server

High-fidelity MCP server that exposes Petstore operations and Calculator functionalities (add, subtract, multiply) based on OpenAPI 3.1 specifications with support for Bearer and OAuth 2.0 authentication.

Tools
3
Updated
Jan 14, 2026

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev

Open http://localhost:3000 with your browser to see the result.

Environment Variables

Set the following environment variables before running:

# Required for Calculator Basic API (Bearer token auth)
export CALCULATOR_BEARER_TOKEN=your-secret-token

OpenAPI Specifications

This server hosts multiple OpenAPI specifications:

Spec NameFileEndpointDescription
OpenAPI 1openapi1.json/api/openapi/openapi1User API v1
OpenAPI 2openapi2.json/api/openapi/openapi2User API v2
Calculator Basiccalculator-basic.json/api/openapi/calculator-basicAdd/Subtract with Bearer auth
Calculator OAuthcalculator-oauth.json/api/openapi/calculator-oauthMultiply with OAuth

List All Available Specs

curl http://localhost:3000/api/openapi

Get a Specific Spec

curl http://localhost:3000/api/openapi/calculator-basic

Calculator APIs

Calculator Basic (Bearer Token Authentication)

Requires Authorization: Bearer <token> header where token matches CALCULATOR_BEARER_TOKEN env var.

Add two numbers:

curl -X POST http://localhost:3000/api/calculator-basic/add \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret-token" \
  -d '{"a": 10, "b": 5}'

Response: {"result": 15}

Subtract two numbers:

curl -X POST http://localhost:3000/api/calculator-basic/subtract \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-secret-token" \
  -d '{"a": 10, "b": 3}'

Response: {"result": 7}

Calculator OAuth (OAuth 2.0 Authentication)

Requires Authorization: Bearer <oauth-token> header with a valid OAuth token (minimum 10 characters for demo).

Multiply two numbers:

curl -X POST http://localhost:3000/api/calculator-oauth/multiply \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-oauth-token-here" \
  -d '{"a": 6, "b": 7}'

Response: {"result": 42}

Docker Deployment

Build and run with Docker:

# Build the image
docker build -t mcp-poc-app .

# Run the container
docker run -p 3000:3000 -e CALCULATOR_BEARER_TOKEN=your-secret-token mcp-poc-app

Learn More

To learn more about Next.js, take a look at the following resources:

You can check out the Next.js GitHub repository - your feedback and contributions are welcome!

Deploy on Vercel

The easiest way to deploy your Next.js app is to use the Vercel Platform from the creators of Next.js.

Check out our Next.js deployment documentation for more details.

Summary

Petstore - OpenAPI 3.1: This is a sample Pet Store Server based on the OpenAPI 3.1 specification.

Some useful links:

For more information about the API: Find out more about Swagger

Table of Contents

Installation

[!TIP] To finish publishing your MCP Server to npm and others you must run your first generation action.

MCP Bundle (Desktop Extension)

Install the MCP server as a Desktop Extension using the pre-built mcp-server.mcpb file:

Simply drag and drop the mcp-server.mcpb file onto Claude Desktop to install the extension.

The MCP bundle package includes the MCP server and all necessary configuration. Once installed, the server will be available without additional setup.

[!NOTE] MCP bundles provide a streamlined way to package and distribute MCP servers. Learn more about Desktop Extensions.

Cursor

Install MCP Server

Or manually:

  1. Open Cursor Settings
  2. Select Tools and Integrations
  3. Select New MCP Server
  4. If the configuration file is empty paste the following JSON into the MCP Server Configuration:
{
  "mcpServers": {
    "Petstore": {
      "command": "npx",
      "args": [
        "petstore",
        "start",
        "--environment",
        "...",
        "--api-key",
        "..."
      ]
    }
  }
}
Claude Code CLI
claude mcp add petstore npx petstore start -- --environment ... --api-key ...
Windsurf

Refer to Official Windsurf documentation for latest information

  1. Open Windsurf Settings
  2. Select Cascade on left side menu
  3. Click on Manage MCPs. (To Manage MCPs you should be signed in with a Windsurf Account)
  4. Click on View raw config to open up the mcp configuration file.
  5. If the configuration file is empty paste the full json
{
  "mcpServers": {
    "Petstore": {
      "command": "npx",
      "args": [
        "petstore",
        "start",
        "--environment",
        "...",
        "--api-key",
        "..."
      ]
    }
  }
}
VS Code

Refer to Official VS Code documentation for latest information

  1. Open Command Palette
  2. Search and open MCP: Open User Configuration. This should open mcp.json file
  3. If the configuration file is empty paste the full json
{
  "mcpServers": {
    "Petstore": {
      "command": "npx",
      "args": [
        "petstore",
        "start",
        "--environment",
        "...",
        "--api-key",
        "..."
      ]
    }
  }
}
Claude Desktop Claude Desktop doesn't yet support SSE/remote MCP servers.

You need to do the following

  1. Open claude Desktop
  2. Open left hand side pane, then click on your Username
  3. Go to Settings
  4. Go to Developer tab (on the left hand side)
  5. Click on Edit Config Paste the following config in the configuration
{
  "mcpServers": {
    "Petstore": {
      "command": "npx",
      "args": [
        "petstore",
        "start",
        "--environment",
        "...",
        "--api-key",
        "..."
      ]
    }
  }
}
Stdio installation via npm To start the MCP server, run:
npx petstore start --environment ... --api-key ...

For a full list of server arguments, run:

npx petstore --help

Reviews

No reviews yet

Sign in to write a review