Skip to content

Commit 5974f60

Browse files
authored
feat(cli,resources): pf-4059 cli catch start issues (#179)
* docs, troubleshooting index, agent troubleshooting guidance * agent, allow checking for node versioning via mcp resource * build, add custom support url to package.json * cli, expose 3 levels of error with troubleshooting links * options, move getNodeMajorVersion to helpers, troubleshooting instructions * resources, patternFlyContext, expose env and support links
1 parent c16a164 commit 5974f60

17 files changed

Lines changed: 361 additions & 93 deletions

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ Welcome to the PatternFly MCP Server documentation. This guide is organized by u
55
### 🚀 Usage
66
- **[MCP Tools and Resources](./usage.md)**: Use built-in tools and resources like `searchPatternFlyDocs` and `usePatternFlyDocs`.
77
- **[Client Configuration](./usage.md)**: Configure the server for your environment.
8+
- **[Troubleshooting](./usage.md#troubleshooting)**: Steps for common setup problems.
89

910
### 🛠️ Developer reference
1011
- **[CLI Reference](./development.md#cli-usage)**: Reference of server options.

docs/usage.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,8 @@ These are **first-step checks** for common setup problems, not full diagnostics.
180180

181181
> **Note on Operating Systems**: Our primary development and testing environments are **macOS and Linux**. While we provide instructions for **Windows**, these commands are run at your own discretion. If you are unsure, please verify them with your IT or system administrator before proceeding.
182182
183+
> **Agents**: PatternFly MCP server information is available internally through the `patternfly://context` MCP resource.
184+
183185
### 1. Verify Node.js Version
184186
The PatternFly MCP server requires **Node.js 20 or higher**.
185187

guidelines/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Agents should use these phrases as signals to consult specific documentation and
3636
| **"review development guide"** | Review `docs/development.md` for CLI, API, and plugin authoring. |
3737
| **"create an example tool plugin"** | Review `guidelines/agent_coding.md`, `docs/development.md`, `docs/examples/*`, and `src/*` for context, coding standards, and existing example formats. |
3838
| **"add documentation links"** / **"add doc entries"** / **"register docs"** / **"update docs.json"** / **"contribute to docs.json"** | Follow `guidelines/skills/add-docs-links/SKILL.md`: docs.json format, duplicate check, raw URL confirmation, then run unit tests and update meta. |
39+
| **"troubleshoot server"** / **"debug server"** | Review `docs/usage.md#troubleshooting` and the PatternFly MCP server resource `patternfly://context` |
3940

4041
## Guidelines Processing Order
4142

guidelines/agent_behaviors.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ For a detailed overview of the system design and roadmap, see [docs/architecture
4646
- **Confirmation Required**: Confirm success; summarize changes; explain impact; verify understanding.
4747
- **Guidance Review Scope**: Unless the user explicitly asks, do not make recommendations on improving guidance if all you're asked to do is review guidance.
4848
- **Environment Awareness**:
49-
- Server execution requires **Node.js >= 20**.
50-
- External tool plugins (`--tool`) require **Node.js >= 22** primarily for its robust **Permission Model** (`--experimental-permission`), which enables strict filesystem and network isolation.
51-
- Always verify environment compatibility when proposing tools using modern Node.js features.
49+
- Server and plugin execution requirements are defined in `package.json`.
50+
- Always verify environment compatibility by checking `patternfly://context` or `package.json`.
51+
- Proactively check for environment mismatches (e.g., Node.js version) if tools fail to load.
5252
- **Security Context**:
5353
- Default to `--plugin-isolation strict`.
54-
- If a tool requires filesystem or network access beyond the sandbox, document the need for `--plugin-isolation none` explicitly.
54+
- If a tool requires filesystem or network access beyond the sandbox, document the need for `--plugin-isolation none`.
55+
- **Implicit Diagnostics**: If a tool call fails, the agent MUST proactively check `patternfly://context` to see if the user's environment meets requirements before requesting more technical details.
5556
- Warn users when a proposed solution requires disabling isolation.
5657
- **State Management**: Use `.agent/` directory for local guidance and state; maintain context; preserve session information.
5758
- **Security Awareness**: Be mindful of path traversal and isolation levels when working with external tools and resource loading.
59+
- **Troubleshooting Reference**: When encountering environment or runtime issues, consult the [Troubleshooting section in docs/usage.md](../docs/usage.md#troubleshooting) for common fixes such as Node.js upgrades, cache resets, and Windows-specific symlink issues.
5860

5961
## 3. Trigger-Based Workflows
6062

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,5 +94,8 @@
9494
"bugs": {
9595
"url": "https://github.com/patternfly/patternfly-mcp/issues"
9696
},
97+
"support": {
98+
"url": "https://github.com/patternfly/patternfly-mcp/blob/main/docs/usage.md#troubleshooting"
99+
},
97100
"homepage": "https://github.com/patternfly/patternfly-mcp#readme"
98101
}

src/__tests__/__snapshots__/options.defaults.test.ts.snap

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ exports[`options defaults should return specific properties: defaults 1`] = `
4545
"test": {},
4646
},
4747
"name": "@patternfly/patternfly-mcp",
48+
"nodeEngine": ">=20.0.0",
4849
"nodeVersion": 22,
50+
"nodeVersionPreferred": 22,
4951
"patternflyOptions": {
5052
"availableResourceVersions": [
5153
"6.0.0",
@@ -84,12 +86,14 @@ exports[`options defaults should return specific properties: defaults 1`] = `
8486
"loadTimeoutMs": 5000,
8587
},
8688
"pluginIsolation": "strict",
89+
"repoBugs": "https://github.com/patternfly/patternfly-mcp/issues",
8790
"repoName": "patternfly-mcp",
8891
"repoResources": {
8992
"bugs": "https://github.com/patternfly/patternfly-mcp/issues",
9093
"git": "git+https://github.com/patternfly/patternfly-mcp.git",
9194
"homepage": "https://github.com/patternfly/patternfly-mcp#readme",
9295
},
96+
"repoSupport": "https://github.com/patternfly/patternfly-mcp/blob/main/docs/usage.md#troubleshooting",
9397
"resourceMemoOptions": {
9498
"default": {
9599
"cacheLimit": 3,
@@ -112,7 +116,7 @@ exports[`options defaults should return specific properties: defaults 1`] = `
112116
113117
",
114118
"serverInstanceOptions": {
115-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
119+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
116120
},
117121
"stats": {
118122
"reportIntervalMs": {

src/__tests__/__snapshots__/server.helpers.test.ts.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,5 @@ ipsum
132132
3
133133
true"
134134
`;
135+
136+
exports[`stringJoin should join values, newline filtered empty 1`] = `""`;

src/__tests__/__snapshots__/server.test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ exports[`runServer should attempt to run server, create transport, connect, and
183183
"resources": {},
184184
"tools": {},
185185
},
186-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
186+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
187187
},
188188
],
189189
],
@@ -256,7 +256,7 @@ exports[`runServer should attempt to run server, disable SIGINT handler: diagnos
256256
"resources": {},
257257
"tools": {},
258258
},
259-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
259+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
260260
},
261261
],
262262
],
@@ -324,7 +324,7 @@ exports[`runServer should attempt to run server, enable SIGINT handler explicitl
324324
"resources": {},
325325
"tools": {},
326326
},
327-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
327+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
328328
},
329329
],
330330
],
@@ -403,7 +403,7 @@ exports[`runServer should attempt to run server, register a tool: diagnostics 1`
403403
"resources": {},
404404
"tools": {},
405405
},
406-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
406+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
407407
},
408408
],
409409
],
@@ -490,7 +490,7 @@ exports[`runServer should attempt to run server, register multiple tools: diagno
490490
"resources": {},
491491
"tools": {},
492492
},
493-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
493+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
494494
},
495495
],
496496
],
@@ -566,7 +566,7 @@ exports[`runServer should attempt to run server, use custom options: diagnostics
566566
"resources": {},
567567
"tools": {},
568568
},
569-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
569+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
570570
},
571571
],
572572
],
@@ -645,7 +645,7 @@ exports[`runServer should attempt to run server, use default tools, http: diagno
645645
"resources": {},
646646
"tools": {},
647647
},
648-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
648+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
649649
},
650650
],
651651
],
@@ -727,7 +727,7 @@ exports[`runServer should attempt to run server, use default tools, stdio: diagn
727727
"resources": {},
728728
"tools": {},
729729
},
730-
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development.",
730+
"instructions": "Use the PatternFly MCP when a user asks about: PatternFly, pf, pf docs, design tokens, design guidelines, accessibility, PatternFly components, and frontend development. Use patternfly://context for server environment and troubleshooting links if runtime issues occur.",
731731
},
732732
],
733733
],
Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,7 @@
1-
import { DEFAULT_OPTIONS, getNodeMajorVersion } from '../options.defaults';
1+
import { DEFAULT_OPTIONS } from '../options.defaults';
22

33
describe('options defaults', () => {
44
it('should return specific properties', () => {
55
expect(DEFAULT_OPTIONS).toMatchSnapshot('defaults');
66
});
77
});
8-
9-
describe('getNodeMajorVersion', () => {
10-
it('should get the current Node.js version', () => {
11-
// Purposeful failure in the event the process.versions.node value is not available
12-
expect(getNodeMajorVersion()).not.toBe(0);
13-
});
14-
15-
it.each([
16-
{
17-
description: 'number',
18-
value: 1_000_000
19-
},
20-
{
21-
description: 'string',
22-
value: 'lorem ipsum'
23-
},
24-
{
25-
description: 'null',
26-
value: null
27-
}
28-
])('should handle basic failure, $description', ({ value }) => {
29-
expect(getNodeMajorVersion(value as any)).toBe(0);
30-
});
31-
});
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { getNodeMajorVersion } from '../options.helpers';
2+
3+
describe('getNodeMajorVersion', () => {
4+
it('should get the current Node.js version', () => {
5+
// Purposeful failure in the event the process.versions.node value is not available
6+
expect(getNodeMajorVersion(process.versions.node)).not.toBe(0);
7+
});
8+
9+
it.each([
10+
{
11+
description: 'number failure',
12+
value: 1_000_000,
13+
expected: 0
14+
},
15+
{
16+
description: 'string',
17+
value: 'lorem ipsum',
18+
expected: 0
19+
},
20+
{
21+
description: 'null failure',
22+
value: null,
23+
expected: 0
24+
},
25+
{
26+
description: 'undefined failure',
27+
value: undefined,
28+
expected: 0
29+
},
30+
{
31+
description: 'NaN failure',
32+
value: NaN,
33+
expected: 0
34+
},
35+
{
36+
description: 'operators',
37+
value: '<=20',
38+
expected: 20
39+
},
40+
{
41+
description: 'operators and semver',
42+
value: '<=20.0.1',
43+
expected: 20
44+
}
45+
])('should handle, $description', ({ value, expected }) => {
46+
expect(getNodeMajorVersion(value as any)).toBe(expected);
47+
});
48+
});

0 commit comments

Comments
 (0)