Modern Python implementation of Agent Smith, a terminal-based AI coding assistant.
- π€ Multi-provider LLM support (Anthropic Claude, OpenAI GPT, AWS Bedrock, Google Vertex)
- π₯οΈ Beautiful terminal UI with Textual
- π§ Extensible tool system (16+ built-in tools)
- π Secure credential management (OS keyring support)
- βοΈ XDG-compliant configuration
- π Fast async I/O with asyncio
- π Type-safe with Pydantic
- π― Model Context Protocol (MCP) support - Connect to GitLab, Jira, databases, and more!
pip install agent-smithcd python
pip install -e ".[dev]"# Install
pip install agent-smith
# Set API key
smith config set anthropic_api_key sk-ant-...
# Or use environment variable
export SMITH_ANTHROPIC_API_KEY=sk-ant-...# Start interactive mode
smith
# Use with specific model
smith --model claude-opus-4-20250514
# Verbose mode
smith --verbose --debugAgent Smith follows XDG Base Directory specification:
Linux/macOS:
- Config:
~/.config/agent-smith/ - Data:
~/.local/share/agent-smith/ - Cache:
~/.cache/agent-smith/ - Logs:
~/.local/state/agent-smith/
Windows:
- Config:
%APPDATA%\agent-smith\ - Data:
%LOCALAPPDATA%\agent-smith\
~/.config/agent-smith/settings.toml
[default]
default_provider = "anthropic"
large_model = "claude-sonnet-4-5-20250929"
small_model = "claude-3-5-haiku-20241022"
show_cost = true
enable_prompt_caching = true
max_parallel_tools = 10~/.config/agent-smith/.secrets.toml (gitignored)
[default]
anthropic_api_key = "sk-ant-..."
openai_api_key = "sk-..."# Configuration
smith config show # Show current configuration
smith config set KEY VALUE # Set configuration value
smith config edit # Edit config in $EDITOR
smith config path # Show config paths
# Model Selection
smith model select # Interactive model selector
smith model list # List available models
# MCP Server
smith mcp serve # Run as MCP server for Claude Desktop
# Utilities
smith doctor # Run diagnostics
smith version # Show version
smith --help # Show helpAll settings can be overridden with environment variables using SMITH_ prefix:
export SMITH_DEFAULT_PROVIDER=openai
export SMITH_LARGE_MODEL=gpt-4o
export SMITH_VERBOSE=true
export SMITH_ANTHROPIC_API_KEY=sk-ant-...
export SMITH_OPENAI_API_KEY=sk-...# Clone repository
git clone https://github.com/brandonrc/agent-smith.git
cd agent-smith/python
# Install with dev dependencies
pip install -e ".[dev]"# Run all tests
pytest
# Run with coverage
pytest --cov=agent_smith --cov-report=html
# Run specific test
pytest tests/test_config.py -vmypy src/agent_smith# Format code
black src/ tests/
# Check formatting
black --check src/ tests/
# Lint with ruff
ruff check src/ tests/Agent Smith supports MCP, allowing it to connect to external services and tools.
MCP is an open standard that enables AI applications to connect to external data sources and tools in a standardized way. Think of it like "USB-C for AI" - one protocol to connect to many services.
Agent Smith can connect to any MCP-compatible server, including:
- GitLab - Manage repositories, merge requests, issues
- Jira - Create and manage tickets, projects, workflows
- Filesystem - Secure file operations in allowed directories
- Databases - PostgreSQL, MySQL, SQLite
- And many more...
- Install Node.js (required for most MCP servers):
# macOS
brew install node
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs- Configure MCP servers in
~/.config/agent-smith/settings.toml:
[mcp]
enabled = true
[mcp.servers.gitlab]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-gitlab"]
env = {
GITLAB_TOKEN = "glpat-your-token-here",
GITLAB_URL = "https://gitlab.com"
}
enabled = true
trusted = false # Will prompt for approval on first use
[mcp.servers.jira]
command = "npx"
args = ["-y", "@modelcontextprotocol/server-jira"]
env = {
JIRA_URL = "https://your-company.atlassian.net",
JIRA_EMAIL = "your-email@company.com",
JIRA_API_TOKEN = "your-api-token"
}
enabled = true
trusted = false-
Start Agent Smith - it will prompt you to approve each MCP server on first use
-
Use MCP tools - Claude can now use GitLab, Jira, etc.:
> "List my open GitLab merge requests"
> "Create a Jira ticket for this bug"
- Check MCP status with
/mcpcommand in the REPL
/mcp- Show MCP server status and tool counts/tools- List all available tools (including MCP tools)
- Server Approval - First-time use requires explicit user approval
- Trust Management - Approved servers are tracked in
~/.local/share/agent-smith/mcp_trust.json - Environment Isolation - Each server runs in its own subprocess
- Configuration Changes - Reapproval required if server config changes
Find more MCP servers at: https://github.com/modelcontextprotocol/servers
src/agent_smith/
βββ cli.py # CLI entry point
βββ config/ # Configuration management (dynaconf)
βββ mcp/ # MCP integration
β βββ client.py # MCP client for single server
β βββ manager.py # Multi-server management
β βββ discovery.py # Tool discovery and registration
β βββ trust.py # Security and approval system
βββ models/ # Pydantic data models
βββ ui/ # Textual UI components
β βββ app.py # Main application
β βββ repl.py # Interactive REPL screen
β βββ help_screen.py # Help screen
βββ tools/ # Tool system (13+ tools)
β βββ bash_tool.py
β βββ file_read_tool.py
β βββ file_write_tool.py
β βββ file_edit_tool.py
β βββ glob_tool.py
β βββ grep_tool.py
β βββ list_tool.py
β βββ agent_tool.py
β βββ think_tool.py
β βββ mcp_tool.py # MCP tool wrapper
β βββ ...
βββ services/ # LLM API clients
β βββ claude.py # Anthropic Claude
β βββ openai.py # OpenAI GPT
βββ query.py # Main query orchestration
βββ mcp_integration.py # MCP initialization