Skip to main content

Quick Start - Claude Desktop Configuration

The fastest way to use PetstoreAPI with MCP is through Claude Desktop. Here’s how to configure it:

Step 1: Get Your API Key

Step 2: Find Your Config File

Config file locations:
  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Step 3: Add MCP Server Configuration

Open your config file and add the Petstore MCP server:
Configuration options:
  • command: Node.js executable
  • args: Path to the MCP server script
  • env.PETSTORE_API_KEY: Your API key (required)
  • env.PETSTORE_API_BASE: API base URL (optional, defaults to production)

Step 4: Restart Claude Desktop

After saving the config file, restart Claude Desktop. The Petstore MCP server will automatically connect.

Step 5: Start Using

Now you can interact with PetstoreAPI using natural language:

Available Tools and Resources

When connected, Claude Desktop can access the following:

Resources (Data Sources)

Tools (Actions)


Usage Examples

Example 1: Search for Pets

User prompt:
Claude actions:
  1. Calls search_pets tool with:
    • species: "DOG"
    • status: "AVAILABLE"
    • maxAge: 24
  2. Receives list of matching dogs
  3. Presents formatted results
Response:

Example 2: Get Pet Details

User prompt:
Claude actions:
  1. Calls get_pet tool with id: "019b4132-70aa-764f-b315-e2803d882a24"
  2. Receives full pet details
  3. Summarizes key information
Response:

Example 3: Create a Pet

User prompt:
Claude actions:
  1. Calls create_pet tool with:
    • name: "Whiskers"
    • species: "CAT"
    • breed: "Persian"
    • ageMonths: 12
    • status: "AVAILABLE"
    • adoptionFee: 200
Response:

Example 4: Create an Order

User prompt:
Claude actions:
  1. Asks for clarification on product details
  2. Calls create_order tool with items and shipping address
Response:

Building Your Own MCP Server

If you want to create a custom MCP server for PetstoreAPI, here’s a complete implementation:

Prerequisites

Server Implementation


How MCP Works

Key Components:
  • Resources: Data sources Claude can read (pets, orders)
  • Tools: Actions Claude can execute (search, create, update)
  • Prompts: Reusable prompt templates for common tasks

Troubleshooting

Server Not Connecting

Symptoms: MCP tools don’t appear in Claude Desktop Solutions:
  1. Check config file syntax (valid JSON)
  2. Verify path to MCP server script is correct
  3. Check API key is set in environment
  4. Restart Claude Desktop completely
  5. Check Claude Desktop logs for errors

API Errors

Symptoms: Tools return error messages Solutions:
  1. Verify API key is valid
  2. Check API base URL is correct
  3. Test API key with curl:

Tools Not Appearing

Symptoms: No Petstore tools shown in Claude Solutions:
  1. Ensure MCP server is running
  2. Check ListToolsRequestSchema handler is implemented
  3. Verify tool schema is valid
  4. Check Claude Desktop logs

Security Best Practices

  1. Never log API keys - Use environment variables only
  2. Validate all inputs - Before passing to API
  3. Implement rate limiting - Protect your API quota
  4. Use HTTPS only - Never expose API keys
  5. Rotate keys regularly - Update your MCP server config