mcp-perforce-server 2.1.0 → 2.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,223 +1,214 @@
1
- # MCP Perforce Server Configuration Examples
2
-
3
- ## Silent Operation Configuration
4
-
5
- To prevent VS Code from asking for approval on every command and to hide terminal execution:
6
-
7
- **Key Settings:**
8
- - `"alwaysAllow": ["p4.*"]` or `"alwaysAllow": true` - Auto-approve all p4 commands
9
- - `"LOG_LEVEL": "error"` - Minimize console output (only show errors)
10
- - `"disabled": false` - Ensure server is enabled
11
-
12
- ## Authentication Configuration
13
-
14
- **Important:** Configure your Perforce credentials using one of these methods:
15
-
16
- 1. **`.p4config` file** (Recommended) - Create in project root:
17
- ```
18
- P4PORT=perforce-server:1666
19
- P4USER=your-username
20
- P4CLIENT=your-workspace-name
21
- P4PASSWD=your-password
22
- ```
23
-
24
- 2. **Environment variables** in MCP config (see examples below)
25
-
26
- The server automatically detects and uses these credentials. Passwords are masked in logs for security.
27
-
28
- ## VS Code with Claude Dev/Cline
29
-
30
- ### Option 1: Using .p4config file (Recommended)
31
- Create a `.p4config` file in your project root, then:
32
- ```json
33
- {
34
- "mcpServers": {
35
- "perforce": {
36
- "command": "mcp-perforce-server",
37
- "args": [],
38
- "env": {
39
- "P4_READONLY_MODE": "false",
40
- "P4_DISABLE_DELETE": "true",
41
- "LOG_LEVEL": "error"
42
- },
43
- "alwaysAllow": ["p4.*"],
44
- "disabled": false
45
- }
46
- }
47
- }
48
- ```
49
-
50
- ### Option 2: Direct configuration in MCP config
51
- ```json
52
- {
53
- "mcpServers": {
54
- "perforce": {
55
- "command": "mcp-perforce-server",
56
- "args": [],
57
- "env": {
58
- "P4PORT": "perforce-server:1666",
59
- "P4USER": "your-username",
60
- "P4CLIENT": "your-workspace-name",
61
- "P4PASSWD": "your-password",
62
- "P4CHARSET": "utf8",
63
- "P4_READONLY_MODE": "false",
64
- "P4_DISABLE_DELETE": "true",
65
- "LOG_LEVEL": "error"
66
- },
67
- "alwaysAllow": ["p4.*"],
68
- "disabled": false
69
- }
70
- }
71
- }
72
- ```
73
-
74
- ## Cursor IDE
75
-
76
- ### Option 1: Using .p4config file (Recommended)
77
- ```json
78
- {
79
- "mcp": {
80
- "servers": {
81
- "perforce": {
82
- "command": "mcp-perforce-server",
83
- "args": [],
84
- "env": {
85
- "P4_READONLY_MODE": "false",
86
- "P4_DISABLE_DELETE": "true",
87
- "LOG_LEVEL": "error"
88
- },
89
- "alwaysAllow": true
90
- }
91
- }
92
- }
93
- }
94
- ```
95
-
96
- ### Option 2: Direct configuration in MCP config
97
- ```json
98
- {
99
- "mcp": {
100
- "servers": {
101
- "perforce": {
102
- "command": "mcp-perforce-server",
103
- "args": [],
104
- "env": {
105
- "P4PORT": "perforce-server:1666",
106
- "P4USER": "your-username",
107
- "P4CLIENT": "your-workspace-name",
108
- "P4PASSWD": "your-password",
109
- "P4_READONLY_MODE": "false",
110
- "P4_DISABLE_DELETE": "true",
111
- "LOG_LEVEL": "error"
112
- },
113
- "alwaysAllow": true
114
- }
115
- }
116
- }
117
- }
118
- ```
119
-
120
- ## Claude Desktop
121
-
122
- ### macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
123
- ### Windows: %APPDATA%\Claude\claude_desktop_config.json
124
-
125
- ### Option 1: Using .p4config file (Recommended)
126
- ```json
127
- {
128
- "mcpServers": {
129
- "perforce": {
130
- "command": "mcp-perforce-server",
131
- "args": [],
132
- "env": {
133
- "P4_READONLY_MODE": "false",
134
- "P4_DISABLE_DELETE": "true",
135
- "LOG_LEVEL": "error"
136
- },
137
- "alwaysAllow": ["p4.*"]
138
- }
139
- }
140
- }
141
- ```
142
-
143
- ### Option 2: Direct configuration in MCP config
144
- ```json
145
- {
146
- "mcpServers": {
147
- "perforce": {
148
- "command": "mcp-perforce-server",
149
- "args": [],
150
- "env": {
151
- "P4PORT": "perforce-server:1666",
152
- "P4USER": "your-username",
153
- "P4CLIENT": "your-workspace-name",
154
- "P4_READONLY_MODE": "false",
155
- "P4_DISABLE_DELETE": "true",
156
- "LOG_LEVEL": "error"
157
- },
158
- "alwaysAllow": ["p4.*"]
159
- }
160
- }
161
- }
162
- ```
163
-
164
- ## Local Development Setup (if not globally installed)
165
-
166
- Replace the "command" field with the full path to your built server:
167
-
168
- ```json
169
- {
170
- "command": "node",
171
- "args": ["/full/path/to/your/mcp-perforce-server/dist/server.js"]
172
- }
173
- ```
174
-
175
- ## Safety Configuration Levels
176
-
177
- ### Maximum Safety (Default)
178
- ```json
179
- {
180
- "env": {
181
- "P4_READONLY_MODE": "true",
182
- "P4_DISABLE_DELETE": "true"
183
- }
184
- }
185
- ```
186
-
187
- ### Write-enabled, Delete Protected
188
- ```json
189
- {
190
- "env": {
191
- "P4_READONLY_MODE": "false",
192
- "P4_DISABLE_DELETE": "true"
193
- }
194
- }
195
- ```
196
-
197
- ## Configuration Notes
198
-
199
- ### Silent Operation
200
- - `"alwaysAllow": ["p4.*"]` - Auto-approves all p4 commands, preventing VS Code approval prompts
201
- - `"alwaysAllow": true` - Auto-approves all commands (Cursor)
202
- - `"LOG_LEVEL": "error"` - Reduces console output to errors only
203
- - `"disabled": false` - Ensures the server is active
204
-
205
- ### Security Levels
206
- - **Safe**: `P4_READONLY_MODE=true, P4_DISABLE_DELETE=true` (read-only)
207
- - **Recommended**: `P4_READONLY_MODE=false, P4_DISABLE_DELETE=true` (write, no delete)
208
- - **Full Access**: `P4_READONLY_MODE=false, P4_DISABLE_DELETE=false` (use with caution)
209
-
210
- ### Troubleshooting
211
- - If commands still show approval prompts, ensure `alwaysAllow` is configured
212
- - If you see terminal output, set `LOG_LEVEL` to `"error"`
213
- - Commands execute silently in the background without terminal windows
214
-
215
- ### Full Access (Use with Caution)
216
- ```json
217
- {
218
- "env": {
219
- "P4_READONLY_MODE": "false",
220
- "P4_DISABLE_DELETE": "false"
221
- }
222
- }
223
- ```
1
+ # MCP Perforce Server Configuration Examples
2
+
3
+ All examples in this document use the default safe profile: read-only enabled and delete disabled.
4
+
5
+ ## Client Config Fields
6
+
7
+ | Field | Required | Example | Description |
8
+ |---|---|---|---|
9
+ | `command` | Yes | `"mcp-perforce-server"` | Executable to start the MCP server. |
10
+ | `args` | No | `[]` or `["/path/to/dist/server.js"]` | Command arguments (use for local build path). |
11
+ | `env` | No | `{ "P4_READONLY_MODE": "true" }` | Server environment variables. |
12
+ | `alwaysAllow` | Client-specific | `["p4.*"]` or `true` | Auto-approve tool calls to reduce prompts. |
13
+ | `disabled` | Client-specific | `false` | Enables/disables the server entry. |
14
+
15
+ ## Authentication Options
16
+
17
+ | Method | Recommended | How it works |
18
+ |---|---|---|
19
+ | `.p4config` file | Yes | Place Perforce variables in a `.p4config` file in your project/workspace root. |
20
+ | MCP `env` variables | Optional | Put Perforce variables directly in the MCP server config JSON. |
21
+
22
+ `.p4config` example:
23
+
24
+ ```ini
25
+ P4PORT=perforce-server:1666
26
+ P4USER=your-username
27
+ P4CLIENT=your-workspace-name
28
+ P4PASSWD=your-password
29
+ ```
30
+
31
+ ## Environment Variables Used In Examples
32
+
33
+ | Variable | Example Value | Default | Purpose |
34
+ |---|---|---|---|
35
+ | `P4_READONLY_MODE` | `"true"` | `true` | Keeps server in read-only mode. |
36
+ | `P4_DISABLE_DELETE` | `"true"` | `true` | Keeps delete operations disabled. |
37
+ | `LOG_LEVEL` | `"error"` | `warn` | Keeps console output minimal. |
38
+ | `P4PORT` | `"perforce-server:1666"` | unset | Perforce server address (required if not in `.p4config`). |
39
+ | `P4USER` | `"your-username"` | unset | Perforce user (required if not in `.p4config`). |
40
+ | `P4CLIENT` | `"your-workspace-name"` | unset | Perforce client/workspace (required if not in `.p4config`). |
41
+ | `P4PASSWD` | `"your-password"` | unset | Password/ticket (optional depending on server auth). |
42
+ | `P4CHARSET` | `"utf8"` | unset | Optional Perforce charset. |
43
+
44
+ For the complete server configuration table (all supported env vars), see [README.md](README.md#server-configuration-reference).
45
+
46
+ ## VS Code with Claude Dev/Cline
47
+
48
+ ### Option 1: Using `.p4config` (Recommended)
49
+
50
+ ```json
51
+ {
52
+ "mcpServers": {
53
+ "perforce": {
54
+ "command": "mcp-perforce-server",
55
+ "args": [],
56
+ "env": {
57
+ "P4_READONLY_MODE": "true",
58
+ "P4_DISABLE_DELETE": "true",
59
+ "LOG_LEVEL": "error"
60
+ },
61
+ "alwaysAllow": ["p4.*"],
62
+ "disabled": false
63
+ }
64
+ }
65
+ }
66
+ ```
67
+
68
+ ### Option 2: Direct MCP Env Configuration
69
+
70
+ ```json
71
+ {
72
+ "mcpServers": {
73
+ "perforce": {
74
+ "command": "mcp-perforce-server",
75
+ "args": [],
76
+ "env": {
77
+ "P4PORT": "perforce-server:1666",
78
+ "P4USER": "your-username",
79
+ "P4CLIENT": "your-workspace-name",
80
+ "P4PASSWD": "your-password",
81
+ "P4CHARSET": "utf8",
82
+ "P4_READONLY_MODE": "true",
83
+ "P4_DISABLE_DELETE": "true",
84
+ "LOG_LEVEL": "error"
85
+ },
86
+ "alwaysAllow": ["p4.*"],
87
+ "disabled": false
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ ## Cursor IDE
94
+
95
+ ### Option 1: Using `.p4config` (Recommended)
96
+
97
+ ```json
98
+ {
99
+ "mcp": {
100
+ "servers": {
101
+ "perforce": {
102
+ "command": "mcp-perforce-server",
103
+ "args": [],
104
+ "env": {
105
+ "P4_READONLY_MODE": "true",
106
+ "P4_DISABLE_DELETE": "true",
107
+ "LOG_LEVEL": "error"
108
+ },
109
+ "alwaysAllow": true
110
+ }
111
+ }
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### Option 2: Direct MCP Env Configuration
117
+
118
+ ```json
119
+ {
120
+ "mcp": {
121
+ "servers": {
122
+ "perforce": {
123
+ "command": "mcp-perforce-server",
124
+ "args": [],
125
+ "env": {
126
+ "P4PORT": "perforce-server:1666",
127
+ "P4USER": "your-username",
128
+ "P4CLIENT": "your-workspace-name",
129
+ "P4PASSWD": "your-password",
130
+ "P4_READONLY_MODE": "true",
131
+ "P4_DISABLE_DELETE": "true",
132
+ "LOG_LEVEL": "error"
133
+ },
134
+ "alwaysAllow": true
135
+ }
136
+ }
137
+ }
138
+ }
139
+ ```
140
+
141
+ ## Claude Desktop
142
+
143
+ Config file paths:
144
+
145
+ | Platform | Path |
146
+ |---|---|
147
+ | macOS | `~/Library/Application Support/Claude/claude_desktop_config.json` |
148
+ | Windows | `%APPDATA%\Claude\claude_desktop_config.json` |
149
+
150
+ ### Option 1: Using `.p4config` (Recommended)
151
+
152
+ ```json
153
+ {
154
+ "mcpServers": {
155
+ "perforce": {
156
+ "command": "mcp-perforce-server",
157
+ "args": [],
158
+ "env": {
159
+ "P4_READONLY_MODE": "true",
160
+ "P4_DISABLE_DELETE": "true",
161
+ "LOG_LEVEL": "error"
162
+ },
163
+ "alwaysAllow": ["p4.*"]
164
+ }
165
+ }
166
+ }
167
+ ```
168
+
169
+ ### Option 2: Direct MCP Env Configuration
170
+
171
+ ```json
172
+ {
173
+ "mcpServers": {
174
+ "perforce": {
175
+ "command": "mcp-perforce-server",
176
+ "args": [],
177
+ "env": {
178
+ "P4PORT": "perforce-server:1666",
179
+ "P4USER": "your-username",
180
+ "P4CLIENT": "your-workspace-name",
181
+ "P4_READONLY_MODE": "true",
182
+ "P4_DISABLE_DELETE": "true",
183
+ "LOG_LEVEL": "error"
184
+ },
185
+ "alwaysAllow": ["p4.*"]
186
+ }
187
+ }
188
+ }
189
+ ```
190
+
191
+ ## Local Development Setup (If Not Globally Installed)
192
+
193
+ Replace `command` with `node` and point `args` at your built server:
194
+
195
+ ```json
196
+ {
197
+ "command": "node",
198
+ "args": ["/full/path/to/your/mcp-perforce-server/dist/server.js"]
199
+ }
200
+ ```
201
+
202
+ ## Safety Profile Used In This Document
203
+
204
+ | Profile | `P4_READONLY_MODE` | `P4_DISABLE_DELETE` | Behavior |
205
+ |---|---|---|---|
206
+ | Default safe profile | `true` | `true` | Read-only; write tools and delete operations blocked by default. |
207
+
208
+ ## Troubleshooting
209
+
210
+ | Symptom | Check |
211
+ |---|---|
212
+ | Approval prompts still appear | Ensure `alwaysAllow` is configured for your client. |
213
+ | Too much terminal output | Set `LOG_LEVEL` to `"error"`. |
214
+ | Perforce auth/config errors | Verify `P4PORT`, `P4USER`, `P4CLIENT` are set via `.p4config` or MCP `env`. |