Skip to main content
Glama
rachana-tf

Petstore MCP Server

by rachana-tf

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 Name

File

Endpoint

Description

OpenAPI 1

openapi1.json

/api/openapi/openapi1

User API v1

OpenAPI 2

openapi2.json

/api/openapi/openapi2

User API v2

Calculator Basic

calculator-basic.json

/api/openapi/calculator-basic

Add/Subtract/Update with Bearer auth

Calculator OAuth

calculator-oauth.json

/api/openapi/calculator-oauth

Multiply with OAuth

List All Available Specs

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

Get a Specific Spec

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

MCP Registry (v0.1)

MCP Registry–style APIs compatible with Consuming Registry Data and GitHub Copilot MCP registry. Data is read from registry-index.json and server.json (MCP ServerDetail schema).

Endpoint

Description

GET /v0.1/servers

List all servers (paginated: limit, cursor, updated_since)

GET /v0.1/servers/{serverName}/versions/latest

Latest version of a server

GET /v0.1/servers/{serverName}/versions/{version}

Specific version details (full server.json)

Note: If serverName contains a slash (e.g. io.github.example/calculator-mcp), URL-encode it: io.github.example%2Fcalculator-mcp.

List all servers

curl "http://localhost:3000/v0.1/servers?limit=10"

Latest version of a server

curl "http://localhost:3000/v0.1/servers/io.github.example%2Fcalculator-mcp/versions/latest"

Specific version

curl "http://localhost:3000/v0.1/servers/io.github.example%2Fcalculator-mcp/versions/1.0.0"

Adding servers

Edit registry-index.json to add { "name": "namespace/name", "version": "x.y.z" } entries. For each distinct server, ensure a corresponding server.json (or per-version file) is used by the app; the sample uses a single server.json at the project root for the default server.

Calculator APIs

Calculator Basic (Bearer Token Authentication)

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

All endpoints support multiple HTTP methods: GET, POST, PUT, PATCH, DELETE, and HEAD.

Add two numbers:

Using POST/PUT/PATCH (with JSON body):

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}'

Using GET/DELETE (with query parameters):

curl -X GET "http://localhost:3000/api/calculator-basic/add?a=10&b=5" \ -H "Authorization: Bearer your-secret-token"

Using HEAD (headers only):

curl -X HEAD "http://localhost:3000/api/calculator-basic/add?a=10&b=5" \ -H "Authorization: Bearer your-secret-token" \ -v

Response: {"result": 15}

Subtract two numbers:

Using POST/PUT/PATCH (with JSON body):

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}'

Using GET/DELETE (with query parameters):

curl -X GET "http://localhost:3000/api/calculator-basic/subtract?a=10&b=3" \ -H "Authorization: Bearer your-secret-token"

Response: {"result": 7}

Update a value with an operation:

Using POST/PUT/PATCH (with JSON body):

curl -X PATCH http://localhost:3000/api/calculator-basic/update \ -H "Content-Type: application/json" \ -H "Authorization: Bearer your-secret-token" \ -d '{"value": 10, "operation": "add", "operand": 5}'

Using GET/DELETE (with query parameters):

curl -X GET "http://localhost:3000/api/calculator-basic/update?value=10&operation=add&operand=5" \ -H "Authorization: Bearer your-secret-token"

Response: {"result": 15, "previousValue": 10, "operation": "add", "operand": 5}

Supported operations: add, subtract, multiply, divide

Note:

  • GET, HEAD, and DELETE methods use query parameters

  • POST, PUT, and PATCH methods use JSON request body

  • All methods require Bearer token authentication

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 mustrun your first generation action.

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 aboutDesktop Extensions.

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 mcp add petstore npx petstore start -- --environment ... --api-key ...

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", "..." ] } } }

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", "..." ] } } }

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", "..." ] } } }
npx petstore start --environment ... --api-key ...

For a full list of server arguments, run:

npx petstore --help
-
security - not tested
F
license - not found
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/rachana-tf/mcp-poc-app'

If you have feedback or need assistance with the MCP directory API, please join our Discord server