You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 18, 2025. It is now read-only.
OpenCode is a Go-based CLI application that brings AI assistance to your terminal. It provides a TUI (Terminal User Interface) for interacting with various AI models to help with coding tasks, debugging, and more.
12
10
13
11
## Features
14
12
15
13
-**Interactive TUI**: Built with [Bubble Tea](https://github.com/charmbracelet/bubbletea) for a smooth terminal experience
16
-
-**Multiple AI Providers**: Support for OpenAI, Anthropic Claude, and Google Gemini models
14
+
-**Multiple AI Providers**: Support for OpenAI, Anthropic Claude, Google Gemini, AWS Bedrock, and Groq
17
15
-**Session Management**: Save and manage multiple conversation sessions
18
16
-**Tool Integration**: AI can execute commands, search files, and modify code
19
-
-**Vim-like Editor**: Integrated editor with Vim keybindings for text input
17
+
-**Vim-like Editor**: Integrated editor with text input capabilities
20
18
-**Persistent Storage**: SQLite database for storing conversations and sessions
19
+
-**LSP Integration**: Language Server Protocol support for code intelligence
20
+
-**File Change Tracking**: Track and visualize file changes during sessions
21
21
22
22
## Installation
23
23
@@ -34,11 +34,107 @@ OpenCode looks for configuration in the following locations:
34
34
-`$XDG_CONFIG_HOME/opencode/.opencode.json`
35
35
-`./.opencode.json` (local directory)
36
36
37
-
You can also use environment variables:
37
+
### Environment Variables
38
+
39
+
You can configure OpenCode using environment variables:
|`fetch`| Fetch data from URLs |`url` (required), `format` (required), `timeout` (optional) |
217
+
|`sourcegraph`| Search code across public repositories |`query` (required), `count` (optional), `context_window` (optional), `timeout` (optional) |
218
+
|`agent`| Run sub-tasks with the AI agent |`prompt` (required) |
81
219
82
220
## Architecture
83
221
@@ -92,6 +230,101 @@ OpenCode is built with a modular architecture:
92
230
-**internal/logging**: Logging infrastructure
93
231
-**internal/message**: Message handling
94
232
-**internal/session**: Session management
233
+
-**internal/lsp**: Language Server Protocol integration
234
+
235
+
## MCP (Model Context Protocol)
236
+
237
+
OpenCode implements the Model Context Protocol (MCP) to extend its capabilities through external tools. MCP provides a standardized way for the AI assistant to interact with external services and tools.
238
+
239
+
### MCP Features
240
+
241
+
-**External Tool Integration**: Connect to external tools and services via a standardized protocol
242
+
-**Tool Discovery**: Automatically discover available tools from MCP servers
243
+
-**Multiple Connection Types**:
244
+
-**Stdio**: Communicate with tools via standard input/output
245
+
-**SSE**: Communicate with tools via Server-Sent Events
246
+
-**Security**: Permission system for controlling access to MCP tools
247
+
248
+
### Configuring MCP Servers
249
+
250
+
MCP servers are defined in the configuration file under the `mcpServers` section:
251
+
252
+
```json
253
+
{
254
+
"mcpServers": {
255
+
"example": {
256
+
"type": "stdio",
257
+
"command": "path/to/mcp-server",
258
+
"env": [],
259
+
"args": []
260
+
},
261
+
"web-example": {
262
+
"type": "sse",
263
+
"url": "https://example.com/mcp",
264
+
"headers": {
265
+
"Authorization": "Bearer token"
266
+
}
267
+
}
268
+
}
269
+
}
270
+
```
271
+
272
+
### MCP Tool Usage
273
+
274
+
Once configured, MCP tools are automatically available to the AI assistant alongside built-in tools. They follow the same permission model as other tools, requiring user approval before execution.
275
+
276
+
## LSP (Language Server Protocol)
277
+
278
+
OpenCode integrates with Language Server Protocol to provide rich code intelligence features across multiple programming languages.
279
+
280
+
### LSP Features
281
+
282
+
-**Multi-language Support**: Connect to language servers for different programming languages
283
+
-**Code Intelligence**: Get diagnostics, completions, and navigation assistance
284
+
-**File Watching**: Automatically notify language servers of file changes
285
+
-**Diagnostics**: Display errors, warnings, and hints in your code
0 commit comments