amcp-agent 0.4.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.
- amcp_agent-0.4.0/.gitignore +149 -0
- amcp_agent-0.4.0/PKG-INFO +291 -0
- amcp_agent-0.4.0/README.md +250 -0
- amcp_agent-0.4.0/pyproject.toml +82 -0
- amcp_agent-0.4.0/src/amcp/__init__.py +132 -0
- amcp_agent-0.4.0/src/amcp/__main__.py +4 -0
- amcp_agent-0.4.0/src/amcp/acp_agent.py +797 -0
- amcp_agent-0.4.0/src/amcp/agent.py +938 -0
- amcp_agent-0.4.0/src/amcp/agent_spec.py +162 -0
- amcp_agent-0.4.0/src/amcp/chat.py +636 -0
- amcp_agent-0.4.0/src/amcp/cli.py +427 -0
- amcp_agent-0.4.0/src/amcp/compaction.py +724 -0
- amcp_agent-0.4.0/src/amcp/config.py +262 -0
- amcp_agent-0.4.0/src/amcp/event_bus.py +635 -0
- amcp_agent-0.4.0/src/amcp/init_wizard.py +465 -0
- amcp_agent-0.4.0/src/amcp/llm.py +256 -0
- amcp_agent-0.4.0/src/amcp/mcp_client.py +98 -0
- amcp_agent-0.4.0/src/amcp/message_queue.py +530 -0
- amcp_agent-0.4.0/src/amcp/models_db.py +445 -0
- amcp_agent-0.4.0/src/amcp/multi_agent.py +370 -0
- amcp_agent-0.4.0/src/amcp/project_rules.py +393 -0
- amcp_agent-0.4.0/src/amcp/readfile.py +71 -0
- amcp_agent-0.4.0/src/amcp/task.py +859 -0
- amcp_agent-0.4.0/src/amcp/tools.py +790 -0
- amcp_agent-0.4.0/src/amcp/ui.py +165 -0
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
share/python-wheels/
|
|
24
|
+
*.egg-info/
|
|
25
|
+
.installed.cfg
|
|
26
|
+
*.egg
|
|
27
|
+
MANIFEST
|
|
28
|
+
|
|
29
|
+
# PyInstaller
|
|
30
|
+
# Usually these files are written by a python script from a template
|
|
31
|
+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
|
32
|
+
*.manifest
|
|
33
|
+
*.spec
|
|
34
|
+
|
|
35
|
+
# Installer logs
|
|
36
|
+
pip-log.txt
|
|
37
|
+
pip-delete-this-directory.txt
|
|
38
|
+
|
|
39
|
+
# Unit test / coverage reports
|
|
40
|
+
htmlcov/
|
|
41
|
+
.tox/
|
|
42
|
+
.nox/
|
|
43
|
+
.coverage
|
|
44
|
+
.coverage.*
|
|
45
|
+
.cache
|
|
46
|
+
nosetests.xml
|
|
47
|
+
coverage.xml
|
|
48
|
+
*.cover
|
|
49
|
+
*.py,cover
|
|
50
|
+
.hypothesis/
|
|
51
|
+
.pytest_cache/
|
|
52
|
+
|
|
53
|
+
# Translations
|
|
54
|
+
*.mo
|
|
55
|
+
*.pot
|
|
56
|
+
|
|
57
|
+
# Django stuff:
|
|
58
|
+
*.log
|
|
59
|
+
local_settings.py
|
|
60
|
+
db.sqlite3
|
|
61
|
+
db.sqlite3-journal
|
|
62
|
+
|
|
63
|
+
# Flask stuff:
|
|
64
|
+
instance/
|
|
65
|
+
.webassets-cache
|
|
66
|
+
|
|
67
|
+
# Scrapy stuff:
|
|
68
|
+
.scrapy
|
|
69
|
+
|
|
70
|
+
# Sphinx documentation
|
|
71
|
+
docs/_build/
|
|
72
|
+
|
|
73
|
+
# PyBuilder
|
|
74
|
+
target/
|
|
75
|
+
|
|
76
|
+
# Jupyter Notebook
|
|
77
|
+
.ipynb_checkpoints
|
|
78
|
+
|
|
79
|
+
# IPython
|
|
80
|
+
profile_default/
|
|
81
|
+
ipython_config.py
|
|
82
|
+
|
|
83
|
+
# pyenv
|
|
84
|
+
.python-version
|
|
85
|
+
|
|
86
|
+
# pipenv
|
|
87
|
+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
|
88
|
+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
|
89
|
+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
|
90
|
+
# install all needed dependencies.
|
|
91
|
+
#Pipfile.lock
|
|
92
|
+
|
|
93
|
+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
|
|
94
|
+
__pypackages__/
|
|
95
|
+
|
|
96
|
+
# Celery stuff
|
|
97
|
+
celerybeat-schedule
|
|
98
|
+
celerybeat.pid
|
|
99
|
+
|
|
100
|
+
# SageMath parsed files
|
|
101
|
+
*.sage.py
|
|
102
|
+
|
|
103
|
+
# Environments
|
|
104
|
+
.env
|
|
105
|
+
.venv
|
|
106
|
+
env/
|
|
107
|
+
venv/
|
|
108
|
+
ENV/
|
|
109
|
+
env.bak/
|
|
110
|
+
venv.bak/
|
|
111
|
+
|
|
112
|
+
# Spyder project settings
|
|
113
|
+
.spyderproject
|
|
114
|
+
.spyproject
|
|
115
|
+
|
|
116
|
+
# Rope project settings
|
|
117
|
+
.ropeproject
|
|
118
|
+
|
|
119
|
+
# mkdocs documentation
|
|
120
|
+
/site
|
|
121
|
+
|
|
122
|
+
# mypy
|
|
123
|
+
.mypy_cache/
|
|
124
|
+
.dmypy.json
|
|
125
|
+
dmypy.json
|
|
126
|
+
|
|
127
|
+
# Pyre type checker
|
|
128
|
+
.pyre/
|
|
129
|
+
|
|
130
|
+
# IDEs
|
|
131
|
+
.vscode/
|
|
132
|
+
.idea/
|
|
133
|
+
*.swp
|
|
134
|
+
*.swo
|
|
135
|
+
*~
|
|
136
|
+
|
|
137
|
+
# OS
|
|
138
|
+
.DS_Store
|
|
139
|
+
.DS_Store?
|
|
140
|
+
._*
|
|
141
|
+
.Spotlight-V100
|
|
142
|
+
.Trashes
|
|
143
|
+
ehthumbs.db
|
|
144
|
+
Thumbs.db
|
|
145
|
+
|
|
146
|
+
# Project specific
|
|
147
|
+
*.pid
|
|
148
|
+
*.seed
|
|
149
|
+
*.pid.lock
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: amcp-agent
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: amcp: Lego-style coding agent CLI. Core: rg grep/find and read; editing & web search via MCP.
|
|
5
|
+
Project-URL: Homepage, https://github.com/tao12345666333/amcp
|
|
6
|
+
Project-URL: Repository, https://github.com/tao12345666333/amcp
|
|
7
|
+
Project-URL: Issues, https://github.com/tao12345666333/amcp/issues
|
|
8
|
+
Author: tao
|
|
9
|
+
License: MIT
|
|
10
|
+
Keywords: agent,ai,cli,coding,llm,mcp
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Environment :: Console
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Topic :: Software Development
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: agent-client-protocol>=0.7.0
|
|
22
|
+
Requires-Dist: mcp[cli]
|
|
23
|
+
Requires-Dist: openai>=1.52.0
|
|
24
|
+
Requires-Dist: prompt-toolkit>=3.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.7
|
|
26
|
+
Requires-Dist: pyyaml>=6.0
|
|
27
|
+
Requires-Dist: rich>=13.7.0
|
|
28
|
+
Requires-Dist: tomli-w>=1.0.0
|
|
29
|
+
Requires-Dist: tomli>=2.0.0; python_version < '3.11'
|
|
30
|
+
Requires-Dist: typer>=0.12.3
|
|
31
|
+
Provides-Extra: anthropic
|
|
32
|
+
Requires-Dist: anthropic>=0.40.0; extra == 'anthropic'
|
|
33
|
+
Provides-Extra: dev
|
|
34
|
+
Requires-Dist: anthropic>=0.40.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: mypy>=1.8.0; extra == 'dev'
|
|
36
|
+
Requires-Dist: pytest-asyncio>=0.23.0; extra == 'dev'
|
|
37
|
+
Requires-Dist: pytest-cov>=4.1.0; extra == 'dev'
|
|
38
|
+
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
39
|
+
Requires-Dist: ruff>=0.3.0; extra == 'dev'
|
|
40
|
+
Description-Content-Type: text/markdown
|
|
41
|
+
|
|
42
|
+
# AMCP
|
|
43
|
+
|
|
44
|
+
[](https://badge.fury.io/py/amcp-agent)
|
|
45
|
+
[](https://github.com/tao12345666333/amcp/actions)
|
|
46
|
+
[](https://www.python.org/downloads/)
|
|
47
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
48
|
+
|
|
49
|
+
tags:
|
|
50
|
+
- building-mcp-track-creative
|
|
51
|
+
- mcp-in-action-track-consumer
|
|
52
|
+
- mcp-in-action-track-creative
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
# AMCP
|
|
56
|
+
|
|
57
|
+
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.).
|
|
58
|
+
|
|
59
|
+
X: https://x.com/zhangjintao9020/status/1995170132973466018?s=20
|
|
60
|
+
Demo: https://drive.google.com/file/d/1FGoY4I_JFQ1FSz19XlVJZ6Z4lWUucD7a/view?usp=sharing
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## Features
|
|
64
|
+
|
|
65
|
+
- **Built-in Tools**: read_file, grep, bash, think, todo, write_file, edit_file
|
|
66
|
+
- **MCP Integration**: Connect to any MCP server for extended capabilities
|
|
67
|
+
- **Conversation History**: Persistent sessions across runs
|
|
68
|
+
- **Flexible Configuration**: YAML-based agent specifications
|
|
69
|
+
- **Tool Calling**: Automatic tool selection and execution
|
|
70
|
+
- **ACP Support**: Full Agent Client Protocol support for IDE integration (Zed, etc.)
|
|
71
|
+
- **AGENTS.md Support**: Auto-load project-specific rules from `AGENTS.md` files
|
|
72
|
+
- **Smart Context Compaction**: Intelligent context management with dynamic thresholds
|
|
73
|
+
- **Multi-Agent System**: Primary/Subagent architecture with built-in agent types (coder, explorer, planner)
|
|
74
|
+
- **Event Bus**: Publish/subscribe system for agent communication and extensibility
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
### Quick Run with uvx (no install needed)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Run directly without installation (like npx)
|
|
82
|
+
uvx amcp-agent
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### From PyPI
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Install from PyPI
|
|
89
|
+
pip install amcp-agent
|
|
90
|
+
|
|
91
|
+
# Or with uv
|
|
92
|
+
uv pip install amcp-agent
|
|
93
|
+
|
|
94
|
+
# With Anthropic Claude support
|
|
95
|
+
pip install amcp-agent[anthropic]
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### From Source (development)
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
# Clone the repository
|
|
102
|
+
git clone https://github.com/tao12345666333/amcp.git
|
|
103
|
+
cd amcp
|
|
104
|
+
|
|
105
|
+
# using uv (recommended)
|
|
106
|
+
uv venv && source .venv/bin/activate
|
|
107
|
+
uv pip install -e .
|
|
108
|
+
|
|
109
|
+
# or with pip
|
|
110
|
+
python -m venv .venv && source .venv/bin/activate
|
|
111
|
+
pip install -e .
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
## Usage
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
# Initialize config
|
|
118
|
+
amcp init
|
|
119
|
+
|
|
120
|
+
# Agent with tool calling (default command)
|
|
121
|
+
amcp # interactive mode with conversation history
|
|
122
|
+
amcp --once "create a hello.py file with a hello function" # single message
|
|
123
|
+
amcp --list # list available agent specifications
|
|
124
|
+
amcp --agent path/to/agent.yaml # use custom agent spec
|
|
125
|
+
amcp --session my-session # use specific session ID
|
|
126
|
+
amcp --clear # clear conversation history
|
|
127
|
+
|
|
128
|
+
# MCP server management
|
|
129
|
+
amcp mcp tools --server exa
|
|
130
|
+
amcp mcp call --server exa --tool web_search_exa --args '{"query":"rust async"}'
|
|
131
|
+
|
|
132
|
+
# Run as ACP agent (for IDE integration)
|
|
133
|
+
amcp-acp
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## ACP (Agent Client Protocol) Support
|
|
137
|
+
|
|
138
|
+
AMCP fully supports the [Agent Client Protocol](https://agentclientprotocol.com/) for integration with IDEs like Zed.
|
|
139
|
+
|
|
140
|
+
### Features
|
|
141
|
+
|
|
142
|
+
- **Session Management**: Create, load, and list sessions
|
|
143
|
+
- **Session Modes**: Switch between `ask`, `architect`, and `code` modes
|
|
144
|
+
- `ask`: Request permission before making changes
|
|
145
|
+
- `architect`: Design and plan without implementation
|
|
146
|
+
- `code`: Full tool access for implementation
|
|
147
|
+
- **Slash Commands**: `/clear`, `/plan`, `/search`, `/help`
|
|
148
|
+
- **Agent Plans**: Visual execution plans for complex tasks
|
|
149
|
+
- **Permission Requests**: User approval for sensitive operations
|
|
150
|
+
- **Client Capabilities**: Use client's filesystem and terminal when available
|
|
151
|
+
|
|
152
|
+
### Running as ACP Agent
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Start the ACP agent server (stdio transport)
|
|
156
|
+
amcp-acp
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Zed Integration
|
|
160
|
+
|
|
161
|
+
Add to your Zed settings (`~/.config/zed/settings.json`):
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"agent": {
|
|
166
|
+
"profiles": {
|
|
167
|
+
"amcp": {
|
|
168
|
+
"name": "AMCP",
|
|
169
|
+
"provider": {
|
|
170
|
+
"type": "acp",
|
|
171
|
+
"command": "amcp-acp"
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
"default_profile": "amcp"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Built-in Tools
|
|
181
|
+
|
|
182
|
+
- **read_file**: Read text files from the workspace
|
|
183
|
+
- **grep**: Search for patterns in files using ripgrep
|
|
184
|
+
- **bash**: Execute bash commands for file operations and system tasks
|
|
185
|
+
- **think**: Internal reasoning and planning
|
|
186
|
+
- **todo**: Manage a todo list to track tasks during complex operations
|
|
187
|
+
- **write_file**: Write content to files (can be disabled via config)
|
|
188
|
+
- **edit_file**: Edit files with search and replace (can be disabled via config)
|
|
189
|
+
- **task**: Spawn sub-agents for parallel task execution
|
|
190
|
+
|
|
191
|
+
## Config
|
|
192
|
+
|
|
193
|
+
The CLI loads MCP servers from `~/.config/amcp/config.toml`.
|
|
194
|
+
Generate a starter config:
|
|
195
|
+
|
|
196
|
+
```bash
|
|
197
|
+
amcp init
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Example (OpenAI-compatible API):
|
|
201
|
+
|
|
202
|
+
```toml
|
|
203
|
+
[servers.exa]
|
|
204
|
+
url = "https://mcp.exa.ai/mcp"
|
|
205
|
+
|
|
206
|
+
[servers.custom]
|
|
207
|
+
command = "npx"
|
|
208
|
+
args = ["-y", "@some/mcp-server"]
|
|
209
|
+
env.API_KEY = "your-key"
|
|
210
|
+
|
|
211
|
+
[chat]
|
|
212
|
+
api_type = "openai" # "openai" (default) or "anthropic"
|
|
213
|
+
base_url = "https://api.openai.com/v1"
|
|
214
|
+
model = "gpt-4o"
|
|
215
|
+
api_key = "your-api-key"
|
|
216
|
+
mcp_tools_enabled = true
|
|
217
|
+
write_tool_enabled = true # Enable/disable built-in write_file tool
|
|
218
|
+
edit_tool_enabled = true # Enable/disable built-in edit_file tool
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
Example (OpenAI Responses API):
|
|
222
|
+
|
|
223
|
+
```toml
|
|
224
|
+
[chat]
|
|
225
|
+
api_type = "openai_responses"
|
|
226
|
+
model = "gpt-4o"
|
|
227
|
+
api_key = "your-api-key"
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Example (Anthropic Claude):
|
|
231
|
+
|
|
232
|
+
```toml
|
|
233
|
+
[chat]
|
|
234
|
+
api_type = "anthropic"
|
|
235
|
+
model = "claude-sonnet-4-20250514"
|
|
236
|
+
api_key = "your-anthropic-api-key" # or set ANTHROPIC_API_KEY env var
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
To use Anthropic, install with: `pip install amcp-agent[anthropic]`
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
### Setup Development Environment
|
|
244
|
+
|
|
245
|
+
```bash
|
|
246
|
+
# Clone the repository
|
|
247
|
+
git clone <repo-url>
|
|
248
|
+
cd AMCP
|
|
249
|
+
|
|
250
|
+
# Install with development dependencies
|
|
251
|
+
pip install -e ".[dev]"
|
|
252
|
+
|
|
253
|
+
# Install pre-commit hooks
|
|
254
|
+
pre-commit install
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Running Tests
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
# Run all tests
|
|
261
|
+
make test
|
|
262
|
+
|
|
263
|
+
# Run with coverage
|
|
264
|
+
make test-cov
|
|
265
|
+
|
|
266
|
+
# Run specific test
|
|
267
|
+
pytest tests/test_tools.py -v
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Code Quality
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
# Lint code
|
|
274
|
+
make lint
|
|
275
|
+
|
|
276
|
+
# Format code
|
|
277
|
+
make format
|
|
278
|
+
|
|
279
|
+
# Type check
|
|
280
|
+
make type-check
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed development guidelines.
|
|
284
|
+
|
|
285
|
+
## Notes
|
|
286
|
+
- `rg` (ripgrep) must be installed and on PATH for the grep tool.
|
|
287
|
+
- MCP servers must be installed separately and runnable (stdio transport).
|
|
288
|
+
|
|
289
|
+
## License
|
|
290
|
+
|
|
291
|
+
Apache-2.0
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# AMCP
|
|
2
|
+
|
|
3
|
+
[](https://badge.fury.io/py/amcp-agent)
|
|
4
|
+
[](https://github.com/tao12345666333/amcp/actions)
|
|
5
|
+
[](https://www.python.org/downloads/)
|
|
6
|
+
[](https://opensource.org/licenses/Apache-2.0)
|
|
7
|
+
|
|
8
|
+
tags:
|
|
9
|
+
- building-mcp-track-creative
|
|
10
|
+
- mcp-in-action-track-consumer
|
|
11
|
+
- mcp-in-action-track-creative
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
# AMCP
|
|
15
|
+
|
|
16
|
+
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.).
|
|
17
|
+
|
|
18
|
+
X: https://x.com/zhangjintao9020/status/1995170132973466018?s=20
|
|
19
|
+
Demo: https://drive.google.com/file/d/1FGoY4I_JFQ1FSz19XlVJZ6Z4lWUucD7a/view?usp=sharing
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- **Built-in Tools**: read_file, grep, bash, think, todo, write_file, edit_file
|
|
25
|
+
- **MCP Integration**: Connect to any MCP server for extended capabilities
|
|
26
|
+
- **Conversation History**: Persistent sessions across runs
|
|
27
|
+
- **Flexible Configuration**: YAML-based agent specifications
|
|
28
|
+
- **Tool Calling**: Automatic tool selection and execution
|
|
29
|
+
- **ACP Support**: Full Agent Client Protocol support for IDE integration (Zed, etc.)
|
|
30
|
+
- **AGENTS.md Support**: Auto-load project-specific rules from `AGENTS.md` files
|
|
31
|
+
- **Smart Context Compaction**: Intelligent context management with dynamic thresholds
|
|
32
|
+
- **Multi-Agent System**: Primary/Subagent architecture with built-in agent types (coder, explorer, planner)
|
|
33
|
+
- **Event Bus**: Publish/subscribe system for agent communication and extensibility
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
### Quick Run with uvx (no install needed)
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Run directly without installation (like npx)
|
|
41
|
+
uvx amcp-agent
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### From PyPI
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
# Install from PyPI
|
|
48
|
+
pip install amcp-agent
|
|
49
|
+
|
|
50
|
+
# Or with uv
|
|
51
|
+
uv pip install amcp-agent
|
|
52
|
+
|
|
53
|
+
# With Anthropic Claude support
|
|
54
|
+
pip install amcp-agent[anthropic]
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### From Source (development)
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Clone the repository
|
|
61
|
+
git clone https://github.com/tao12345666333/amcp.git
|
|
62
|
+
cd amcp
|
|
63
|
+
|
|
64
|
+
# using uv (recommended)
|
|
65
|
+
uv venv && source .venv/bin/activate
|
|
66
|
+
uv pip install -e .
|
|
67
|
+
|
|
68
|
+
# or with pip
|
|
69
|
+
python -m venv .venv && source .venv/bin/activate
|
|
70
|
+
pip install -e .
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Initialize config
|
|
77
|
+
amcp init
|
|
78
|
+
|
|
79
|
+
# Agent with tool calling (default command)
|
|
80
|
+
amcp # interactive mode with conversation history
|
|
81
|
+
amcp --once "create a hello.py file with a hello function" # single message
|
|
82
|
+
amcp --list # list available agent specifications
|
|
83
|
+
amcp --agent path/to/agent.yaml # use custom agent spec
|
|
84
|
+
amcp --session my-session # use specific session ID
|
|
85
|
+
amcp --clear # clear conversation history
|
|
86
|
+
|
|
87
|
+
# MCP server management
|
|
88
|
+
amcp mcp tools --server exa
|
|
89
|
+
amcp mcp call --server exa --tool web_search_exa --args '{"query":"rust async"}'
|
|
90
|
+
|
|
91
|
+
# Run as ACP agent (for IDE integration)
|
|
92
|
+
amcp-acp
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## ACP (Agent Client Protocol) Support
|
|
96
|
+
|
|
97
|
+
AMCP fully supports the [Agent Client Protocol](https://agentclientprotocol.com/) for integration with IDEs like Zed.
|
|
98
|
+
|
|
99
|
+
### Features
|
|
100
|
+
|
|
101
|
+
- **Session Management**: Create, load, and list sessions
|
|
102
|
+
- **Session Modes**: Switch between `ask`, `architect`, and `code` modes
|
|
103
|
+
- `ask`: Request permission before making changes
|
|
104
|
+
- `architect`: Design and plan without implementation
|
|
105
|
+
- `code`: Full tool access for implementation
|
|
106
|
+
- **Slash Commands**: `/clear`, `/plan`, `/search`, `/help`
|
|
107
|
+
- **Agent Plans**: Visual execution plans for complex tasks
|
|
108
|
+
- **Permission Requests**: User approval for sensitive operations
|
|
109
|
+
- **Client Capabilities**: Use client's filesystem and terminal when available
|
|
110
|
+
|
|
111
|
+
### Running as ACP Agent
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Start the ACP agent server (stdio transport)
|
|
115
|
+
amcp-acp
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Zed Integration
|
|
119
|
+
|
|
120
|
+
Add to your Zed settings (`~/.config/zed/settings.json`):
|
|
121
|
+
|
|
122
|
+
```json
|
|
123
|
+
{
|
|
124
|
+
"agent": {
|
|
125
|
+
"profiles": {
|
|
126
|
+
"amcp": {
|
|
127
|
+
"name": "AMCP",
|
|
128
|
+
"provider": {
|
|
129
|
+
"type": "acp",
|
|
130
|
+
"command": "amcp-acp"
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
},
|
|
134
|
+
"default_profile": "amcp"
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Built-in Tools
|
|
140
|
+
|
|
141
|
+
- **read_file**: Read text files from the workspace
|
|
142
|
+
- **grep**: Search for patterns in files using ripgrep
|
|
143
|
+
- **bash**: Execute bash commands for file operations and system tasks
|
|
144
|
+
- **think**: Internal reasoning and planning
|
|
145
|
+
- **todo**: Manage a todo list to track tasks during complex operations
|
|
146
|
+
- **write_file**: Write content to files (can be disabled via config)
|
|
147
|
+
- **edit_file**: Edit files with search and replace (can be disabled via config)
|
|
148
|
+
- **task**: Spawn sub-agents for parallel task execution
|
|
149
|
+
|
|
150
|
+
## Config
|
|
151
|
+
|
|
152
|
+
The CLI loads MCP servers from `~/.config/amcp/config.toml`.
|
|
153
|
+
Generate a starter config:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
amcp init
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Example (OpenAI-compatible API):
|
|
160
|
+
|
|
161
|
+
```toml
|
|
162
|
+
[servers.exa]
|
|
163
|
+
url = "https://mcp.exa.ai/mcp"
|
|
164
|
+
|
|
165
|
+
[servers.custom]
|
|
166
|
+
command = "npx"
|
|
167
|
+
args = ["-y", "@some/mcp-server"]
|
|
168
|
+
env.API_KEY = "your-key"
|
|
169
|
+
|
|
170
|
+
[chat]
|
|
171
|
+
api_type = "openai" # "openai" (default) or "anthropic"
|
|
172
|
+
base_url = "https://api.openai.com/v1"
|
|
173
|
+
model = "gpt-4o"
|
|
174
|
+
api_key = "your-api-key"
|
|
175
|
+
mcp_tools_enabled = true
|
|
176
|
+
write_tool_enabled = true # Enable/disable built-in write_file tool
|
|
177
|
+
edit_tool_enabled = true # Enable/disable built-in edit_file tool
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
Example (OpenAI Responses API):
|
|
181
|
+
|
|
182
|
+
```toml
|
|
183
|
+
[chat]
|
|
184
|
+
api_type = "openai_responses"
|
|
185
|
+
model = "gpt-4o"
|
|
186
|
+
api_key = "your-api-key"
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Example (Anthropic Claude):
|
|
190
|
+
|
|
191
|
+
```toml
|
|
192
|
+
[chat]
|
|
193
|
+
api_type = "anthropic"
|
|
194
|
+
model = "claude-sonnet-4-20250514"
|
|
195
|
+
api_key = "your-anthropic-api-key" # or set ANTHROPIC_API_KEY env var
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
To use Anthropic, install with: `pip install amcp-agent[anthropic]`
|
|
199
|
+
|
|
200
|
+
## Development
|
|
201
|
+
|
|
202
|
+
### Setup Development Environment
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Clone the repository
|
|
206
|
+
git clone <repo-url>
|
|
207
|
+
cd AMCP
|
|
208
|
+
|
|
209
|
+
# Install with development dependencies
|
|
210
|
+
pip install -e ".[dev]"
|
|
211
|
+
|
|
212
|
+
# Install pre-commit hooks
|
|
213
|
+
pre-commit install
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
### Running Tests
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
# Run all tests
|
|
220
|
+
make test
|
|
221
|
+
|
|
222
|
+
# Run with coverage
|
|
223
|
+
make test-cov
|
|
224
|
+
|
|
225
|
+
# Run specific test
|
|
226
|
+
pytest tests/test_tools.py -v
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Code Quality
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# Lint code
|
|
233
|
+
make lint
|
|
234
|
+
|
|
235
|
+
# Format code
|
|
236
|
+
make format
|
|
237
|
+
|
|
238
|
+
# Type check
|
|
239
|
+
make type-check
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for detailed development guidelines.
|
|
243
|
+
|
|
244
|
+
## Notes
|
|
245
|
+
- `rg` (ripgrep) must be installed and on PATH for the grep tool.
|
|
246
|
+
- MCP servers must be installed separately and runnable (stdio transport).
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
Apache-2.0
|