curlgen-mcp 1.0.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.
- curlgen_mcp-1.0.0/LICENSE +21 -0
- curlgen_mcp-1.0.0/PKG-INFO +183 -0
- curlgen_mcp-1.0.0/README.md +152 -0
- curlgen_mcp-1.0.0/pyproject.toml +62 -0
- curlgen_mcp-1.0.0/setup.cfg +4 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/__init__.py +3 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/__main__.py +6 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/codegen.py +937 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/config.py +213 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/gate.py +437 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/http.py +243 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/paths.py +128 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/py.typed +0 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/request.py +397 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/server.py +718 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/signing.py +49 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/ssh.py +365 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp/transfer.py +136 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp.egg-info/PKG-INFO +183 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp.egg-info/SOURCES.txt +32 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp.egg-info/dependency_links.txt +1 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp.egg-info/entry_points.txt +2 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp.egg-info/requires.txt +2 -0
- curlgen_mcp-1.0.0/src/curlgen_mcp.egg-info/top_level.txt +1 -0
- curlgen_mcp-1.0.0/tests/test_codegen.py +267 -0
- curlgen_mcp-1.0.0/tests/test_config.py +208 -0
- curlgen_mcp-1.0.0/tests/test_gate.py +68 -0
- curlgen_mcp-1.0.0/tests/test_http.py +216 -0
- curlgen_mcp-1.0.0/tests/test_paths.py +100 -0
- curlgen_mcp-1.0.0/tests/test_request.py +302 -0
- curlgen_mcp-1.0.0/tests/test_server.py +518 -0
- curlgen_mcp-1.0.0/tests/test_signing.py +49 -0
- curlgen_mcp-1.0.0/tests/test_ssh.py +275 -0
- curlgen_mcp-1.0.0/tests/test_transfer.py +144 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 xiaobinger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: curlgen-mcp
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: HTTP requests, signed code generation, GateShell/SSH execution and file transfer.
|
|
5
|
+
Author: xiaobinger
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/xiaobinger/cURL_remote
|
|
8
|
+
Project-URL: Repository, https://github.com/xiaobinger/cURL_remote
|
|
9
|
+
Project-URL: Issues, https://github.com/xiaobinger/cURL_remote/issues
|
|
10
|
+
Keywords: mcp,model-context-protocol,curl,http,signature,ssh,jump-host,bastion,code-generation
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
|
+
Classifier: Topic :: Internet :: WWW/HTTP
|
|
22
|
+
Classifier: Topic :: Software Development :: Code Generators
|
|
23
|
+
Classifier: Topic :: System :: Systems Administration
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Description-Content-Type: text/markdown
|
|
27
|
+
License-File: LICENSE
|
|
28
|
+
Requires-Dist: mcp>=1.29.0
|
|
29
|
+
Requires-Dist: paramiko>=3.4
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
<!-- mcp-name: io.github.xiaobinger/curlgen-mcp -->
|
|
33
|
+
|
|
34
|
+
# cURL Generator MCP
|
|
35
|
+
|
|
36
|
+
An MCP (Model Context Protocol) server that turns the [cURL Generator / 星轨控制台](https://github.com/xiaobinger/cURL_remote) toolbox into agent-callable tools:
|
|
37
|
+
|
|
38
|
+
- **HTTP requests** — send requests locally with structured params, headers, auth and bodies.
|
|
39
|
+
- **Signed code generation** — generate `cURL`, Python, JavaScript, TypeScript, Node.js, Java, C#, Go, PHP and Rust code; optionally compute a Java-compatible MD5/SHA256 signature at runtime or embed the static value.
|
|
40
|
+
- **Signature placement** — body, header, query string, or automatic (GET-like → query, others → body), with custom field/header names.
|
|
41
|
+
- **GateShell bastion** — password login, list authorized machines, jump into a target, execute commands, run HTTP requests from inside, upload/download files.
|
|
42
|
+
- **Standard SSH jump host** — `direct-tcpip` jump execution and SFTP upload/download.
|
|
43
|
+
|
|
44
|
+
The server speaks **stdio** and reuses the desktop app's `~/.cURL` configuration, so environments, signing keys, SSH jump hosts and target machines are shared.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pip install curlgen-mcp
|
|
50
|
+
# or run without installing
|
|
51
|
+
uvx curlgen-mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Python 3.10+ is required. Dependencies: `mcp`, `paramiko`.
|
|
55
|
+
|
|
56
|
+
## MCP client configuration
|
|
57
|
+
|
|
58
|
+
```json
|
|
59
|
+
{
|
|
60
|
+
"mcpServers": {
|
|
61
|
+
"curlgen": {
|
|
62
|
+
"command": "uvx",
|
|
63
|
+
"args": ["curlgen-mcp"],
|
|
64
|
+
"env": {
|
|
65
|
+
"CURLGEN_CONFIG_DIR": "C:\\Users\\you\\.cURL"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`CURLGEN_CONFIG_DIR` is optional; it defaults to `~/.cURL`. Existing desktop-app files are read directly:
|
|
73
|
+
|
|
74
|
+
| File | Used for |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `env_configs.json` | Environments, signing keys/algorithm/field, custom variables, SSH target label |
|
|
77
|
+
| `ssh_config.json` | GateShell jump host and target machine list |
|
|
78
|
+
| `saved_requests.json` | Read-only; not used by the current tools |
|
|
79
|
+
|
|
80
|
+
Secrets are never returned by `list_environments` or `ssh_list_targets`; they are only used for the requested operation.
|
|
81
|
+
|
|
82
|
+
## Tools
|
|
83
|
+
|
|
84
|
+
| Tool | Purpose |
|
|
85
|
+
| --- | --- |
|
|
86
|
+
| `list_environments` | List environment aliases, signing settings, variable **names** and SSH target labels |
|
|
87
|
+
| `http_request` | Send an HTTP request from the local machine |
|
|
88
|
+
| `generate_code` | Generate request code in one of ten languages |
|
|
89
|
+
| `ssh_list_targets` | List configured target machines and jump host (password masked) |
|
|
90
|
+
| `ssh_exec` | Execute a command through a standard SSH jump host |
|
|
91
|
+
| `remote_http_request` | Send an HTTP request from a remote target (`transport=gateshell/ssh`) |
|
|
92
|
+
| `bastion_login` | Log in to the GateShell menu |
|
|
93
|
+
| `bastion_list_hosts` | List all machines authorized on the bastion |
|
|
94
|
+
| `bastion_connect` | Enter a target machine's shell |
|
|
95
|
+
| `bastion_exec` | Execute a command on the connected target |
|
|
96
|
+
| `bastion_status` | Show login state and the selected target |
|
|
97
|
+
| `bastion_logout` | Close the bastion session |
|
|
98
|
+
| `bastion_upload` | Upload a local file to the target via base64 chunks |
|
|
99
|
+
| `bastion_download` | Download a remote file via base64 chunks |
|
|
100
|
+
| `ssh_upload` | Upload a local file via SFTP |
|
|
101
|
+
| `ssh_download` | Download a remote file via SFTP |
|
|
102
|
+
|
|
103
|
+
### `http_request` / `generate_code` arguments
|
|
104
|
+
|
|
105
|
+
Both accept the same request shape:
|
|
106
|
+
|
|
107
|
+
- `method`, `url`, `environment`
|
|
108
|
+
- `headers`, `params`
|
|
109
|
+
- `body`, `body_type` (`json` / `form` / `raw` / `none`)
|
|
110
|
+
- `auth_type` (`none` / `bearer` / `basic` / `api_key`), `auth_token`, `auth_username`, `auth_password`, `auth_header`
|
|
111
|
+
- `sign_enabled`, `sign_placement` (`auto` / `body` / `header` / `query` / `none`), `sign_field`, `sign_header`, `sign_algo`, `sign_key`
|
|
112
|
+
- `verify_ssl`, `timeout`, `proxy`, `follow_redirects`
|
|
113
|
+
|
|
114
|
+
`generate_code` additionally takes `lang` and `sign_mode` (`static` / `runtime`).
|
|
115
|
+
|
|
116
|
+
### Signing compatibility
|
|
117
|
+
|
|
118
|
+
The signature string follows the Java backend used by the desktop app:
|
|
119
|
+
|
|
120
|
+
```text
|
|
121
|
+
sorted(k1=v1&k2=v2&...) + "&" + "key=" + secret
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
- Keys are sorted case-insensitively by upper-cased name.
|
|
125
|
+
- Empty values, `None`, and the signature field itself are excluded.
|
|
126
|
+
- MD5 and SHA256 both return upper-case hex.
|
|
127
|
+
- Query params and JSON / form / raw body params are merged before signing.
|
|
128
|
+
- `sign_placement=auto` puts the signature in the query string for `GET` / `HEAD` / `OPTIONS`, otherwise in the body.
|
|
129
|
+
- `sign_header` defaults to `X-Sign`; `sign_field` defaults to the environment's `param_name` (usually `sign`).
|
|
130
|
+
|
|
131
|
+
Runtime signing code is generated for Python, JavaScript, TypeScript, Node.js and Java. Other languages receive the static signature value (already injected into the URL, headers or body). This keeps generated snippets runnable without adding signing logic to every ecosystem.
|
|
132
|
+
|
|
133
|
+
Runtime signing snippets read the key from the `CURLGEN_SIGN_KEY` environment
|
|
134
|
+
variable; the real key is never embedded in generated code. Set it before
|
|
135
|
+
running the snippet, for example:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
export CURLGEN_SIGN_KEY="your-key" # PowerShell: $env:CURLGEN_SIGN_KEY="your-key"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## GateShell notes
|
|
142
|
+
|
|
143
|
+
GateShell is a **menu-based** bastion. It does not support SSH `exec` and does not pass raw TCP through `direct-tcpip`; this server therefore drives its interactive menu:
|
|
144
|
+
|
|
145
|
+
```text
|
|
146
|
+
password login → invoke_shell menu → /<ip> search → Enter → target shell
|
|
147
|
+
→ sentinel-wrapped command → exit code + output
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The session is reused across tool calls; call `bastion_logout` to close it.
|
|
151
|
+
|
|
152
|
+
## File transfer
|
|
153
|
+
|
|
154
|
+
- GateShell uploads: truncate the remote path, append base64 chunks, then verify size and SHA-256.
|
|
155
|
+
- GateShell downloads: check remote size, read one base64 stream, decode locally, then verify size and SHA-256.
|
|
156
|
+
- Standard SSH: SFTP with the same size and SHA-256 checks.
|
|
157
|
+
- Default maximum transfer size is 8 MiB (`CURLGEN_MCP_MAX_TRANSFER` bytes). GateShell commands are capped at 16 KiB of payload even if `CURLGEN_MCP_CHUNK_SIZE` is larger.
|
|
158
|
+
- Local paths are restricted to `$HOME` and the current working directory by default. Override with `CURLGEN_MCP_FILE_ROOTS` (OS path separator, `;` on Windows, `:` on POSIX). Symlinks are resolved before the check.
|
|
159
|
+
|
|
160
|
+
## Environment variables
|
|
161
|
+
|
|
162
|
+
| Variable | Default | Meaning |
|
|
163
|
+
| --- | --- | --- |
|
|
164
|
+
| `CURLGEN_CONFIG_DIR` | `~/.cURL` | Configuration directory |
|
|
165
|
+
| `CURLGEN_ENV` | — | Default environment alias |
|
|
166
|
+
| `CURLGEN_SIGN_KEY` | — | Override the environment signing key |
|
|
167
|
+
| `CURLGEN_SIGN_ALGO` | — | Override `MD5` / `SHA256` |
|
|
168
|
+
| `CURLGEN_JUMP_HOST` / `CURLGEN_JUMP_PORT` / `CURLGEN_JUMP_USER` / `CURLGEN_JUMP_PASSWORD` | — | Override jump host settings |
|
|
169
|
+
| `CURLGEN_TARGET_HOST` / `CURLGEN_TARGET_PORT` / `CURLGEN_TARGET_USER` / `CURLGEN_TARGET_PASSWORD` / `CURLGEN_TARGET_KEY` | — | Override target machine settings |
|
|
170
|
+
| `CURLGEN_JUMP_KEY` | — | Jump-host private key path |
|
|
171
|
+
| `CURLGEN_MCP_FILE_ROOTS` | `$HOME` + CWD | Allowed local paths for transfer |
|
|
172
|
+
| `CURLGEN_MCP_MAX_TRANSFER` | `8388608` | Maximum upload/download bytes |
|
|
173
|
+
| `CURLGEN_MCP_CHUNK_SIZE` | `65536` | GateShell transfer chunk bytes (capped at 16384) |
|
|
174
|
+
| `CURLGEN_MCP_MAX_RESPONSE` | `2097152` | Maximum response bytes (local and remote, max 20 MiB) |
|
|
175
|
+
| `CURLGEN_MCP_LOG_LEVEL` | `INFO` | Server log level written to stderr |
|
|
176
|
+
|
|
177
|
+
## Security
|
|
178
|
+
|
|
179
|
+
This server can execute commands and transfer files on remote machines. Run it only in MCP clients you trust, protect `~/.cURL` (it can contain signing keys and the jump-host password), and prefer environment-variable injection for secrets in CI. Every command is explicitly requested by the agent; no background jobs are started. Request previews and generated code intentionally include the request's own credentials (for example a bearer token) so the snippet can run; signing keys and SSH passwords are not included. Disabling TLS verification (`verify_ssl=false`) or using a proxy exposes traffic to interception — use only when you understand the risk.
|
|
180
|
+
|
|
181
|
+
## License
|
|
182
|
+
|
|
183
|
+
MIT. Registry metadata marker: `mcp-name: io.github.xiaobinger/curlgen-mcp`
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
<!-- mcp-name: io.github.xiaobinger/curlgen-mcp -->
|
|
2
|
+
|
|
3
|
+
# cURL Generator MCP
|
|
4
|
+
|
|
5
|
+
An MCP (Model Context Protocol) server that turns the [cURL Generator / 星轨控制台](https://github.com/xiaobinger/cURL_remote) toolbox into agent-callable tools:
|
|
6
|
+
|
|
7
|
+
- **HTTP requests** — send requests locally with structured params, headers, auth and bodies.
|
|
8
|
+
- **Signed code generation** — generate `cURL`, Python, JavaScript, TypeScript, Node.js, Java, C#, Go, PHP and Rust code; optionally compute a Java-compatible MD5/SHA256 signature at runtime or embed the static value.
|
|
9
|
+
- **Signature placement** — body, header, query string, or automatic (GET-like → query, others → body), with custom field/header names.
|
|
10
|
+
- **GateShell bastion** — password login, list authorized machines, jump into a target, execute commands, run HTTP requests from inside, upload/download files.
|
|
11
|
+
- **Standard SSH jump host** — `direct-tcpip` jump execution and SFTP upload/download.
|
|
12
|
+
|
|
13
|
+
The server speaks **stdio** and reuses the desktop app's `~/.cURL` configuration, so environments, signing keys, SSH jump hosts and target machines are shared.
|
|
14
|
+
|
|
15
|
+
## Install
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pip install curlgen-mcp
|
|
19
|
+
# or run without installing
|
|
20
|
+
uvx curlgen-mcp
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Python 3.10+ is required. Dependencies: `mcp`, `paramiko`.
|
|
24
|
+
|
|
25
|
+
## MCP client configuration
|
|
26
|
+
|
|
27
|
+
```json
|
|
28
|
+
{
|
|
29
|
+
"mcpServers": {
|
|
30
|
+
"curlgen": {
|
|
31
|
+
"command": "uvx",
|
|
32
|
+
"args": ["curlgen-mcp"],
|
|
33
|
+
"env": {
|
|
34
|
+
"CURLGEN_CONFIG_DIR": "C:\\Users\\you\\.cURL"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`CURLGEN_CONFIG_DIR` is optional; it defaults to `~/.cURL`. Existing desktop-app files are read directly:
|
|
42
|
+
|
|
43
|
+
| File | Used for |
|
|
44
|
+
| --- | --- |
|
|
45
|
+
| `env_configs.json` | Environments, signing keys/algorithm/field, custom variables, SSH target label |
|
|
46
|
+
| `ssh_config.json` | GateShell jump host and target machine list |
|
|
47
|
+
| `saved_requests.json` | Read-only; not used by the current tools |
|
|
48
|
+
|
|
49
|
+
Secrets are never returned by `list_environments` or `ssh_list_targets`; they are only used for the requested operation.
|
|
50
|
+
|
|
51
|
+
## Tools
|
|
52
|
+
|
|
53
|
+
| Tool | Purpose |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `list_environments` | List environment aliases, signing settings, variable **names** and SSH target labels |
|
|
56
|
+
| `http_request` | Send an HTTP request from the local machine |
|
|
57
|
+
| `generate_code` | Generate request code in one of ten languages |
|
|
58
|
+
| `ssh_list_targets` | List configured target machines and jump host (password masked) |
|
|
59
|
+
| `ssh_exec` | Execute a command through a standard SSH jump host |
|
|
60
|
+
| `remote_http_request` | Send an HTTP request from a remote target (`transport=gateshell/ssh`) |
|
|
61
|
+
| `bastion_login` | Log in to the GateShell menu |
|
|
62
|
+
| `bastion_list_hosts` | List all machines authorized on the bastion |
|
|
63
|
+
| `bastion_connect` | Enter a target machine's shell |
|
|
64
|
+
| `bastion_exec` | Execute a command on the connected target |
|
|
65
|
+
| `bastion_status` | Show login state and the selected target |
|
|
66
|
+
| `bastion_logout` | Close the bastion session |
|
|
67
|
+
| `bastion_upload` | Upload a local file to the target via base64 chunks |
|
|
68
|
+
| `bastion_download` | Download a remote file via base64 chunks |
|
|
69
|
+
| `ssh_upload` | Upload a local file via SFTP |
|
|
70
|
+
| `ssh_download` | Download a remote file via SFTP |
|
|
71
|
+
|
|
72
|
+
### `http_request` / `generate_code` arguments
|
|
73
|
+
|
|
74
|
+
Both accept the same request shape:
|
|
75
|
+
|
|
76
|
+
- `method`, `url`, `environment`
|
|
77
|
+
- `headers`, `params`
|
|
78
|
+
- `body`, `body_type` (`json` / `form` / `raw` / `none`)
|
|
79
|
+
- `auth_type` (`none` / `bearer` / `basic` / `api_key`), `auth_token`, `auth_username`, `auth_password`, `auth_header`
|
|
80
|
+
- `sign_enabled`, `sign_placement` (`auto` / `body` / `header` / `query` / `none`), `sign_field`, `sign_header`, `sign_algo`, `sign_key`
|
|
81
|
+
- `verify_ssl`, `timeout`, `proxy`, `follow_redirects`
|
|
82
|
+
|
|
83
|
+
`generate_code` additionally takes `lang` and `sign_mode` (`static` / `runtime`).
|
|
84
|
+
|
|
85
|
+
### Signing compatibility
|
|
86
|
+
|
|
87
|
+
The signature string follows the Java backend used by the desktop app:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
sorted(k1=v1&k2=v2&...) + "&" + "key=" + secret
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- Keys are sorted case-insensitively by upper-cased name.
|
|
94
|
+
- Empty values, `None`, and the signature field itself are excluded.
|
|
95
|
+
- MD5 and SHA256 both return upper-case hex.
|
|
96
|
+
- Query params and JSON / form / raw body params are merged before signing.
|
|
97
|
+
- `sign_placement=auto` puts the signature in the query string for `GET` / `HEAD` / `OPTIONS`, otherwise in the body.
|
|
98
|
+
- `sign_header` defaults to `X-Sign`; `sign_field` defaults to the environment's `param_name` (usually `sign`).
|
|
99
|
+
|
|
100
|
+
Runtime signing code is generated for Python, JavaScript, TypeScript, Node.js and Java. Other languages receive the static signature value (already injected into the URL, headers or body). This keeps generated snippets runnable without adding signing logic to every ecosystem.
|
|
101
|
+
|
|
102
|
+
Runtime signing snippets read the key from the `CURLGEN_SIGN_KEY` environment
|
|
103
|
+
variable; the real key is never embedded in generated code. Set it before
|
|
104
|
+
running the snippet, for example:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
export CURLGEN_SIGN_KEY="your-key" # PowerShell: $env:CURLGEN_SIGN_KEY="your-key"
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## GateShell notes
|
|
111
|
+
|
|
112
|
+
GateShell is a **menu-based** bastion. It does not support SSH `exec` and does not pass raw TCP through `direct-tcpip`; this server therefore drives its interactive menu:
|
|
113
|
+
|
|
114
|
+
```text
|
|
115
|
+
password login → invoke_shell menu → /<ip> search → Enter → target shell
|
|
116
|
+
→ sentinel-wrapped command → exit code + output
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The session is reused across tool calls; call `bastion_logout` to close it.
|
|
120
|
+
|
|
121
|
+
## File transfer
|
|
122
|
+
|
|
123
|
+
- GateShell uploads: truncate the remote path, append base64 chunks, then verify size and SHA-256.
|
|
124
|
+
- GateShell downloads: check remote size, read one base64 stream, decode locally, then verify size and SHA-256.
|
|
125
|
+
- Standard SSH: SFTP with the same size and SHA-256 checks.
|
|
126
|
+
- Default maximum transfer size is 8 MiB (`CURLGEN_MCP_MAX_TRANSFER` bytes). GateShell commands are capped at 16 KiB of payload even if `CURLGEN_MCP_CHUNK_SIZE` is larger.
|
|
127
|
+
- Local paths are restricted to `$HOME` and the current working directory by default. Override with `CURLGEN_MCP_FILE_ROOTS` (OS path separator, `;` on Windows, `:` on POSIX). Symlinks are resolved before the check.
|
|
128
|
+
|
|
129
|
+
## Environment variables
|
|
130
|
+
|
|
131
|
+
| Variable | Default | Meaning |
|
|
132
|
+
| --- | --- | --- |
|
|
133
|
+
| `CURLGEN_CONFIG_DIR` | `~/.cURL` | Configuration directory |
|
|
134
|
+
| `CURLGEN_ENV` | — | Default environment alias |
|
|
135
|
+
| `CURLGEN_SIGN_KEY` | — | Override the environment signing key |
|
|
136
|
+
| `CURLGEN_SIGN_ALGO` | — | Override `MD5` / `SHA256` |
|
|
137
|
+
| `CURLGEN_JUMP_HOST` / `CURLGEN_JUMP_PORT` / `CURLGEN_JUMP_USER` / `CURLGEN_JUMP_PASSWORD` | — | Override jump host settings |
|
|
138
|
+
| `CURLGEN_TARGET_HOST` / `CURLGEN_TARGET_PORT` / `CURLGEN_TARGET_USER` / `CURLGEN_TARGET_PASSWORD` / `CURLGEN_TARGET_KEY` | — | Override target machine settings |
|
|
139
|
+
| `CURLGEN_JUMP_KEY` | — | Jump-host private key path |
|
|
140
|
+
| `CURLGEN_MCP_FILE_ROOTS` | `$HOME` + CWD | Allowed local paths for transfer |
|
|
141
|
+
| `CURLGEN_MCP_MAX_TRANSFER` | `8388608` | Maximum upload/download bytes |
|
|
142
|
+
| `CURLGEN_MCP_CHUNK_SIZE` | `65536` | GateShell transfer chunk bytes (capped at 16384) |
|
|
143
|
+
| `CURLGEN_MCP_MAX_RESPONSE` | `2097152` | Maximum response bytes (local and remote, max 20 MiB) |
|
|
144
|
+
| `CURLGEN_MCP_LOG_LEVEL` | `INFO` | Server log level written to stderr |
|
|
145
|
+
|
|
146
|
+
## Security
|
|
147
|
+
|
|
148
|
+
This server can execute commands and transfer files on remote machines. Run it only in MCP clients you trust, protect `~/.cURL` (it can contain signing keys and the jump-host password), and prefer environment-variable injection for secrets in CI. Every command is explicitly requested by the agent; no background jobs are started. Request previews and generated code intentionally include the request's own credentials (for example a bearer token) so the snippet can run; signing keys and SSH passwords are not included. Disabling TLS verification (`verify_ssl=false`) or using a proxy exposes traffic to interception — use only when you understand the risk.
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT. Registry metadata marker: `mcp-name: io.github.xiaobinger/curlgen-mcp`
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "curlgen-mcp"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "HTTP requests, signed code generation, GateShell/SSH execution and file transfer."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "xiaobinger" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"mcp",
|
|
16
|
+
"model-context-protocol",
|
|
17
|
+
"curl",
|
|
18
|
+
"http",
|
|
19
|
+
"signature",
|
|
20
|
+
"ssh",
|
|
21
|
+
"jump-host",
|
|
22
|
+
"bastion",
|
|
23
|
+
"code-generation",
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
"Environment :: Console",
|
|
28
|
+
"Intended Audience :: Developers",
|
|
29
|
+
"Operating System :: OS Independent",
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"Programming Language :: Python :: 3.10",
|
|
32
|
+
"Programming Language :: Python :: 3.11",
|
|
33
|
+
"Programming Language :: Python :: 3.12",
|
|
34
|
+
"Programming Language :: Python :: 3.13",
|
|
35
|
+
"Programming Language :: Python :: 3.14",
|
|
36
|
+
"Topic :: Internet :: WWW/HTTP",
|
|
37
|
+
"Topic :: Software Development :: Code Generators",
|
|
38
|
+
"Topic :: System :: Systems Administration",
|
|
39
|
+
"Typing :: Typed",
|
|
40
|
+
]
|
|
41
|
+
dependencies = [
|
|
42
|
+
"mcp>=1.29.0",
|
|
43
|
+
"paramiko>=3.4",
|
|
44
|
+
]
|
|
45
|
+
|
|
46
|
+
[project.scripts]
|
|
47
|
+
curlgen-mcp = "curlgen_mcp.server:main"
|
|
48
|
+
|
|
49
|
+
[project.urls]
|
|
50
|
+
Homepage = "https://github.com/xiaobinger/cURL_remote"
|
|
51
|
+
Repository = "https://github.com/xiaobinger/cURL_remote"
|
|
52
|
+
Issues = "https://github.com/xiaobinger/cURL_remote/issues"
|
|
53
|
+
|
|
54
|
+
[tool.setuptools]
|
|
55
|
+
package-dir = { "" = "src" }
|
|
56
|
+
include-package-data = true
|
|
57
|
+
|
|
58
|
+
[tool.setuptools.packages.find]
|
|
59
|
+
where = ["src"]
|
|
60
|
+
|
|
61
|
+
[tool.setuptools.package-data]
|
|
62
|
+
curlgen_mcp = ["py.typed"]
|