Dog API MCP Server

February 14, 2025 ยท View on GitHub

npm version License TypeScript

A Model Context Protocol (MCP) server that provides tools for retrieving random dog facts using the Dog API. This server integrates seamlessly with MCP-enabled AI systems, allowing them to access interesting dog facts programmatically.

System Architecture

graph TD
    A[MCP Client] -->|Tool Request| B[Dog API Server]
    B -->|HTTP Request| C[Dog API]
    C -->|Dog Fact| B
    B -->|Tool Response| A

Features

  • ๐Ÿ• get_dog_fact: Retrieves a random dog fact
  • ๐Ÿ”„ Built on MCP for seamless AI integration
  • โšก Fast and lightweight
  • ๐Ÿ”’ Type-safe with TypeScript

Installation

npm install -g dog-api-server

Local Installation

npm install dog-api-server

Usage

1. As an MCP Server

Add to your MCP configuration (e.g., claude_desktop_config.json or cline_mcp_settings.json):

{
  "mcpServers": {
    "dog-api": {
      "command": "dog-api-server",
      "args": [],
      "env": {}
    }
  }
}

2. Direct Usage

# Start the server
dog-api-server

Available Tools

get_dog_fact

Retrieves a random dog fact from the Dog API.

Input Schema

{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}

Example Usage

const result = await use_mcp_tool({
  server_name: "dog-api",
  tool_name: "get_dog_fact",
  arguments: {}
});

console.log(result.content[0].text); // Prints the dog fact

Development

Prerequisites

  • Node.js >= 18
  • npm >= 9

Setup

  1. Clone the repository:
git clone https://github.com/yourusername/dog-api-server.git
cd dog-api-server
  1. Install dependencies:
npm install
  1. Build the project:
npm run build
  1. Start in development mode:
npm start

Testing

Run the test suite:

npm test

Contributing

Contributions are welcome! Please read our Contributing Guidelines before submitting a pull request.

Development Process

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Changelog

See CHANGELOG.md for a list of changes.

Troubleshooting

Common Issues

  1. Server not starting

    • Ensure Node.js >= 18 is installed
    • Check if the port is already in use
    • Verify permissions for the executable
  2. Tool not found in MCP

    • Verify MCP configuration is correct
    • Ensure server is running
    • Check console for error messages

License

ISC License - see the LICENSE file for details.

Acknowledgments