Petstore MCP Server

Petstore MCP Server

A read-only MCP server that exposes Swagger Petstore v2 GET endpoints as tools for searching available pets, fetching pet details, and checking inventory.

Category
Visit Server

README

Theorvane Petstore MCP Example

A single runnable example showing a truthful end-to-end path from the public Swagger Petstore v2 demo API to a TypeChain @Agent() that uses an actual local MCP HTTP session.

What this proves

Swagger Petstore v2 GET API
  → injected PetstoreClient
  → TypeMCP @McpServer() / @McpTool()
  → TypeMCP Streamable HTTP handler
  → local 127.0.0.1 ephemeral-port MCP runtime
  → official MCP SDK client session
  → TypeChain @Agent() + @Tool() MCP-client façade
  → TypeChain buildAgent() / LangChain agent loop

The fixture run proves the MCP SDK client performs protocol initialization, tools/list, and tools/call over loopback Streamable HTTP. It also proves a LangChain FakeToolCallingModel selects search_available_pets, and the TypeChain @Agent() façade sends that call through the MCP client rather than calling the REST client or TypeMCP server directly.

Prerequisites

  • Node.js 20 or newer
  • npm 10 or newer
npm ci
npm run check

Run the deterministic MCP agent example

npm run example:petstore:mcp-agent:fixture

It starts an in-process Node HTTP server bound only to 127.0.0.1 on an ephemeral port, connects the official MCP SDK StreamableHTTPClientTransport, discovers the tools, runs the agent loop, and shuts down the MCP client session and HTTP server in finally blocks.

Expected result contains fixture data:

{
  "discoveredTools": [
    "search_available_pets",
    "get_pet",
    "get_petstore_inventory"
  ],
  "tool": "search_available_pets",
  "result": [
    { "id": 1, "name": "Milo", "status": "available" },
    { "id": 2, "name": "Nori", "status": "available" }
  ]
}

For the narrower protocol-only smoke run (loopback URL, 404 route boundary, tools/list, and tools/call), use:

npm run example:petstore:mcp:fixture

Optional public REST smoke run

npm run example:petstore:live

This calls the mutable public Swagger Petstore demo API. Its data and uptime are outside this repository's control, so it is not used by tests or CI. The command is a GET-only REST smoke run; it does not demonstrate MCP client connectivity or a model-backed agent.

Read-only Petstore contract

PetstoreClient has a fixed base URL, https://petstore.swagger.io/v2, and only sends GET requests. The TypeMCP server exposes exactly three tools:

MCP tool REST operation
search_available_pets GET /pet/findByStatus?status=available
get_pet GET /pet/{petId}
get_petstore_inventory GET /store/inventory

The example has no create, update, delete, API-key, credential, environment-configured API host, or public listener path.

Application-owned model runtime

The fixture uses FakeToolCallingModel, not a live provider. An application that wants a real model must install/configure that model itself, then pass it together with a connected MCP client to the agent builder:

import { buildPetstoreMcpAgent } from "./examples/typechain-petstore-mcp-agent.js";

// The consuming application chooses, authenticates, and authorizes this model.
declare const applicationModel: Parameters<
  typeof buildPetstoreMcpAgent
>[0]["model"];

// The application owns the lifecycle of this client connection.
declare const connectedMcpClient: Parameters<
  typeof buildPetstoreMcpAgent
>[0]["client"];

const agent = buildPetstoreMcpAgent({
  model: applicationModel,
  client: connectedMcpClient,
});

This repository deliberately does not select a provider/model, install provider SDKs, read credentials or process.env, run a live LLM command, or implement authorization/retry/audit/redaction policy.

Example-only runtime boundary

The loopback runtime is a deterministic integration example, not a production deployment recipe. It intentionally does not provide public hosting, authentication, authorization, durable sessions, a reverse proxy, observability, deployment configuration, or persistent MCP lifecycle management. A production application must own those decisions.

Development

npm run lint
npm run build
npm test
npm run audit:prod
npm run check

Packages

License

MIT © Theorvane

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured