UNPKG

rapidapi-mcp-server

Version:

MCP server for discovering and assessing APIs from RapidAPI marketplace

207 lines (149 loc) 4.06 kB
# RapidAPI MCP Server An MCP (Model Context Protocol) server that enables API discovery and assessment from the RapidAPI marketplace through web automation. ## Features - **Search APIs**: Find APIs by keyword and category - **Assess APIs**: Get comprehensive details including ratings, pricing, and endpoints - **Get Documentation**: Extract documentation links and endpoint information - **Compare APIs**: Side-by-side comparison of multiple APIs ## Installation ### Quick Start with npx No installation required - use directly with npx: ```bash npx -y rapidapi-mcp-server ``` ### Install Globally ```bash npm install -g rapidapi-mcp-server ``` ## Usage ### MCP Server Configuration #### Claude Desktop Configuration Add to your Claude Desktop configuration file: **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json` **Windows**: `%APPDATA%\Claude\claude_desktop_config.json` ```json { "mcpServers": { "rapidapi": { "command": "npx", "args": ["-y", "rapidapi-mcp-server"] } } } ``` #### VS Code Configuration For VS Code with MCP support, add a `.vscode/mcp.json` file to your workspace: ```json { "mcpServers": { "rapidapi": { "command": "npx", "args": ["-y", "rapidapi-mcp-server"] } } } ``` #### Alternative: Global Installation If you prefer global installation: ```json { "mcpServers": { "rapidapi": { "command": "rapidapi-mcp-server" } } } ``` ### Available Tools #### search_apis Search for APIs in the RapidAPI marketplace. **Parameters:** - `query` (string): Search term (e.g., "weather", "crypto") - `category` (string, optional): Filter by category - `maxResults` (number, optional): Max results (1-50, default: 20) #### assess_api Get comprehensive assessment of a specific API. **Parameters:** - `apiUrl` (string): RapidAPI URL for the specific API #### get_api_documentation Extract documentation and endpoint information. **Parameters:** - `apiUrl` (string): RapidAPI URL for the specific API #### compare_apis Compare multiple APIs side by side. **Parameters:** - `apiUrls` (array): 2-5 RapidAPI URLs to compare ## Development ### Setup ```bash # Clone and install dependencies npm install # Build the project npm run build # Run tests npm test # Development mode npm run dev ``` ### Environment Variables - `PUPPETEER_EXECUTABLE_PATH`: Custom Chrome/Chromium executable path (optional) ### Testing ```bash # Run all tests npm test # Run unit tests only npm run test:unit # Run integration tests only npm run test:integration # Run with coverage npm run test:coverage ``` ## Examples ### Search for Weather APIs ```javascript // Using the search_apis tool { "query": "weather", "category": "Weather", "maxResults": 10 } ``` ### Assess a Specific API ```javascript // Using the assess_api tool { "apiUrl": "https://rapidapi.com/weatherapi/api/weatherapi-com" } ``` ### Compare Multiple APIs ```javascript // Using the compare_apis tool { "apiUrls": [ "https://rapidapi.com/weatherapi/api/weatherapi-com", "https://rapidapi.com/visual-crossing-corporation/api/visual-crossing-weather" ] } ``` ## Architecture The server follows a modular architecture: - **MCP Protocol Layer**: Handles tool registration and request/response formatting - **Business Logic**: API search orchestration and assessment coordination - **Web Automation**: Browser management and anti-detection measures - **Data Extraction**: Parsing and structuring data from RapidAPI pages ## Limitations - Requires a browser (Chrome/Chromium) for web automation - Subject to RapidAPI's rate limiting and anti-bot measures - Performance depends on network conditions and page load times - May require updates if RapidAPI changes their page structure ## Contributing 1. Fork the repository 2. Create a feature branch 3. Make your changes 4. Add tests for new functionality 5. Ensure all tests pass 6. Submit a pull request ## License ISC ## Support For issues and feature requests, please use the GitHub issue tracker.