Skip to content

Commit 9ad4f1c

Browse files
P4 MCP Server 2026.1 - Stream Tools
P4 MCP Server 2026.1 adds full stream operations support—including switching, creating, merging, and propagation between streams—along with admin and user controls for enabling or disabling tools via p4 property at global, group, and user levels. The release introduces remote HTTP deployment for shared MCP access, a pre-built Linux binary, SSL/CA certificate support, MCP Registry discovery, and confirmation prompts for all destructive operations. Infrastructure improvements include FastMCP 3 with Search Transforms, non-root Docker execution, and a modular codebase refactor. Security fixes address two CVEs, and several bug fixes resolve issues with shared workspaces, safety gate enforcement, and unintended user creation.
1 parent c54422e commit 9ad4f1c

51 files changed

Lines changed: 7011 additions & 2672 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Dockerfile

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ RUN apt-get update && apt-get install -y \
77
build-essential \
88
&& rm -rf /var/lib/apt/lists/*
99

10-
RUN useradd -m mcpuser
1110
# Set working directory
1211
WORKDIR /app
1312

@@ -18,10 +17,18 @@ RUN pip install --no-cache-dir -r requirements.txt
1817
# Copy application code
1918
COPY src/ ./src/
2019

20+
# Create non-root user and setup permissions
21+
RUN useradd -u 1000 -m -s /bin/bash mcpuser && \
22+
mkdir -p /app/logs && \
23+
chown -R mcpuser:mcpuser /app/logs
24+
2125
# Set environment variables
2226
ENV PYTHONPATH=/app
2327
ENV P4TICKETS=/home/mcpuser/.p4tickets
28+
29+
# Switch to non-root user
30+
USER mcpuser
2431

25-
# Run the server
32+
# Run the serve
2633
ENTRYPOINT ["python3", "-m", "src.main"]
27-
CMD ["--transport", "stdio"]
34+
CMD ["--transport", "stdio"]

README.md

Lines changed: 474 additions & 60 deletions
Large diffs are not rendered by default.

THIRD-PARTY-NOTICES.txt

Lines changed: 697 additions & 834 deletions
Large diffs are not rendered by default.

p4-mcp-server.spec

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,10 @@ import os
33
import sys
44
import importlib.metadata
55
from PyInstaller.utils.hooks import collect_data_files, collect_submodules
6-
import fakeredis
7-
fakeredis_path = os.path.dirname(fakeredis.__file__)
86

97
dist = importlib.metadata.distribution("fastmcp")
108
fastmcp_dist_info = dist._path
119

12-
# Collect fakeredis data files (commands.json)
13-
fakeredis_data = collect_data_files('fakeredis')
1410

1511
# Collect rich._unicode_data submodules (dynamically imported at runtime)
1612
rich_unicode_imports = collect_submodules('rich._unicode_data')
@@ -29,10 +25,8 @@ a = Analysis(
2925
('icons/logo-p4mcp-icon.png', 'icons'),
3026
('icons/logo-p4mcp-reg.png', 'icons'),
3127
(fastmcp_dist_info, os.path.basename(fastmcp_dist_info)),
32-
(os.path.join(fakeredis_path, 'commands.json'), 'fakeredis'),
33-
(os.path.join(fakeredis_path, 'model'), 'fakeredis/model'),
34-
] + fakeredis_data,
35-
hiddenimports=['lupa', 'lupa.lua51'] + rich_unicode_imports,
28+
],
29+
hiddenimports=rich_unicode_imports,
3630
hookspath=[],
3731
hooksconfig={},
3832
runtime_hooks=[],

requirements.txt

Lines changed: 45 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,72 @@
1-
altgraph==0.17.5
1+
aiofile==3.9.0
22
annotated-types==0.7.0
3-
anyio==4.12.1
4-
attrs==25.4.0
5-
Authlib==1.6.6
3+
anyio==4.13.0
4+
attrs==26.1.0
5+
Authlib==1.6.11
66
beartype==0.22.9
7-
certifi==2026.1.4
7+
cachetools==7.0.5
8+
caio==0.9.25
9+
certifi==2026.2.25
810
cffi==2.0.0
9-
charset-normalizer==3.4.4
10-
click==8.3.1
11-
cloudpickle==3.1.2
12-
cryptography==46.0.5
13-
cyclopts==4.5.1
14-
docstring_parser==0.17.0
11+
charset-normalizer==3.4.7
12+
click==8.3.2
13+
cryptography==46.0.7
14+
cyclopts==4.10.2
15+
dnspython==2.8.0
16+
docstring_parser==0.18.0
1517
docutils==0.22.4
18+
email-validator==2.3.0
1619
exceptiongroup==1.3.1
17-
fakeredis==2.33.0
18-
fastmcp==2.14.4
20+
fastmcp==3.2.4
21+
griffelib==2.0.2
1922
h11==0.16.0
2023
httpcore==1.0.9
2124
httpx==0.28.1
2225
httpx-sse==0.4.3
2326
idna==3.11
2427
importlib_metadata==8.7.1
28+
jaraco.classes==3.4.0
29+
jaraco.context==6.1.2
30+
jaraco.functools==4.4.0
2531
jsonref==1.1.0
2632
jsonschema==4.26.0
27-
jsonschema-path==0.3.4
33+
jsonschema-path==0.4.5
2834
jsonschema-specifications==2025.9.1
29-
lupa==2.6
30-
macholib==1.16.4
35+
keyring==25.7.0
3136
markdown-it-py==4.0.0
32-
mcp==1.26.0
37+
mcp==1.27.0
3338
mdurl==0.1.2
39+
more-itertools==11.0.2
3440
openapi-pydantic==0.5.1
35-
opentelemetry-api==1.39.1
36-
opentelemetry-exporter-prometheus==0.60b1
37-
opentelemetry-instrumentation==0.60b1
38-
opentelemetry-sdk==1.39.1
39-
opentelemetry-semantic-conventions==0.60b1
41+
opentelemetry-api==1.41.0
4042
p4python==2025.2.2863679
41-
packaging==26.0
42-
pathable==0.4.4
43-
platformdirs==4.5.1
44-
prometheus_client==0.24.1
45-
py-key-value-aio==0.3.0
46-
py-key-value-shared==0.3.0
43+
packaging==26.1
44+
pathable==0.5.0
45+
platformdirs==4.9.6
46+
py-key-value-aio==0.4.4
4747
pycparser==3.0
48-
pydantic==2.12.5
49-
pydantic-settings==2.12.0
50-
pydantic_core==2.41.5
51-
pydocket==0.16.6
52-
Pygments==2.19.2
53-
PyJWT==2.11.0
48+
pydantic==2.13.2
49+
pydantic-settings==2.13.1
50+
pydantic_core==2.46.2
51+
Pygments==2.20.0
52+
PyJWT==2.12.1
5453
pyperclip==1.11.0
55-
python-dotenv==1.2.1
56-
python-json-logger==4.0.0
57-
python-multipart==0.0.22
54+
python-dotenv==1.2.2
55+
python-multipart==0.0.26
5856
PyYAML==6.0.3
59-
redis==7.1.0
60-
referencing==0.36.2
61-
requests==2.32.5
62-
rich==14.3.2
57+
referencing==0.37.0
58+
requests==2.33.1
59+
rich==15.0.0
6360
rich-rst==1.3.2
6461
rpds-py==0.30.0
65-
setuptools==80.10.2
66-
shellingham==1.5.4
67-
sortedcontainers==2.4.0
68-
sse-starlette==3.2.0
69-
starlette==0.52.1
70-
typer==0.21.1
62+
sse-starlette==3.3.4
63+
starlette==1.0.0
64+
truststore==0.10.4
7165
typing-inspection==0.4.2
7266
typing_extensions==4.15.0
67+
uncalled-for==0.3.1
7368
urllib3==2.6.3
74-
uvicorn==0.40.0
69+
uvicorn==0.44.0
70+
watchfiles==1.1.1
7571
websockets==16.0
76-
wrapt==1.17.3
77-
zipp==3.23.0
72+
zipp==3.23.1
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: p4-changelist-management
3+
description: P4 changelist workflows — create, list, submit, shelve, unshelve, and manage changelists and shelved files via P4 MCP tools. Use when: creating changelists, editing files, shelving, unshelving, submitting, organizing changes, or managing pending work in P4.
4+
---
5+
6+
# Changelist Management
7+
8+
Use the `query_changelists`, `modify_changelists`, `query_shelves`, and `modify_shelves` tools to manage P4 changelists and shelved files.
9+
10+
## Querying Changelists
11+
12+
| Action | Purpose | Key Parameters |
13+
|--------|---------|----------------|
14+
| `list` | List changelists with filters | `status`, `user`, `workspace_name`, `depot_path`, `max_results` |
15+
| `get` | Get full changelist details | `changelist_id` |
16+
17+
## Modifying Changelists
18+
19+
| Action | Purpose | Key Parameters |
20+
|--------|---------|----------------|
21+
| `create` | Create a new pending changelist | `description` |
22+
| `update` | Update changelist description or fields | `changelist_id`, `description` |
23+
| `submit` | Submit a pending changelist | `changelist_id` |
24+
| `delete` | Delete an empty pending changelist (requires approval) | `changelist_id` |
25+
| `move_files` | Move files to a target changelist | `changelist_id`, `file_paths` |
26+
27+
## Querying Shelves
28+
29+
| Action | Purpose | Key Parameters |
30+
|--------|---------|----------------|
31+
| `list` | List shelved changelists | `user`, `max_results` |
32+
| `diff` | View diff of shelved files | `changelist_id` |
33+
| `files` | List files in a shelved changelist | `changelist_id` |
34+
35+
## Modifying Shelves
36+
37+
| Action | Purpose | Key Parameters |
38+
|--------|---------|----------------|
39+
| `shelve` | Shelve files from a pending changelist | `changelist_id`, `file_paths` |
40+
| `unshelve` | Unshelve files back to the same changelist | `changelist_id`, `file_paths` |
41+
| `unshelve_to_changelist` | Unshelve files into a different changelist | `changelist_id`, `target_changelist`, `file_paths` |
42+
| `update` | Update shelved files with new edits | `changelist_id`, `file_paths` |
43+
| `delete` | Delete shelved files (requires approval) | `changelist_id`, `file_paths`, `force` |
44+
45+
## Common Workflows
46+
47+
### Make and submit a change
48+
49+
1. `modify_changelists``create` a pending changelist
50+
2. `modify_files``edit` (or `add`/`delete`) to open files for edit in the changelist
51+
3. `modify_changelists``submit` to commit the change
52+
53+
### Shelve work in progress
54+
55+
1. `modify_changelists``create` a pending changelist
56+
2. `modify_files``edit` to open files
57+
3. `modify_shelves``shelve` to store changes server-side
58+
4. `modify_files``revert` local copies (shelve is preserved)
59+
60+
### Resume shelved work
61+
62+
1. `query_shelves``list` to find your shelved changelists
63+
2. `modify_shelves``unshelve` to restore files to your workspace
64+
3. Continue editing, then `modify_changelists``submit`
65+
66+
### Organize files across changelists
67+
68+
1. `query_changelists``list` with `status=pending` to see your open changelists
69+
2. `modify_changelists``move_files` to reorganize files between changelists
70+
71+
## Best Practices
72+
73+
- Always provide a meaningful description when creating changelists.
74+
- Shelve before sharing work with others (e.g., for code review).
75+
- Use `query_shelves``diff` to verify shelved content before unshelving.
76+
- Submit changelists promptly to avoid long-lived pending changes.
77+
- Use `move_files` to keep changelists focused on a single logical change.

skills/p4-code-review/SKILL.md

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
---
2+
name: p4-code-review
3+
description: P4 code review workflows — discover, create, vote, comment, transition, and manage reviews via P4 MCP tools. Use when: creating reviews, voting, commenting, transitioning review states, managing participants, or tracking review activity in P4.
4+
---
5+
6+
# Code Review Workflows
7+
8+
Use the `query_reviews` and `modify_reviews` tools to manage P4 Code Review code reviews.
9+
10+
## Querying Reviews
11+
12+
| Action | Purpose | Key Parameters |
13+
|--------|---------|----------------|
14+
| `list` | List reviews with filters | `review_fields`, `max_results` |
15+
| `dashboard` | Get review dashboard for current user ||
16+
| `get` | Get full review details | `review_id` |
17+
| `transitions` | Get available state transitions | `review_id` |
18+
| `files` | List files in a review | `review_id` |
19+
| `files_readby` | Check which files have been read by reviewers | `review_id` |
20+
| `comments` | Get all comments on a review | `review_id` |
21+
| `activity` | Get review activity log | `review_id` |
22+
23+
## Modifying Reviews
24+
25+
### Lifecycle
26+
27+
| Action | Purpose | Key Parameters |
28+
|--------|---------|----------------|
29+
| `create` | Create a new review from a changelist | `change_id`, `description` |
30+
| `transition` | Move review to a new state | `review_id`, `transition` |
31+
| `archive_inactive` | Archive stale reviews | `not_updated_since`, `max_reviews` |
32+
| `obliterate` | Permanently remove a review (requires approval) | `review_id` |
33+
34+
### Voting & Participation
35+
36+
| Action | Purpose | Key Parameters |
37+
|--------|---------|----------------|
38+
| `vote` | Vote on a review (up/down/clear) | `review_id`, `vote_value` |
39+
| `append_participants` | Add reviewers | `review_id`, `users`, `groups` |
40+
| `replace_participants` | Replace all reviewers | `review_id`, `users`, `groups` |
41+
| `delete_participants` | Remove reviewers | `review_id`, `users`, `groups` |
42+
| `join` | Join a review as participant | `review_id` |
43+
| `leave` | Leave a review | `review_id` |
44+
45+
### Comments
46+
47+
| Action | Purpose | Key Parameters |
48+
|--------|---------|----------------|
49+
| `add_comment` | Add a new comment | `review_id`, `body`, `context` |
50+
| `reply_comment` | Reply to an existing comment | `review_id`, `comment_id`, `body` |
51+
| `mark_comment_read` | Mark a comment as read | `review_id`, `comment_id` |
52+
| `mark_comment_unread` | Mark a comment as unread | `review_id`, `comment_id` |
53+
| `mark_all_comments_read` | Mark all comments as read | `review_id` |
54+
| `mark_all_comments_unread` | Mark all comments as unread | `review_id` |
55+
56+
### Changelist Management
57+
58+
| Action | Purpose | Key Parameters |
59+
|--------|---------|----------------|
60+
| `append_change` | Add a changelist to a review | `review_id`, `change_id` |
61+
| `replace_with_change` | Replace review content with a new changelist | `review_id`, `change_id` |
62+
63+
### Metadata
64+
65+
| Action | Purpose | Key Parameters |
66+
|--------|---------|----------------|
67+
| `update_author` | Change the review author | `review_id`, `new_author` |
68+
| `update_description` | Update review description | `review_id`, `new_description` |
69+
| `refresh_projects` | Refresh project associations | `review_id` |
70+
71+
## Common Workflows
72+
73+
### Submit code for review
74+
75+
1. `modify_changelists``create` a pending changelist with your edits
76+
2. `modify_shelves``shelve` the changelist
77+
3. `modify_reviews``create` a review from the changelist
78+
4. `modify_reviews``append_participants` to add reviewers
79+
80+
### Review code
81+
82+
1. `query_reviews``dashboard` to see reviews assigned to you
83+
2. `query_reviews``get` to see review details
84+
3. `query_reviews``files` to see changed files
85+
4. `query_reviews``comments` to see existing discussion
86+
5. `modify_reviews``add_comment` to provide feedback
87+
6. `modify_reviews``vote` to approve or request changes
88+
7. `query_reviews``transitions` to see available state changes
89+
8. `modify_reviews``transition` to approve/reject
90+
91+
### Update a review
92+
93+
1. Make edits and shelve the updated changelist
94+
2. `modify_reviews``replace_with_change` to update review content
95+
3. Review comments and address feedback
96+
97+
## Best Practices
98+
99+
- Check `transitions` before calling `transition` to verify the target state is valid.
100+
- Use `files_readby` to track which reviewers have seen the latest changes.
101+
- Always `shelve` changes before creating a review so reviewers can see the diff.
102+
- Use `append_participants` rather than `replace_participants` to avoid removing existing reviewers.

0 commit comments

Comments
 (0)