capix-mcp 2.1.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/CONTRIBUTING.md +168 -0
- package/LICENSE +201 -0
- package/README.md +309 -0
- package/bin/capix-mcp.js +2 -0
- package/dist/capixClient.d.ts +127 -0
- package/dist/capixClient.d.ts.map +1 -0
- package/dist/capixClient.js +77 -0
- package/dist/capixClient.js.map +1 -0
- package/dist/client.d.ts +119 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +308 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +307 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.d.ts +28 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +203 -0
- package/dist/prompts.js.map +1 -0
- package/dist/resources.d.ts +28 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +101 -0
- package/dist/resources.js.map +1 -0
- package/dist/server.d.ts +61 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +223 -0
- package/dist/server.js.map +1 -0
- package/dist/tools.d.ts +32 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +1101 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +194 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +43 -0
- package/dist/types.js.map +1 -0
- package/package.json +60 -0
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
# Contributing to Capix MCP
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Capix MCP! This guide covers how to build, test, and contribute to the project.
|
|
4
|
+
|
|
5
|
+
## Prerequisites
|
|
6
|
+
|
|
7
|
+
- **Node.js** >= 18
|
|
8
|
+
- **TypeScript** 5.7+ (installed as a dev dependency)
|
|
9
|
+
- A Capix account (sign up at [capix.network](https://capix.network)) for integration testing
|
|
10
|
+
|
|
11
|
+
## Getting started
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Clone the repository
|
|
15
|
+
git clone https://github.com/CapIX-Protocol/CapIX-MCP.git
|
|
16
|
+
cd CapIX-MCP
|
|
17
|
+
|
|
18
|
+
# Install dependencies
|
|
19
|
+
npm install
|
|
20
|
+
|
|
21
|
+
# Build the project
|
|
22
|
+
npm run build
|
|
23
|
+
|
|
24
|
+
# Run the server locally
|
|
25
|
+
npm start
|
|
26
|
+
|
|
27
|
+
# Or run in development mode (auto-restart on file changes)
|
|
28
|
+
npm run dev
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Project structure
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
capix-mcp/
|
|
35
|
+
├── bin/
|
|
36
|
+
│ └── capix-mcp.js # CLI entry point (imports dist/index.js)
|
|
37
|
+
├── src/
|
|
38
|
+
│ ├── index.ts # CLI argument parsing + command dispatch
|
|
39
|
+
│ ├── server.ts # McpServer assembly + transport wiring
|
|
40
|
+
│ ├── client.ts # Capix API client + auth providers
|
|
41
|
+
│ ├── tools.ts # All 59 tool definitions (Zod schemas + handlers)
|
|
42
|
+
│ ├── types.ts # Shared types (branded IDs, money, errors)
|
|
43
|
+
│ ├── resources.ts # MCP resources (capix:// URIs)
|
|
44
|
+
│ └── prompts.ts # MCP guided prompts
|
|
45
|
+
├── package.json
|
|
46
|
+
├── tsconfig.json
|
|
47
|
+
└── README.md
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Development
|
|
51
|
+
|
|
52
|
+
### Build
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm run build # Compile TypeScript to dist/
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Type-check
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
npm run typecheck # tsc --noEmit (no output = success)
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Local testing
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Authenticate
|
|
68
|
+
npm start -- login
|
|
69
|
+
|
|
70
|
+
# Run the doctor to verify auth + tool inventory
|
|
71
|
+
npm start -- doctor
|
|
72
|
+
|
|
73
|
+
# Start the server on stdio
|
|
74
|
+
npm start
|
|
75
|
+
|
|
76
|
+
# Start with HTTP transport
|
|
77
|
+
npm start -- server --http 8080 --token my-secret
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Diagnosing issues
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm start -- doctor # Auth status, base URL, tool inventory
|
|
84
|
+
npm start -- --health # JSON health report
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Code style
|
|
88
|
+
|
|
89
|
+
### TypeScript conventions
|
|
90
|
+
|
|
91
|
+
- **Strict mode** is enabled (`"strict": true` in tsconfig.json). All code must pass type-checking.
|
|
92
|
+
- **ESM modules**: the project uses `"type": "module"` in package.json. Use `.js` extensions in imports (e.g., `import { X } from "./foo.js"`).
|
|
93
|
+
- **No `any`**: prefer `unknown` + type narrowing over `any`. Use Zod schemas for runtime validation of external input.
|
|
94
|
+
- **Branded types**: IDs (`DeploymentId`, `QuoteId`, etc.) are branded string types. Never construct them with raw string casts — use the factory functions or Zod schemas.
|
|
95
|
+
|
|
96
|
+
### Tool definitions
|
|
97
|
+
|
|
98
|
+
Every tool is defined with `defineTool()`:
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
defineTool({
|
|
102
|
+
name: "capix_example",
|
|
103
|
+
description: "Short description. Read-only | Billable; requires approval.",
|
|
104
|
+
scope: "discovery",
|
|
105
|
+
...READ_ONLY, // or BILLABLE, APPROVAL_ONLY
|
|
106
|
+
inputShape: {
|
|
107
|
+
// Zod raw shape — validated by the MCP SDK before dispatch
|
|
108
|
+
},
|
|
109
|
+
outputShape: {
|
|
110
|
+
// Optional Zod raw shape for structured output validation
|
|
111
|
+
},
|
|
112
|
+
handler: async (args, { client, ctx }) => {
|
|
113
|
+
// Thin: translate Zod-validated args → client call → return upstream JSON
|
|
114
|
+
return client.get("/api/v1/example", { id: args.id });
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Key rules for tool handlers:
|
|
120
|
+
|
|
121
|
+
1. **Handlers are thin** — they translate arguments into client calls and return the upstream JSON. No business logic in the handler.
|
|
122
|
+
2. **Billable tools** must use `callBillable()` which enforces the `approvalToken` gate.
|
|
123
|
+
3. **Read-only tools** use `...READ_ONLY` and auto-run after authentication.
|
|
124
|
+
4. **Errors** — let `CapixApiError` propagate. The server wrapper catches it and surfaces it as a structured MCP error.
|
|
125
|
+
|
|
126
|
+
### Commits
|
|
127
|
+
|
|
128
|
+
- Use clear, descriptive commit messages.
|
|
129
|
+
- Reference issues in the format `Fixes #123` or `Closes #456`.
|
|
130
|
+
|
|
131
|
+
## Adding a new tool
|
|
132
|
+
|
|
133
|
+
1. Add the tool definition in `src/tools.ts` using `defineTool()`.
|
|
134
|
+
2. Place it in the appropriate scope array (`discoveryTools`, `lifecycleTools`, etc.).
|
|
135
|
+
3. Update the tool count comment at the top of `tools.ts`.
|
|
136
|
+
4. Update the README tool table.
|
|
137
|
+
5. Run `npm run typecheck` to verify.
|
|
138
|
+
6. Run `npm start -- doctor` to verify the new tool appears in the inventory.
|
|
139
|
+
|
|
140
|
+
## Pull request process
|
|
141
|
+
|
|
142
|
+
1. **Fork** the repository and create your branch from `main`.
|
|
143
|
+
2. **Write tests** if applicable (the project currently relies on integration testing via `doctor` and manual verification).
|
|
144
|
+
3. **Type-check**: `npm run typecheck` must pass with zero errors.
|
|
145
|
+
4. **Build**: `npm run build` must succeed.
|
|
146
|
+
5. **Document**: update the README tool table if you added/changed a tool.
|
|
147
|
+
6. **Submit** a pull request with a clear description of what changed and why.
|
|
148
|
+
|
|
149
|
+
### PR checklist
|
|
150
|
+
|
|
151
|
+
- [ ] `npm run typecheck` passes
|
|
152
|
+
- [ ] `npm run build` succeeds
|
|
153
|
+
- [ ] New tools are documented in README.md
|
|
154
|
+
- [ ] Tool count in `tools.ts` header comment is updated
|
|
155
|
+
- [ ] No secrets or API keys committed
|
|
156
|
+
|
|
157
|
+
## Reporting issues
|
|
158
|
+
|
|
159
|
+
- **Bugs**: open a [GitHub issue](https://github.com/CapIX-Protocol/CapIX-MCP/issues) with:
|
|
160
|
+
- `capix-mcp --version` output
|
|
161
|
+
- `capix-mcp doctor` output (redact any sensitive info)
|
|
162
|
+
- Steps to reproduce
|
|
163
|
+
- Expected vs actual behavior
|
|
164
|
+
- **Security issues**: do NOT open a public issue. Email security@capix.network.
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
By contributing, you agree that your contributions will be licensed under the [Apache-2.0 License](LICENSE).
|
package/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 2026 Capix Network
|
|
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.
|
package/README.md
ADDED
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
# Capix MCP — infrastructure controls for AI agents
|
|
2
|
+
|
|
3
|
+
Capix MCP is a [Model Context Protocol](https://modelcontextprotocol.io) server that gives AI coding agents the ability to deploy and manage private LLM instances, GPU compute, websites, and verified workloads on the [Capix network](https://capix.network) — all through a single authenticated connection.
|
|
4
|
+
|
|
5
|
+
<!--PEnd of auto-generated overview -->
|
|
6
|
+
|
|
7
|
+
## Quick start
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @capix/mcp
|
|
11
|
+
capix-mcp login
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
That's it. Your AI agent can now deploy models, manage compute, and build websites on Capix.
|
|
15
|
+
|
|
16
|
+
## How it works
|
|
17
|
+
|
|
18
|
+
Capix MCP exposes **59 tools** grouped into seven scopes. The server speaks stdio (for local agent integration) and streamable HTTP (for remote/hosted use). Authentication is handled via OAuth PKCE (through the `@capix/auth-broker`) or a simple `CAPIX_API_KEY` environment variable.
|
|
19
|
+
|
|
20
|
+
Read-only tools auto-run after authentication. Billable tools require a bound `approvalToken` — the agent obtains this after quoting the cost upstream, so no spend happens without explicit user consent.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
### Global (recommended)
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g @capix/mcp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### From source
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
git clone https://github.com/CapIX-Protocol/CapIX-MCP.git
|
|
34
|
+
cd CapIX-MCP
|
|
35
|
+
npm install
|
|
36
|
+
npm run build
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Authentication
|
|
40
|
+
|
|
41
|
+
Run the login command for an interactive OAuth flow:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
capix-mcp login
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or set environment variables directly:
|
|
48
|
+
|
|
49
|
+
| Variable | Description | Default |
|
|
50
|
+
|---|---|---|
|
|
51
|
+
| `CAPIX_BASE_URL` | Capix network URL | `https://capix.network` |
|
|
52
|
+
| `CAPIX_API_KEY` | Session token or API key (fallback when no OAuth) | — |
|
|
53
|
+
| `CAPIX_REFRESH_TOKEN` | OAuth refresh token (auto-discovery: IDE/CLI sets this) | — |
|
|
54
|
+
| `CAPIX_PROJECT_ID` | Default project id for unscoped reads | — |
|
|
55
|
+
| `CAPIX_OAUTH_CLIENT_ID` | OAuth client id | `capix-mcp` |
|
|
56
|
+
| `CAPIX_MCP_HTTP_PORT` | Port for the streamable HTTP transport | — |
|
|
57
|
+
| `CAPIX_MCP_HTTP_TOKEN` | Bearer service token guarding the HTTP transport | — |
|
|
58
|
+
|
|
59
|
+
### Auto-discovery
|
|
60
|
+
|
|
61
|
+
When run as `capix-mcp server --stdio`, the server resolves credentials in this order:
|
|
62
|
+
|
|
63
|
+
1. **`CAPIX_API_KEY`** in env — session token set by the IDE or CLI
|
|
64
|
+
2. **`CAPIX_REFRESH_TOKEN`** in env — the broker refreshes to obtain an access token
|
|
65
|
+
3. **Stored broker credentials** — OS keyring or `~/.capix/credentials.json`
|
|
66
|
+
|
|
67
|
+
If none are found, the server starts but tool calls will fail with `not_authenticated` until credentials are resolved. CapixIDE and Capix Code set `CAPIX_REFRESH_TOKEN` automatically when signed in.
|
|
68
|
+
|
|
69
|
+
### Health check
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
capix-mcp --health
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Outputs a JSON status report: version, auth method, tool count, and per-scope breakdown.
|
|
76
|
+
|
|
77
|
+
## Wire into your AI agent
|
|
78
|
+
|
|
79
|
+
### CapixIDE / Capix Code
|
|
80
|
+
|
|
81
|
+
The MCP server **auto-discovers** in both CapixIDE and Capix Code when you're signed in. The IDE sets `CAPIX_REFRESH_TOKEN` in the environment before spawning the server, so no manual configuration is needed.
|
|
82
|
+
|
|
83
|
+
To verify:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
capix-mcp doctor
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### opencode
|
|
90
|
+
|
|
91
|
+
Add to `~/.config/capix-code/opencode.json`:
|
|
92
|
+
|
|
93
|
+
```jsonc
|
|
94
|
+
{
|
|
95
|
+
"mcp": {
|
|
96
|
+
"capix": {
|
|
97
|
+
"type": "local",
|
|
98
|
+
"command": ["capix-mcp"],
|
|
99
|
+
"enabled": true
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Claude Code
|
|
106
|
+
|
|
107
|
+
Add to `.mcp.json` in your project root:
|
|
108
|
+
|
|
109
|
+
```json
|
|
110
|
+
{
|
|
111
|
+
"mcpServers": {
|
|
112
|
+
"capix": {
|
|
113
|
+
"command": "capix-mcp"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Other MCP-compatible agents
|
|
120
|
+
|
|
121
|
+
Any agent that supports the Model Context Protocol can connect. Start the server on stdio (the default):
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
capix-mcp
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
Or with streamable HTTP:
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
capix-mcp server --http 8080 --token <service-token>
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
## Tools (59)
|
|
134
|
+
|
|
135
|
+
All tools are prefixed with `capix_`. Read-only tools auto-run after authentication. Billable tools require a bound `approvalToken`.
|
|
136
|
+
|
|
137
|
+
### Discovery (9) — read-only
|
|
138
|
+
|
|
139
|
+
| Tool | Description |
|
|
140
|
+
|---|---|
|
|
141
|
+
| `capix_account` | Inspect the authenticated account: wallet, balance, limits, active deployments/agents |
|
|
142
|
+
| `capix_balance` | Get the cash balance (available / held / total) for the account |
|
|
143
|
+
| `capix_projects` | List projects visible to the authenticated account |
|
|
144
|
+
| `capix_compute_catalog` | List the live compute capability catalog (provider / region / tier / price) |
|
|
145
|
+
| `capix_model_catalog` | List the live model endpoint catalog (model id, context length, price) |
|
|
146
|
+
| `capix_network_status` | Inspect network and gateway status (provider health, lanes, emergency flags) |
|
|
147
|
+
| `capix_deployments` | List deployments with phase + allocation state |
|
|
148
|
+
| `capix_receipts` | List work receipts for the account |
|
|
149
|
+
| `capix_attestations` | List attestation records for the account |
|
|
150
|
+
|
|
151
|
+
### Planning (6) — read-only
|
|
152
|
+
|
|
153
|
+
| Tool | Description |
|
|
154
|
+
|---|---|
|
|
155
|
+
| `capix_compute_plan` | Plan a compute deployment (matching models to offers) |
|
|
156
|
+
| `capix_compute_quote` | Get a canonical quote for a compute deployment |
|
|
157
|
+
| `capix_model_plan` | Plan a model endpoint deployment |
|
|
158
|
+
| `capix_model_quote` | Get a canonical quote for a model endpoint plan |
|
|
159
|
+
| `capix_stack_validate` | Validate a multi-component stack definition |
|
|
160
|
+
| `capix_stack_plan` | Plan a multi-component stack deployment |
|
|
161
|
+
|
|
162
|
+
### Lifecycle (7) — billable, requires approval
|
|
163
|
+
|
|
164
|
+
| Tool | Description |
|
|
165
|
+
|---|---|
|
|
166
|
+
| `capix_deploy` | Deploy a resource (compute or model endpoint) from a quote |
|
|
167
|
+
| `capix_start` | Start a stopped deployment |
|
|
168
|
+
| `capix_stop` | Stop a running deployment |
|
|
169
|
+
| `capix_restart` | Restart a deployment (stop + start cycle) |
|
|
170
|
+
| `capix_delete` | Delete a deployment permanently |
|
|
171
|
+
| `capix_extend` | Extend a deployment's lifetime |
|
|
172
|
+
| `capix_cancel` | Cancel an in-progress operation |
|
|
173
|
+
|
|
174
|
+
### Networking (8) — billable, requires approval
|
|
175
|
+
|
|
176
|
+
| Tool | Description |
|
|
177
|
+
|---|---|
|
|
178
|
+
| `capix_create_vpc` | Create a VPC for a project |
|
|
179
|
+
| `capix_create_endpoint` | Create a network endpoint for a deployment |
|
|
180
|
+
| `capix_expose_port` | Expose a port on a deployment |
|
|
181
|
+
| `capix_close_port` | Close a previously exposed port |
|
|
182
|
+
| `capix_inspect_routes` | Inspect the routing table for a deployment |
|
|
183
|
+
| `capix_create_private_connection` | Create a private connection between deployments |
|
|
184
|
+
| `capix_request_dedicated_ip` | Request a dedicated IP for a deployment |
|
|
185
|
+
| `capix_port_forward` | Set up port forwarding for a deployment |
|
|
186
|
+
|
|
187
|
+
### Testing (6) — mixed
|
|
188
|
+
|
|
189
|
+
| Tool | Description |
|
|
190
|
+
|---|---|
|
|
191
|
+
| `capix_create_test_env` | Create an isolated test environment |
|
|
192
|
+
| `capix_run_health_checks` | Run health checks against a deployment |
|
|
193
|
+
| `capix_run_bounded_command` | Run a bounded shell command inside a deployment |
|
|
194
|
+
| `capix_inspect_logs` | Inspect deployment logs |
|
|
195
|
+
| `capix_inspect_metrics` | Inspect deployment metrics |
|
|
196
|
+
| `capix_destroy_task_resources` | Destroy resources created by a specific task |
|
|
197
|
+
|
|
198
|
+
### Verification (6) — read-only
|
|
199
|
+
|
|
200
|
+
| Tool | Description |
|
|
201
|
+
|---|---|
|
|
202
|
+
| `capix_fetch_attestation` | Fetch an attestation record |
|
|
203
|
+
| `capix_verify_attestation` | Verify an attestation against its expected measurements |
|
|
204
|
+
| `capix_fetch_proof` | Fetch a zkVM proof artifact for a workload |
|
|
205
|
+
| `capix_verify_proof` | Verify a zkVM proof artifact against its public inputs |
|
|
206
|
+
| `capix_inspect_measurement` | Inspect the measurement of a workload |
|
|
207
|
+
| `capix_inspect_receipt` | Inspect a work receipt in detail |
|
|
208
|
+
|
|
209
|
+
### Website (17)
|
|
210
|
+
|
|
211
|
+
| Tool | Description |
|
|
212
|
+
|---|---|
|
|
213
|
+
| `capix_website_project_string_check` | Check a website project string for validity |
|
|
214
|
+
| `capix_website_create` | Create a new website project |
|
|
215
|
+
| `capix_website_detect` | Auto-detect website framework from a repository |
|
|
216
|
+
| `capix_website_plan` | Plan a website deployment (build + hosting plan) |
|
|
217
|
+
| `capix_website_quote` | Get a canonical quote for a website deploy |
|
|
218
|
+
| `capix_website_deploy` | Deploy a website (build + host) |
|
|
219
|
+
| `capix_website_preview` | Create a preview deployment |
|
|
220
|
+
| `capix_website_promote` | Promote a preview to production |
|
|
221
|
+
| `capix_website_rollback` | Rollback a website to a previous deployment |
|
|
222
|
+
| `capix_website_get` | Get a website project descriptor |
|
|
223
|
+
| `capix_website_deployments` | List deployments for a website |
|
|
224
|
+
| `capix_website_logs` | Inspect build/runtime logs for a website |
|
|
225
|
+
| `capix_website_metrics` | Inspect request/bandwidth metrics for a website |
|
|
226
|
+
| `capix_website_domain_add` | Add a custom domain to a website |
|
|
227
|
+
| `capix_website_domain_verify` | Verify DNS ownership for a pending custom domain |
|
|
228
|
+
| `capix_website_domain_remove` | Remove a custom domain from a website |
|
|
229
|
+
| `capix_website_destroy` | Destroy a website and all its resources |
|
|
230
|
+
|
|
231
|
+
## Configuration
|
|
232
|
+
|
|
233
|
+
### Environment variables
|
|
234
|
+
|
|
235
|
+
| Variable | Required | Description |
|
|
236
|
+
|---|---|---|
|
|
237
|
+
| `CAPIX_BASE_URL` | No | Capix network URL (default: `https://capix.network`) |
|
|
238
|
+
| `CAPIX_API_KEY` | No* | Session token / API key (fallback when no OAuth) |
|
|
239
|
+
| `CAPIX_REFRESH_TOKEN` | No* | OAuth refresh token for auto-discovery |
|
|
240
|
+
| `CAPIX_PROJECT_ID` | No | Default project id for unscoped reads |
|
|
241
|
+
| `CAPIX_OAUTH_CLIENT_ID` | No | OAuth client id (default: `capix-mcp`) |
|
|
242
|
+
| `CAPIX_MCP_HTTP_PORT` | No | Port for the streamable HTTP transport |
|
|
243
|
+
| `CAPIX_MCP_HTTP_TOKEN` | No | Bearer service token guarding the HTTP transport |
|
|
244
|
+
|
|
245
|
+
\* At least one of `CAPIX_API_KEY`, `CAPIX_REFRESH_TOKEN`, or stored OAuth credentials (via `capix-mcp login`) is required for authenticated tool calls.
|
|
246
|
+
|
|
247
|
+
## CLI commands
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
capix-mcp [server] [--http <port> [--token <token>]] Run the MCP server
|
|
251
|
+
capix-mcp doctor Diagnose auth + tool inventory
|
|
252
|
+
capix-mcp login [--device] Authenticate via OAuth PKCE
|
|
253
|
+
capix-mcp logout Revoke tokens + clear credentials
|
|
254
|
+
capix-mcp --version Print version and exit
|
|
255
|
+
capix-mcp --health Run a quick health check and exit
|
|
256
|
+
capix-mcp --help Show help
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
## Example workflow: private LLM for a coding session
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# 1. Authenticate
|
|
263
|
+
capix-mcp login
|
|
264
|
+
|
|
265
|
+
# 2. Your AI agent can now (autonomously):
|
|
266
|
+
# - Browse the model catalog
|
|
267
|
+
# - Find a GPU that fits the model's VRAM requirements
|
|
268
|
+
# - Deploy + wait for the endpoint to be ready
|
|
269
|
+
# - Use the endpoint as its LLM for the coding session
|
|
270
|
+
# - Destroy the instance when done to stop billing
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
The agent follows the Capix control-plane invariants:
|
|
274
|
+
1. Read-only tools auto-run after authentication
|
|
275
|
+
2. Billable tools require a bound `approvalToken` (obtained after quoting)
|
|
276
|
+
3. Every billable action produces a work receipt with a cost breakdown
|
|
277
|
+
|
|
278
|
+
## Auto-discovery in CapixIDE and Capix Code
|
|
279
|
+
|
|
280
|
+
When you're signed in to CapixIDE or Capix Code, the IDE automatically:
|
|
281
|
+
|
|
282
|
+
1. Spawns `capix-mcp` as a local MCP server
|
|
283
|
+
2. Sets `CAPIX_REFRESH_TOKEN` in the server's environment
|
|
284
|
+
3. The server uses the refresh token to obtain a fresh access token via the broker
|
|
285
|
+
|
|
286
|
+
No manual configuration needed. Verify with:
|
|
287
|
+
|
|
288
|
+
```bash
|
|
289
|
+
capix-mcp doctor
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
## API reference
|
|
293
|
+
|
|
294
|
+
Full API documentation: [https://capix.network/docs/api](https://capix.network/docs/api)
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
Apache-2.0. See [LICENSE](LICENSE).
|
|
299
|
+
|
|
300
|
+
## Contributing
|
|
301
|
+
|
|
302
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
303
|
+
|
|
304
|
+
## Links
|
|
305
|
+
|
|
306
|
+
- **Capix Protocol** — [capix.network](https://capix.network)
|
|
307
|
+
- **Capix IDE** — [github.com/CapIX-Protocol/CapIX-IDE](https://github.com/CapIX-Protocol/CapIX-IDE)
|
|
308
|
+
- **Capix Code** (CLI assistant) — [github.com/CapIX-Protocol/CapIX-Code](https://github.com/CapIX-Protocol/CapIX-Code)
|
|
309
|
+
- **MCP Protocol** — [modelcontextprotocol.io](https://modelcontextprotocol.io)
|
package/bin/capix-mcp.js
ADDED