Web content fetching and conversion for efficient LLM usage
## Fetch MCP Server: HTTP Requests and Web Content Retrieval The **Fetch MCP Server** is the official MCP server for making HTTP requests and retrieving web content directly from Google Antigravity. Access APIs, download files, and fetch web pages without writing boilerplate code—just describe what you need in natural language. ### Why Fetch MCP? Modern development requires constant interaction with web APIs and remote resources. The Fetch MCP simplifies this by providing: - **Simple HTTP Requests**: GET, POST, PUT, DELETE without code - **Content Extraction**: Clean text from web pages - **API Integration**: Work with any REST API - **File Downloads**: Retrieve remote files - **Response Parsing**: Automatic JSON/XML handling ### Key Features #### 1. HTTP Requests Make any HTTP request naturally: ``` "GET the user profile from https://api.example.com/users/1" "POST new data to the orders endpoint" "Send a PUT request to update the settings" "DELETE the expired session" ``` Supports: - All HTTP methods (GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS) - Custom headers and authentication - Request body in JSON, form data, or raw text - Query parameters #### 2. Web Content Retrieval Fetch and extract content from websites: ``` "Get the main content from this article URL" "Extract the text from this documentation page" "Fetch the pricing table from the competitor site" ``` Features: - HTML to Markdown conversion - Main content extraction - Link and image extraction - Metadata parsing #### 3. API Integration Work with REST APIs seamlessly: ``` "Call the GitHub API to get repository info" "Fetch weather data from OpenWeatherMap" "Get the latest stock price from the financial API" ``` Handles: - JSON response parsing - API authentication (Bearer, API key, Basic) - Pagination for large responses - Rate limiting awareness #### 4. File Downloads Download remote files: ``` "Download the CSV export from this URL" "Fetch the image from the CDN" "Get the PDF documentation file" ``` #### 5. Response Handling Process responses intelligently: - Automatic content-type detection - JSON pretty printing - Binary file handling - Error response parsing ### Configuration Set up the Fetch MCP: ```json { "mcpServers": { "fetch": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-fetch"], "env": { "USER_AGENT": "Antigravity-MCP/1.0" } } } } ``` ### Common Workflows #### API Exploration ``` 1. "Fetch the API documentation page" 2. "GET the /users endpoint to see the response format" 3. "POST a test user to verify authentication" 4. "Review the error response format" ``` #### Data Collection ``` 1. "Fetch product data from the catalog API" 2. "Download the CSV export" 3. "Get pricing from the competitor's page" 4. "Save the results for analysis" ``` #### Integration Testing ``` 1. "Check if the API is responding" 2. "Verify the authentication flow" 3. "Test error handling with invalid requests" ``` ### Request Examples #### GET with Headers ``` "GET https://api.example.com/data with Authorization: Bearer token123" ``` #### POST with JSON Body ``` "POST to https://api.example.com/users with body {name: John, email: john@example.com}" ``` #### Custom Headers ``` "Fetch the URL with headers: Accept: application/json, X-API-Key: abc123" ``` ### Best Practices 1. **Set User-Agent**: Identify your requests properly 2. **Handle Errors**: Expect and handle HTTP errors 3. **Respect Rate Limits**: Don't overwhelm APIs 4. **Cache When Possible**: Avoid redundant requests 5. **Use HTTPS**: Always prefer secure connections ### Authentication Methods The Fetch MCP supports various auth methods: #### Bearer Token ``` "GET the endpoint with Bearer token abc123" ``` #### API Key ``` "Fetch with header X-API-Key: your-key" ``` #### Basic Auth ``` "GET the URL with Basic auth username:password" ``` ### Content Types Handle different content types: #### JSON ``` "Parse the JSON response from the API" ``` #### XML ``` "Fetch the XML feed and extract items" ``` #### HTML ``` "Get the page and extract the article content" ``` #### Binary ``` "Download the file and save it" ``` ### Error Handling The Fetch MCP provides clear error information: - HTTP status codes and messages - Response body for error details - Network error descriptions - Timeout handling ### Performance Tips 1. **Use HEAD Requests**: Check resource existence without downloading 2. **Request Compression**: Accept gzip/deflate encoding 3. **Conditional Requests**: Use ETags and If-Modified-Since 4. **Connection Reuse**: Multiple requests share connections ### Security Considerations - Never include secrets in URLs - Use HTTPS for sensitive data - Validate SSL certificates - Be cautious with redirects - Don't trust response content blindly ### Integration with Development The Fetch MCP enables: - **API Testing**: Quick endpoint verification - **Documentation**: Fetch and read API docs - **Data Import**: Pull external data into your project - **Monitoring**: Check service availability The Fetch MCP Server transforms web interactions into simple conversations, making API integration and web content retrieval effortless.
{
"mcpServers": {
"fetch": {
"args": [
"mcp-server-fetch"
],
"command": "uvx"
}
}
}