You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+104-5Lines changed: 104 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,7 +19,7 @@ The Model Context Protocol (MCP) is an open standard that enables AI assistants
19
19
## Prerequisites
20
20
21
21
- Node.js 20.0.0 or higher
22
-
-npm (or another Node package manager)
22
+
-NPM (or another Node package manager)
23
23
24
24
## Installation
25
25
@@ -63,7 +63,7 @@ These are the most relevant NPM scripts from package.json:
63
63
-`build`: Build the TypeScript project (cleans dist, type-checks, bundles)
64
64
-`build:clean`: Remove dist
65
65
-`build:watch`: Build in watch mode
66
-
-`start`: Run the built server(node dist/index.js)
66
+
-`start`: Run the built server, CLI (node dist/cli.js)
67
67
-`start:dev`: Run with tsx in watch mode (development)
68
68
-`test`: Run linting, type-check, and unit tests in src/
69
69
-`test:dev`: Jest watch mode for unit tests
@@ -75,7 +75,7 @@ These are the most relevant NPM scripts from package.json:
75
75
76
76
## Usage
77
77
78
-
The MCP server communicates over stdio and provides access to PatternFly documentation through the following tools. Both tools accept an argument named `urlList` which must be an array of strings. Each string is either:
78
+
The MCP server can communicate over **stdio** (default) or **HTTP** transport. It provides access to PatternFly documentation through the following tools. Both tools accept an argument named `urlList` which must be an array of strings. Each string is either:
79
79
- An external URL (e.g., a raw GitHub URL to a .md file), or
80
80
- A local file path (e.g., documentation/.../README.md). When running with the --docs-host flag, these paths are resolved under the llms-files directory instead.
Then, passing a local path such as react-core/6.0.0/llms.txt in urlList will load from llms-files/react-core/6.0.0/llms.txt.
145
145
146
+
## HTTP transport mode
147
+
148
+
By default, the server communicates over stdio. To run the server over HTTP instead, use the `--http` flag. This enables the server to accept HTTP requests on a specified port and host.
149
+
150
+
### Basic HTTP usage
151
+
152
+
```bash
153
+
npx @patternfly/patternfly-mcp --http
154
+
```
155
+
156
+
This starts the server on `http://127.0.0.1:8080` (default port and host).
157
+
158
+
### HTTP options
159
+
160
+
-`--http`: Enable HTTP transport mode (default: stdio)
161
+
-`--port <number>`: Port number to listen on (default: 8080)
162
+
-`--host <string>`: Host address to bind to (default: 127.0.0.1)
163
+
-`--allowed-origins <origins>`: Comma-separated list of allowed CORS origins
164
+
-`--allowed-hosts <hosts>`: Comma-separated list of allowed host headers
165
+
166
+
#### Security note: DNS rebinding protection (default)
167
+
168
+
This server enables DNS rebinding protection by default when running in HTTP mode. If you're behind a proxy or load balancer, ensure the client sends a correct `Host` header and configure `--allowed-hosts` accordingly. Otherwise, requests may be rejected by design. For example:
169
+
170
+
```bash
171
+
npx @patternfly/patternfly-mcp --http \
172
+
--host 0.0.0.0 --port 8080 \
173
+
--allowed-hosts "localhost,127.0.0.1,example.com"
174
+
```
175
+
176
+
If your client runs on a different origin, also set `--allowed-origins` to allow CORS. Example:
If the specified port is already in use, the server will:
203
+
- Display a helpful error message with the process ID (if available)
204
+
- Suggest using a different port with `--port` or stopping the process using the port
205
+
206
+
**Note**: The server uses memoization to prevent duplicate server instances within the same process. If you need to restart the server, simply stop the existing instance and start a new one.
207
+
146
208
## MCP client configuration examples
147
209
148
210
Most MCP clients use a JSON configuration to specify how to start this server. The server itself only reads CLI flags and environment variables, not the JSON configuration. Below are examples you can adapt to your MCP client.
@@ -182,14 +244,49 @@ Most MCP clients use a JSON configuration to specify how to start this server. T
0 commit comments