macp-mcp 0.1.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.
- macp_mcp-0.1.0/LICENSE +201 -0
- macp_mcp-0.1.0/PKG-INFO +225 -0
- macp_mcp-0.1.0/README.md +190 -0
- macp_mcp-0.1.0/pyproject.toml +108 -0
- macp_mcp-0.1.0/setup.cfg +4 -0
- macp_mcp-0.1.0/src/macp_mcp/__init__.py +7 -0
- macp_mcp-0.1.0/src/macp_mcp/__main__.py +31 -0
- macp_mcp-0.1.0/src/macp_mcp/_contract.py +118 -0
- macp_mcp-0.1.0/src/macp_mcp/bridge.py +399 -0
- macp_mcp-0.1.0/src/macp_mcp/config.py +124 -0
- macp_mcp-0.1.0/src/macp_mcp/results.py +144 -0
- macp_mcp-0.1.0/src/macp_mcp/server.py +250 -0
- macp_mcp-0.1.0/src/macp_mcp.egg-info/PKG-INFO +225 -0
- macp_mcp-0.1.0/src/macp_mcp.egg-info/SOURCES.txt +16 -0
- macp_mcp-0.1.0/src/macp_mcp.egg-info/dependency_links.txt +1 -0
- macp_mcp-0.1.0/src/macp_mcp.egg-info/entry_points.txt +2 -0
- macp_mcp-0.1.0/src/macp_mcp.egg-info/requires.txt +12 -0
- macp_mcp-0.1.0/src/macp_mcp.egg-info/top_level.txt +1 -0
macp_mcp-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
macp_mcp-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: macp-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server that lets any MCP client run or join a MACP Decision session
|
|
5
|
+
Author-email: Multi-Agent Coordination Protocol <macp@multiagentcoordinationprotocol.org>
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://multiagentcoordinationprotocol.io
|
|
8
|
+
Project-URL: Repository, https://github.com/multiagentcoordinationprotocol/macp-mcp
|
|
9
|
+
Project-URL: Changelog, https://github.com/multiagentcoordinationprotocol/macp-mcp/blob/main/CHANGELOG.md
|
|
10
|
+
Project-URL: Bug Tracker, https://github.com/multiagentcoordinationprotocol/macp-mcp/issues
|
|
11
|
+
Keywords: mcp,macp,multi-agent,coordination,model-context-protocol
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: macp-sdk-python<0.19,>=0.18.0
|
|
24
|
+
Requires-Dist: mcp<3,>=2.3.0
|
|
25
|
+
Requires-Dist: typing-extensions>=4.12
|
|
26
|
+
Provides-Extra: dev
|
|
27
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
28
|
+
Requires-Dist: pytest-cov>=5.0; extra == "dev"
|
|
29
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
31
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
32
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
33
|
+
Requires-Dist: jsonschema>=4.0; extra == "dev"
|
|
34
|
+
Dynamic: license-file
|
|
35
|
+
|
|
36
|
+
# macp-mcp
|
|
37
|
+
|
|
38
|
+
An MCP server that lets any MCP client (Claude Desktop, Claude Code, Cursor and
|
|
39
|
+
others) run or join a [MACP](https://multiagentcoordinationprotocol.io) Decision
|
|
40
|
+
session.
|
|
41
|
+
|
|
42
|
+
**The first proof that MACP governs MCP tool use.** MCP decides which tools a
|
|
43
|
+
model can call. MACP decides who may use them and when, and records what was
|
|
44
|
+
decided. The model drives every step through ordinary MCP tool calls. The MACP
|
|
45
|
+
runtime enforces who may propose, vote and commit, ends the session in one
|
|
46
|
+
binding Commitment, and gives that outcome an RFC-MACP-0013 hash that anyone
|
|
47
|
+
can recompute.
|
|
48
|
+
[`examples/decision-via-mcp.md`](examples/decision-via-mcp.md) is a recorded
|
|
49
|
+
run: two MCP clients drive a session to `RESOLVED`. The runtime refuses the
|
|
50
|
+
non-initiator's `commit` call, and the commitment hash verifies.
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
MCP client (model) ──stdio──▶ macp-mcp ──gRPC──▶ MACP runtime
|
|
54
|
+
tool calls one MACP agent enforces membership, order,
|
|
55
|
+
(macp-sdk-python) identity; records the Commitment
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install macp-mcp # or: uvx macp-mcp
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Python 3.11 or newer. It needs a MACP runtime to talk to. For local
|
|
65
|
+
development:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
docker run -p 50051:50051 -e MACP_ALLOW_INSECURE=1 -e MACP_MEMORY_ONLY=1 \
|
|
69
|
+
ghcr.io/multiagentcoordinationprotocol/macp-runtime:0.9.0
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
One `macp-mcp` process is one MACP agent. To have several agents take part in
|
|
73
|
+
a session, run one server per agent (for example, one per MCP client), each
|
|
74
|
+
with its own `MACP_AGENT_ID`.
|
|
75
|
+
|
|
76
|
+
## Configure your MCP client
|
|
77
|
+
|
|
78
|
+
### Claude Desktop
|
|
79
|
+
|
|
80
|
+
Add the server to `claude_desktop_config.json` (Settings → Developer → Edit Config):
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"mcpServers": {
|
|
85
|
+
"macp": {
|
|
86
|
+
"command": "uvx",
|
|
87
|
+
"args": ["macp-mcp"],
|
|
88
|
+
"env": {
|
|
89
|
+
"MACP_RUNTIME_TARGET": "127.0.0.1:50051",
|
|
90
|
+
"MACP_AGENT_ID": "coordinator",
|
|
91
|
+
"MACP_ALLOW_INSECURE": "1"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
If you installed with pip, use `"command": "macp-mcp"` and drop `args`.
|
|
99
|
+
|
|
100
|
+
### Claude Code
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
claude mcp add macp \
|
|
104
|
+
--env MACP_RUNTIME_TARGET=127.0.0.1:50051 \
|
|
105
|
+
--env MACP_AGENT_ID=coordinator \
|
|
106
|
+
--env MACP_ALLOW_INSECURE=1 \
|
|
107
|
+
-- uvx macp-mcp
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Or check it into a project's `.mcp.json`:
|
|
111
|
+
|
|
112
|
+
```json
|
|
113
|
+
{
|
|
114
|
+
"mcpServers": {
|
|
115
|
+
"macp": {
|
|
116
|
+
"command": "uvx",
|
|
117
|
+
"args": ["macp-mcp"],
|
|
118
|
+
"env": {
|
|
119
|
+
"MACP_RUNTIME_TARGET": "127.0.0.1:50051",
|
|
120
|
+
"MACP_AGENT_ID": "alice",
|
|
121
|
+
"MACP_ALLOW_INSECURE": "1"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Then ask the model something like: *"Start a MACP decision with alice on
|
|
129
|
+
which deployment plan to use, propose a canary rollout, and vote for it."*
|
|
130
|
+
|
|
131
|
+
### Against a production runtime
|
|
132
|
+
|
|
133
|
+
Drop `MACP_ALLOW_INSECURE` and pass the bearer token the runtime issued for
|
|
134
|
+
this agent:
|
|
135
|
+
|
|
136
|
+
```json
|
|
137
|
+
"env": {
|
|
138
|
+
"MACP_RUNTIME_TARGET": "macp.example.com:443",
|
|
139
|
+
"MACP_AGENT_ID": "coordinator",
|
|
140
|
+
"MACP_AUTH_TOKEN": "<token issued for coordinator>"
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Environment variables
|
|
145
|
+
|
|
146
|
+
| Variable | Default | Meaning |
|
|
147
|
+
|---|---|---|
|
|
148
|
+
| `MACP_RUNTIME_TARGET` | `127.0.0.1:50051` | Runtime gRPC address (`host:port`). |
|
|
149
|
+
| `MACP_AGENT_ID` | `mcp-agent` | The MACP agent this server acts as. With dev-agent auth it is also the bearer token. With `MACP_AUTH_TOKEN` it is the identity the runtime must bind the token to. |
|
|
150
|
+
| `MACP_AUTH_TOKEN` | unset | Bearer token issued by the runtime. When unset, dev-agent auth is used, which needs a runtime started with `MACP_ALLOW_INSECURE=1`. |
|
|
151
|
+
| `MACP_ALLOW_INSECURE` | off | `1` uses plaintext gRPC. For a local runtime only. |
|
|
152
|
+
| `MACP_TLS_CA_FILE` | system trust | PEM bundle for a private CA. Cannot be combined with `MACP_ALLOW_INSECURE`. |
|
|
153
|
+
| `MACP_DEFAULT_TTL_MS` | `300000` | Session TTL used when `start_session` is called without `ttl_ms`. |
|
|
154
|
+
| `MACP_REPLAY_IDLE_MS` | `1000` | How long a history read waits for the next envelope before treating the replay as complete. |
|
|
155
|
+
|
|
156
|
+
The server logs to stderr only, because stdout carries the MCP protocol. A
|
|
157
|
+
bad configuration exits with status 2 and a one-line message.
|
|
158
|
+
|
|
159
|
+
## Tools
|
|
160
|
+
|
|
161
|
+
| Tool | Kind | What it does |
|
|
162
|
+
|---|---|---|
|
|
163
|
+
| `start_session` | write | Start a Decision session with this agent as initiator. Takes `intent`, `participants` and optional `ttl_ms` and `context_id`. Returns the `session_id` to share. |
|
|
164
|
+
| `propose` | write | Put an option (`proposal_id`, `option`, `rationale`) up for decision. |
|
|
165
|
+
| `vote` | write | Cast this agent's `APPROVE` / `REJECT` / `ABSTAIN` vote on a proposal. |
|
|
166
|
+
| `get_commitment` | read | The resolved session's binding Commitment, the exact payload bytes (`payload_b64`) and its RFC-MACP-0013 `commitment_hash`. |
|
|
167
|
+
| `verify` | read | Recompute a commitment hash with the SDK verifier, either from the runtime's recorded history (`session_id`) or from bytes you hold (`payload_b64`). Returns `match`, `mismatch` or `cannot_verify`. |
|
|
168
|
+
| `evaluate` | write | Record a scored assessment (`APPROVE` / `REVIEW` / `BLOCK` / `REJECT`, confidence 0..1) before voting. |
|
|
169
|
+
| `commit` | write | Resolve the session with a binding Commitment (`action`, `authority_scope`, `reason`). Under the default policy only the initiator can commit. |
|
|
170
|
+
| `get_session` | read | The session's state, participants, proposals, evaluations, votes, approve totals and majority winner. |
|
|
171
|
+
|
|
172
|
+
The first five are the core loop: start, propose, vote, read the outcome and
|
|
173
|
+
check it. The other three are the minimum needed to make that loop usable
|
|
174
|
+
from MCP:
|
|
175
|
+
|
|
176
|
+
- **`commit`**: a Decision session only resolves, and only produces a
|
|
177
|
+
Commitment for `get_commitment` and `verify` to read, when someone commits.
|
|
178
|
+
Without this tool an MCP client could never finish a session it started.
|
|
179
|
+
- **`get_session`**: MCP is request/response, and the runtime's `GetSession`
|
|
180
|
+
returns metadata only. Without this tool a model joining a session has no
|
|
181
|
+
way to see what was proposed or how the votes stand. It rebuilds the
|
|
182
|
+
session view from the runtime's replayable history.
|
|
183
|
+
- **`evaluate`**: the Decision mode's assessment step. It lets an agent record
|
|
184
|
+
a reasoned, scored opinion (including a `BLOCK`) that other participants and
|
|
185
|
+
later auditors can see, separately from the bare vote.
|
|
186
|
+
|
|
187
|
+
Objections, cancellation, signals and other modes are deliberately left out.
|
|
188
|
+
They belong to orchestrators built on
|
|
189
|
+
[macp-sdk-python](https://github.com/multiagentcoordinationprotocol/macp-sdk-python).
|
|
190
|
+
|
|
191
|
+
Errors the model can act on, such as a runtime rejection or a bad argument,
|
|
192
|
+
come back as tool errors with the text `"<CODE>: <message>"`, for example
|
|
193
|
+
`FORBIDDEN: Forbidden` when a non-initiator tries to commit. The code is the
|
|
194
|
+
MACP error code (the Ack failure code, then the `macp-error-code` trailer,
|
|
195
|
+
then the gRPC status name).
|
|
196
|
+
|
|
197
|
+
The server is stateless. Every read replays the session from the runtime, so a
|
|
198
|
+
restart loses nothing, and several servers (agents) can share one session.
|
|
199
|
+
|
|
200
|
+
## Tool contract
|
|
201
|
+
|
|
202
|
+
[`contract/tools.json`](contract/tools.json) pins the tool names,
|
|
203
|
+
descriptions, annotations, input schemas and output schemas. It is fully
|
|
204
|
+
inlined JSON Schema 2020-12. The TypeScript twin
|
|
205
|
+
([macp-mcp-typescript](https://github.com/multiagentcoordinationprotocol/macp-mcp-typescript))
|
|
206
|
+
exposes the identical surface and tests against a byte-identical copy of this
|
|
207
|
+
file. Any change to the tool surface changes the manifest (`make contract`)
|
|
208
|
+
and needs the matching change in the TypeScript twin.
|
|
209
|
+
|
|
210
|
+
## Development
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
make setup # pip install -e ".[dev]"
|
|
214
|
+
make lint typecheck test # ruff, mypy strict, unit tests + 85% coverage gate
|
|
215
|
+
make verify-contract # advertised tools == contract/tools.json
|
|
216
|
+
make test-integration-docker # CI's integration gate: pinned runtime image + stdio MCP clients
|
|
217
|
+
make transcript # re-record examples/decision-via-mcp.md (runtime on :50051)
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
Releases follow macp-sdk-python: release-please opens the release PR, and
|
|
221
|
+
merging it tags `vX.Y.Z`, which publishes to PyPI through trusted publishing.
|
|
222
|
+
|
|
223
|
+
## License
|
|
224
|
+
|
|
225
|
+
Apache-2.0
|
macp_mcp-0.1.0/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# macp-mcp
|
|
2
|
+
|
|
3
|
+
An MCP server that lets any MCP client (Claude Desktop, Claude Code, Cursor and
|
|
4
|
+
others) run or join a [MACP](https://multiagentcoordinationprotocol.io) Decision
|
|
5
|
+
session.
|
|
6
|
+
|
|
7
|
+
**The first proof that MACP governs MCP tool use.** MCP decides which tools a
|
|
8
|
+
model can call. MACP decides who may use them and when, and records what was
|
|
9
|
+
decided. The model drives every step through ordinary MCP tool calls. The MACP
|
|
10
|
+
runtime enforces who may propose, vote and commit, ends the session in one
|
|
11
|
+
binding Commitment, and gives that outcome an RFC-MACP-0013 hash that anyone
|
|
12
|
+
can recompute.
|
|
13
|
+
[`examples/decision-via-mcp.md`](examples/decision-via-mcp.md) is a recorded
|
|
14
|
+
run: two MCP clients drive a session to `RESOLVED`. The runtime refuses the
|
|
15
|
+
non-initiator's `commit` call, and the commitment hash verifies.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
MCP client (model) ──stdio──▶ macp-mcp ──gRPC──▶ MACP runtime
|
|
19
|
+
tool calls one MACP agent enforces membership, order,
|
|
20
|
+
(macp-sdk-python) identity; records the Commitment
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Install
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install macp-mcp # or: uvx macp-mcp
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Python 3.11 or newer. It needs a MACP runtime to talk to. For local
|
|
30
|
+
development:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
docker run -p 50051:50051 -e MACP_ALLOW_INSECURE=1 -e MACP_MEMORY_ONLY=1 \
|
|
34
|
+
ghcr.io/multiagentcoordinationprotocol/macp-runtime:0.9.0
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
One `macp-mcp` process is one MACP agent. To have several agents take part in
|
|
38
|
+
a session, run one server per agent (for example, one per MCP client), each
|
|
39
|
+
with its own `MACP_AGENT_ID`.
|
|
40
|
+
|
|
41
|
+
## Configure your MCP client
|
|
42
|
+
|
|
43
|
+
### Claude Desktop
|
|
44
|
+
|
|
45
|
+
Add the server to `claude_desktop_config.json` (Settings → Developer → Edit Config):
|
|
46
|
+
|
|
47
|
+
```json
|
|
48
|
+
{
|
|
49
|
+
"mcpServers": {
|
|
50
|
+
"macp": {
|
|
51
|
+
"command": "uvx",
|
|
52
|
+
"args": ["macp-mcp"],
|
|
53
|
+
"env": {
|
|
54
|
+
"MACP_RUNTIME_TARGET": "127.0.0.1:50051",
|
|
55
|
+
"MACP_AGENT_ID": "coordinator",
|
|
56
|
+
"MACP_ALLOW_INSECURE": "1"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
If you installed with pip, use `"command": "macp-mcp"` and drop `args`.
|
|
64
|
+
|
|
65
|
+
### Claude Code
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
claude mcp add macp \
|
|
69
|
+
--env MACP_RUNTIME_TARGET=127.0.0.1:50051 \
|
|
70
|
+
--env MACP_AGENT_ID=coordinator \
|
|
71
|
+
--env MACP_ALLOW_INSECURE=1 \
|
|
72
|
+
-- uvx macp-mcp
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Or check it into a project's `.mcp.json`:
|
|
76
|
+
|
|
77
|
+
```json
|
|
78
|
+
{
|
|
79
|
+
"mcpServers": {
|
|
80
|
+
"macp": {
|
|
81
|
+
"command": "uvx",
|
|
82
|
+
"args": ["macp-mcp"],
|
|
83
|
+
"env": {
|
|
84
|
+
"MACP_RUNTIME_TARGET": "127.0.0.1:50051",
|
|
85
|
+
"MACP_AGENT_ID": "alice",
|
|
86
|
+
"MACP_ALLOW_INSECURE": "1"
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
Then ask the model something like: *"Start a MACP decision with alice on
|
|
94
|
+
which deployment plan to use, propose a canary rollout, and vote for it."*
|
|
95
|
+
|
|
96
|
+
### Against a production runtime
|
|
97
|
+
|
|
98
|
+
Drop `MACP_ALLOW_INSECURE` and pass the bearer token the runtime issued for
|
|
99
|
+
this agent:
|
|
100
|
+
|
|
101
|
+
```json
|
|
102
|
+
"env": {
|
|
103
|
+
"MACP_RUNTIME_TARGET": "macp.example.com:443",
|
|
104
|
+
"MACP_AGENT_ID": "coordinator",
|
|
105
|
+
"MACP_AUTH_TOKEN": "<token issued for coordinator>"
|
|
106
|
+
}
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Environment variables
|
|
110
|
+
|
|
111
|
+
| Variable | Default | Meaning |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| `MACP_RUNTIME_TARGET` | `127.0.0.1:50051` | Runtime gRPC address (`host:port`). |
|
|
114
|
+
| `MACP_AGENT_ID` | `mcp-agent` | The MACP agent this server acts as. With dev-agent auth it is also the bearer token. With `MACP_AUTH_TOKEN` it is the identity the runtime must bind the token to. |
|
|
115
|
+
| `MACP_AUTH_TOKEN` | unset | Bearer token issued by the runtime. When unset, dev-agent auth is used, which needs a runtime started with `MACP_ALLOW_INSECURE=1`. |
|
|
116
|
+
| `MACP_ALLOW_INSECURE` | off | `1` uses plaintext gRPC. For a local runtime only. |
|
|
117
|
+
| `MACP_TLS_CA_FILE` | system trust | PEM bundle for a private CA. Cannot be combined with `MACP_ALLOW_INSECURE`. |
|
|
118
|
+
| `MACP_DEFAULT_TTL_MS` | `300000` | Session TTL used when `start_session` is called without `ttl_ms`. |
|
|
119
|
+
| `MACP_REPLAY_IDLE_MS` | `1000` | How long a history read waits for the next envelope before treating the replay as complete. |
|
|
120
|
+
|
|
121
|
+
The server logs to stderr only, because stdout carries the MCP protocol. A
|
|
122
|
+
bad configuration exits with status 2 and a one-line message.
|
|
123
|
+
|
|
124
|
+
## Tools
|
|
125
|
+
|
|
126
|
+
| Tool | Kind | What it does |
|
|
127
|
+
|---|---|---|
|
|
128
|
+
| `start_session` | write | Start a Decision session with this agent as initiator. Takes `intent`, `participants` and optional `ttl_ms` and `context_id`. Returns the `session_id` to share. |
|
|
129
|
+
| `propose` | write | Put an option (`proposal_id`, `option`, `rationale`) up for decision. |
|
|
130
|
+
| `vote` | write | Cast this agent's `APPROVE` / `REJECT` / `ABSTAIN` vote on a proposal. |
|
|
131
|
+
| `get_commitment` | read | The resolved session's binding Commitment, the exact payload bytes (`payload_b64`) and its RFC-MACP-0013 `commitment_hash`. |
|
|
132
|
+
| `verify` | read | Recompute a commitment hash with the SDK verifier, either from the runtime's recorded history (`session_id`) or from bytes you hold (`payload_b64`). Returns `match`, `mismatch` or `cannot_verify`. |
|
|
133
|
+
| `evaluate` | write | Record a scored assessment (`APPROVE` / `REVIEW` / `BLOCK` / `REJECT`, confidence 0..1) before voting. |
|
|
134
|
+
| `commit` | write | Resolve the session with a binding Commitment (`action`, `authority_scope`, `reason`). Under the default policy only the initiator can commit. |
|
|
135
|
+
| `get_session` | read | The session's state, participants, proposals, evaluations, votes, approve totals and majority winner. |
|
|
136
|
+
|
|
137
|
+
The first five are the core loop: start, propose, vote, read the outcome and
|
|
138
|
+
check it. The other three are the minimum needed to make that loop usable
|
|
139
|
+
from MCP:
|
|
140
|
+
|
|
141
|
+
- **`commit`**: a Decision session only resolves, and only produces a
|
|
142
|
+
Commitment for `get_commitment` and `verify` to read, when someone commits.
|
|
143
|
+
Without this tool an MCP client could never finish a session it started.
|
|
144
|
+
- **`get_session`**: MCP is request/response, and the runtime's `GetSession`
|
|
145
|
+
returns metadata only. Without this tool a model joining a session has no
|
|
146
|
+
way to see what was proposed or how the votes stand. It rebuilds the
|
|
147
|
+
session view from the runtime's replayable history.
|
|
148
|
+
- **`evaluate`**: the Decision mode's assessment step. It lets an agent record
|
|
149
|
+
a reasoned, scored opinion (including a `BLOCK`) that other participants and
|
|
150
|
+
later auditors can see, separately from the bare vote.
|
|
151
|
+
|
|
152
|
+
Objections, cancellation, signals and other modes are deliberately left out.
|
|
153
|
+
They belong to orchestrators built on
|
|
154
|
+
[macp-sdk-python](https://github.com/multiagentcoordinationprotocol/macp-sdk-python).
|
|
155
|
+
|
|
156
|
+
Errors the model can act on, such as a runtime rejection or a bad argument,
|
|
157
|
+
come back as tool errors with the text `"<CODE>: <message>"`, for example
|
|
158
|
+
`FORBIDDEN: Forbidden` when a non-initiator tries to commit. The code is the
|
|
159
|
+
MACP error code (the Ack failure code, then the `macp-error-code` trailer,
|
|
160
|
+
then the gRPC status name).
|
|
161
|
+
|
|
162
|
+
The server is stateless. Every read replays the session from the runtime, so a
|
|
163
|
+
restart loses nothing, and several servers (agents) can share one session.
|
|
164
|
+
|
|
165
|
+
## Tool contract
|
|
166
|
+
|
|
167
|
+
[`contract/tools.json`](contract/tools.json) pins the tool names,
|
|
168
|
+
descriptions, annotations, input schemas and output schemas. It is fully
|
|
169
|
+
inlined JSON Schema 2020-12. The TypeScript twin
|
|
170
|
+
([macp-mcp-typescript](https://github.com/multiagentcoordinationprotocol/macp-mcp-typescript))
|
|
171
|
+
exposes the identical surface and tests against a byte-identical copy of this
|
|
172
|
+
file. Any change to the tool surface changes the manifest (`make contract`)
|
|
173
|
+
and needs the matching change in the TypeScript twin.
|
|
174
|
+
|
|
175
|
+
## Development
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
make setup # pip install -e ".[dev]"
|
|
179
|
+
make lint typecheck test # ruff, mypy strict, unit tests + 85% coverage gate
|
|
180
|
+
make verify-contract # advertised tools == contract/tools.json
|
|
181
|
+
make test-integration-docker # CI's integration gate: pinned runtime image + stdio MCP clients
|
|
182
|
+
make transcript # re-record examples/decision-via-mcp.md (runtime on :50051)
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
Releases follow macp-sdk-python: release-please opens the release PR, and
|
|
186
|
+
merging it tags `vX.Y.Z`, which publishes to PyPI through trusted publishing.
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
Apache-2.0
|