coala-client 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.
- coala_client-0.1.0/LICENSE +21 -0
- coala_client-0.1.0/PKG-INFO +296 -0
- coala_client-0.1.0/README.md +263 -0
- coala_client-0.1.0/pyproject.toml +44 -0
- coala_client-0.1.0/src/coala_client/__init__.py +3 -0
- coala_client-0.1.0/src/coala_client/cli.py +426 -0
- coala_client-0.1.0/src/coala_client/config.py +233 -0
- coala_client-0.1.0/src/coala_client/llm_client.py +262 -0
- coala_client-0.1.0/src/coala_client/main.py +323 -0
- coala_client-0.1.0/src/coala_client/mcp_import.py +172 -0
- coala_client-0.1.0/src/coala_client/mcp_manager.py +225 -0
- coala_client-0.1.0/src/coala_client/sandbox.py +70 -0
- coala_client-0.1.0/src/coala_client/skill_import.py +188 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 coala-info
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: coala-client
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A simple command line interface for LLM with MCP server and OpenAI-compatible API support
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: coala-info
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Classifier: Development Status :: 4 - Beta
|
|
10
|
+
Classifier: Environment :: Console
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Dist: anyio (>=4.0.0)
|
|
21
|
+
Requires-Dist: click (>=8.1.0)
|
|
22
|
+
Requires-Dist: httpx (>=0.27.0)
|
|
23
|
+
Requires-Dist: mcp (>=1.0.0)
|
|
24
|
+
Requires-Dist: openai (>=1.68.0)
|
|
25
|
+
Requires-Dist: pydantic (>=2.0.0)
|
|
26
|
+
Requires-Dist: pydantic-settings (>=2.0.0)
|
|
27
|
+
Requires-Dist: rich (>=13.0.0)
|
|
28
|
+
Project-URL: Documentation, https://github.com/coala-info/coala_client#readme
|
|
29
|
+
Project-URL: Homepage, https://github.com/coala-info/coala_client
|
|
30
|
+
Project-URL: Repository, https://github.com/coala-info/coala_client
|
|
31
|
+
Description-Content-Type: text/markdown
|
|
32
|
+
|
|
33
|
+
# Coala Client
|
|
34
|
+
|
|
35
|
+
A simple command line interface for LLM with MCP (Model Context Protocol) server support and OpenAI-compatible API support.
|
|
36
|
+
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
- **OpenAI-compatible API support**: Works with OpenAI, Google Gemini, Ollama, and any OpenAI-compatible API
|
|
40
|
+
- **MCP Server integration**: Connect to multiple MCP servers for extended tool capabilities
|
|
41
|
+
- **Interactive chat**: Rich terminal UI with streaming responses
|
|
42
|
+
- **Tool calling**: Automatic tool execution with MCP servers
|
|
43
|
+
|
|
44
|
+
## Installation
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install coala-client
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
### 1. Initialize Configuration
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
coala init
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
This creates a default MCP servers configuration file at `~/.config/coala/mcps/mcp_servers.json`.
|
|
59
|
+
|
|
60
|
+
### 2. Set API Key
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# For OpenAI
|
|
64
|
+
export OPENAI_API_KEY=your-openai-api-key
|
|
65
|
+
|
|
66
|
+
# For Gemini
|
|
67
|
+
export GEMINI_API_KEY=your-gemini-api-key
|
|
68
|
+
|
|
69
|
+
# Ollama doesn't require an API key (runs locally)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### 3. Start Chatting
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
# Interactive chat with default provider (OpenAI)
|
|
76
|
+
coala
|
|
77
|
+
|
|
78
|
+
# Use a specific provider
|
|
79
|
+
coala -p gemini
|
|
80
|
+
coala -p ollama
|
|
81
|
+
|
|
82
|
+
# Use a specific model
|
|
83
|
+
coala -p openai -m gpt-4-turbo
|
|
84
|
+
|
|
85
|
+
# Single prompt
|
|
86
|
+
coala ask "What is the capital of France?"
|
|
87
|
+
|
|
88
|
+
# Disable MCP servers
|
|
89
|
+
coala --no-mcp
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
### Environment Variables
|
|
95
|
+
|
|
96
|
+
| Variable | Description | Default |
|
|
97
|
+
|----------|-------------|---------|
|
|
98
|
+
| `PROVIDER` | Default LLM provider | `openai` |
|
|
99
|
+
| `OPENAI_API_KEY` | OpenAI API key | - |
|
|
100
|
+
| `OPENAI_BASE_URL` | OpenAI base URL | `https://api.openai.com/v1` |
|
|
101
|
+
| `OPENAI_MODEL` | OpenAI model | `gpt-4o` |
|
|
102
|
+
| `GEMINI_API_KEY` | Gemini API key | - |
|
|
103
|
+
| `GEMINI_BASE_URL` | Gemini base URL | `https://generativelanguage.googleapis.com/v1beta/openai` |
|
|
104
|
+
| `GEMINI_MODEL` | Gemini model | `gemini-2.5-flash-lite` |
|
|
105
|
+
| `OLLAMA_BASE_URL` | Ollama base URL | `http://localhost:11434/v1` |
|
|
106
|
+
| `OLLAMA_MODEL` | Ollama model | `qwen3` |
|
|
107
|
+
| `SYSTEM_PROMPT` | System prompt | `You are a helpful assistant.` |
|
|
108
|
+
| `MAX_TOKENS` | Max tokens in response | `4096` |
|
|
109
|
+
| `TEMPERATURE` | Temperature | `0.7` |
|
|
110
|
+
| `MCP_CONFIG_FILE` | MCP config file path | `~/.config/coala/mcps/mcp_servers.json` |
|
|
111
|
+
|
|
112
|
+
### MCP Servers Configuration
|
|
113
|
+
|
|
114
|
+
Edit `~/.config/coala/mcps/mcp_servers.json`:
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{
|
|
118
|
+
"mcpServers": {
|
|
119
|
+
"filesystem": {
|
|
120
|
+
"command": "npx",
|
|
121
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"],
|
|
122
|
+
"env": {}
|
|
123
|
+
},
|
|
124
|
+
"github": {
|
|
125
|
+
"command": "npx",
|
|
126
|
+
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
127
|
+
"env": {
|
|
128
|
+
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Environment Variables for MCP Servers
|
|
136
|
+
|
|
137
|
+
You can set environment variables that will be available to all MCP servers by editing `~/.config/coala/env`:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
# Environment variables for MCP servers
|
|
141
|
+
# Format: KEY=value
|
|
142
|
+
|
|
143
|
+
# Set default provider (openai, gemini, ollama, custom)
|
|
144
|
+
PROVIDER=gemini
|
|
145
|
+
|
|
146
|
+
# API keys and model settings
|
|
147
|
+
GEMINI_API_KEY=your-gemini-api-key
|
|
148
|
+
GEMINI_MODEL=gemini-2.5-flash-lite
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
**Note:** The `PROVIDER` variable in the env file will set the default LLM provider. These variables will be merged with server-specific `env` settings in `mcp_servers.json`. Server-specific environment variables take precedence over the base environment variables.
|
|
152
|
+
|
|
153
|
+
## CLI Commands
|
|
154
|
+
|
|
155
|
+
### Interactive Chat
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
coala [OPTIONS]
|
|
159
|
+
coala chat [OPTIONS]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
Options:
|
|
163
|
+
- `-p, --provider`: LLM provider (openai/gemini/ollama/custom)
|
|
164
|
+
- `-m, --model`: Model name override
|
|
165
|
+
- `--no-mcp`: Disable MCP servers
|
|
166
|
+
- `--sandbox`: Enable `run_command` tool so the LLM can run basic Linux shell commands (timeout 30s)
|
|
167
|
+
|
|
168
|
+
### Single Prompt
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
coala ask "Your prompt here"
|
|
172
|
+
coala -c "Your prompt here"
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Chat Commands
|
|
176
|
+
|
|
177
|
+
During interactive chat:
|
|
178
|
+
- `/help` - Show help
|
|
179
|
+
- `/exit` / `/quit` - Exit chat
|
|
180
|
+
- `/clear` - Clear conversation history
|
|
181
|
+
- `/tools` - List available MCP tools
|
|
182
|
+
- `/servers` - List connected MCP servers
|
|
183
|
+
- `/skill` - List installed skills (from ~/.config/coala/skills/)
|
|
184
|
+
- `/skill <name>` - Load a skill into the chat (adds its instructions to context)
|
|
185
|
+
- `/model` - Show current model info
|
|
186
|
+
- `/switch <provider>` - Switch provider
|
|
187
|
+
|
|
188
|
+
### Configuration
|
|
189
|
+
|
|
190
|
+
```bash
|
|
191
|
+
coala init # Create default config files
|
|
192
|
+
coala config # Show current configuration
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
### CWL toolset as MCP server
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
# Import one or more CWL files into a named toolset (copied to ~/.config/coala/mcps/<toolset>/)
|
|
199
|
+
coala mcp-import <TOOLSET> file1.cwl [file2.cwl ...]
|
|
200
|
+
|
|
201
|
+
# Import a zip of CWL files (extracted to ~/.config/coala/mcps/<toolset>/)
|
|
202
|
+
coala mcp-import <TOOLSET> tools.zip
|
|
203
|
+
|
|
204
|
+
# SOURCES can also be http(s) URLs to a .cwl file or a .zip
|
|
205
|
+
coala mcp-import <TOOLSET> https://example.com/tools.zip
|
|
206
|
+
coala mcp-import <TOOLSET> https://example.com/tool.cwl
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
This creates `run_mcp.py` in `~/.config/coala/mcps/<toolset>/`, adds the server to `~/.config/coala/mcps/mcp_servers.json`, and prints the MCP entry. The generated script uses `coala.mcp_api` (stdio transport). Ensure the `coala` package is installed in the environment that runs the MCP server.
|
|
210
|
+
|
|
211
|
+
**List servers and tools:**
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
# List configured MCP server names
|
|
215
|
+
coala mcp-list
|
|
216
|
+
|
|
217
|
+
# Show tool schemas (name, description, inputSchema) for a server
|
|
218
|
+
coala mcp-list <SERVER_NAME>
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
**Call an MCP tool directly:**
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
coala mcp-call <SERVER>.<TOOL> --args '<JSON>'
|
|
225
|
+
# Example:
|
|
226
|
+
coala mcp-call gene-variant.ncbi_datasets_gene --args '{"data": [{"gene": "TP53", "taxon": "human"}]}'
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Skills
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
# Import skills from a GitHub folder (e.g. vercel-labs/agent-skills/skills)
|
|
233
|
+
coala skill https://github.com/vercel-labs/agent-skills/tree/main/skills
|
|
234
|
+
|
|
235
|
+
# Import from a zip URL or local zip/directory
|
|
236
|
+
coala skill http://localhost:3000/files/bedtools/bedtools-skills.zip
|
|
237
|
+
coala skill ./my-skills.zip
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
All skills are copied to `~/.config/coala/skills/`. Each source gets its own subfolder (e.g. `skills/bedtools/` for a zip from `.../bedtools/bedtools-skills.zip`, `skills/agent-skills/` for the GitHub repo).
|
|
241
|
+
|
|
242
|
+
## Examples
|
|
243
|
+
|
|
244
|
+
### Using with Ollama
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Start Ollama server
|
|
248
|
+
ollama serve
|
|
249
|
+
|
|
250
|
+
# Pull a model
|
|
251
|
+
ollama pull llama3.2
|
|
252
|
+
|
|
253
|
+
# Chat with Ollama
|
|
254
|
+
coala -p ollama -m llama3.2
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
### Using with Gemini
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
export GEMINI_API_KEY=your-api-key
|
|
261
|
+
coala -p gemini
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### Using Custom OpenAI-compatible API
|
|
265
|
+
|
|
266
|
+
```bash
|
|
267
|
+
export CUSTOM_API_KEY=your-api-key
|
|
268
|
+
export CUSTOM_BASE_URL=https://your-api.com/v1
|
|
269
|
+
export CUSTOM_MODEL=your-model
|
|
270
|
+
coala -p custom
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
## Development
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# Install with dev dependencies
|
|
277
|
+
uv pip install -e ".[dev]"
|
|
278
|
+
|
|
279
|
+
# Run tests
|
|
280
|
+
pytest
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Publishing to PyPI
|
|
284
|
+
|
|
285
|
+
The repo includes a GitHub Action (`.github/workflows/release.yml`) that builds with Poetry and publishes to PyPI when a release is published.
|
|
286
|
+
|
|
287
|
+
1. **Create a GitHub environment** named `pypi` (optional but recommended).
|
|
288
|
+
2. **Configure PyPI** using one of:
|
|
289
|
+
- **Trusted Publishing (recommended)**: In PyPI → Your projects → coala-client → Publishing, add a new trusted publisher: GitHub, this repo, workflow `publish-pypi.yml`, environment `pypi`. No secrets needed.
|
|
290
|
+
- **API token**: Generate a token at pypi.org, add it as repository (or `pypi` environment) secret `PYPI_API_TOKEN`.
|
|
291
|
+
3. **Publish**: Create a new release (tag e.g. `v0.1.0`). The workflow runs on release and uploads the built package. You can also run it manually (Actions → Build and publish to PyPI → Run workflow).
|
|
292
|
+
|
|
293
|
+
## License
|
|
294
|
+
|
|
295
|
+
MIT
|
|
296
|
+
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
# Coala Client
|
|
2
|
+
|
|
3
|
+
A simple command line interface for LLM with MCP (Model Context Protocol) server support and OpenAI-compatible API support.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **OpenAI-compatible API support**: Works with OpenAI, Google Gemini, Ollama, and any OpenAI-compatible API
|
|
8
|
+
- **MCP Server integration**: Connect to multiple MCP servers for extended tool capabilities
|
|
9
|
+
- **Interactive chat**: Rich terminal UI with streaming responses
|
|
10
|
+
- **Tool calling**: Automatic tool execution with MCP servers
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pip install coala-client
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### 1. Initialize Configuration
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
coala init
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
This creates a default MCP servers configuration file at `~/.config/coala/mcps/mcp_servers.json`.
|
|
27
|
+
|
|
28
|
+
### 2. Set API Key
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# For OpenAI
|
|
32
|
+
export OPENAI_API_KEY=your-openai-api-key
|
|
33
|
+
|
|
34
|
+
# For Gemini
|
|
35
|
+
export GEMINI_API_KEY=your-gemini-api-key
|
|
36
|
+
|
|
37
|
+
# Ollama doesn't require an API key (runs locally)
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### 3. Start Chatting
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Interactive chat with default provider (OpenAI)
|
|
44
|
+
coala
|
|
45
|
+
|
|
46
|
+
# Use a specific provider
|
|
47
|
+
coala -p gemini
|
|
48
|
+
coala -p ollama
|
|
49
|
+
|
|
50
|
+
# Use a specific model
|
|
51
|
+
coala -p openai -m gpt-4-turbo
|
|
52
|
+
|
|
53
|
+
# Single prompt
|
|
54
|
+
coala ask "What is the capital of France?"
|
|
55
|
+
|
|
56
|
+
# Disable MCP servers
|
|
57
|
+
coala --no-mcp
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Configuration
|
|
61
|
+
|
|
62
|
+
### Environment Variables
|
|
63
|
+
|
|
64
|
+
| Variable | Description | Default |
|
|
65
|
+
|----------|-------------|---------|
|
|
66
|
+
| `PROVIDER` | Default LLM provider | `openai` |
|
|
67
|
+
| `OPENAI_API_KEY` | OpenAI API key | - |
|
|
68
|
+
| `OPENAI_BASE_URL` | OpenAI base URL | `https://api.openai.com/v1` |
|
|
69
|
+
| `OPENAI_MODEL` | OpenAI model | `gpt-4o` |
|
|
70
|
+
| `GEMINI_API_KEY` | Gemini API key | - |
|
|
71
|
+
| `GEMINI_BASE_URL` | Gemini base URL | `https://generativelanguage.googleapis.com/v1beta/openai` |
|
|
72
|
+
| `GEMINI_MODEL` | Gemini model | `gemini-2.5-flash-lite` |
|
|
73
|
+
| `OLLAMA_BASE_URL` | Ollama base URL | `http://localhost:11434/v1` |
|
|
74
|
+
| `OLLAMA_MODEL` | Ollama model | `qwen3` |
|
|
75
|
+
| `SYSTEM_PROMPT` | System prompt | `You are a helpful assistant.` |
|
|
76
|
+
| `MAX_TOKENS` | Max tokens in response | `4096` |
|
|
77
|
+
| `TEMPERATURE` | Temperature | `0.7` |
|
|
78
|
+
| `MCP_CONFIG_FILE` | MCP config file path | `~/.config/coala/mcps/mcp_servers.json` |
|
|
79
|
+
|
|
80
|
+
### MCP Servers Configuration
|
|
81
|
+
|
|
82
|
+
Edit `~/.config/coala/mcps/mcp_servers.json`:
|
|
83
|
+
|
|
84
|
+
```json
|
|
85
|
+
{
|
|
86
|
+
"mcpServers": {
|
|
87
|
+
"filesystem": {
|
|
88
|
+
"command": "npx",
|
|
89
|
+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/dir"],
|
|
90
|
+
"env": {}
|
|
91
|
+
},
|
|
92
|
+
"github": {
|
|
93
|
+
"command": "npx",
|
|
94
|
+
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
95
|
+
"env": {
|
|
96
|
+
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-token"
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Environment Variables for MCP Servers
|
|
104
|
+
|
|
105
|
+
You can set environment variables that will be available to all MCP servers by editing `~/.config/coala/env`:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Environment variables for MCP servers
|
|
109
|
+
# Format: KEY=value
|
|
110
|
+
|
|
111
|
+
# Set default provider (openai, gemini, ollama, custom)
|
|
112
|
+
PROVIDER=gemini
|
|
113
|
+
|
|
114
|
+
# API keys and model settings
|
|
115
|
+
GEMINI_API_KEY=your-gemini-api-key
|
|
116
|
+
GEMINI_MODEL=gemini-2.5-flash-lite
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Note:** The `PROVIDER` variable in the env file will set the default LLM provider. These variables will be merged with server-specific `env` settings in `mcp_servers.json`. Server-specific environment variables take precedence over the base environment variables.
|
|
120
|
+
|
|
121
|
+
## CLI Commands
|
|
122
|
+
|
|
123
|
+
### Interactive Chat
|
|
124
|
+
|
|
125
|
+
```bash
|
|
126
|
+
coala [OPTIONS]
|
|
127
|
+
coala chat [OPTIONS]
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Options:
|
|
131
|
+
- `-p, --provider`: LLM provider (openai/gemini/ollama/custom)
|
|
132
|
+
- `-m, --model`: Model name override
|
|
133
|
+
- `--no-mcp`: Disable MCP servers
|
|
134
|
+
- `--sandbox`: Enable `run_command` tool so the LLM can run basic Linux shell commands (timeout 30s)
|
|
135
|
+
|
|
136
|
+
### Single Prompt
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
coala ask "Your prompt here"
|
|
140
|
+
coala -c "Your prompt here"
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Chat Commands
|
|
144
|
+
|
|
145
|
+
During interactive chat:
|
|
146
|
+
- `/help` - Show help
|
|
147
|
+
- `/exit` / `/quit` - Exit chat
|
|
148
|
+
- `/clear` - Clear conversation history
|
|
149
|
+
- `/tools` - List available MCP tools
|
|
150
|
+
- `/servers` - List connected MCP servers
|
|
151
|
+
- `/skill` - List installed skills (from ~/.config/coala/skills/)
|
|
152
|
+
- `/skill <name>` - Load a skill into the chat (adds its instructions to context)
|
|
153
|
+
- `/model` - Show current model info
|
|
154
|
+
- `/switch <provider>` - Switch provider
|
|
155
|
+
|
|
156
|
+
### Configuration
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
coala init # Create default config files
|
|
160
|
+
coala config # Show current configuration
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### CWL toolset as MCP server
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
# Import one or more CWL files into a named toolset (copied to ~/.config/coala/mcps/<toolset>/)
|
|
167
|
+
coala mcp-import <TOOLSET> file1.cwl [file2.cwl ...]
|
|
168
|
+
|
|
169
|
+
# Import a zip of CWL files (extracted to ~/.config/coala/mcps/<toolset>/)
|
|
170
|
+
coala mcp-import <TOOLSET> tools.zip
|
|
171
|
+
|
|
172
|
+
# SOURCES can also be http(s) URLs to a .cwl file or a .zip
|
|
173
|
+
coala mcp-import <TOOLSET> https://example.com/tools.zip
|
|
174
|
+
coala mcp-import <TOOLSET> https://example.com/tool.cwl
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
This creates `run_mcp.py` in `~/.config/coala/mcps/<toolset>/`, adds the server to `~/.config/coala/mcps/mcp_servers.json`, and prints the MCP entry. The generated script uses `coala.mcp_api` (stdio transport). Ensure the `coala` package is installed in the environment that runs the MCP server.
|
|
178
|
+
|
|
179
|
+
**List servers and tools:**
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
# List configured MCP server names
|
|
183
|
+
coala mcp-list
|
|
184
|
+
|
|
185
|
+
# Show tool schemas (name, description, inputSchema) for a server
|
|
186
|
+
coala mcp-list <SERVER_NAME>
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**Call an MCP tool directly:**
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
coala mcp-call <SERVER>.<TOOL> --args '<JSON>'
|
|
193
|
+
# Example:
|
|
194
|
+
coala mcp-call gene-variant.ncbi_datasets_gene --args '{"data": [{"gene": "TP53", "taxon": "human"}]}'
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Skills
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
# Import skills from a GitHub folder (e.g. vercel-labs/agent-skills/skills)
|
|
201
|
+
coala skill https://github.com/vercel-labs/agent-skills/tree/main/skills
|
|
202
|
+
|
|
203
|
+
# Import from a zip URL or local zip/directory
|
|
204
|
+
coala skill http://localhost:3000/files/bedtools/bedtools-skills.zip
|
|
205
|
+
coala skill ./my-skills.zip
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
All skills are copied to `~/.config/coala/skills/`. Each source gets its own subfolder (e.g. `skills/bedtools/` for a zip from `.../bedtools/bedtools-skills.zip`, `skills/agent-skills/` for the GitHub repo).
|
|
209
|
+
|
|
210
|
+
## Examples
|
|
211
|
+
|
|
212
|
+
### Using with Ollama
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
# Start Ollama server
|
|
216
|
+
ollama serve
|
|
217
|
+
|
|
218
|
+
# Pull a model
|
|
219
|
+
ollama pull llama3.2
|
|
220
|
+
|
|
221
|
+
# Chat with Ollama
|
|
222
|
+
coala -p ollama -m llama3.2
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
### Using with Gemini
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
export GEMINI_API_KEY=your-api-key
|
|
229
|
+
coala -p gemini
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Using Custom OpenAI-compatible API
|
|
233
|
+
|
|
234
|
+
```bash
|
|
235
|
+
export CUSTOM_API_KEY=your-api-key
|
|
236
|
+
export CUSTOM_BASE_URL=https://your-api.com/v1
|
|
237
|
+
export CUSTOM_MODEL=your-model
|
|
238
|
+
coala -p custom
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
## Development
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Install with dev dependencies
|
|
245
|
+
uv pip install -e ".[dev]"
|
|
246
|
+
|
|
247
|
+
# Run tests
|
|
248
|
+
pytest
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Publishing to PyPI
|
|
252
|
+
|
|
253
|
+
The repo includes a GitHub Action (`.github/workflows/release.yml`) that builds with Poetry and publishes to PyPI when a release is published.
|
|
254
|
+
|
|
255
|
+
1. **Create a GitHub environment** named `pypi` (optional but recommended).
|
|
256
|
+
2. **Configure PyPI** using one of:
|
|
257
|
+
- **Trusted Publishing (recommended)**: In PyPI → Your projects → coala-client → Publishing, add a new trusted publisher: GitHub, this repo, workflow `publish-pypi.yml`, environment `pypi`. No secrets needed.
|
|
258
|
+
- **API token**: Generate a token at pypi.org, add it as repository (or `pypi` environment) secret `PYPI_API_TOKEN`.
|
|
259
|
+
3. **Publish**: Create a new release (tag e.g. `v0.1.0`). The workflow runs on release and uploads the built package. You can also run it manually (Actions → Build and publish to PyPI → Run workflow).
|
|
260
|
+
|
|
261
|
+
## License
|
|
262
|
+
|
|
263
|
+
MIT
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "coala-client"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A simple command line interface for LLM with MCP server and OpenAI-compatible API support"
|
|
5
|
+
authors = ["coala-info"]
|
|
6
|
+
license = "MIT"
|
|
7
|
+
readme = "README.md"
|
|
8
|
+
packages = [{ include = "coala_client", from = "src" }]
|
|
9
|
+
homepage = "https://github.com/coala-info/coala_client"
|
|
10
|
+
repository = "https://github.com/coala-info/coala_client"
|
|
11
|
+
documentation = "https://github.com/coala-info/coala_client#readme"
|
|
12
|
+
classifiers = [
|
|
13
|
+
"Development Status :: 4 - Beta",
|
|
14
|
+
"Environment :: Console",
|
|
15
|
+
"Intended Audience :: Developers",
|
|
16
|
+
"License :: OSI Approved :: MIT License",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Topic :: Scientific/Engineering",
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
[tool.poetry.dependencies]
|
|
25
|
+
python = ">=3.10"
|
|
26
|
+
openai = ">=1.68.0"
|
|
27
|
+
mcp = ">=1.0.0"
|
|
28
|
+
click = ">=8.1.0"
|
|
29
|
+
rich = ">=13.0.0"
|
|
30
|
+
pydantic = ">=2.0.0"
|
|
31
|
+
pydantic-settings = ">=2.0.0"
|
|
32
|
+
httpx = ">=0.27.0"
|
|
33
|
+
anyio = ">=4.0.0"
|
|
34
|
+
|
|
35
|
+
[tool.poetry.group.dev.dependencies]
|
|
36
|
+
pytest = ">=8.0.0"
|
|
37
|
+
pytest-asyncio = ">=0.24.0"
|
|
38
|
+
|
|
39
|
+
[tool.poetry.scripts]
|
|
40
|
+
coala = "coala_client.main:cli"
|
|
41
|
+
|
|
42
|
+
[build-system]
|
|
43
|
+
requires = ["poetry-core"]
|
|
44
|
+
build-backend = "poetry.core.masonry.api"
|