|
| 1 | +# MCP REST API Tester Plugin |
| 2 | + |
| 3 | +This plugin automatically configures the [dkmaker-mcp-rest-api](https://github.com/dkmaker/mcp-rest-api) MCP server for Claude Code. |
| 4 | + |
| 5 | +## What This Plugin Does |
| 6 | + |
| 7 | +When installed, this plugin adds the REST API tester MCP server to Claude Code, enabling you to test HTTP endpoints directly from conversations with Claude. |
| 8 | + |
| 9 | +## Installation |
| 10 | + |
| 11 | +```bash |
| 12 | +/plugin install mcp-rest-api@my-claude-plugins |
| 13 | +``` |
| 14 | + |
| 15 | +Or from the terminal: |
| 16 | +```bash |
| 17 | +claude plugin install mcp-rest-api@my-claude-plugins |
| 18 | +``` |
| 19 | + |
| 20 | +## Configuration |
| 21 | + |
| 22 | +The plugin uses environment variables with the `REST_MCP_` prefix to avoid conflicts with other tools. |
| 23 | + |
| 24 | +### Configuration Template |
| 25 | + |
| 26 | +Copy this template to your settings file and uncomment/configure the variables you need: |
| 27 | + |
| 28 | +```json |
| 29 | +{ |
| 30 | + "env": { |
| 31 | + "REST_MCP_BASE_URL": "https://api.example.com", |
| 32 | + |
| 33 | + // Authentication - choose ONE method: |
| 34 | + |
| 35 | + // Option 1: Bearer Token |
| 36 | + // "REST_MCP_AUTH_BEARER": "your-bearer-token", |
| 37 | + |
| 38 | + // Option 2: Basic Auth |
| 39 | + // "REST_MCP_AUTH_USERNAME": "your-username", |
| 40 | + // "REST_MCP_AUTH_PASSWORD": "your-password", |
| 41 | + |
| 42 | + // Option 3: API Key |
| 43 | + // "REST_MCP_APIKEY_HEADER": "X-API-Key", |
| 44 | + // "REST_MCP_APIKEY_VALUE": "your-api-key", |
| 45 | + |
| 46 | + // Optional settings: |
| 47 | + // "REST_MCP_SSL_VERIFY": "true", |
| 48 | + // "REST_MCP_RESPONSE_LIMIT": "10000", |
| 49 | + |
| 50 | + // Custom headers (optional): |
| 51 | + // "HEADER_X-API-Version": "2.0", |
| 52 | + // "HEADER_Accept": "application/json", |
| 53 | + // "HEADER_Authorization": "custom-auth-value" |
| 54 | + } |
| 55 | +} |
| 56 | +``` |
| 57 | + |
| 58 | +### Option 1: Shell Environment (Recommended) |
| 59 | + |
| 60 | +Set environment variables before starting Claude Code: |
| 61 | + |
| 62 | +```bash |
| 63 | +# In your ~/.bashrc or ~/.zshrc |
| 64 | +export REST_MCP_BASE_URL="https://your-api.com" |
| 65 | +export REST_MCP_AUTH_BEARER="your-bearer-token" |
| 66 | + |
| 67 | +# Or for one session |
| 68 | +REST_MCP_BASE_URL="http://localhost:3000" claude |
| 69 | +``` |
| 70 | + |
| 71 | +### Option 2: Project Settings |
| 72 | + |
| 73 | +Edit `.claude/settings.json` in your project and paste this template: |
| 74 | + |
| 75 | +```json |
| 76 | +{ |
| 77 | + "env": { |
| 78 | + "REST_MCP_BASE_URL": "http://localhost:3000", |
| 79 | + |
| 80 | + // Authentication - choose ONE method: |
| 81 | + |
| 82 | + // Option 1: Bearer Token |
| 83 | + // "REST_MCP_AUTH_BEARER": "your-bearer-token", |
| 84 | + |
| 85 | + // Option 2: Basic Auth |
| 86 | + "REST_MCP_AUTH_USERNAME": "admin", |
| 87 | + "REST_MCP_AUTH_PASSWORD": "dev-password", |
| 88 | + |
| 89 | + // Option 3: API Key |
| 90 | + // "REST_MCP_APIKEY_HEADER": "X-API-Key", |
| 91 | + // "REST_MCP_APIKEY_VALUE": "your-api-key", |
| 92 | + |
| 93 | + // Optional settings: |
| 94 | + // "REST_MCP_SSL_VERIFY": "false", |
| 95 | + // "REST_MCP_RESPONSE_LIMIT": "50000" |
| 96 | + } |
| 97 | +} |
| 98 | +``` |
| 99 | + |
| 100 | +### Option 3: User Settings (All Projects) |
| 101 | + |
| 102 | +Edit `~/.claude/settings.json` and paste this template: |
| 103 | + |
| 104 | +```json |
| 105 | +{ |
| 106 | + "env": { |
| 107 | + "REST_MCP_BASE_URL": "https://api.production.com", |
| 108 | + |
| 109 | + // Authentication - choose ONE method: |
| 110 | + |
| 111 | + // Option 1: Bearer Token |
| 112 | + "REST_MCP_AUTH_BEARER": "your-production-token", |
| 113 | + |
| 114 | + // Option 2: Basic Auth |
| 115 | + // "REST_MCP_AUTH_USERNAME": "username", |
| 116 | + // "REST_MCP_AUTH_PASSWORD": "password", |
| 117 | + |
| 118 | + // Option 3: API Key |
| 119 | + // "REST_MCP_APIKEY_HEADER": "X-API-Key", |
| 120 | + // "REST_MCP_APIKEY_VALUE": "your-key", |
| 121 | + |
| 122 | + // Optional settings: |
| 123 | + "REST_MCP_SSL_VERIFY": "true", |
| 124 | + "REST_MCP_RESPONSE_LIMIT": "10000" |
| 125 | + } |
| 126 | +} |
| 127 | +``` |
| 128 | + |
| 129 | +## Environment Variables Reference |
| 130 | + |
| 131 | +All variables use the `REST_MCP_` prefix to avoid naming conflicts. |
| 132 | + |
| 133 | +| Variable | Maps to MCP Server | Description | Default | |
| 134 | +|----------|-------------------|-------------|---------| |
| 135 | +| `REST_MCP_BASE_URL` | `REST_BASE_URL` | Base URL for API requests | `https://api.example.com` | |
| 136 | +| `REST_MCP_AUTH_BEARER` | `AUTH_BEARER` | Bearer token authentication | None | |
| 137 | +| `REST_MCP_AUTH_USERNAME` | `AUTH_BASIC_USERNAME` | Basic auth username | None | |
| 138 | +| `REST_MCP_AUTH_PASSWORD` | `AUTH_BASIC_PASSWORD` | Basic auth password | None | |
| 139 | +| `REST_MCP_APIKEY_HEADER` | `AUTH_APIKEY_HEADER_NAME` | API key header name | None | |
| 140 | +| `REST_MCP_APIKEY_VALUE` | `AUTH_APIKEY_VALUE` | API key value | None | |
| 141 | +| `REST_MCP_SSL_VERIFY` | `REST_ENABLE_SSL_VERIFY` | Enable SSL verification | `true` | |
| 142 | +| `REST_MCP_RESPONSE_LIMIT` | `REST_RESPONSE_SIZE_LIMIT` | Max response size (bytes) | `10000` | |
| 143 | + |
| 144 | +**Custom Headers**: Use the `HEADER_*` prefix directly (not `REST_MCP_`): |
| 145 | +```bash |
| 146 | +export HEADER_X-API-Version="2.0" |
| 147 | +export HEADER_Accept="application/json" |
| 148 | +``` |
| 149 | + |
| 150 | +## Quick Start Examples |
| 151 | + |
| 152 | +### Testing a Local API |
| 153 | + |
| 154 | +```bash |
| 155 | +# Configure for local development |
| 156 | +export REST_MCP_BASE_URL="http://localhost:3000" |
| 157 | +export REST_MCP_AUTH_BEARER="dev-token" |
| 158 | + |
| 159 | +# Start Claude Code |
| 160 | +claude |
| 161 | + |
| 162 | +# Ask Claude to test endpoints |
| 163 | +> Test the GET /users endpoint |
| 164 | +> Make a POST to /auth/login with email and password |
| 165 | +``` |
| 166 | + |
| 167 | +### Testing a Production API |
| 168 | + |
| 169 | +```bash |
| 170 | +# Configure for production |
| 171 | +export REST_MCP_BASE_URL="https://api.production.com" |
| 172 | +export REST_MCP_AUTH_BEARER="prod-bearer-token-xyz" |
| 173 | +export REST_MCP_SSL_VERIFY="true" |
| 174 | + |
| 175 | +claude |
| 176 | +``` |
| 177 | + |
| 178 | +### Using Basic Auth |
| 179 | + |
| 180 | +```bash |
| 181 | +export REST_MCP_BASE_URL="https://api.example.com" |
| 182 | +export REST_MCP_AUTH_USERNAME="admin" |
| 183 | +export REST_MCP_AUTH_PASSWORD="secret" |
| 184 | + |
| 185 | +claude |
| 186 | +``` |
| 187 | + |
| 188 | +### Using API Key |
| 189 | + |
| 190 | +```bash |
| 191 | +export REST_MCP_BASE_URL="https://api.example.com" |
| 192 | +export REST_MCP_APIKEY_HEADER="X-API-Key" |
| 193 | +export REST_MCP_APIKEY_VALUE="your-api-key-here" |
| 194 | + |
| 195 | +claude |
| 196 | +``` |
| 197 | + |
| 198 | +## Authentication Methods |
| 199 | + |
| 200 | +The MCP server supports multiple authentication methods. Configure only one: |
| 201 | + |
| 202 | +| Method | Variables | |
| 203 | +|--------|-----------| |
| 204 | +| **Bearer Token** | `REST_MCP_AUTH_BEARER` | |
| 205 | +| **Basic Auth** | `REST_MCP_AUTH_USERNAME` + `REST_MCP_AUTH_PASSWORD` | |
| 206 | +| **API Key** | `REST_MCP_APIKEY_HEADER` + `REST_MCP_APIKEY_VALUE` | |
| 207 | + |
| 208 | +## Usage |
| 209 | + |
| 210 | +Once installed and configured, ask Claude to test REST endpoints: |
| 211 | + |
| 212 | +``` |
| 213 | +Test the GET /users endpoint |
| 214 | +Make a POST request to /auth/login with {"email": "test@example.com", "password": "secret"} |
| 215 | +What does the /api/status endpoint return? |
| 216 | +Check if the /health endpoint is responding |
| 217 | +Send a PUT request to /users/123 to update the user |
| 218 | +``` |
| 219 | + |
| 220 | +Claude will automatically use the `test_request` tool from the MCP server. |
| 221 | + |
| 222 | +## Troubleshooting |
| 223 | + |
| 224 | +### MCP server not appearing |
| 225 | + |
| 226 | +After installation, restart Claude Code: |
| 227 | +```bash |
| 228 | +# Exit Claude Code (Ctrl+D or /exit) |
| 229 | +# Start it again |
| 230 | +claude |
| 231 | + |
| 232 | +# Check if server is loaded |
| 233 | +/mcp |
| 234 | +``` |
| 235 | + |
| 236 | +You should see "rest-api" in the list. |
| 237 | + |
| 238 | +### Environment variables not working |
| 239 | + |
| 240 | +1. Set the env vars **before** starting Claude Code |
| 241 | +2. Or configure them in `settings.json` |
| 242 | +3. **Restart Claude Code** after changing settings |
| 243 | + |
| 244 | +Check your current env vars: |
| 245 | +```bash |
| 246 | +env | grep REST_MCP |
| 247 | +``` |
| 248 | + |
| 249 | +### NPM package not found |
| 250 | + |
| 251 | +The plugin uses `npx -y dkmaker-mcp-rest-api` which downloads the package on first use. |
| 252 | + |
| 253 | +Requirements: |
| 254 | +- Node.js 18+ installed |
| 255 | +- Internet connection for first run |
| 256 | + |
| 257 | +## Uninstall |
| 258 | + |
| 259 | +```bash |
| 260 | +/plugin uninstall mcp-rest-api@my-claude-plugins |
| 261 | +``` |
| 262 | + |
| 263 | +## More Information |
| 264 | + |
| 265 | +- **GitHub**: https://github.com/dkmaker/mcp-rest-api |
| 266 | +- **NPM**: https://www.npmjs.com/package/dkmaker-mcp-rest-api |
| 267 | +- **MCP Server Documentation**: Full configuration guide in the main repository |
0 commit comments