Skip to content

Add MCP server petstore3_swagger_io_api_v3 #213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions servers/petstore3_swagger_io_api_v3/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
src/
node_modules/
.gitignore
tsconfig.json
327 changes: 327 additions & 0 deletions servers/petstore3_swagger_io_api_v3/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,327 @@
# @open-mcp/petstore3_swagger_io_api_v3

## Using the remote server

To use the hosted Streamable HTTP server, add the following to your client config:

```json
{
"mcpServers": {
"petstore3_swagger_io_api_v3": {
"transport": "streamableHttp",
"url": "https://mcp.open-mcp.org/api/server/petstore3_swagger_io_api_v3@latest/mcp"
}
}
}
```

#### Forwarding variables

You can forward "environment" variables to the remote server by including them in the request headers or URL query string (headers take precedence). Just prefix the variable name with `FORWARD_VAR_` like so:

```ini
https://mcp.open-mcp.org/api/server/petstore3_swagger_io_api_v3@latest/mcp?FORWARD_VAR_OPEN_MCP_BASE_URL=https%3A%2F%2Fapi.example.com
```

<Callout title="Security" type="warn">
Sending authentication tokens as forwarded variables is not recommended
</Callout>

## Installing locally

If you want to run the server locally on your own machine instead of using the remote server, first set the environment variables as shell variables:

```bash
OAUTH2_TOKEN='...'
API_KEY='...'
```

Then use the OpenMCP config CLI to add the server to your MCP client:

### Claude desktop

```bash
npx @open-mcp/config add petstore3_swagger_io_api_v3 \
~/Library/Application\ Support/Claude/claude_desktop_config.json \
--OAUTH2_TOKEN=$OAUTH2_TOKEN \
--API_KEY=$API_KEY
```

### Cursor

Run this from the root of your project directory or, to add to all cursor projects, run it from your home directory `~`.

```bash
npx @open-mcp/config add petstore3_swagger_io_api_v3 \
.cursor/mcp.json \
--OAUTH2_TOKEN=$OAUTH2_TOKEN \
--API_KEY=$API_KEY
```

### Other

```bash
npx @open-mcp/config add petstore3_swagger_io_api_v3 \
/path/to/client/config.json \
--OAUTH2_TOKEN=$OAUTH2_TOKEN \
--API_KEY=$API_KEY
```

### Manually

If you don't want to use the helper above, add the following to your MCP client config manually:

```json
{
"mcpServers": {
"petstore3_swagger_io_api_v3": {
"command": "npx",
"args": ["-y", "@open-mcp/petstore3_swagger_io_api_v3"],
"env": {"OAUTH2_TOKEN":"...","API_KEY":"..."}
}
}
}
```

## Environment variables

- `OPEN_MCP_BASE_URL` - overwrites the base URL of every tool's underlying API request
- `OAUTH2_TOKEN` - gets sent to the API provider
- `API_KEY` - gets sent to the API provider

## Tools

### expandSchema

Expand the input schema for a tool before calling the tool

**Input schema**

- `toolName` (string)
- `jsonPointers` (array)

### updatepet

**Environment variables**

- `OAUTH2_TOKEN`

**Input schema**

- `id` (integer)
- `name` (string)
- `category` (object)
- `photoUrls` (array)
- `tags` (array)
- `status` (string)

### addpet

**Environment variables**

- `OAUTH2_TOKEN`

**Input schema**

- `id` (integer)
- `name` (string)
- `category` (object)
- `photoUrls` (array)
- `tags` (array)
- `status` (string)

### findpetsbystatus

**Environment variables**

- `OAUTH2_TOKEN`

**Input schema**

- `status` (string)

### findpetsbytags

**Environment variables**

- `OAUTH2_TOKEN`

**Input schema**

- `tags` (array)

### getpetbyid

**Environment variables**

- `API_KEY`
- `OAUTH2_TOKEN`

**Input schema**

- `petId` (integer)

### updatepetwithform

**Environment variables**

- `OAUTH2_TOKEN`

**Input schema**

- `petId` (integer)
- `name` (string)
- `status` (string)

### deletepet

**Environment variables**

- `OAUTH2_TOKEN`

**Input schema**

