Description
### 1. Basic Configuration
This is a minimal, usable configuration that runs the Fetch MCP Server via `npx` with default settings.
```json
{
"mcpServers": {
"fetch-mcp-server": {
"command": "npx",
"args": [
"fetch-mcp-server"
],
"env": {
"NODE_ENV": "development"
},
"category": "Automation"
}
}
}
```
**Explanation (not part of JSON):**
- `mcpServers`: Root object where Claude Code looks for MCP server definitions.
- `"fetch-mcp-server"`: The ID you’ll use to reference this server inside Claude Code.
- `"command": "npx"`: Uses `npx` to run the Fetch MCP Server without a global install.
- `"args": ["fetch-mcp-server"]`: The package/binary name for the MCP server.
- `"env": { "NODE_ENV": "development" }`: Simple environment setting; optional but common.
- `"category": "Automation"`: Groups this server under “Automation” in the Claude UI.
---
### 2. Advanced Configuration
This configuration adds explicit logging, a custom config file, and stricter timeouts.
```json
{
"mcpServers": {
"fetch-mcp-server-advanced": {
"command": "npx",
"args": [
"fetch-mcp-server",
"--config",
"/Users/yourname/.config/fetch-mcp/config.json",
"--log-level",
"debug",
"--max-concurrent",
"5"
],
"env": {
"NODE_ENV": "production",
"FETCH_MCP_DEFAULT_TIMEOUT_MS": "15000",
"FETCH_MCP_ALLOWED_DOMAINS": "api.github.com,api.openai.com,example.com",
"FETCH_MCP_ENABLE_CACHE": "true"
},
"category": "Automation",
"disabled": false,
"timeoutSeconds": 60
}
}
}
```
**Explanation (not part of JSON):**
- `"fetch-mcp-server-advanced"`: Separate name so you can keep both basic and advanced configs side-by-side.
- `--config /Users/yourname/.config/fetch-mcp/config.json`: Points the server to an external config file you manage.
- `--log-level debug`: Enables more verbose logging for troubleshooting.
- `--max-concurrent 5`: Example flag to limit concurrent fetches (if supported by the server).
- `FETCH_MCP_DEFAULT_TIMEOUT_MS`: Default HTTP timeout for outbound requests (in ms).
- `FETCH_MCP_ALLOWED_DOMAINS`: Comma-separated whitelist of allowed domains for security.
- `FETCH_MCP_ENABLE_CACHE`: Enables internal response caching (if implemented).
- `disabled: false`: Ensures the server is active.
- `timeoutSeconds: 60`: How long Claude waits for the MCP tool before giving up.
---
### 3. Use Case Specific Configuration – Production API Integration
This configuration is tailored for a production environment where the Fetch MCP Server is used to safely query a specific internal API and a couple of external services.
```json
{
"mcpServers": {
"fetch-mcp-server-production-api": {
"command": "/usr/local/bin/node",
"args": [
"/opt/mcp/fetch-mcp-server/dist/index.js",
"--config",
"/opt/mcp/fetch-mcp-server/config.production.json",
"--log-level",
"info",
"--max-concurrent",
"10"
],
"env": {
"NODE_ENV": "production",
"FETCH_MCP_DEFAULT_TIMEOUT_MS": "8000",
"FETCH_MCP_ALLOWED_DOMAINS": "api.internal.mycompany.com,api.stripe.com,api.sendgrid.com",
"FETCH_MCP_REQUIRE_HTTPS": "true",
"FETCH_MCP_STRIP_HEADERS": "authorization,cookie,set-cookie",
"FETCH_MCP_DEFAULT_HEADERS": "{\"User-Agent\":\"Claude-Fetch-MCP/1.0\",\"Accept\":\"application/json\"}",
"FETCH_MCP_INTERNAL_API_TOKEN": "YOUR_INTERNAL_API_TOKEN_HERE"
},
"category": "Automation",
"timeoutSeconds": 30,
"disabled": false
}
}
}
```
**Explanation (not part of JSON):**
- `command: "/usr/local/bin/node"`: Uses a specific Node binary (common in production).
- `args[0]: "/opt/mcp/fetch-mcp-server/dist/index.js"`: Points to a locally deployed build of the server.
- `--config ...config.production.json`: Uses a dedicated production config file.
- `--log-level info`: Quieter logs than `debug`, suitable for production.
- `--max-concurrent 10`: Allows more parallel requests for higher throughput.
- `FETCH_MCP_DEFAULT_TIMEOUT_MS: "8000"`: Slightly aggressive timeout to keep tools responsive.
- `FETCH_MCP_ALLOWED_DOMAINS`: Only your internal API and vetted third-party APIs can be called.
- `FETCH_MCP_REQUIRE_HTTPS: "true"`: Disallows insecure HTTP calls.
- `FETCH_MCP_STRIP_HEADERS`: Headers that will be removed from responses before passing them back to Claude (for security/privacy).
- `FETCH_MCP_DEFAULT_HEADERS`: JSON-encoded object of headers automatically attached to every outbound request.
- `FETCH_MCP_INTERNAL_API_TOKEN`: Token your internal API expects, which the server can inject into requests.
- `timeoutSeconds: 30`: Tool-level timeout for Claude’s request to the MCP.
- Suitable when Claude needs controlled, auditable access to production APIs via the Fetch MCP Server.