Skip to content

Commit da75959

Browse files
committed
feat: add Claude Code plugin support
- Add .claude-plugin/plugin.json for marketplace distribution - Add .mcp.json with REST_MCP_* env variable mapping - Add PLUGIN.md with installation and configuration guide - Update README.md with three installation methods: - Claude Code plugin (recommended) - Manual MCP server configuration - NPM global install for other MCP clients - Plugin available via dkmaker/my-claude-plugins marketplace
1 parent 53a796e commit da75959

4 files changed

Lines changed: 353 additions & 1 deletion

File tree

.claude-plugin/plugin.json

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
{
2+
"name": "mcp-rest-api",
3+
"version": "0.4.0",
4+
"description": "REST API tester MCP server - test HTTP endpoints directly from Claude Code",
5+
"author": {
6+
"name": "Christian Pedersen",
7+
"email": "christian@dkmaker.xyz"
8+
},
9+
"homepage": "https://github.com/dkmaker/mcp-rest-api",
10+
"repository": "https://github.com/dkmaker/mcp-rest-api",
11+
"license": "MIT",
12+
"keywords": ["mcp", "rest", "api", "http", "testing", "development"]
13+
}

.mcp.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"mcpServers": {
3+
"rest-api": {
4+
"type": "stdio",
5+
"command": "npx",
6+
"args": ["-y", "dkmaker-mcp-rest-api"],
7+
"env": {
8+
"REST_BASE_URL": "${REST_MCP_BASE_URL:-https://api.example.com}",
9+
"AUTH_BEARER": "${REST_MCP_AUTH_BEARER}",
10+
"AUTH_BASIC_USERNAME": "${REST_MCP_AUTH_USERNAME}",
11+
"AUTH_BASIC_PASSWORD": "${REST_MCP_AUTH_PASSWORD}",
12+
"AUTH_APIKEY_HEADER_NAME": "${REST_MCP_APIKEY_HEADER}",
13+
"AUTH_APIKEY_VALUE": "${REST_MCP_APIKEY_VALUE}",
14+
"REST_ENABLE_SSL_VERIFY": "${REST_MCP_SSL_VERIFY:-true}",
15+
"REST_RESPONSE_SIZE_LIMIT": "${REST_MCP_RESPONSE_LIMIT:-10000}"
16+
}
17+
}
18+
}
19+
}

PLUGIN.md

Lines changed: 267 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,267 @@
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

README.md

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,65 @@ A TypeScript-based MCP server that enables testing of REST APIs through Cline. T
1010

1111
## Installation
1212

13+
Choose one of the following methods:
14+
15+
### Option 1: Claude Code Plugin (Recommended)
16+
17+
Install via the my-claude-plugins marketplace for automatic configuration:
18+
19+
```bash
20+
# In Claude Code
21+
/plugin marketplace add dkmaker/my-claude-plugins
22+
/plugin install mcp-rest-api@my-claude-plugins
23+
```
24+
25+
Then configure with environment variables (see [PLUGIN.md](PLUGIN.md) for details):
26+
27+
```bash
28+
export REST_MCP_BASE_URL="https://your-api.com"
29+
export REST_MCP_AUTH_BEARER="your-token"
30+
claude
31+
```
32+
33+
### Option 2: Manual MCP Server Configuration
34+
35+
Add the MCP server directly using the `claude mcp add` command:
36+
37+
```bash
38+
# Basic setup (no authentication)
39+
claude mcp add --transport stdio rest-api -- npx -y dkmaker-mcp-rest-api
40+
41+
# With Bearer token authentication
42+
claude mcp add --transport stdio \
43+
--env REST_BASE_URL=https://api.example.com \
44+
--env AUTH_BEARER=your-token \
45+
rest-api -- npx -y dkmaker-mcp-rest-api
46+
47+
# With Basic authentication
48+
claude mcp add --transport stdio \
49+
--env REST_BASE_URL=https://api.example.com \
50+
--env AUTH_BASIC_USERNAME=admin \
51+
--env AUTH_BASIC_PASSWORD=secret \
52+
rest-api -- npx -y dkmaker-mcp-rest-api
53+
54+
# With API Key authentication
55+
claude mcp add --transport stdio \
56+
--env REST_BASE_URL=https://api.example.com \
57+
--env AUTH_APIKEY_HEADER_NAME=X-API-Key \
58+
--env AUTH_APIKEY_VALUE=your-key \
59+
rest-api -- npx -y dkmaker-mcp-rest-api
60+
```
61+
62+
### Option 3: NPM Global Install (For Cline and other MCP clients)
63+
1364
Install the package globally:
1465
```bash
1566
npm install -g dkmaker-mcp-rest-api
1667
```
1768

18-
## Configuration
69+
Then configure your MCP client. See the [Configuration](#configuration) section below for client-specific setup.
70+
71+
## Configuration for Cline and Other MCP Clients
1972

2073
### Cline Custom Instructions
2174

0 commit comments

Comments
 (0)