pr-council-mcp 0.2.0__tar.gz
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.
- pr_council_mcp-0.2.0/LICENSE.txt +207 -0
- pr_council_mcp-0.2.0/PKG-INFO +193 -0
- pr_council_mcp-0.2.0/README.md +164 -0
- pr_council_mcp-0.2.0/pyproject.toml +99 -0
- pr_council_mcp-0.2.0/pyproject.toml.orig +86 -0
- pr_council_mcp-0.2.0/src/pr_council/__init__.py +8 -0
- pr_council_mcp-0.2.0/src/pr_council/agents/__init__.py +1 -0
- pr_council_mcp-0.2.0/src/pr_council/agents/review/__init__.py +1 -0
- pr_council_mcp-0.2.0/src/pr_council/agents/review/aggregator.py +134 -0
- pr_council_mcp-0.2.0/src/pr_council/agents/review/common.py +252 -0
- pr_council_mcp-0.2.0/src/pr_council/agents/review/deliberator.py +104 -0
- pr_council_mcp-0.2.0/src/pr_council/agents/review/reviewer.py +154 -0
- pr_council_mcp-0.2.0/src/pr_council/config.py +92 -0
- pr_council_mcp-0.2.0/src/pr_council/errors.py +13 -0
- pr_council_mcp-0.2.0/src/pr_council/py.typed +1 -0
- pr_council_mcp-0.2.0/src/pr_council/review/__init__.py +1 -0
- pr_council_mcp-0.2.0/src/pr_council/review/diff.py +26 -0
- pr_council_mcp-0.2.0/src/pr_council/review/git.py +707 -0
- pr_council_mcp-0.2.0/src/pr_council/review/locks.py +32 -0
- pr_council_mcp-0.2.0/src/pr_council/review/models.py +238 -0
- pr_council_mcp-0.2.0/src/pr_council/review/policy.py +170 -0
- pr_council_mcp-0.2.0/src/pr_council/review/store.py +320 -0
- pr_council_mcp-0.2.0/src/pr_council/server.py +25 -0
- pr_council_mcp-0.2.0/src/pr_council/server_setup.py +159 -0
- pr_council_mcp-0.2.0/src/pr_council/tools/__init__.py +10 -0
- pr_council_mcp-0.2.0/src/pr_council/tools/review.py +191 -0
- pr_council_mcp-0.2.0/src/pr_council/workflows/__init__.py +1 -0
- pr_council_mcp-0.2.0/src/pr_council/workflows/registry.py +5 -0
- pr_council_mcp-0.2.0/src/pr_council/workflows/review/__init__.py +1 -0
- pr_council_mcp-0.2.0/src/pr_council/workflows/review/graph.py +1300 -0
- pr_council_mcp-0.2.0/src/pr_council/workflows/review/runtime.py +354 -0
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
Apache License Version 2.0
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Salesforce, Inc.
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Apache License
|
|
7
|
+
Version 2.0, January 2004
|
|
8
|
+
http://www.apache.org/licenses/
|
|
9
|
+
|
|
10
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
11
|
+
|
|
12
|
+
1. Definitions.
|
|
13
|
+
|
|
14
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
15
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
16
|
+
|
|
17
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
18
|
+
the copyright owner that is granting the License.
|
|
19
|
+
|
|
20
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
21
|
+
other entities that control, are controlled by, or are under common
|
|
22
|
+
control with that entity. For the purposes of this definition,
|
|
23
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
24
|
+
direction or management of such entity, whether by contract or
|
|
25
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
26
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
27
|
+
|
|
28
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
29
|
+
exercising permissions granted by this License.
|
|
30
|
+
|
|
31
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
32
|
+
including but not limited to software source code, documentation
|
|
33
|
+
source, and configuration files.
|
|
34
|
+
|
|
35
|
+
"Object" form shall mean any form resulting from mechanical
|
|
36
|
+
transformation or translation of a Source form, including but
|
|
37
|
+
not limited to compiled object code, generated documentation,
|
|
38
|
+
and conversions to other media types.
|
|
39
|
+
|
|
40
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
41
|
+
Object form, made available under the License, as indicated by a
|
|
42
|
+
copyright notice that is included in or attached to the work
|
|
43
|
+
(an example is provided in the Appendix below).
|
|
44
|
+
|
|
45
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
46
|
+
form, that is based on (or derived from) the Work and for which the
|
|
47
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
48
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
49
|
+
of this License, Derivative Works shall not include works that remain
|
|
50
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
51
|
+
the Work and Derivative Works thereof.
|
|
52
|
+
|
|
53
|
+
"Contribution" shall mean any work of authorship, including
|
|
54
|
+
the original version of the Work and any modifications or additions
|
|
55
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
56
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
57
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
58
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
59
|
+
means any form of electronic, verbal, or written communication sent
|
|
60
|
+
to the Licensor or its representatives, including but not limited to
|
|
61
|
+
communication on electronic mailing lists, source code control systems,
|
|
62
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
63
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
64
|
+
excluding communication that is conspicuously marked or otherwise
|
|
65
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
66
|
+
|
|
67
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
68
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
69
|
+
subsequently incorporated within the Work.
|
|
70
|
+
|
|
71
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
72
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
73
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
74
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
75
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
76
|
+
Work and such Derivative Works in Source or Object form.
|
|
77
|
+
|
|
78
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
79
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
80
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
81
|
+
(except as stated in this section) patent license to make, have made,
|
|
82
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
83
|
+
where such license applies only to those patent claims licensable
|
|
84
|
+
by such Contributor that are necessarily infringed by their
|
|
85
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
86
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
87
|
+
institute patent litigation against any entity (including a
|
|
88
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
89
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
90
|
+
or contributory patent infringement, then any patent licenses
|
|
91
|
+
granted to You under this License for that Work shall terminate
|
|
92
|
+
as of the date such litigation is filed.
|
|
93
|
+
|
|
94
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
95
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
96
|
+
modifications, and in Source or Object form, provided that You
|
|
97
|
+
meet the following conditions:
|
|
98
|
+
|
|
99
|
+
(a) You must give any other recipients of the Work or
|
|
100
|
+
Derivative Works a copy of this License; and
|
|
101
|
+
|
|
102
|
+
(b) You must cause any modified files to carry prominent notices
|
|
103
|
+
stating that You changed the files; and
|
|
104
|
+
|
|
105
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
106
|
+
that You distribute, all copyright, patent, trademark, and
|
|
107
|
+
attribution notices from the Source form of the Work,
|
|
108
|
+
excluding those notices that do not pertain to any part of
|
|
109
|
+
the Derivative Works; and
|
|
110
|
+
|
|
111
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
112
|
+
distribution, then any Derivative Works that You distribute must
|
|
113
|
+
include a readable copy of the attribution notices contained
|
|
114
|
+
within such NOTICE file, excluding those notices that do not
|
|
115
|
+
pertain to any part of the Derivative Works, in at least one
|
|
116
|
+
of the following places: within a NOTICE text file distributed
|
|
117
|
+
as part of the Derivative Works; within the Source form or
|
|
118
|
+
documentation, if provided along with the Derivative Works; or,
|
|
119
|
+
within a display generated by the Derivative Works, if and
|
|
120
|
+
wherever such third-party notices normally appear. The contents
|
|
121
|
+
of the NOTICE file are for informational purposes only and
|
|
122
|
+
do not modify the License. You may add Your own attribution
|
|
123
|
+
notices within Derivative Works that You distribute, alongside
|
|
124
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
125
|
+
that such additional attribution notices cannot be construed
|
|
126
|
+
as modifying the License.
|
|
127
|
+
|
|
128
|
+
You may add Your own copyright statement to Your modifications and
|
|
129
|
+
may provide additional or different license terms and conditions
|
|
130
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
131
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
132
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
133
|
+
the conditions stated in this License.
|
|
134
|
+
|
|
135
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
136
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
137
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
138
|
+
this License, without any additional terms or conditions.
|
|
139
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
140
|
+
the terms of any separate license agreement you may have executed
|
|
141
|
+
with Licensor regarding such Contributions.
|
|
142
|
+
|
|
143
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
144
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
145
|
+
except as required for reasonable and customary use in describing the
|
|
146
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
147
|
+
|
|
148
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
149
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
150
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
151
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
152
|
+
implied, including, without limitation, any warranties or conditions
|
|
153
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
154
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
155
|
+
appropriateness of using or redistributing the Work and assume any
|
|
156
|
+
risks associated with Your exercise of permissions under this License.
|
|
157
|
+
|
|
158
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
159
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
160
|
+
unless required by applicable law (such as deliberate and grossly
|
|
161
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
162
|
+
liable to You for damages, including any direct, indirect, special,
|
|
163
|
+
incidental, or consequential damages of any character arising as a
|
|
164
|
+
result of this License or out of the use or inability to use the
|
|
165
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
166
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
167
|
+
other commercial damages or losses), even if such Contributor
|
|
168
|
+
has been advised of the possibility of such damages.
|
|
169
|
+
|
|
170
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
171
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
172
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
173
|
+
or other liability obligations and/or rights consistent with this
|
|
174
|
+
License. However, in accepting such obligations, You may act only
|
|
175
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
176
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
177
|
+
defend, and hold each Contributor harmless for any liability
|
|
178
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
179
|
+
of your accepting any such warranty or additional liability.
|
|
180
|
+
|
|
181
|
+
END OF TERMS AND CONDITIONS
|
|
182
|
+
|
|
183
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
184
|
+
|
|
185
|
+
To apply the Apache License to your work, attach the following
|
|
186
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
|
187
|
+
replaced with your own identifying information. (Don't include
|
|
188
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
189
|
+
comment syntax for the file format. We also recommend that a
|
|
190
|
+
file or class name and description of purpose be included on the
|
|
191
|
+
same "printed page" as the copyright notice for easier
|
|
192
|
+
identification within third-party archives.
|
|
193
|
+
|
|
194
|
+
Copyright {yyyy} {name of copyright owner}
|
|
195
|
+
|
|
196
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
197
|
+
you may not use this file except in compliance with the License.
|
|
198
|
+
You may obtain a copy of the License at
|
|
199
|
+
|
|
200
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
201
|
+
|
|
202
|
+
Unless required by applicable law or agreed to in writing, software
|
|
203
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
204
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
205
|
+
See the License for the specific language governing permissions and
|
|
206
|
+
limitations under the License.
|
|
207
|
+
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: pr-council-mcp
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Standalone local MCP server for durable, multi-model pull-request reviews over stdio.
|
|
5
|
+
Author: Demian Brecht
|
|
6
|
+
Author-email: Demian Brecht <dbrecht@salesforce.com>
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE.txt
|
|
9
|
+
Classifier: Development Status :: 3 - Alpha
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
12
|
+
Classifier: Operating System :: MacOS
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Topic :: Software Development :: Quality Assurance
|
|
15
|
+
Requires-Dist: fastmcp>=4.0.5
|
|
16
|
+
Requires-Dist: langchain>=1.4.2,<2
|
|
17
|
+
Requires-Dist: langchain-core>=1.6.4
|
|
18
|
+
Requires-Dist: localmcplib[sandbox,server,workflows]>=0.1.3
|
|
19
|
+
Requires-Dist: pydantic>=2.13.5
|
|
20
|
+
Requires-Dist: localmcplib[telemetry]>=0.1.3 ; extra == 'langfuse'
|
|
21
|
+
Maintainer: Demian Brecht
|
|
22
|
+
Maintainer-email: Demian Brecht <dbrecht@salesforce.com>
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Project-URL: Homepage, https://github.com/salesforce-misc/pr-council-mcp
|
|
25
|
+
Project-URL: Repository, https://github.com/salesforce-misc/pr-council-mcp
|
|
26
|
+
Project-URL: Issues, https://github.com/salesforce-misc/pr-council-mcp/issues
|
|
27
|
+
Provides-Extra: langfuse
|
|
28
|
+
Description-Content-Type: text/markdown
|
|
29
|
+
|
|
30
|
+
# pr-council-mcp
|
|
31
|
+
|
|
32
|
+
`pr-council-mcp` is a local MCP server for durable, multi-model pull-request reviews. Quality and security reviewers
|
|
33
|
+
inspect a PR independently, deliberators filter their findings, and an aggregator prepares a single review for human
|
|
34
|
+
approval before anything is published to GitHub.
|
|
35
|
+
|
|
36
|
+
It is also an experimental playground running on two related tracks:
|
|
37
|
+
|
|
38
|
+
- **Infrastructure:** using an MCP seam between the conversational client and a durable service, with LangGraph
|
|
39
|
+
orchestration and recovery, constrained model tooling, macOS sandboxing, approval-gated side effects, and optional
|
|
40
|
+
Langfuse telemetry.
|
|
41
|
+
- **Product:** exploring whether multi-model, multi-disposition reviews become more useful when independent quality
|
|
42
|
+
and security findings go through deliberation, reconciliation, and aggregation before reaching a human.
|
|
43
|
+
|
|
44
|
+
> **Status: early development (alpha).** The design, tool surface, and configuration are still changing and may
|
|
45
|
+
> break between versions. Expect rough edges, and expect the interfaces to evolve as both tracks are explored.
|
|
46
|
+
|
|
47
|
+
## Quickstart
|
|
48
|
+
|
|
49
|
+
The server currently runs on macOS and requires Python 3.12+. Install
|
|
50
|
+
[`uv`](https://docs.astral.sh/uv/getting-started/installation/), `git`, [`rg`](https://github.com/BurntSushi/ripgrep),
|
|
51
|
+
and [`gh`](https://cli.github.com/), then authenticate GitHub:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
gh auth login
|
|
55
|
+
gh auth status
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
On first launch, the server creates `~/.config/localmcp/localmcp.toml` (or the path beneath `$XDG_CONFIG_HOME`) with
|
|
59
|
+
this base configuration if the file does not exist. The `llm`, `secrets`, and `observability` tables are owned by
|
|
60
|
+
localmcplib; pr-council owns only its optional `pr_review` table:
|
|
61
|
+
|
|
62
|
+
```toml
|
|
63
|
+
schema_version = 1
|
|
64
|
+
|
|
65
|
+
[llm]
|
|
66
|
+
backend = "native"
|
|
67
|
+
|
|
68
|
+
[secrets.openai_api_key]
|
|
69
|
+
env_vars = ["OPENAI_API_KEY"]
|
|
70
|
+
|
|
71
|
+
[secrets.anthropic_api_key]
|
|
72
|
+
env_vars = ["ANTHROPIC_API_KEY"]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Set `OPENAI_API_KEY` and/or `ANTHROPIC_API_KEY` for the providers used by your selected models. Native secrets may
|
|
76
|
+
instead be stored in the shared `localmcp` keyring service under the `openai_api_key` and `anthropic_api_key`
|
|
77
|
+
accounts. The server starts without these keys and reports missing credentials when a review is requested.
|
|
78
|
+
|
|
79
|
+
Install the package on demand from public PyPI in your MCP client configuration.
|
|
80
|
+
|
|
81
|
+
### Claude Code
|
|
82
|
+
|
|
83
|
+
Add `.mcp.json`:
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"mcpServers": {
|
|
88
|
+
"pr-council-mcp": {
|
|
89
|
+
"command": "uvx",
|
|
90
|
+
"args": ["--from", "pr-council-mcp", "pr-council-mcp"]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### opencode
|
|
97
|
+
|
|
98
|
+
Add `opencode.jsonc`:
|
|
99
|
+
|
|
100
|
+
```jsonc
|
|
101
|
+
{
|
|
102
|
+
"$schema": "https://opencode.ai/config.json",
|
|
103
|
+
"mcp": {
|
|
104
|
+
"pr-council-mcp": {
|
|
105
|
+
"type": "local",
|
|
106
|
+
"command": ["uvx", "--from", "pr-council-mcp", "pr-council-mcp"]
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Example session
|
|
113
|
+
|
|
114
|
+
The client owns the conversation and handles the operation ID, polling, and preview details. A typical terminal
|
|
115
|
+
session looks like this (output is illustrative):
|
|
116
|
+
|
|
117
|
+
```text
|
|
118
|
+
$ claude
|
|
119
|
+
> Use pr-council-mcp to review https://github.com/acme/widgets/pull/123.
|
|
120
|
+
Focus on authorization boundaries and regressions. Show me the review before publishing it.
|
|
121
|
+
|
|
122
|
+
The council review is ready. It found two issues:
|
|
123
|
+
1. High: a new update path does not enforce repository membership.
|
|
124
|
+
2. Medium: retries can create duplicate audit records.
|
|
125
|
+
|
|
126
|
+
I have the revision-bound publication preview. Nothing has been published.
|
|
127
|
+
|
|
128
|
+
> Publish that review.
|
|
129
|
+
|
|
130
|
+
Published the approved inline comments and COMMENT-only summary to PR #123.
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## How it works
|
|
134
|
+
|
|
135
|
+
Reviews are checkpointed operations rather than one long MCP request. The client starts a review, polls it, presents
|
|
136
|
+
the exact revision-bound preview, and publishes only after explicit approval. Restarts can recover unfinished work,
|
|
137
|
+
and publication revalidates the PR revision and approved payload before writing.
|
|
138
|
+
|
|
139
|
+
By default the server prepares an isolated managed worktree. Reviewer and deliberator models receive one bounded Bash
|
|
140
|
+
tool inside a read-only macOS Seatbelt sandbox. They can inspect source and Git history with ordinary local tools, but
|
|
141
|
+
cannot write files, access the network or credentials, or execute repository code. A local-checkout mode is also
|
|
142
|
+
available when cloning a large repository is impractical.
|
|
143
|
+
|
|
144
|
+
The MCP surface intentionally stays small: start, status, preview, commit, and cancel. Published reviews contain
|
|
145
|
+
inline comments plus a `COMMENT`-only summary; the server never approves or rejects a pull request.
|
|
146
|
+
|
|
147
|
+
## Tools
|
|
148
|
+
|
|
149
|
+
Inspect the MCP server's tool schema for complete arguments and return models.
|
|
150
|
+
|
|
151
|
+
| Tool | What it does | Important behavior and requirements |
|
|
152
|
+
| --- | --- | --- |
|
|
153
|
+
| `pr_council_start` | Starts a durable initial or follow-up PR review and returns an opaque operation ID. | Accepts a GitHub PR URL, source mode, finalized context, review mode, optional baseline, iterations, and optional model overrides. It never publishes comments. |
|
|
154
|
+
| `pr_council_get` | Polls review status, progress, failures, and completion data. | The calling agent retains the operation ID and polls until the review is ready, terminal, or needs action. |
|
|
155
|
+
| `pr_council_preview` | Returns the exact revision-bound summary and inline comments. | Read-only. The calling agent presents this payload for human review without changing it. |
|
|
156
|
+
| `pr_council_commit` | Publishes one approved preview as inline comments plus a `COMMENT`-only summary. | Requires the preview revision and payload hash, revalidates the PR endpoints and authenticated GitHub user, and never approves or rejects the PR. |
|
|
157
|
+
| `pr_council_cancel` | Requests cooperative cancellation of one owned operation. | Cancellation is unavailable once publication has begun. |
|
|
158
|
+
|
|
159
|
+
## Basic configuration
|
|
160
|
+
|
|
161
|
+
Configuration lives at `~/.config/localmcp/localmcp.toml`, or beneath `$XDG_CONFIG_HOME` when set. Shared root values
|
|
162
|
+
are inherited by every local MCP server and `[server.pr-council-mcp]` overrides this server's application settings.
|
|
163
|
+
Unknown application keys are rejected. The generated configuration uses the default reviewer matrix.
|
|
164
|
+
|
|
165
|
+
Secrets resolve from declared environment aliases first and the shared `localmcp` OS-keyring service second. The
|
|
166
|
+
native backend resolves `openai_api_key` and `anthropic_api_key` as required by the selected models. GitHub
|
|
167
|
+
authentication is owned by `gh`, with `GH_TOKEN` or `GITHUB_TOKEN` available as overrides. Secret values are never
|
|
168
|
+
logged.
|
|
169
|
+
|
|
170
|
+
Structured logs are written only to
|
|
171
|
+
`~/.local/state/localmcp/pr-council-mcp/logs/pr-council-mcp.log` (or beneath `$XDG_STATE_HOME`) because stdout and
|
|
172
|
+
stderr carry the MCP protocol. Langfuse tracing is optional and enabled with `LOCALMCP_LANGFUSE_ENABLED=true`.
|
|
173
|
+
Tool inputs and outputs remain suppressed unless `LOCALMCP_LANGFUSE_CAPTURE_PAYLOADS=true` is also set.
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
Clone [localmcplib](https://github.com/salesforce-misc/localmcplib) beside this repository, then run:
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
uv sync --frozen
|
|
181
|
+
make ci
|
|
182
|
+
uv run python -m pr_council.server
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
The checked-in `.mcp.json` and `opencode.jsonc` use that local environment. Launch Claude Code or opencode from the
|
|
186
|
+
repository root to make the development checkout available as `pr-council-mcp`.
|
|
187
|
+
|
|
188
|
+
See [AGENTS.md](AGENTS.md) for detailed architecture and implementation contracts. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
189
|
+
for contribution guidance.
|
|
190
|
+
|
|
191
|
+
## License
|
|
192
|
+
|
|
193
|
+
[Apache-2.0](LICENSE.txt)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# pr-council-mcp
|
|
2
|
+
|
|
3
|
+
`pr-council-mcp` is a local MCP server for durable, multi-model pull-request reviews. Quality and security reviewers
|
|
4
|
+
inspect a PR independently, deliberators filter their findings, and an aggregator prepares a single review for human
|
|
5
|
+
approval before anything is published to GitHub.
|
|
6
|
+
|
|
7
|
+
It is also an experimental playground running on two related tracks:
|
|
8
|
+
|
|
9
|
+
- **Infrastructure:** using an MCP seam between the conversational client and a durable service, with LangGraph
|
|
10
|
+
orchestration and recovery, constrained model tooling, macOS sandboxing, approval-gated side effects, and optional
|
|
11
|
+
Langfuse telemetry.
|
|
12
|
+
- **Product:** exploring whether multi-model, multi-disposition reviews become more useful when independent quality
|
|
13
|
+
and security findings go through deliberation, reconciliation, and aggregation before reaching a human.
|
|
14
|
+
|
|
15
|
+
> **Status: early development (alpha).** The design, tool surface, and configuration are still changing and may
|
|
16
|
+
> break between versions. Expect rough edges, and expect the interfaces to evolve as both tracks are explored.
|
|
17
|
+
|
|
18
|
+
## Quickstart
|
|
19
|
+
|
|
20
|
+
The server currently runs on macOS and requires Python 3.12+. Install
|
|
21
|
+
[`uv`](https://docs.astral.sh/uv/getting-started/installation/), `git`, [`rg`](https://github.com/BurntSushi/ripgrep),
|
|
22
|
+
and [`gh`](https://cli.github.com/), then authenticate GitHub:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
gh auth login
|
|
26
|
+
gh auth status
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
On first launch, the server creates `~/.config/localmcp/localmcp.toml` (or the path beneath `$XDG_CONFIG_HOME`) with
|
|
30
|
+
this base configuration if the file does not exist. The `llm`, `secrets`, and `observability` tables are owned by
|
|
31
|
+
localmcplib; pr-council owns only its optional `pr_review` table:
|
|
32
|
+
|
|
33
|
+
```toml
|
|
34
|
+
schema_version = 1
|
|
35
|
+
|
|
36
|
+
[llm]
|
|
37
|
+
backend = "native"
|
|
38
|
+
|
|
39
|
+
[secrets.openai_api_key]
|
|
40
|
+
env_vars = ["OPENAI_API_KEY"]
|
|
41
|
+
|
|
42
|
+
[secrets.anthropic_api_key]
|
|
43
|
+
env_vars = ["ANTHROPIC_API_KEY"]
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Set `OPENAI_API_KEY` and/or `ANTHROPIC_API_KEY` for the providers used by your selected models. Native secrets may
|
|
47
|
+
instead be stored in the shared `localmcp` keyring service under the `openai_api_key` and `anthropic_api_key`
|
|
48
|
+
accounts. The server starts without these keys and reports missing credentials when a review is requested.
|
|
49
|
+
|
|
50
|
+
Install the package on demand from public PyPI in your MCP client configuration.
|
|
51
|
+
|
|
52
|
+
### Claude Code
|
|
53
|
+
|
|
54
|
+
Add `.mcp.json`:
|
|
55
|
+
|
|
56
|
+
```json
|
|
57
|
+
{
|
|
58
|
+
"mcpServers": {
|
|
59
|
+
"pr-council-mcp": {
|
|
60
|
+
"command": "uvx",
|
|
61
|
+
"args": ["--from", "pr-council-mcp", "pr-council-mcp"]
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### opencode
|
|
68
|
+
|
|
69
|
+
Add `opencode.jsonc`:
|
|
70
|
+
|
|
71
|
+
```jsonc
|
|
72
|
+
{
|
|
73
|
+
"$schema": "https://opencode.ai/config.json",
|
|
74
|
+
"mcp": {
|
|
75
|
+
"pr-council-mcp": {
|
|
76
|
+
"type": "local",
|
|
77
|
+
"command": ["uvx", "--from", "pr-council-mcp", "pr-council-mcp"]
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### Example session
|
|
84
|
+
|
|
85
|
+
The client owns the conversation and handles the operation ID, polling, and preview details. A typical terminal
|
|
86
|
+
session looks like this (output is illustrative):
|
|
87
|
+
|
|
88
|
+
```text
|
|
89
|
+
$ claude
|
|
90
|
+
> Use pr-council-mcp to review https://github.com/acme/widgets/pull/123.
|
|
91
|
+
Focus on authorization boundaries and regressions. Show me the review before publishing it.
|
|
92
|
+
|
|
93
|
+
The council review is ready. It found two issues:
|
|
94
|
+
1. High: a new update path does not enforce repository membership.
|
|
95
|
+
2. Medium: retries can create duplicate audit records.
|
|
96
|
+
|
|
97
|
+
I have the revision-bound publication preview. Nothing has been published.
|
|
98
|
+
|
|
99
|
+
> Publish that review.
|
|
100
|
+
|
|
101
|
+
Published the approved inline comments and COMMENT-only summary to PR #123.
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## How it works
|
|
105
|
+
|
|
106
|
+
Reviews are checkpointed operations rather than one long MCP request. The client starts a review, polls it, presents
|
|
107
|
+
the exact revision-bound preview, and publishes only after explicit approval. Restarts can recover unfinished work,
|
|
108
|
+
and publication revalidates the PR revision and approved payload before writing.
|
|
109
|
+
|
|
110
|
+
By default the server prepares an isolated managed worktree. Reviewer and deliberator models receive one bounded Bash
|
|
111
|
+
tool inside a read-only macOS Seatbelt sandbox. They can inspect source and Git history with ordinary local tools, but
|
|
112
|
+
cannot write files, access the network or credentials, or execute repository code. A local-checkout mode is also
|
|
113
|
+
available when cloning a large repository is impractical.
|
|
114
|
+
|
|
115
|
+
The MCP surface intentionally stays small: start, status, preview, commit, and cancel. Published reviews contain
|
|
116
|
+
inline comments plus a `COMMENT`-only summary; the server never approves or rejects a pull request.
|
|
117
|
+
|
|
118
|
+
## Tools
|
|
119
|
+
|
|
120
|
+
Inspect the MCP server's tool schema for complete arguments and return models.
|
|
121
|
+
|
|
122
|
+
| Tool | What it does | Important behavior and requirements |
|
|
123
|
+
| --- | --- | --- |
|
|
124
|
+
| `pr_council_start` | Starts a durable initial or follow-up PR review and returns an opaque operation ID. | Accepts a GitHub PR URL, source mode, finalized context, review mode, optional baseline, iterations, and optional model overrides. It never publishes comments. |
|
|
125
|
+
| `pr_council_get` | Polls review status, progress, failures, and completion data. | The calling agent retains the operation ID and polls until the review is ready, terminal, or needs action. |
|
|
126
|
+
| `pr_council_preview` | Returns the exact revision-bound summary and inline comments. | Read-only. The calling agent presents this payload for human review without changing it. |
|
|
127
|
+
| `pr_council_commit` | Publishes one approved preview as inline comments plus a `COMMENT`-only summary. | Requires the preview revision and payload hash, revalidates the PR endpoints and authenticated GitHub user, and never approves or rejects the PR. |
|
|
128
|
+
| `pr_council_cancel` | Requests cooperative cancellation of one owned operation. | Cancellation is unavailable once publication has begun. |
|
|
129
|
+
|
|
130
|
+
## Basic configuration
|
|
131
|
+
|
|
132
|
+
Configuration lives at `~/.config/localmcp/localmcp.toml`, or beneath `$XDG_CONFIG_HOME` when set. Shared root values
|
|
133
|
+
are inherited by every local MCP server and `[server.pr-council-mcp]` overrides this server's application settings.
|
|
134
|
+
Unknown application keys are rejected. The generated configuration uses the default reviewer matrix.
|
|
135
|
+
|
|
136
|
+
Secrets resolve from declared environment aliases first and the shared `localmcp` OS-keyring service second. The
|
|
137
|
+
native backend resolves `openai_api_key` and `anthropic_api_key` as required by the selected models. GitHub
|
|
138
|
+
authentication is owned by `gh`, with `GH_TOKEN` or `GITHUB_TOKEN` available as overrides. Secret values are never
|
|
139
|
+
logged.
|
|
140
|
+
|
|
141
|
+
Structured logs are written only to
|
|
142
|
+
`~/.local/state/localmcp/pr-council-mcp/logs/pr-council-mcp.log` (or beneath `$XDG_STATE_HOME`) because stdout and
|
|
143
|
+
stderr carry the MCP protocol. Langfuse tracing is optional and enabled with `LOCALMCP_LANGFUSE_ENABLED=true`.
|
|
144
|
+
Tool inputs and outputs remain suppressed unless `LOCALMCP_LANGFUSE_CAPTURE_PAYLOADS=true` is also set.
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
Clone [localmcplib](https://github.com/salesforce-misc/localmcplib) beside this repository, then run:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
uv sync --frozen
|
|
152
|
+
make ci
|
|
153
|
+
uv run python -m pr_council.server
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
The checked-in `.mcp.json` and `opencode.jsonc` use that local environment. Launch Claude Code or opencode from the
|
|
157
|
+
repository root to make the development checkout available as `pr-council-mcp`.
|
|
158
|
+
|
|
159
|
+
See [AGENTS.md](AGENTS.md) for detailed architecture and implementation contracts. See [CONTRIBUTING.md](CONTRIBUTING.md)
|
|
160
|
+
for contribution guidance.
|
|
161
|
+
|
|
162
|
+
## License
|
|
163
|
+
|
|
164
|
+
[Apache-2.0](LICENSE.txt)
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "pr-council-mcp"
|
|
3
|
+
version = "0.2.0"
|
|
4
|
+
description = "Standalone local MCP server for durable, multi-model pull-request reviews over stdio."
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
requires-python = ">=3.12"
|
|
7
|
+
license = "Apache-2.0"
|
|
8
|
+
license-files = ["LICENSE.txt"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 3 - Alpha",
|
|
11
|
+
"Intended Audience :: Developers",
|
|
12
|
+
"License :: OSI Approved :: Apache Software License",
|
|
13
|
+
"Operating System :: MacOS",
|
|
14
|
+
"Programming Language :: Python :: 3.12",
|
|
15
|
+
"Topic :: Software Development :: Quality Assurance",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"fastmcp>=4.0.5",
|
|
19
|
+
"langchain>=1.4.2,<2",
|
|
20
|
+
"langchain-core>=1.6.4",
|
|
21
|
+
"localmcplib[sandbox,server,workflows]>=0.1.3",
|
|
22
|
+
"pydantic>=2.13.5",
|
|
23
|
+
]
|
|
24
|
+
|
|
25
|
+
[[project.authors]]
|
|
26
|
+
name = "Demian Brecht"
|
|
27
|
+
email = "dbrecht@salesforce.com"
|
|
28
|
+
|
|
29
|
+
[[project.maintainers]]
|
|
30
|
+
name = "Demian Brecht"
|
|
31
|
+
email = "dbrecht@salesforce.com"
|
|
32
|
+
|
|
33
|
+
[project.urls]
|
|
34
|
+
Homepage = "https://github.com/salesforce-misc/pr-council-mcp"
|
|
35
|
+
Repository = "https://github.com/salesforce-misc/pr-council-mcp"
|
|
36
|
+
Issues = "https://github.com/salesforce-misc/pr-council-mcp/issues"
|
|
37
|
+
|
|
38
|
+
[project.optional-dependencies]
|
|
39
|
+
langfuse = ["localmcplib[telemetry]>=0.1.3"]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
pr-council-mcp = "pr_council.server:main"
|
|
43
|
+
|
|
44
|
+
[build-system]
|
|
45
|
+
requires = ["uv_build>=0.12.17,<0.13.0"]
|
|
46
|
+
build-backend = "uv_build"
|
|
47
|
+
|
|
48
|
+
[tool.uv]
|
|
49
|
+
package = true
|
|
50
|
+
native-tls = true
|
|
51
|
+
|
|
52
|
+
[tool.uv.sources.localmcplib]
|
|
53
|
+
path = "../localmcplib"
|
|
54
|
+
|
|
55
|
+
[tool.uv.build-backend]
|
|
56
|
+
module-name = "pr_council"
|
|
57
|
+
|
|
58
|
+
[tool.pytest.ini_options]
|
|
59
|
+
testpaths = ["tests"]
|
|
60
|
+
asyncio_mode = "auto"
|
|
61
|
+
|
|
62
|
+
[tool.coverage.run]
|
|
63
|
+
branch = true
|
|
64
|
+
relative_files = true
|
|
65
|
+
source = ["src/pr_council"]
|
|
66
|
+
|
|
67
|
+
[tool.ruff]
|
|
68
|
+
line-length = 120
|
|
69
|
+
target-version = "py312"
|
|
70
|
+
src = [
|
|
71
|
+
"src",
|
|
72
|
+
"tests",
|
|
73
|
+
]
|
|
74
|
+
|
|
75
|
+
[tool.ruff.lint]
|
|
76
|
+
select = [
|
|
77
|
+
"E",
|
|
78
|
+
"F",
|
|
79
|
+
"W",
|
|
80
|
+
"I",
|
|
81
|
+
"UP",
|
|
82
|
+
"B",
|
|
83
|
+
]
|
|
84
|
+
|
|
85
|
+
[tool.ruff.format]
|
|
86
|
+
|
|
87
|
+
[tool.mypy]
|
|
88
|
+
python_version = "3.12"
|
|
89
|
+
strict = true
|
|
90
|
+
plugins = ["pydantic.mypy"]
|
|
91
|
+
|
|
92
|
+
[dependency-groups]
|
|
93
|
+
dev = [
|
|
94
|
+
"mypy>=2.3.1",
|
|
95
|
+
"pytest>=9.1.1",
|
|
96
|
+
"pytest-asyncio>=1.4.0",
|
|
97
|
+
"pytest-cov>=7.1.0",
|
|
98
|
+
"ruff>=0.16.8",
|
|
99
|
+
]
|