Spaces:
Configuration error
Configuration error
File size: 5,318 Bytes
1cefe65 f679000 1cefe65 43e1a80 9b5e21d 657f5ca 422129b 657f5ca 43e1a80 a9455d5 43e1a80 9b5e21d a9455d5 9b5e21d a9455d5 8a173aa 9b5e21d fb6b08c 9b5e21d fb6b08c 9b5e21d 8a173aa 9b5e21d fb6b08c f679000 9b5e21d 43e1a80 f679000 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | # AMCP
[](https://github.com/tao12345666333/amcp/actions)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/Apache-2.0)
tags:
- building-mcp-track-creative
- mcp-in-action-track-consumer
- mcp-in-action-track-creative
---
# AMCP
A Lego-style coding agent CLI with built-in tools (grep, read files, bash execution) and MCP server integration for extended capabilities (web search, etc.).
X: https://x.com/zhangjintao9020/status/1995170132973466018?s=20
Demo: https://drive.google.com/file/d/1FGoY4I_JFQ1FSz19XlVJZ6Z4lWUucD7a/view?usp=sharing
## Features
- **Built-in Tools**: read_file, grep, bash, think
- **MCP Integration**: Connect to any MCP server for extended capabilities
- **Conversation History**: Persistent sessions across runs
- **Flexible Configuration**: YAML-based agent specifications
- **Tool Calling**: Automatic tool selection and execution
- **ACP Support**: Full Agent Client Protocol support for IDE integration (Zed, etc.)
## Install (editable)
```bash
# using uv (recommended)
uv venv && source .venv/bin/activate
uv pip install -e .
# or with pip
python -m venv .venv && source .venv/bin/activate
pip install -e .
```
## Usage
```bash
# Initialize config
amcp init
# Agent with tool calling (default command)
amcp # interactive mode with conversation history
amcp --once "create a hello.py file with a hello function" # single message
amcp --list # list available agent specifications
amcp --agent path/to/agent.yaml # use custom agent spec
amcp --session my-session # use specific session ID
amcp --clear # clear conversation history
# MCP server management
amcp mcp tools --server exa
amcp mcp call --server exa --tool web_search_exa --args '{"query":"rust async"}'
# Run as ACP agent (for IDE integration)
amcp-acp
```
## ACP (Agent Client Protocol) Support
AMCP fully supports the [Agent Client Protocol](https://agentclientprotocol.com/) for integration with IDEs like Zed.
### Features
- **Session Management**: Create, load, and list sessions
- **Session Modes**: Switch between `ask`, `architect`, and `code` modes
- `ask`: Request permission before making changes
- `architect`: Design and plan without implementation
- `code`: Full tool access for implementation
- **Slash Commands**: `/clear`, `/plan`, `/search`, `/help`
- **Agent Plans**: Visual execution plans for complex tasks
- **Permission Requests**: User approval for sensitive operations
- **Client Capabilities**: Use client's filesystem and terminal when available
### Running as ACP Agent
```bash
# Start the ACP agent server (stdio transport)
amcp-acp
```
### Zed Integration
Add to your Zed settings (`~/.config/zed/settings.json`):
```json
{
"agent": {
"profiles": {
"amcp": {
"name": "AMCP",
"provider": {
"type": "acp",
"command": "amcp-acp"
}
}
},
"default_profile": "amcp"
}
}
```
## Built-in Tools
- **read_file**: Read text files from the workspace
- **grep**: Search for patterns in files using ripgrep
- **bash**: Execute bash commands for file operations and system tasks
- **think**: Internal reasoning and planning
- **todo**: Manage a todo list to track tasks during complex operations
- **write_file**: Write content to files (can be disabled via config)
- **edit_file**: Edit files with search and replace (can be disabled via config)
## Config
The CLI loads MCP servers from `~/.config/amcp/config.toml`.
Generate a starter config:
```bash
amcp init
```
Example (OpenAI-compatible API):
```toml
[servers.exa]
url = "https://mcp.exa.ai/mcp"
[servers.custom]
command = "npx"
args = ["-y", "@some/mcp-server"]
env.API_KEY = "your-key"
[chat]
api_type = "openai" # "openai" (default) or "anthropic"
base_url = "https://api.openai.com/v1"
model = "gpt-4o"
api_key = "your-api-key"
mcp_tools_enabled = true
write_tool_enabled = true # Enable/disable built-in write_file tool
edit_tool_enabled = true # Enable/disable built-in edit_file tool
```
Example (OpenAI Responses API):
```toml
[chat]
api_type = "openai_responses"
model = "gpt-4o"
api_key = "your-api-key"
```
Example (Anthropic Claude):
```toml
[chat]
api_type = "anthropic"
model = "claude-sonnet-4-20250514"
api_key = "your-anthropic-api-key" # or set ANTHROPIC_API_KEY env var
```
To use Anthropic, install with: `pip install amcp[anthropic]`
## Development
### Setup Development Environment
```bash
# Clone the repository
git clone <repo-url>
cd AMCP
# Install with development dependencies
pip install -e ".[dev]"
# Install pre-commit hooks
pre-commit install
```
### Running Tests
```bash
# Run all tests
make test
# Run with coverage
make test-cov
# Run specific test
pytest tests/test_tools.py -v
```
### Code Quality
```bash
# Lint code
make lint
# Format code
make format
# Type check
make type-check
```
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed development guidelines.
## Notes
- `rg` (ripgrep) must be installed and on PATH for the grep tool.
- MCP servers must be installed separately and runnable (stdio transport).
## License
Apache-2.0
|