- `petId` (integer)
- `api_key` (string)

### uploadfile

**Environment variables**

- `OAUTH2_TOKEN`

**Input schema**

- `petId` (integer)
- `additionalMetadata` (string)

### getinventory

**Environment variables**

- `API_KEY`

**Input schema**

No input parameters

### placeorder

**Environment variables**

No environment variables required

**Input schema**

- `id` (integer)
- `petId` (integer)
- `quantity` (integer)
- `shipDate` (string)
- `status` (string)
- `complete` (boolean)

### getorderbyid

**Environment variables**

No environment variables required

**Input schema**

- `orderId` (integer)

### deleteorder

**Environment variables**

No environment variables required

**Input schema**

- `orderId` (integer)

### createuser

**Environment variables**

No environment variables required

**Input schema**

- `id` (integer)
- `username` (string)
- `firstName` (string)
- `lastName` (string)
- `email` (string)
- `password` (string)
- `phone` (string)
- `userStatus` (integer)

### createuserswithlistinput

**Environment variables**

No environment variables required

**Input schema**

No input parameters

### loginuser

**Environment variables**

No environment variables required

**Input schema**

- `username` (string)
- `password` (string)

### logoutuser

**Environment variables**

No environment variables required

**Input schema**

No input parameters

### getuserbyname

**Environment variables**

No environment variables required

**Input schema**

- `username` (string)

### updateuser

**Environment variables**

No environment variables required

**Input schema**

- `username` (string)
- `id` (integer)
- `b_username` (string)
- `firstName` (string)
- `lastName` (string)
- `email` (string)
- `password` (string)
- `phone` (string)
- `userStatus` (integer)

### deleteuser

**Environment variables**

No environment variables required

**Input schema**

- `username` (string)
36 changes: 36 additions & 0 deletions servers/petstore3_swagger_io_api_v3/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"name": "@open-mcp/petstore3_swagger_io_api_v3",
"version": "0.0.1",
"main": "dist/index.js",
"type": "module",
"bin": {
"petstore3_swagger_io_api_v3": "./dist/index.js"
},
"files": [
"dist"
],
"scripts": {
"clean": "rm -rf dist",
"copy-json-schema": "mkdir -p dist/tools && find src/tools -type d -name 'schema-json' -exec sh -c 'mkdir -p dist/tools/$(dirname {} | sed \"s/src\\/tools\\///\") && cp -r {} dist/tools/$(dirname {} | sed \"s/src\\/tools\\///\")/' \\;",
"prebuild": "npm run clean && npm run copy-json-schema",
"build": "tsc && chmod 755 dist/index.js",
"test": "echo \"No test specified\"",
"prepublishOnly": "npm install && npm run build && npm run test"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.9.0",
"@open-mcp/core": "latest",
"zod": "^3.24.2"
},
"devDependencies": {
"@types/node": "^22.14.1",
"typescript": "^5.8.3"
},
"publishConfig": {
"access": "public"
}
}
24 changes: 24 additions & 0 deletions servers/petstore3_swagger_io_api_v3/src/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export const OPENAPI_URL = "https://raw.githubusercontent.com/swagger-api/swagger-petstore/refs/heads/master/src/main/resources/openapi.yaml"
export const SERVER_NAME = "petstore3_swagger_io_api_v3"
export const SERVER_VERSION = "0.0.1"
export const OPERATION_FILES_RELATIVE = [
"./tools/updatepet/index.js",
"./tools/addpet/index.js",
"./tools/findpetsbystatus/index.js",
"./tools/findpetsbytags/index.js",
"./tools/getpetbyid/index.js",
"./tools/updatepetwithform/index.js",
"./tools/deletepet/index.js",
"./tools/uploadfile/index.js",
"./tools/getinventory/index.js",
"./tools/placeorder/index.js",
"./tools/getorderbyid/index.js",
"./tools/deleteorder/index.js",
"./tools/createuser/index.js",
"./tools/createuserswithlistinput/index.js",
"./tools/loginuser/index.js",
"./tools/logoutuser/index.js",
"./tools/getuserbyname/index.js",
"./tools/updateuser/index.js",
"./tools/deleteuser/index.js"
]
Loading