Dog API MCP Server
February 14, 2025 ยท View on GitHub
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
Global Installation (Recommended)
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
- Clone the repository:
git clone https://github.com/yourusername/dog-api-server.git
cd dog-api-server
- Install dependencies:
npm install
- Build the project:
npm run build
- 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
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Changelog
See CHANGELOG.md for a list of changes.
Troubleshooting
Common Issues
-
Server not starting
- Ensure Node.js >= 18 is installed
- Check if the port is already in use
- Verify permissions for the executable
-
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
- Dog API for providing the dog facts
- Model Context Protocol for the MCP specification