MCP server for managing multiple Claude Code sessions via iTerm2
Project description
Claude Team MCP Server
An MCP server that allows one Claude Code session to spawn and manage a team of other Claude Code sessions via iTerm2.
Features
- Spawn Sessions: Create new Claude Code sessions in iTerm2 windows or split panes
- Send Messages: Inject prompts into managed sessions
- Read Responses: Retrieve conversation state from session JSONL files
- Monitor Status: Check if sessions are idle, processing, or waiting for input
- Coordinate Work: Manage multi-agent workflows from a single Claude Code session
Requirements
- macOS with iTerm2 installed
- iTerm2 Python API enabled (Preferences → General → Magic → Enable Python API)
- Python 3.11+
- uv package manager
Installation
# Clone the repository
cd /path/to/claude-team
# Install with uv
uv sync
Configuration for Claude Code
Add to your Claude Code MCP settings. You can configure this at:
- Global:
~/.claude/settings.json - Project:
.claude/settings.jsonin your project directory
{
"mcpServers": {
"claude-team": {
"command": "uv",
"args": ["run", "--directory", "/path/to/claude-team", "python", "-m", "claude_team_mcp"]
}
}
}
After adding the configuration, restart Claude Code for it to take effect.
MCP Tools
| Tool | Description |
|---|---|
spawn_session |
Create a new Claude Code session in a new window or split pane |
list_sessions |
List all managed sessions with status |
send_message |
Send a prompt to a session, optionally wait for response |
get_response |
Get the latest response from a session |
get_session_status |
Get detailed status including screen preview |
close_session |
Gracefully terminate a session |
Tool Details
spawn_session
Arguments:
project_path: str - Directory where Claude Code should run
session_name: str - Optional friendly name for the session
layout: str - "auto" (default), "new_window", "split_vertical", or "split_horizontal"
Returns:
session_id, name, project_path, status, claude_session_id
send_message
Arguments:
session_id: str - ID of target session
message: str - The prompt to send
wait_for_response: bool - If True, wait for Claude to respond
timeout: float - Max seconds to wait (default: 120)
Returns:
success, session_id, message_sent, [response]
get_response
Arguments:
session_id: str - ID of target session
wait: bool - If True, wait if session is processing
timeout: float - Max seconds to wait (default: 60)
Returns:
session_id, status, is_processing, last_response, tool_uses, message_count
Usage Patterns
Basic: Spawn and Send
From your Claude Code session, you can spawn workers and send them tasks:
"Spawn a new Claude session in /path/to/frontend"
→ Uses spawn_session tool
→ Returns session_id: "worker-1"
"Send worker-1 the message: Review the React components"
→ Uses send_message tool
"Check on worker-1's progress"
→ Uses get_session_status tool
Parallel Work Distribution
Spawn multiple workers for parallel tasks:
"Create three worker sessions:
- worker-frontend in /path/to/frontend
- worker-backend in /path/to/backend
- worker-tests in /path/to/tests"
"Send each worker their task:
- frontend: Update the login page styles
- backend: Add rate limiting to the API
- tests: Write integration tests for auth"
"Wait for all workers and collect their responses"
Coordinated Workflow
Use the manager to coordinate between workers:
"Spawn a backend worker and have it create a new API endpoint"
→ Wait for response
"Now spawn a frontend worker and tell it about the new endpoint"
→ Pass context from backend worker's response
"Finally, spawn a test worker to write tests for the integration"
Architecture
┌─────────────────────────────────────────────────────────────┐
│ Manager Claude Code Session │
│ (has claude-team MCP server) │
├─────────────────────────────────────────────────────────────┤
│ MCP Tools │
│ spawn_session │ send_message │ get_response │ list_sessions │
└────────────────┬────────────────────────────────────────────┘
│
┌────────┼────────┐
▼ ▼ ▼
┌─────────┐ ┌─────────┐ ┌─────────┐
│Worker 1 │ │Worker 2 │ │Worker 3 │
│(iTerm2) │ │(iTerm2) │ │(iTerm2) │
│ │ │ │ │ │
│ Claude │ │ Claude │ │ Claude │
│ Code │ │ Code │ │ Code │
└─────────┘ └─────────┘ └─────────┘
The manager maintains:
- Session Registry: Maps session IDs to iTerm2 sessions
- iTerm2 Connection: Persistent connection for terminal control
- JSONL Monitoring: Reads Claude's session files for conversation state
Development
# Sync dependencies
uv sync
# Run tests
uv run pytest
# Run the server directly (for debugging)
uv run python -m claude_team_mcp
Troubleshooting
"Could not connect to iTerm2"
- Make sure iTerm2 is running
- Enable: iTerm2 → Preferences → General → Magic → Enable Python API
"Session not found"
- The session may have been closed externally
- Use
list_sessionsto see active sessions
"No JSONL session file found"
- Claude Code may still be starting up
- Wait a few seconds and try again
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_team_mcp-0.1.0.tar.gz.
File metadata
- Download URL: claude_team_mcp-0.1.0.tar.gz
- Upload date:
- Size: 233.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad4b0108997140e4394e5132c9a04ed181494033a55ef4be15db718e19f90517
|
|
| MD5 |
74a18ffb8f2cf7772c3dbca6a6780129
|
|
| BLAKE2b-256 |
6daa024d29bc3a281908e75a0f738451cbcd1f6743390fa75605ebf1965eb37c
|
File details
Details for the file claude_team_mcp-0.1.0-py3-none-any.whl.
File metadata
- Download URL: claude_team_mcp-0.1.0-py3-none-any.whl
- Upload date:
- Size: 57.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3facadbb6daf49d4381a5f5db3d83bb21b7faca496b5bd140e818826c2d6cab0
|
|
| MD5 |
2af4e9e41d6b3e22eec2c11000927646
|
|
| BLAKE2b-256 |
28b49f66eff719dd5df49b9310b0a9d8fa6a7e763d7dff60504df20772ea8c80
|