@jrwoodcock/modelmux 2.0.0
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.
- package/LICENSE +202 -0
- package/NOTICE +7 -0
- package/README.md +373 -0
- package/package.json +46 -0
- package/src/server.js +686 -0
- package/src/test.js +207 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
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 2026 Jason R. Woodcock
|
|
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.
|
|
202
|
+
|
package/NOTICE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
modelmux
|
|
2
|
+
Copyright 2026 Jason R. Woodcock
|
|
3
|
+
|
|
4
|
+
This product is licensed under the Apache License, Version 2.0 (see the LICENSE
|
|
5
|
+
file). When redistributing this software or derivative works, you must retain
|
|
6
|
+
this attribution notice, credit the original author (Jason R. Woodcock), and
|
|
7
|
+
reference the original project at https://github.com/JRWoodcock/modelmux.
|
package/README.md
ADDED
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
# modelmux
|
|
2
|
+
|
|
3
|
+
> An MCP server that lets Claude Code, Codex, and Perplexity call each other as tools — directly from your terminal, mid-session, without switching windows. Supports text, code, images, and PDFs passed by file path.
|
|
4
|
+
|
|
5
|
+
**Author:** Jason R. Woodcock
|
|
6
|
+
**Version:** 2.0.0
|
|
7
|
+
**License:** Apache-2.0 — see [LICENSE](LICENSE)
|
|
8
|
+
|
|
9
|
+
Instead of copy-pasting between AI tools, you can say things like:
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
Ask Codex to review this function and compare it to your approach
|
|
13
|
+
```
|
|
14
|
+
```
|
|
15
|
+
Use the broker to get Claude and Codex opinions on this architecture, then synthesize a recommendation
|
|
16
|
+
```
|
|
17
|
+
```
|
|
18
|
+
Ask Claude to review /Users/you/project/auth.php for security vulnerabilities
|
|
19
|
+
```
|
|
20
|
+
```
|
|
21
|
+
Use the broker to analyse /Users/you/docs/architecture.pdf and suggest improvements
|
|
22
|
+
```
|
|
23
|
+
```
|
|
24
|
+
Ask Perplexity what the current best practices are for WordPress REST API auth
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
## How it works
|
|
30
|
+
|
|
31
|
+
modelmux is a small [MCP (Model Context Protocol)](https://modelcontextprotocol.io) server. Both Claude Code and Codex support MCP natively — when you register modelmux, it appears as a set of callable tools inside both agents. When you invoke one of those tools, modelmux makes a direct API call to the target AI and returns the response inline into your current session.
|
|
32
|
+
|
|
33
|
+
**It runs on-demand only.** The modelmux process starts when you open Claude Code or Codex, and stops when you close them. Nothing runs in the background.
|
|
34
|
+
|
|
35
|
+
**It uses API keys, not subscription quota.** Calls go through your Anthropic/OpenAI/Perplexity API accounts at pay-per-token rates — completely separate from your Claude Code or Codex subscription limits. Light use (a few cross-reviews per day) typically costs under $5/month across all three APIs.
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Prerequisites
|
|
40
|
+
|
|
41
|
+
- macOS (tested on MacBook Air and Mac Mini; Apple Silicon and Intel both work)
|
|
42
|
+
- [Node.js](https://nodejs.org) v18 or higher
|
|
43
|
+
- [Claude Code](https://claude.ai/code) and/or [Codex CLI](https://developers.openai.com/codex) installed
|
|
44
|
+
- API keys for the services you want to use (you can skip any you don't need)
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Installation
|
|
49
|
+
|
|
50
|
+
### Quick install
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git clone https://github.com/JRWoodcock/modelmux.git
|
|
54
|
+
cd modelmux
|
|
55
|
+
bash install.sh
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
The installer will:
|
|
59
|
+
1. Check for Node.js 18+
|
|
60
|
+
2. Prompt you for API keys and save them to `~/.zshrc`
|
|
61
|
+
3. Register modelmux with Claude Code and Codex automatically
|
|
62
|
+
4. Run a connectivity test against each API
|
|
63
|
+
|
|
64
|
+
Then restart Claude Code and/or Codex to pick up the new MCP server.
|
|
65
|
+
|
|
66
|
+
### Install from npm
|
|
67
|
+
|
|
68
|
+
The server is also published to npm. This gives you the `modelmux` command
|
|
69
|
+
without cloning, but does not set up API keys or register the server — run those
|
|
70
|
+
steps yourself (see [API keys](#api-keys) and the registration commands below).
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
npm install -g @jrwoodcock/modelmux
|
|
74
|
+
|
|
75
|
+
# Register the installed command with each agent:
|
|
76
|
+
claude mcp add modelmux -- modelmux
|
|
77
|
+
codex mcp add modelmux -- modelmux
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
The package name is scoped (`@jrwoodcock/modelmux`), but the installed command
|
|
81
|
+
is just `modelmux`.
|
|
82
|
+
|
|
83
|
+
### Installing on multiple Macs
|
|
84
|
+
|
|
85
|
+
Same steps on each machine. The installer creates `~/.modelmux/` locally from the cloned repo. Your API keys are stored in `~/.zshrc` on each machine separately — enter them fresh on each install (or sync your dotfiles if you already do that).
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# On your second Mac:
|
|
89
|
+
git clone https://github.com/JRWoodcock/modelmux.git
|
|
90
|
+
cd modelmux
|
|
91
|
+
bash install.sh
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Manual registration (if the installer skipped a tool)
|
|
95
|
+
|
|
96
|
+
If Claude Code or Codex wasn't found during install, register manually after installing them:
|
|
97
|
+
|
|
98
|
+
**Claude Code:**
|
|
99
|
+
```bash
|
|
100
|
+
claude mcp add modelmux -- node ~/.modelmux/src/server.js
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Codex:**
|
|
104
|
+
```bash
|
|
105
|
+
codex mcp add modelmux -- node ~/.modelmux/src/server.js
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## API keys
|
|
111
|
+
|
|
112
|
+
The installer prompts for these interactively. To set or update them manually:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
# Add to ~/.zshrc
|
|
116
|
+
export ANTHROPIC_API_KEY="sk-ant-..." # console.anthropic.com/settings/keys
|
|
117
|
+
export OPENAI_API_KEY="sk-..." # platform.openai.com/api-keys
|
|
118
|
+
export PERPLEXITY_API_KEY="pplx-..." # perplexity.ai/settings/api
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
Then `source ~/.zshrc` and restart Claude Code / Codex.
|
|
122
|
+
|
|
123
|
+
You only need keys for the tools you plan to use. The `broker` tool's synthesis step uses Claude, so `ANTHROPIC_API_KEY` is the most important one.
|
|
124
|
+
|
|
125
|
+
### Optional model overrides
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
export ANTHROPIC_MODEL="claude-sonnet-4-6" # default
|
|
129
|
+
export OPENAI_MODEL="gpt-4o" # default
|
|
130
|
+
export PERPLEXITY_MODEL="sonar-pro" # default
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
---
|
|
134
|
+
|
|
135
|
+
## Tools
|
|
136
|
+
|
|
137
|
+
Once registered, both Claude Code and Codex can call these tools naturally during a conversation:
|
|
138
|
+
|
|
139
|
+
| Tool | Description |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `ask_claude` | Send a prompt to Claude (Anthropic API), optionally with a file |
|
|
142
|
+
| `ask_codex` | Send a prompt to OpenAI (GPT-4o by default), optionally with a file |
|
|
143
|
+
| `ask_perplexity` | Send a prompt to Perplexity with live web search, optionally with a text/code file |
|
|
144
|
+
| `broker` | Query multiple AIs in parallel with the same prompt and file, optionally synthesize into one response |
|
|
145
|
+
|
|
146
|
+
All tools accept:
|
|
147
|
+
- `prompt` — required, the question or instruction
|
|
148
|
+
- `system` — optional system prompt to set the AI's role (e.g. `"You are a security expert reviewing code for vulnerabilities"`)
|
|
149
|
+
- `file` — optional absolute or relative path to a file on disk (see file support below)
|
|
150
|
+
|
|
151
|
+
The `broker` tool also accepts:
|
|
152
|
+
- `targets` — array of `"claude"`, `"codex"`, `"perplexity"` (default: `["claude", "codex"]`)
|
|
153
|
+
- `synthesize` — `true` (default) to get a synthesized summary, `false` for raw side-by-side responses
|
|
154
|
+
|
|
155
|
+
### File support
|
|
156
|
+
|
|
157
|
+
Pass any local file by path and modelmux will read, encode, and send it to the target AI automatically.
|
|
158
|
+
|
|
159
|
+
| File type | Extensions | ask_claude | ask_codex | ask_perplexity | broker |
|
|
160
|
+
|---|---|---|---|---|---|
|
|
161
|
+
| Code / text | `.js` `.ts` `.php` `.py` `.md` `.txt` `.json` `.css` `.html` `.sql` and more | ✅ | ✅ | ✅ | ✅ all targets |
|
|
162
|
+
| Images | `.png` `.jpg` `.jpeg` `.gif` `.webp` | ✅ vision API | ✅ vision API | ⚠️ skipped with note | ✅ Claude + Codex only |
|
|
163
|
+
| PDFs | `.pdf` | ✅ document API | ✅ inline base64 | ⚠️ skipped with note | ✅ Claude + Codex only |
|
|
164
|
+
|
|
165
|
+
When a broker call includes an image or PDF and Perplexity is a target, Perplexity receives a transparent note that a binary file was attached but not forwarded — it answers on the text prompt alone rather than silently failing.
|
|
166
|
+
|
|
167
|
+
**Size limit:** 20 MB per file. A clear error is returned if the limit is exceeded.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Usage examples
|
|
172
|
+
|
|
173
|
+
Use these prompts naturally inside Claude Code or Codex — the agent will call the appropriate tool automatically.
|
|
174
|
+
|
|
175
|
+
### Cross-review (text prompt)
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
Ask Codex to review this function and tell me if it agrees with your approach:
|
|
179
|
+
|
|
180
|
+
function parseDate(str) {
|
|
181
|
+
return new Date(str);
|
|
182
|
+
}
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
### Cross-review (file path)
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
Ask Claude to review /Users/you/project/auth.php for security vulnerabilities
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
Ask Codex to refactor /Users/you/project/utils.js and suggest a cleaner approach
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### Image analysis
|
|
196
|
+
|
|
197
|
+
```
|
|
198
|
+
Ask Claude to describe the UI layout in /Users/you/Desktop/mockup.png and
|
|
199
|
+
suggest accessibility improvements
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
```
|
|
203
|
+
Use the broker to get both Claude and Codex opinions on the architecture
|
|
204
|
+
diagram at /Users/you/docs/system-diagram.png
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### PDF review
|
|
208
|
+
|
|
209
|
+
```
|
|
210
|
+
Ask Claude to summarise the key decisions in /Users/you/docs/proposal.pdf
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
Use the broker to analyse /Users/you/docs/architecture.pdf and identify
|
|
215
|
+
any risks, with Claude and Codex each giving their perspective
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
### Parallel opinions with synthesis
|
|
219
|
+
|
|
220
|
+
```
|
|
221
|
+
Use the broker to get both Claude and Codex opinions on whether I should use
|
|
222
|
+
PostgreSQL or MongoDB for a WordPress plugin that stores form submissions.
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Raw side-by-side (no synthesis)
|
|
226
|
+
|
|
227
|
+
```
|
|
228
|
+
Use the broker with synthesize=false to compare how Claude and Codex would
|
|
229
|
+
approach rate-limiting a REST API endpoint.
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### All three AIs
|
|
233
|
+
|
|
234
|
+
```
|
|
235
|
+
Use the broker with targets ["claude", "codex", "perplexity"] to research
|
|
236
|
+
the current best MCP servers for browser automation and give me a recommendation.
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### Web-grounded research
|
|
240
|
+
|
|
241
|
+
```
|
|
242
|
+
Ask Perplexity what the latest WordPress security patches cover and whether
|
|
243
|
+
any affect the WooCommerce REST API.
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Role-scoped review
|
|
247
|
+
|
|
248
|
+
```
|
|
249
|
+
Ask Claude to review /Users/you/project/login.php as a security expert
|
|
250
|
+
looking specifically for SQL injection and authentication bypass vulnerabilities
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
## Testing your setup
|
|
256
|
+
|
|
257
|
+
```bash
|
|
258
|
+
node ~/.modelmux/src/test.js
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
This checks:
|
|
262
|
+
- Connectivity to each configured API (Claude, OpenAI, Perplexity)
|
|
263
|
+
- Local file read/write access
|
|
264
|
+
|
|
265
|
+
Run it any time you want to verify your keys are working or after moving to a new machine.
|
|
266
|
+
|
|
267
|
+
---
|
|
268
|
+
|
|
269
|
+
## Cost
|
|
270
|
+
|
|
271
|
+
modelmux calls bypass your Claude Code and Codex subscription quotas entirely. Each call is billed at standard API rates against your API accounts:
|
|
272
|
+
|
|
273
|
+
| Usage pattern | Estimated monthly cost |
|
|
274
|
+
|---|---|
|
|
275
|
+
| A few text cross-reviews per day | ~$2–5 across all APIs |
|
|
276
|
+
| Broker calls several times per day | ~$10–20 |
|
|
277
|
+
| Heavy all-day usage | Could exceed $40 |
|
|
278
|
+
|
|
279
|
+
**File calls cost more than text-only calls.** Images and PDFs are base64-encoded before being sent, which significantly increases token count. A one-page PDF or a medium-resolution image can use 10–50x the tokens of a plain text prompt. Use file-based calls when you genuinely need the AI to see the file; paste code as text when that's sufficient.
|
|
280
|
+
|
|
281
|
+
The `broker` tool with `synthesize=true` makes two Claude calls per invocation (one for the query, one for synthesis). Use `ask_claude` or `ask_codex` individually when you only need one opinion.
|
|
282
|
+
|
|
283
|
+
You need a small amount of credit loaded on each API account — even $5 on each lasts a long time at light usage. These are separate from your claude.ai and ChatGPT subscriptions:
|
|
284
|
+
- **Anthropic Console:** console.anthropic.com
|
|
285
|
+
- **OpenAI Platform:** platform.openai.com
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## File layout
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
modelmux/
|
|
293
|
+
├── install.sh ← run this on each Mac
|
|
294
|
+
├── package.json
|
|
295
|
+
├── package-lock.json
|
|
296
|
+
├── README.md
|
|
297
|
+
├── CLAUDE.md ← guidance for AI coding agents working on the repo
|
|
298
|
+
├── LICENSE ← Apache-2.0
|
|
299
|
+
├── NOTICE ← attribution notice (Apache-2.0)
|
|
300
|
+
├── .gitignore
|
|
301
|
+
└── src/
|
|
302
|
+
├── server.js ← the MCP server (stdio transport, no dependencies)
|
|
303
|
+
└── test.js ← API connectivity smoke test
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
`server.js` has no npm dependencies — it uses only Node.js built-ins and the native `fetch` API (available since Node 18). No `npm install` needed.
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Troubleshooting
|
|
311
|
+
|
|
312
|
+
**Tools don't appear in Claude Code or Codex**
|
|
313
|
+
Restart the app after registration. MCP servers are loaded at startup.
|
|
314
|
+
|
|
315
|
+
**"X_API_KEY not set" error**
|
|
316
|
+
Run `source ~/.zshrc` in your terminal before launching the AI tool, or add the export to your shell profile and open a fresh terminal.
|
|
317
|
+
|
|
318
|
+
**Connectivity test fails**
|
|
319
|
+
Check that the key is correct and that your API account has credit loaded. Perplexity requires a paid API plan (separate from Perplexity Pro).
|
|
320
|
+
|
|
321
|
+
**Registered but getting no response**
|
|
322
|
+
Run `claude mcp list` or `codex mcp list` to confirm `modelmux` appears. If it does, try the test script to isolate which API is failing.
|
|
323
|
+
|
|
324
|
+
**"File not found" error**
|
|
325
|
+
Use an absolute path (starting with `/`) rather than a relative path. In Claude Code or Codex sessions the working directory may not be where you expect. Example: `/Users/you/project/auth.php` rather than `./auth.php`.
|
|
326
|
+
|
|
327
|
+
**"File too large" error**
|
|
328
|
+
The 20 MB limit applies to the raw file size before base64 encoding. For large PDFs, consider splitting them or copying the relevant pages to a new file first.
|
|
329
|
+
|
|
330
|
+
**Image or PDF not being understood by the AI**
|
|
331
|
+
Confirm the file extension is one of the supported types. If you're using a `.jpeg` extension it will work — both `.jpg` and `.jpeg` are recognised. For PDFs, very large or scanned-only documents (no embedded text layer) may produce poor results.
|
|
332
|
+
|
|
333
|
+
**Perplexity says it can't see my image/PDF**
|
|
334
|
+
This is expected — Perplexity's API does not support vision or document inputs. The broker sends Perplexity a text note explaining the file was skipped. Use `ask_claude` or `ask_codex` directly for image and PDF analysis.
|
|
335
|
+
|
|
336
|
+
**Want to unregister**
|
|
337
|
+
```bash
|
|
338
|
+
claude mcp remove modelmux
|
|
339
|
+
codex mcp remove modelmux
|
|
340
|
+
rm -rf ~/.modelmux
|
|
341
|
+
```
|
|
342
|
+
Then remove the API key exports from `~/.zshrc` if desired.
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Contributing
|
|
347
|
+
|
|
348
|
+
Pull requests welcome. The server is intentionally minimal — a single file with no npm dependencies. Keep it that way if you can. Contributions are accepted under the Apache-2.0 license (per section 5 of the license).
|
|
349
|
+
|
|
350
|
+
If you add support for a new file type or AI provider, update the file support matrix in this README and add a test case to `src/test.js`.
|
|
351
|
+
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
## Author
|
|
355
|
+
|
|
356
|
+
Jason R. Woodcock
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## License
|
|
361
|
+
|
|
362
|
+
Licensed under the **Apache License, Version 2.0**.
|
|
363
|
+
Copyright © 2026 Jason R. Woodcock.
|
|
364
|
+
|
|
365
|
+
You are free to use, modify, and redistribute this software, including for
|
|
366
|
+
commercial purposes. In return, the license requires that you:
|
|
367
|
+
|
|
368
|
+
- retain the copyright, license, and attribution notices (see [NOTICE](NOTICE));
|
|
369
|
+
- state any significant changes you make to the files; and
|
|
370
|
+
- include a copy of the license with any redistribution.
|
|
371
|
+
|
|
372
|
+
It also includes an explicit patent grant from contributors. See the
|
|
373
|
+
[LICENSE](LICENSE) and [NOTICE](NOTICE) files for the full terms.
|
package/package.json
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jrwoodcock/modelmux",
|
|
3
|
+
"version": "2.0.0",
|
|
4
|
+
"description": "MCP server that lets Claude Code, Codex, and Perplexity call each other as tools. Supports text, code, images, and PDFs passed by file path.",
|
|
5
|
+
"author": "Jason R. Woodcock",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"main": "src/server.js",
|
|
9
|
+
"bin": {
|
|
10
|
+
"modelmux": "src/server.js"
|
|
11
|
+
},
|
|
12
|
+
"publishConfig": {
|
|
13
|
+
"access": "public"
|
|
14
|
+
},
|
|
15
|
+
"scripts": {
|
|
16
|
+
"start": "node src/server.js",
|
|
17
|
+
"test": "node src/test.js"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18.0.0"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"mcp",
|
|
24
|
+
"model-context-protocol",
|
|
25
|
+
"claude",
|
|
26
|
+
"codex",
|
|
27
|
+
"perplexity",
|
|
28
|
+
"modelmux",
|
|
29
|
+
"multi-agent",
|
|
30
|
+
"llm"
|
|
31
|
+
],
|
|
32
|
+
"repository": {
|
|
33
|
+
"type": "git",
|
|
34
|
+
"url": "git+https://github.com/JRWoodcock/modelmux.git"
|
|
35
|
+
},
|
|
36
|
+
"homepage": "https://github.com/JRWoodcock/modelmux#readme",
|
|
37
|
+
"bugs": {
|
|
38
|
+
"url": "https://github.com/JRWoodcock/modelmux/issues"
|
|
39
|
+
},
|
|
40
|
+
"files": [
|
|
41
|
+
"src",
|
|
42
|
+
"README.md",
|
|
43
|
+
"LICENSE",
|
|
44
|
+
"NOTICE"
|
|
45
|
+
]
|
|
46
|
+
}
|