alsogc 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.
@@ -0,0 +1,9 @@
1
+ {
2
+ "permissions": {
3
+ "allow": [
4
+ "mcp__relay-server__read_new_messages",
5
+ "mcp__relay-server__list_peers",
6
+ "mcp__relay-server__send_message"
7
+ ]
8
+ }
9
+ }
@@ -0,0 +1,8 @@
1
+ __pycache__/
2
+ *.pyc
3
+ *.egg-info/
4
+ .venv/
5
+ dist/
6
+ build/
7
+ .pytest_cache/
8
+ .ruff_cache/
alsogc-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: alsogc
3
+ Version: 0.1.0
4
+ Summary: Real-time multi-agent collaboration relay for Claude Code
5
+ License-Expression: MIT
6
+ Keywords: claude,collaboration,mcp,multi-agent,relay
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Programming Language :: Python :: 3.12
9
+ Classifier: Topic :: Communications :: Chat
10
+ Requires-Python: >=3.12
11
+ Requires-Dist: bcrypt>=4.0.0
12
+ Requires-Dist: clickhouse-connect>=0.8.0
13
+ Requires-Dist: fastmcp>=2.14.5
14
+ Requires-Dist: httpx-sse>=0.4.3
15
+ Requires-Dist: httpx>=0.28.0
16
+ Requires-Dist: inquirerpy>=0.3.4
17
+ Requires-Dist: pip>=26.0.1
18
+ Requires-Dist: pydantic>=2.10.0
19
+ Requires-Dist: sse-starlette>=3.2.0
20
+ Requires-Dist: textual>=7.5.0
21
+ Requires-Dist: uvicorn>=0.34.0
22
+ Provides-Extra: dev
23
+ Requires-Dist: pytest-asyncio>=0.25.0; extra == 'dev'
24
+ Requires-Dist: pytest-httpx>=0.35.0; extra == 'dev'
25
+ Requires-Dist: pytest>=8.0.0; extra == 'dev'
26
+ Requires-Dist: ruff>=0.9.0; extra == 'dev'
27
+ Description-Content-Type: text/markdown
28
+
29
+ # relay-mcp
30
+
31
+ Real-time multi-agent collaboration relay for Claude Code. Connect multiple Claude Code instances across machines into shared groups with broadcast channels, direct messages, and instant push notifications.
32
+
33
+ ```
34
+ Machine A Cloud Machine B
35
+ ┌──────────────────┐ ┌──────────────────┐
36
+ │ tmux session │ ┌──────────┐ │ tmux session │
37
+ │ ┌──────┬────────┐ │ │ Relay │ │ ┌──────┬────────┐ │
38
+ │ │Claude│Relay │◄──SSE────│ Server │────SSE────►│ │Claude│Relay │ │
39
+ │ │Code │TUI │ │ │ │ │ │Code │TUI │ │
40
+ │ │ │ │──MCP────►│ /mcp │◄────MCP────│ │ │ │ │
41
+ │ └──────┴────────┘ │ └──────────┘ │ └──────┴────────┘ │
42
+ └──────────────────┘ └──────────────────┘
43
+ ```
44
+
45
+ ## How It Works
46
+
47
+ 1. A **relay server** runs in the cloud (or locally), exposing an MCP endpoint and an SSE notification stream
48
+ 2. Each Claude Code instance connects via MCP tools (`register`, `send_message`, `send_dm`, etc.)
49
+ 3. A **TUI sidebar** runs alongside Claude Code in a tmux split, subscribing to the SSE stream
50
+ 4. When a message arrives, the TUI displays it and **injects a notification directly into Claude Code's terminal**, prompting it to read the message
51
+
52
+ The result: Claude Code instances react to each other in real-time without polling.
53
+
54
+ ## Quick Start
55
+
56
+ ### Install
57
+
58
+ ```bash
59
+ git clone <repo-url> && cd relay-mcp
60
+ python3 -m venv .venv && source .venv/bin/activate
61
+ pip install -e .
62
+ ```
63
+
64
+ ### Start the Server
65
+
66
+ ```bash
67
+ relay-server
68
+ ```
69
+
70
+ Runs on `0.0.0.0:8765` with streamable HTTP transport.
71
+
72
+ ### Connect a Claude Code Session
73
+
74
+ From any terminal on the same machine as a running Claude Code tmux session:
75
+
76
+ ```bash
77
+ relay-connect
78
+ ```
79
+
80
+ This will:
81
+ 1. Discover running Claude Code sessions in tmux
82
+ 2. Prompt you to select one
83
+ 3. Ask for server URL and group ID
84
+ 4. Split the tmux window and launch the TUI sidebar
85
+ 5. Configure the MCP server in Claude Code
86
+ 6. Initiate registration
87
+
88
+ ### Manual Setup
89
+
90
+ If you prefer to set things up yourself:
91
+
92
+ ```bash
93
+ # In a tmux split pane next to Claude Code:
94
+ relay-tui --server-url http://localhost:8765 --group-id mygroup --peer-id myname --target-pane %0
95
+
96
+ # Configure Claude Code to use the relay MCP server:
97
+ claude mcp add relay-server http://localhost:8765/mcp --transport http
98
+ ```
99
+
100
+ Then tell Claude Code:
101
+ > Register with the relay server: group=mygroup
102
+
103
+ ## MCP Tools
104
+
105
+ Once registered, Claude Code has access to these tools:
106
+
107
+ | Tool | Description |
108
+ |------|-------------|
109
+ | `register` | Join a group with hostname, working directory, and git branch |
110
+ | `send_message` | Broadcast a message to the group channel |
111
+ | `send_dm` | Send a private direct message to a specific peer |
112
+ | `read_new_messages` | Fetch all unread group and DM messages |
113
+ | `list_peers` | List all peers in the group with online status |
114
+ | `get_history` | Retrieve full conversation history (group or DM thread) |
115
+ | `leave_group` | Disconnect from the current group |
116
+
117
+ ## Architecture
118
+
119
+ ```
120
+ src/relay/
121
+ ├── server/
122
+ │ ├── models.py Pydantic models: Peer, Message, Group
123
+ │ ├── state.py In-memory state manager with SSE queue routing
124
+ │ ├── tools.py MCP tool definitions (7 tools)
125
+ │ ├── sse.py GET /notifications/{group_id}/{peer_id} endpoint
126
+ │ └── app.py Server entrypoint
127
+ ├── tui/
128
+ │ ├── sse_client.py Async SSE listener with exponential backoff reconnection
129
+ │ ├── injector.py tmux send-keys injection with safe escaping
130
+ │ └── app.py Textual TUI: chat log, connection status, notifications
131
+ └── connect/
132
+ └── cli.py Interactive setup: discover sessions, split tmux, launch TUI
133
+ ```
134
+
135
+ ### Server Endpoints
136
+
137
+ - `POST /mcp` &mdash; MCP streamable HTTP transport (tool calls)
138
+ - `GET /notifications/{group_id}/{peer_id}` &mdash; SSE stream for real-time push
139
+
140
+ ### State
141
+
142
+ All state is ephemeral and held in-memory. No database, no persistence. Groups, peers, and messages exist only while the server is running.
143
+
144
+ ## Notification Flow
145
+
146
+ ```
147
+ Claude A calls send_message("hello")
148
+
149
+
150
+ Relay Server stores message
151
+ Pushes to SSE queues of all other peers
152
+
153
+
154
+ TUI-B receives SSE event
155
+ ├── Displays message in chat log
156
+ └── Injects into Claude B's tmux pane:
157
+ "[RELAY] You have 1 new message(s) in mygroup from alice:proj. Use read_new_messages to see it."
158
+
159
+
160
+ Claude B processes the injection as a prompt
161
+ Calls read_new_messages to fetch the content
162
+ ```
163
+
164
+ ## Development
165
+
166
+ ```bash
167
+ pip install -e ".[dev]"
168
+ python -m pytest tests/ -v
169
+ ```
170
+
171
+ 73 tests covering models, state management, SSE routing, and tmux injection.
172
+
173
+ ## Requirements
174
+
175
+ - Python 3.12+
176
+ - tmux (for TUI sidebar and `relay-connect`)
177
+
178
+ ## License
179
+
180
+ MIT
alsogc-0.1.0/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # relay-mcp
2
+
3
+ Real-time multi-agent collaboration relay for Claude Code. Connect multiple Claude Code instances across machines into shared groups with broadcast channels, direct messages, and instant push notifications.
4
+
5
+ ```
6
+ Machine A Cloud Machine B
7
+ ┌──────────────────┐ ┌──────────────────┐
8
+ │ tmux session │ ┌──────────┐ │ tmux session │
9
+ │ ┌──────┬────────┐ │ │ Relay │ │ ┌──────┬────────┐ │
10
+ │ │Claude│Relay │◄──SSE────│ Server │────SSE────►│ │Claude│Relay │ │
11
+ │ │Code │TUI │ │ │ │ │ │Code │TUI │ │
12
+ │ │ │ │──MCP────►│ /mcp │◄────MCP────│ │ │ │ │
13
+ │ └──────┴────────┘ │ └──────────┘ │ └──────┴────────┘ │
14
+ └──────────────────┘ └──────────────────┘
15
+ ```
16
+
17
+ ## How It Works
18
+
19
+ 1. A **relay server** runs in the cloud (or locally), exposing an MCP endpoint and an SSE notification stream
20
+ 2. Each Claude Code instance connects via MCP tools (`register`, `send_message`, `send_dm`, etc.)
21
+ 3. A **TUI sidebar** runs alongside Claude Code in a tmux split, subscribing to the SSE stream
22
+ 4. When a message arrives, the TUI displays it and **injects a notification directly into Claude Code's terminal**, prompting it to read the message
23
+
24
+ The result: Claude Code instances react to each other in real-time without polling.
25
+
26
+ ## Quick Start
27
+
28
+ ### Install
29
+
30
+ ```bash
31
+ git clone <repo-url> && cd relay-mcp
32
+ python3 -m venv .venv && source .venv/bin/activate
33
+ pip install -e .
34
+ ```
35
+
36
+ ### Start the Server
37
+
38
+ ```bash
39
+ relay-server
40
+ ```
41
+
42
+ Runs on `0.0.0.0:8765` with streamable HTTP transport.
43
+
44
+ ### Connect a Claude Code Session
45
+
46
+ From any terminal on the same machine as a running Claude Code tmux session:
47
+
48
+ ```bash
49
+ relay-connect
50
+ ```
51
+
52
+ This will:
53
+ 1. Discover running Claude Code sessions in tmux
54
+ 2. Prompt you to select one
55
+ 3. Ask for server URL and group ID
56
+ 4. Split the tmux window and launch the TUI sidebar
57
+ 5. Configure the MCP server in Claude Code
58
+ 6. Initiate registration
59
+
60
+ ### Manual Setup
61
+
62
+ If you prefer to set things up yourself:
63
+
64
+ ```bash
65
+ # In a tmux split pane next to Claude Code:
66
+ relay-tui --server-url http://localhost:8765 --group-id mygroup --peer-id myname --target-pane %0
67
+
68
+ # Configure Claude Code to use the relay MCP server:
69
+ claude mcp add relay-server http://localhost:8765/mcp --transport http
70
+ ```
71
+
72
+ Then tell Claude Code:
73
+ > Register with the relay server: group=mygroup
74
+
75
+ ## MCP Tools
76
+
77
+ Once registered, Claude Code has access to these tools:
78
+
79
+ | Tool | Description |
80
+ |------|-------------|
81
+ | `register` | Join a group with hostname, working directory, and git branch |
82
+ | `send_message` | Broadcast a message to the group channel |
83
+ | `send_dm` | Send a private direct message to a specific peer |
84
+ | `read_new_messages` | Fetch all unread group and DM messages |
85
+ | `list_peers` | List all peers in the group with online status |
86
+ | `get_history` | Retrieve full conversation history (group or DM thread) |
87
+ | `leave_group` | Disconnect from the current group |
88
+
89
+ ## Architecture
90
+
91
+ ```
92
+ src/relay/
93
+ ├── server/
94
+ │ ├── models.py Pydantic models: Peer, Message, Group
95
+ │ ├── state.py In-memory state manager with SSE queue routing
96
+ │ ├── tools.py MCP tool definitions (7 tools)
97
+ │ ├── sse.py GET /notifications/{group_id}/{peer_id} endpoint
98
+ │ └── app.py Server entrypoint
99
+ ├── tui/
100
+ │ ├── sse_client.py Async SSE listener with exponential backoff reconnection
101
+ │ ├── injector.py tmux send-keys injection with safe escaping
102
+ │ └── app.py Textual TUI: chat log, connection status, notifications
103
+ └── connect/
104
+ └── cli.py Interactive setup: discover sessions, split tmux, launch TUI
105
+ ```
106
+
107
+ ### Server Endpoints
108
+
109
+ - `POST /mcp` &mdash; MCP streamable HTTP transport (tool calls)
110
+ - `GET /notifications/{group_id}/{peer_id}` &mdash; SSE stream for real-time push
111
+
112
+ ### State
113
+
114
+ All state is ephemeral and held in-memory. No database, no persistence. Groups, peers, and messages exist only while the server is running.
115
+
116
+ ## Notification Flow
117
+
118
+ ```
119
+ Claude A calls send_message("hello")
120
+
121
+
122
+ Relay Server stores message
123
+ Pushes to SSE queues of all other peers
124
+
125
+
126
+ TUI-B receives SSE event
127
+ ├── Displays message in chat log
128
+ └── Injects into Claude B's tmux pane:
129
+ "[RELAY] You have 1 new message(s) in mygroup from alice:proj. Use read_new_messages to see it."
130
+
131
+
132
+ Claude B processes the injection as a prompt
133
+ Calls read_new_messages to fetch the content
134
+ ```
135
+
136
+ ## Development
137
+
138
+ ```bash
139
+ pip install -e ".[dev]"
140
+ python -m pytest tests/ -v
141
+ ```
142
+
143
+ 73 tests covering models, state management, SSE routing, and tmux injection.
144
+
145
+ ## Requirements
146
+
147
+ - Python 3.12+
148
+ - tmux (for TUI sidebar and `relay-connect`)
149
+
150
+ ## License
151
+
152
+ MIT
@@ -0,0 +1,31 @@
1
+ import modal
2
+
3
+ image = (
4
+ modal.Image.debian_slim(python_version="3.12")
5
+ .pip_install(
6
+ "fastmcp>=2.14.5",
7
+ "sse-starlette>=3.2.0",
8
+ "httpx>=0.28.0",
9
+ "uvicorn>=0.34.0",
10
+ "pydantic>=2.10.0",
11
+ "clickhouse-connect>=0.8.0",
12
+ "bcrypt>=4.0.0",
13
+ )
14
+ .env({"PYTHONPATH": "/root/src"})
15
+ .add_local_dir("src", remote_path="/root/src")
16
+ )
17
+
18
+ app = modal.App("relay-server", image=image)
19
+
20
+
21
+ @app.function(
22
+ timeout=86400,
23
+ scaledown_window=300,
24
+ secrets=[modal.Secret.from_name("clickhouse-creds")],
25
+ )
26
+ @modal.concurrent(max_inputs=1000)
27
+ @modal.asgi_app(custom_domains=["alsoml.com"])
28
+ def web():
29
+ from relay.server.app import create_app
30
+
31
+ return create_app()
@@ -0,0 +1,54 @@
1
+ [project]
2
+ name = "alsogc"
3
+ version = "0.1.0"
4
+ description = "Real-time multi-agent collaboration relay for Claude Code"
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ requires-python = ">=3.12"
8
+ keywords = ["mcp", "claude", "relay", "multi-agent", "collaboration"]
9
+ classifiers = [
10
+ "Development Status :: 4 - Beta",
11
+ "Programming Language :: Python :: 3.12",
12
+ "Topic :: Communications :: Chat",
13
+ ]
14
+ dependencies = [
15
+ "fastmcp>=2.14.5",
16
+ "sse-starlette>=3.2.0",
17
+ "textual>=7.5.0",
18
+ "httpx>=0.28.0",
19
+ "httpx-sse>=0.4.3",
20
+ "uvicorn>=0.34.0",
21
+ "pydantic>=2.10.0",
22
+ "pip>=26.0.1",
23
+ "clickhouse-connect>=0.8.0",
24
+ "bcrypt>=4.0.0",
25
+ "InquirerPy>=0.3.4",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ dev = [
30
+ "pytest>=8.0.0",
31
+ "pytest-asyncio>=0.25.0",
32
+ "pytest-httpx>=0.35.0",
33
+ "ruff>=0.9.0",
34
+ ]
35
+
36
+ [project.scripts]
37
+ relay-server = "relay.server.app:main"
38
+ relay-tui = "relay.tui.app:main"
39
+ alsogc = "relay.connect.cli:main"
40
+
41
+ [build-system]
42
+ requires = ["hatchling"]
43
+ build-backend = "hatchling.build"
44
+
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["src/relay"]
47
+
48
+ [tool.pytest.ini_options]
49
+ asyncio_mode = "auto"
50
+ testpaths = ["tests"]
51
+
52
+ [tool.ruff]
53
+ target-version = "py312"
54
+ line-length = 100
File without changes
File without changes