seventy6/thecatapi-mcp-server
3.2
If you are the rightful owner of thecatapi-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
TheCatAPI MCP Server is a Model Context Protocol server implementation that allows AI assistants to interact with cat images, breeds, and related data through a standardized MCP interface.
Tools
5
Resources
0
Prompts
0
TheCatAPI MCP Server
A Model Context Protocol (MCP) server implementation for TheCatAPI, allowing AI assistants to interact with cat images, breeds, and related data through the standardized MCP interface.
Features
- 🐱 Search for cat images with various filters
- 🧬 Browse cat breeds and their characteristics
- 📷 Get random cat images
- ⭐ Favorite cat images
- 🔄 Fully typed responses
- 🔒 API key management
Prerequisites
- Node.js 18+
- TheCatAPI key (sign up at thecatapi.com)
Installation
- Clone this repository
- Install dependencies:
npm install
- Create a
.env
file with your TheCatAPI key:CAT_API_KEY=your_api_key_here PORT=3000
- Build the project:
npm run build
- Start the server:
npm start
Development
Run the development server:
npm run dev
Usage
The MCP server exposes the following endpoints:
/mcp
- The main MCP endpoint (using Streamable HTTP transport)/health
- Health check endpoint
Available Tools
getRandomCat
- Get random cat images with optional filteringsearchCats
- Search for cat images with various filtering optionsgetCatBreeds
- List all available cat breedsgetCatBreedDetails
- Get detailed information about a specific breedfavoriteCat
- Mark a cat image as favorite
Available Resources
cat://{id}
- Get details about a specific cat by IDbreed://{id}
- Get details about a specific breed by IDcats://search
- Search for cat images with filtering options
Testing
To test the MCP server, run:
npx ts-node src/test/testClient.ts
Example API Interactions
1. Initializing a Session
// Request
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"capabilities": {},
"clientInfo": {
"name": "ExampleClient",
"version": "1.0.0"
}
}
}
// Response
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"capabilities": {
"tools": true,
"resources": true
},
"serverInfo": {
"name": "TheCatAPI-MCP-Server",
"version": "1.0.0"
}
}
}
2. Getting Random Cat Images
// Request
{
"jsonrpc": "2.0",
"id": 2,
"method": "mcp/tool/invoke",
"params": {
"tool": "getRandomCat",
"parameters": {
"limit": 2,
"has_breeds": true
}
}
}
License
MIT