termigent 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- termigent-0.1.0/.gitignore +6 -0
- termigent-0.1.0/LICENSE +21 -0
- termigent-0.1.0/PKG-INFO +136 -0
- termigent-0.1.0/README.md +107 -0
- termigent-0.1.0/pyproject.toml +44 -0
- termigent-0.1.0/setup.cfg +4 -0
- termigent-0.1.0/termigent/__init__.py +8 -0
- termigent-0.1.0/termigent/__main__.py +4 -0
- termigent-0.1.0/termigent/cli.py +93 -0
- termigent-0.1.0/termigent/server.py +50 -0
- termigent-0.1.0/termigent.egg-info/PKG-INFO +136 -0
- termigent-0.1.0/termigent.egg-info/SOURCES.txt +16 -0
- termigent-0.1.0/termigent.egg-info/dependency_links.txt +1 -0
- termigent-0.1.0/termigent.egg-info/entry_points.txt +2 -0
- termigent-0.1.0/termigent.egg-info/requires.txt +7 -0
- termigent-0.1.0/termigent.egg-info/scm_file_list.json +12 -0
- termigent-0.1.0/termigent.egg-info/scm_version.json +8 -0
- termigent-0.1.0/termigent.egg-info/top_level.txt +1 -0
termigent-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Fortune
|
|
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.
|
termigent-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: termigent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal MCP server that exposes a system terminal over SSE.
|
|
5
|
+
Author: Fortune
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: mcp,model-context-protocol,sse,terminal,shell,ai,llm
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: System :: Shells
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: fastapi>=0.110
|
|
23
|
+
Requires-Dist: uvicorn>=0.27
|
|
24
|
+
Requires-Dist: mcp<2,>=1.2
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Termigent
|
|
31
|
+
|
|
32
|
+
A universal [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that exposes a system terminal over Server-Sent Events (SSE).
|
|
33
|
+
|
|
34
|
+
## Who it is for
|
|
35
|
+
|
|
36
|
+
Termigent is for people who prefer to stay in a graphical MCP client such as the Claude Desktop app and still want the assistant to run real shell commands, either on the local machine or on a remote server.
|
|
37
|
+
|
|
38
|
+
- **Local execution** — run `termigent` next to Claude Desktop and let Claude inspect files, run tools, and automate tasks on that machine.
|
|
39
|
+
- **Remote execution** — install `termigent` on a remote host, start it with `--host 0.0.0.0`, and let Claude operate that server through the same GUI.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Any GUI MCP client that supports remote SSE, or a stdio bridge such as `mcp-remote`, can use it.
|
|
43
|
+
|
|
44
|
+
## Requirements
|
|
45
|
+
|
|
46
|
+
- Python 3.10+
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install termigent
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
termigent # http://127.0.0.1:8000
|
|
59
|
+
termigent --port 3000
|
|
60
|
+
termigent --host 0.0.0.0 --port 8000
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
| Flag | Default | Description |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `--host` | `127.0.0.1` | Interface to bind |
|
|
66
|
+
| `--port` | `8000` | Port to listen on |
|
|
67
|
+
| `--version` | | Print version |
|
|
68
|
+
|
|
69
|
+
The MCP endpoint is `http://<host>:<port>/sse`.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Tool
|
|
74
|
+
|
|
75
|
+
`run_command(command: str)` executes the command with the shell and returns its combined stdout/stderr. A non-zero exit status is appended as `[exit code: N]`.
|
|
76
|
+
|
|
77
|
+
In the server terminal, each call is shown as a green `agent@termigent:~$` prompt, a white command, and light-gray output:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
agent@termigent:~$ pwd
|
|
81
|
+
/home/user
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Connect Claude Desktop
|
|
86
|
+
|
|
87
|
+
Claude Desktop brokers remote connectors through Anthropic's cloud, so a connector URL cannot reach your loopback address. Bridge the SSE endpoint through `mcp-remote` in the Desktop config instead. This requires Node.js, which provides `npx`.
|
|
88
|
+
|
|
89
|
+
**On the local machine** — start `termigent`, then add this to `claude_desktop_config.json`:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"termigent": {
|
|
95
|
+
"command": "npx",
|
|
96
|
+
"args": ["-y", "mcp-remote", "http://127.0.0.1:8000/sse"]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**On a remote server** — install termigent there and bind it to all interfaces:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
termigent --host 0.0.0.0 --port 8000
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Then, on the machine running Claude Desktop, point the bridge at the server:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"mcpServers": {
|
|
113
|
+
"termigent": {
|
|
114
|
+
"command": "npx",
|
|
115
|
+
"args": ["-y", "mcp-remote", "http://SERVER_IP:8000/sse"]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Restart Claude Desktop after changing its config so it initializes a new MCP session.
|
|
123
|
+
|
|
124
|
+
## Security
|
|
125
|
+
|
|
126
|
+
`termigent` has **no authentication** and runs commands with the privileges of the user that started it. Anyone who can reach the endpoint can execute arbitrary shell commands.
|
|
127
|
+
|
|
128
|
+
- Keep the default loopback bind for local use. When using `--host 0.0.0.0` so another machine can connect, firewall the port to the client's address only.
|
|
129
|
+
- Do not expose the endpoint to untrusted networks without an authenticating reverse proxy.
|
|
130
|
+
- Termigent is not a sandbox; commands can read, modify, and delete anything the host user can.
|
|
131
|
+
|
|
132
|
+
Only run it on systems you control and with clients you trust.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Termigent
|
|
2
|
+
|
|
3
|
+
A universal [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that exposes a system terminal over Server-Sent Events (SSE).
|
|
4
|
+
|
|
5
|
+
## Who it is for
|
|
6
|
+
|
|
7
|
+
Termigent is for people who prefer to stay in a graphical MCP client such as the Claude Desktop app and still want the assistant to run real shell commands, either on the local machine or on a remote server.
|
|
8
|
+
|
|
9
|
+
- **Local execution** — run `termigent` next to Claude Desktop and let Claude inspect files, run tools, and automate tasks on that machine.
|
|
10
|
+
- **Remote execution** — install `termigent` on a remote host, start it with `--host 0.0.0.0`, and let Claude operate that server through the same GUI.
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
Any GUI MCP client that supports remote SSE, or a stdio bridge such as `mcp-remote`, can use it.
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Python 3.10+
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install termigent
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
termigent # http://127.0.0.1:8000
|
|
30
|
+
termigent --port 3000
|
|
31
|
+
termigent --host 0.0.0.0 --port 8000
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
| Flag | Default | Description |
|
|
35
|
+
| --- | --- | --- |
|
|
36
|
+
| `--host` | `127.0.0.1` | Interface to bind |
|
|
37
|
+
| `--port` | `8000` | Port to listen on |
|
|
38
|
+
| `--version` | | Print version |
|
|
39
|
+
|
|
40
|
+
The MCP endpoint is `http://<host>:<port>/sse`.
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
## Tool
|
|
45
|
+
|
|
46
|
+
`run_command(command: str)` executes the command with the shell and returns its combined stdout/stderr. A non-zero exit status is appended as `[exit code: N]`.
|
|
47
|
+
|
|
48
|
+
In the server terminal, each call is shown as a green `agent@termigent:~$` prompt, a white command, and light-gray output:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
agent@termigent:~$ pwd
|
|
52
|
+
/home/user
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
## Connect Claude Desktop
|
|
57
|
+
|
|
58
|
+
Claude Desktop brokers remote connectors through Anthropic's cloud, so a connector URL cannot reach your loopback address. Bridge the SSE endpoint through `mcp-remote` in the Desktop config instead. This requires Node.js, which provides `npx`.
|
|
59
|
+
|
|
60
|
+
**On the local machine** — start `termigent`, then add this to `claude_desktop_config.json`:
|
|
61
|
+
|
|
62
|
+
```json
|
|
63
|
+
{
|
|
64
|
+
"mcpServers": {
|
|
65
|
+
"termigent": {
|
|
66
|
+
"command": "npx",
|
|
67
|
+
"args": ["-y", "mcp-remote", "http://127.0.0.1:8000/sse"]
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
**On a remote server** — install termigent there and bind it to all interfaces:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
termigent --host 0.0.0.0 --port 8000
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
Then, on the machine running Claude Desktop, point the bridge at the server:
|
|
80
|
+
|
|
81
|
+
```json
|
|
82
|
+
{
|
|
83
|
+
"mcpServers": {
|
|
84
|
+
"termigent": {
|
|
85
|
+
"command": "npx",
|
|
86
|
+
"args": ["-y", "mcp-remote", "http://SERVER_IP:8000/sse"]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
Restart Claude Desktop after changing its config so it initializes a new MCP session.
|
|
94
|
+
|
|
95
|
+
## Security
|
|
96
|
+
|
|
97
|
+
`termigent` has **no authentication** and runs commands with the privileges of the user that started it. Anyone who can reach the endpoint can execute arbitrary shell commands.
|
|
98
|
+
|
|
99
|
+
- Keep the default loopback bind for local use. When using `--host 0.0.0.0` so another machine can connect, firewall the port to the client's address only.
|
|
100
|
+
- Do not expose the endpoint to untrusted networks without an authenticating reverse proxy.
|
|
101
|
+
- Termigent is not a sandbox; commands can read, modify, and delete anything the host user can.
|
|
102
|
+
|
|
103
|
+
Only run it on systems you control and with clients you trust.
|
|
104
|
+
|
|
105
|
+
## License
|
|
106
|
+
|
|
107
|
+
MIT
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77", "setuptools-scm>=8"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "termigent"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Universal MCP server that exposes a system terminal over SSE."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "Fortune" }]
|
|
14
|
+
keywords = ["mcp", "model-context-protocol", "sse", "terminal", "shell", "ai", "llm"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Development Status :: 4 - Beta",
|
|
17
|
+
"Environment :: Console",
|
|
18
|
+
"Intended Audience :: Developers",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Programming Language :: Python :: 3.14",
|
|
26
|
+
"Topic :: System :: Shells",
|
|
27
|
+
]
|
|
28
|
+
dependencies = [
|
|
29
|
+
"fastapi>=0.110",
|
|
30
|
+
"uvicorn>=0.27",
|
|
31
|
+
"mcp>=1.2,<2",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
dev = ["build>=1.0", "twine>=5.0"]
|
|
36
|
+
|
|
37
|
+
[project.scripts]
|
|
38
|
+
termigent = "termigent.cli:main"
|
|
39
|
+
|
|
40
|
+
[tool.setuptools_scm]
|
|
41
|
+
fallback_version = "0.0.0"
|
|
42
|
+
|
|
43
|
+
[tool.setuptools.packages.find]
|
|
44
|
+
include = ["termigent*"]
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Command-line entry point for Termigent."""
|
|
2
|
+
|
|
3
|
+
import argparse
|
|
4
|
+
import asyncio
|
|
5
|
+
import logging
|
|
6
|
+
|
|
7
|
+
import uvicorn
|
|
8
|
+
|
|
9
|
+
from termigent import __version__
|
|
10
|
+
from termigent.server import build_app
|
|
11
|
+
|
|
12
|
+
GREEN = "\033[32m"
|
|
13
|
+
RESET = "\033[0m"
|
|
14
|
+
|
|
15
|
+
_QUIET_LOGGERS = (
|
|
16
|
+
"uvicorn",
|
|
17
|
+
"uvicorn.error",
|
|
18
|
+
"uvicorn.access",
|
|
19
|
+
"mcp",
|
|
20
|
+
"mcp.server",
|
|
21
|
+
"mcp.server.sse",
|
|
22
|
+
"anyio",
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def _parser() -> argparse.ArgumentParser:
|
|
27
|
+
parser = argparse.ArgumentParser(
|
|
28
|
+
prog="termigent",
|
|
29
|
+
description="Universal MCP server exposing a system terminal over SSE.",
|
|
30
|
+
)
|
|
31
|
+
parser.add_argument(
|
|
32
|
+
"--host",
|
|
33
|
+
default="127.0.0.1",
|
|
34
|
+
help="Interface to bind (default: 127.0.0.1)",
|
|
35
|
+
)
|
|
36
|
+
parser.add_argument(
|
|
37
|
+
"--port",
|
|
38
|
+
type=int,
|
|
39
|
+
default=8000,
|
|
40
|
+
help="Port to listen on (default: 8000)",
|
|
41
|
+
)
|
|
42
|
+
parser.add_argument(
|
|
43
|
+
"--version",
|
|
44
|
+
action="version",
|
|
45
|
+
version=f"%(prog)s {__version__}",
|
|
46
|
+
)
|
|
47
|
+
return parser
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
def _silence_network_logs() -> None:
|
|
51
|
+
for name in _QUIET_LOGGERS:
|
|
52
|
+
logging.getLogger(name).setLevel(logging.CRITICAL)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
async def _serve(host: str, port: int) -> None:
|
|
56
|
+
config = uvicorn.Config(
|
|
57
|
+
build_app(),
|
|
58
|
+
host=host,
|
|
59
|
+
port=port,
|
|
60
|
+
log_config=None,
|
|
61
|
+
access_log=False,
|
|
62
|
+
)
|
|
63
|
+
server = uvicorn.Server(config)
|
|
64
|
+
task = asyncio.create_task(server.serve())
|
|
65
|
+
|
|
66
|
+
while not server.started:
|
|
67
|
+
if task.done():
|
|
68
|
+
await task
|
|
69
|
+
return
|
|
70
|
+
await asyncio.sleep(0.05)
|
|
71
|
+
|
|
72
|
+
print(f"{GREEN}Ready!{RESET}", flush=True)
|
|
73
|
+
await task
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def main(argv: list[str] | None = None) -> None:
|
|
77
|
+
args = _parser().parse_args(argv)
|
|
78
|
+
|
|
79
|
+
_silence_network_logs()
|
|
80
|
+
|
|
81
|
+
print(
|
|
82
|
+
f"🚀 Launching Termigent over SSE on http://{args.host}:{args.port}",
|
|
83
|
+
flush=True,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
try:
|
|
87
|
+
asyncio.run(_serve(args.host, args.port))
|
|
88
|
+
except KeyboardInterrupt:
|
|
89
|
+
pass
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == "__main__":
|
|
93
|
+
main()
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"""MCP server definition and the terminal execution tool."""
|
|
2
|
+
|
|
3
|
+
import subprocess
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
from mcp.server.fastmcp import FastMCP
|
|
7
|
+
|
|
8
|
+
GREEN = "\033[32m"
|
|
9
|
+
WHITE = "\033[97m"
|
|
10
|
+
OUTPUT = "\033[38;5;252m"
|
|
11
|
+
RESET = "\033[0m"
|
|
12
|
+
PROMPT = f"{GREEN}agent@termigent:~$ {WHITE}"
|
|
13
|
+
|
|
14
|
+
mcp = FastMCP("termigent")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@mcp.tool()
|
|
18
|
+
def run_command(command: str) -> str:
|
|
19
|
+
"""Execute a shell command on the host terminal and return its output.
|
|
20
|
+
|
|
21
|
+
Args:
|
|
22
|
+
command: The shell command to execute.
|
|
23
|
+
"""
|
|
24
|
+
print(f"{PROMPT}{command}{RESET}", flush=True)
|
|
25
|
+
|
|
26
|
+
process = subprocess.run(
|
|
27
|
+
command,
|
|
28
|
+
shell=True,
|
|
29
|
+
stdout=subprocess.PIPE,
|
|
30
|
+
stderr=subprocess.STDOUT,
|
|
31
|
+
text=True,
|
|
32
|
+
)
|
|
33
|
+
|
|
34
|
+
output = process.stdout or ""
|
|
35
|
+
if output:
|
|
36
|
+
sys.stdout.write(OUTPUT)
|
|
37
|
+
sys.stdout.write(output)
|
|
38
|
+
if not output.endswith("\n"):
|
|
39
|
+
sys.stdout.write("\n")
|
|
40
|
+
sys.stdout.write(RESET)
|
|
41
|
+
sys.stdout.flush()
|
|
42
|
+
|
|
43
|
+
if process.returncode != 0:
|
|
44
|
+
return f"{output}\n[exit code: {process.returncode}]"
|
|
45
|
+
return output
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def build_app():
|
|
49
|
+
"""Return the Starlette app exposing the SSE MCP endpoint."""
|
|
50
|
+
return mcp.sse_app()
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: termigent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal MCP server that exposes a system terminal over SSE.
|
|
5
|
+
Author: Fortune
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: mcp,model-context-protocol,sse,terminal,shell,ai,llm
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
18
|
+
Classifier: Topic :: System :: Shells
|
|
19
|
+
Requires-Python: >=3.10
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: fastapi>=0.110
|
|
23
|
+
Requires-Dist: uvicorn>=0.27
|
|
24
|
+
Requires-Dist: mcp<2,>=1.2
|
|
25
|
+
Provides-Extra: dev
|
|
26
|
+
Requires-Dist: build>=1.0; extra == "dev"
|
|
27
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# Termigent
|
|
31
|
+
|
|
32
|
+
A universal [Model Context Protocol](https://modelcontextprotocol.io) (MCP) server that exposes a system terminal over Server-Sent Events (SSE).
|
|
33
|
+
|
|
34
|
+
## Who it is for
|
|
35
|
+
|
|
36
|
+
Termigent is for people who prefer to stay in a graphical MCP client such as the Claude Desktop app and still want the assistant to run real shell commands, either on the local machine or on a remote server.
|
|
37
|
+
|
|
38
|
+
- **Local execution** — run `termigent` next to Claude Desktop and let Claude inspect files, run tools, and automate tasks on that machine.
|
|
39
|
+
- **Remote execution** — install `termigent` on a remote host, start it with `--host 0.0.0.0`, and let Claude operate that server through the same GUI.
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
Any GUI MCP client that supports remote SSE, or a stdio bridge such as `mcp-remote`, can use it.
|
|
43
|
+
|
|
44
|
+
## Requirements
|
|
45
|
+
|
|
46
|
+
- Python 3.10+
|
|
47
|
+
|
|
48
|
+
## Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
pip install termigent
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
## Usage
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
termigent # http://127.0.0.1:8000
|
|
59
|
+
termigent --port 3000
|
|
60
|
+
termigent --host 0.0.0.0 --port 8000
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
| Flag | Default | Description |
|
|
64
|
+
| --- | --- | --- |
|
|
65
|
+
| `--host` | `127.0.0.1` | Interface to bind |
|
|
66
|
+
| `--port` | `8000` | Port to listen on |
|
|
67
|
+
| `--version` | | Print version |
|
|
68
|
+
|
|
69
|
+
The MCP endpoint is `http://<host>:<port>/sse`.
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## Tool
|
|
74
|
+
|
|
75
|
+
`run_command(command: str)` executes the command with the shell and returns its combined stdout/stderr. A non-zero exit status is appended as `[exit code: N]`.
|
|
76
|
+
|
|
77
|
+
In the server terminal, each call is shown as a green `agent@termigent:~$` prompt, a white command, and light-gray output:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
agent@termigent:~$ pwd
|
|
81
|
+
/home/user
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## Connect Claude Desktop
|
|
86
|
+
|
|
87
|
+
Claude Desktop brokers remote connectors through Anthropic's cloud, so a connector URL cannot reach your loopback address. Bridge the SSE endpoint through `mcp-remote` in the Desktop config instead. This requires Node.js, which provides `npx`.
|
|
88
|
+
|
|
89
|
+
**On the local machine** — start `termigent`, then add this to `claude_desktop_config.json`:
|
|
90
|
+
|
|
91
|
+
```json
|
|
92
|
+
{
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"termigent": {
|
|
95
|
+
"command": "npx",
|
|
96
|
+
"args": ["-y", "mcp-remote", "http://127.0.0.1:8000/sse"]
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**On a remote server** — install termigent there and bind it to all interfaces:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
termigent --host 0.0.0.0 --port 8000
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Then, on the machine running Claude Desktop, point the bridge at the server:
|
|
109
|
+
|
|
110
|
+
```json
|
|
111
|
+
{
|
|
112
|
+
"mcpServers": {
|
|
113
|
+
"termigent": {
|
|
114
|
+
"command": "npx",
|
|
115
|
+
"args": ["-y", "mcp-remote", "http://SERVER_IP:8000/sse"]
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Restart Claude Desktop after changing its config so it initializes a new MCP session.
|
|
123
|
+
|
|
124
|
+
## Security
|
|
125
|
+
|
|
126
|
+
`termigent` has **no authentication** and runs commands with the privileges of the user that started it. Anyone who can reach the endpoint can execute arbitrary shell commands.
|
|
127
|
+
|
|
128
|
+
- Keep the default loopback bind for local use. When using `--host 0.0.0.0` so another machine can connect, firewall the port to the client's address only.
|
|
129
|
+
- Do not expose the endpoint to untrusted networks without an authenticating reverse proxy.
|
|
130
|
+
- Termigent is not a sandbox; commands can read, modify, and delete anything the host user can.
|
|
131
|
+
|
|
132
|
+
Only run it on systems you control and with clients you trust.
|
|
133
|
+
|
|
134
|
+
## License
|
|
135
|
+
|
|
136
|
+
MIT
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
.gitignore
|
|
2
|
+
LICENSE
|
|
3
|
+
README.md
|
|
4
|
+
pyproject.toml
|
|
5
|
+
termigent/__init__.py
|
|
6
|
+
termigent/__main__.py
|
|
7
|
+
termigent/cli.py
|
|
8
|
+
termigent/server.py
|
|
9
|
+
termigent.egg-info/PKG-INFO
|
|
10
|
+
termigent.egg-info/SOURCES.txt
|
|
11
|
+
termigent.egg-info/dependency_links.txt
|
|
12
|
+
termigent.egg-info/entry_points.txt
|
|
13
|
+
termigent.egg-info/requires.txt
|
|
14
|
+
termigent.egg-info/scm_file_list.json
|
|
15
|
+
termigent.egg-info/scm_version.json
|
|
16
|
+
termigent.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
termigent
|