amanahfy-ai-mcp
Provides tools for AI assistants to access Amanahfy APIs, enabling campaign details and IP geolocation lookups.
README
Amanahfy AI MCP Server
A production-ready Model Context Protocol (MCP) server that provides AI tools & resources with access to Amanahfy APIs & services. Built with TypeScript and following clean architecture principles.
🚀 Features
- Dual Transport Support: STDIO (Claude Desktop) and HTTP (testing/development)
- Clean Architecture: 5-layer architecture with separation of concerns
- CLI Tools: Command-line interface for direct API testing
- Resource Access: URI-based resource references (
campaign://slug,ip://address) - Type Safety: Full TypeScript implementation with Zod validation
📋 Prerequisites
- Node.js (>=18.0.0): Download
- Git: For version control
- Claude Desktop: For MCP integration (Optional)
⚡ Quick Start
1. Installation
# Clone the repository
git clone <your-repo-url>
cd amanahfy-ai-mcp
# Install dependencies
npm install
# Build the project
npm run build
2. Claude Desktop Integration
Add to your Claude Desktop configuration (claude_desktop_config.json):
{
"mcpServers": {
"amanahfy-ai-mcp": {
"command": "node",
"args": [
"C:\\path\\to\\campaign-agent-mcp-server\\dist\\index.js"
],
"env": {
"TRANSPORT_MODE": "stdio"
}
}
}
}
3. Test the Connection
Restart Claude Desktop completely, then ask Claude:
- "Look up the campaign gaza-100k-in-72hrs"
- "What's the location of IP 8.8.8.8?"
💻 CLI Usage
Test functionality directly from the command line:
Campaign Commands
# Get campaign details
npm run cli -- get-campaign-details gaza-100k-in-72hrs
# With custom options
npm run cli -- get-campaign-details gaza-100k-in-72hrs --timeout 5000 --retries 1
🏗️ Architecture
The server follows a clean 5-layer architecture:
├── CLI Layer (src/cli/) # Command-line interfaces
├── Tools Layer (src/tools/) # MCP tool definitions
├── Resources Layer (src/resources/) # MCP resource handlers
├── Controllers Layer (src/controllers/) # Business logic
├── Services Layer (src/services/) # External API integration
└── Utils Layer (src/utils/) # Shared utilities
⚙️ Configuration
Environment Variables
Create a .env file in the project root:
# Transport Configuration
TRANSPORT_MODE=stdio
PORT=8000
DEBUG=false
NODE_ENV=production
# API Configuration
AMANAHFY_API_BASE=https://api.amanahfy.com/api
# Optional API Keys
# IPAPI_API_TOKEN=your_api_token_here
Available Scripts
# Development
npm run build # Compile TypeScript
npm run dev:stdio # Run in STDIO mode with debug
npm run dev:http # Run in HTTP mode with debug
# MCP Server Modes
npm run mcp:stdio # STDIO transport (for Claude Desktop)
npm run mcp:http # HTTP transport (for testing)
# Testing & Development
npm run cli # CLI mode
npm run test # Run tests
npm run lint # Run ESLint
npm run format # Format with Prettier
# Debugging
npm run mcp:inspect # Launch with MCP Inspector
🧪 Testing & Development
MCP Inspector (Recommended)
Test your MCP server with the official inspector:
# Launch server with inspector
npm run mcp:inspect
# Then open: http://localhost:3000/mcp
Manual Testing
# Test HTTP mode
npm run mcp:http
# Test specific endpoints
curl http://localhost:8000/mcp
CLI Testing
# Test campaign lookup
npm run cli -- get-campaign-details gaza-100k-in-72hrs
# Test IP lookup
npm run cli -- get-ip-details 8.8.8.8
🔧 Troubleshooting
Common Issues
-
"Not valid JSON" error
- Ensure no console output is interfering with STDIO mode
- Check that
TRANSPORT_MODE=stdioin Claude Desktop config
-
Module not found errors
- Run
npm run buildafter any code changes - Verify all dependencies are installed:
npm install
- Run
-
API timeout errors
- Check network connectivity
- Increase timeout values in tool parameters
- Verify API endpoints are accessible
-
Claude Desktop connection issues
- Use absolute paths in config
- Restart Claude Desktop completely after config changes
- Check Claude Desktop logs for detailed error messages
Debug Mode
Enable detailed logging:
DEBUG=true
NODE_ENV=development
Need help? Open an issue or check the troubleshooting section above.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。