This release adds intelligent binary discovery and Docker support to Tendril, making it more flexible and cross-platform compatible. ## Features ### Binary Path Resolution - Intelligent binary discovery with smart fallbacks - Explicit user configuration via gitea_mcp_binary_path setting - Standard system paths (/usr/local/bin, /usr/bin) - User home directories (~/.local/bin, ~/.cargo/bin, ~/bin) - Platform-specific paths (/opt/homebrew/bin on macOS M-series) - System PATH environment variable search - Robust WASM sandbox handling for filesystem checks - Comprehensive error messages with troubleshooting guidance - Removed hardcoded /usr/local/bin/gitea-mcp path ### Docker Support - New use_docker configuration option for containerized deployment - New docker_image configuration for custom images (default: gitea/gitea-mcp-server:latest) - Automatic docker binary detection at /usr/bin/docker or other standard locations - Proper gitea-mcp command-line flag formatting (-token, -t stdio, -host, -insecure) - STDIO communication through Docker containers ### Cross-Platform Support - Linux: Standard system and user paths - macOS Intel: Same as Linux - macOS M-series (ARM64): Optimized for /opt/homebrew/bin - Windows: Program Files paths (code ready, untested) - Proper PATH separator handling (: on Unix, ; on Windows) ## Bug Fixes - Fixed WASM sandbox filesystem access limitations - Corrected Docker image name to gitea/gitea-mcp-server:latest - Fixed Docker command flag formatting for gitea-mcp arguments - Improved error handling with helpful resolution steps ## Documentation - Updated README.md with Docker mode examples and configuration reference - Expanded DEVELOPMENT.md with architecture and testing roadmap - Updated PROJECT_STATUS.md with v0.1.0 feature status - Updated configuration with all new options and detailed comments - Added comprehensive inline code comments ## Testing - Binary mode auto-detection: Tested and working - Binary mode custom path: Tested and working - Docker mode with default image: Tested and working - Self-hosted Gitea instances: Tested and working - Self-signed certificate support: Tested and working ## Files Changed - src/mcp_server_gitea.rs: Core extension (~350 lines) - configuration/default_settings.jsonc: New settings - configuration/installation_instructions.md: Updated guide - README.md: Expanded documentation - DEVELOPMENT.md: Complete developer guide - PROJECT_STATUS.md: Updated status - .gitignore: Added comprehensive ignore file ## Breaking Changes None - fully backward compatible. ## Next Steps (v0.2.0) - Cross-platform testing - Interactive configuration wizard - Performance optimizations - Marketplace publication
139 lines
5.1 KiB
Markdown
139 lines
5.1 KiB
Markdown
# Zed Extensions for BCOS
|
|
|
|
This document provides information about developing Zed extensions, with specific focus on Model Context Protocol (MCP) server extensions that will be used in the BCOS project.
|
|
|
|
## Extension Capabilities
|
|
|
|
Extensions can add the following capabilities to Zed:
|
|
- Languages
|
|
- Debuggers
|
|
- Themes
|
|
- Icon Themes
|
|
- Slash Commands
|
|
- MCP Servers (primary focus for BCOS)
|
|
## Developing an Extension Locally
|
|
Before starting to develop an extension for Zed, be sure to install Rust via rustup.
|
|
|
|
Rust must be installed via rustup. If you have Rust installed via homebrew or otherwise, installing dev extensions will not work.
|
|
|
|
When developing an extension, you can use it in Zed without needing to publish it by installing it as a dev extension.
|
|
|
|
From the extensions page, click the Install Dev Extension button (or the zed: install dev extension action) and select the directory containing your extension.
|
|
|
|
If you need to troubleshoot, you can check the Zed.log (zed: open log) for additional output. For debug output, close and relaunch zed with the zed --foreground from the command line which show more verbose INFO level logging.
|
|
|
|
If you already have a published extension with the same name installed, your dev extension will override it.
|
|
|
|
After installing the Extensions page will indicate that that the upstream extension is "Overridden by dev extension".
|
|
|
|
Pre-installed extensions with the same name have to be uninstalled before installing the dev extension. See #31106 for more.
|
|
|
|
## Directory Structure of a Zed Extension
|
|
A Zed extension is a Git repository that contains an extension.toml. This file must contain some basic information about the extension:
|
|
|
|
```
|
|
id = "my-extension"
|
|
name = "My extension"
|
|
version = "0.0.1"
|
|
schema_version = 1
|
|
authors = ["Your Name <you@example.com>"]
|
|
description = "My cool extension"
|
|
repository = "https://github.com/your-name/my-zed-extension"
|
|
```
|
|
|
|
In addition to this, there are several other optional files and directories that can be used to add functionality to a Zed extension. An example directory structure of an extension that provides all capabilities is as follows:
|
|
```
|
|
my-extension/
|
|
extension.toml
|
|
Cargo.toml
|
|
src/
|
|
lib.rs
|
|
languages/
|
|
my-language/
|
|
config.toml
|
|
highlights.scm
|
|
themes/
|
|
my-theme.json
|
|
```
|
|
|
|
## WebAssembly
|
|
Procedural parts of extensions are written in Rust and compiled to WebAssembly. To develop an extension that includes custom code, include a Cargo.toml like this:
|
|
|
|
```
|
|
[package]
|
|
name = "my-extension"
|
|
version = "0.0.1"
|
|
edition = "2021"
|
|
|
|
[lib]
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
zed_extension_api = "0.1.0"
|
|
```
|
|
|
|
Use the latest version of the zed_extension_api available on crates.io. Make sure it's still compatible with Zed versions you want to support.
|
|
|
|
In the src/lib.rs file in your Rust crate you will need to define a struct for your extension and implement the Extension trait, as well as use the register_extension! macro to register your extension:
|
|
|
|
```
|
|
use zed_extension_api as zed;
|
|
|
|
struct MyExtension {
|
|
// ... state
|
|
}
|
|
|
|
impl zed::Extension for MyExtension {
|
|
// ...
|
|
}
|
|
|
|
zed::register_extension!(MyExtension);
|
|
```
|
|
|
|
stdout/stderr is forwarded directly to the Zed process. In order to see println!/dbg! output from your extension, you can start Zed in your terminal with a --foreground flag.
|
|
|
|
# MCP Server Extensions
|
|
Model Context Protocol servers can be exposed as extensions for use in the Agent Panel.
|
|
|
|
## Defining MCP Extensions
|
|
A given extension may provide one or more MCP servers. Each MCP server must be registered in the extension.toml:
|
|
|
|
```
|
|
[context_servers.my-context-server]
|
|
```
|
|
|
|
Then, in the Rust code for your extension, implement the context_server_command method on your extension:
|
|
|
|
```
|
|
impl zed::Extension for MyExtension {
|
|
fn context_server_command(
|
|
&mut self,
|
|
context_server_id: &ContextServerId,
|
|
project: &zed::Project,
|
|
) -> Result<zed::Command> {
|
|
Ok(zed::Command {
|
|
command: get_path_to_context_server_executable()?,
|
|
args: get_args_for_context_server()?,
|
|
env: get_env_for_context_server()?,
|
|
})
|
|
}
|
|
}
|
|
```
|
|
|
|
This method should return the command to start up an MCP server, along with any arguments or environment variables necessary for it to function.
|
|
|
|
If you need to download the MCP server from an external source—like GitHub Releases or npm—you can also do that in this function.
|
|
|
|
## Available Extensions
|
|
An example Zed Extension for the Gitlab MCP is in `config/mcp/gitlab-mcp-zed/`.
|
|
|
|
For the BCOS project, we will develop a Gitea MCP Extension based on this example. This extension will integrate with our Gitea instance to provide seamless access to our repository from within the Zed IDE.
|
|
|
|
## BCOS-Specific Integration
|
|
For the BCOS project, MCP server extensions will be stored in `/config/mcp` according to our monorepo structure. This ensures proper versioning and access control for our development environment.
|
|
|
|
When developing MCP server extensions for BCOS, ensure they follow the project's security and automation guidelines documented in the technical specifications.
|
|
|
|
## Testing
|
|
To test the new MCP server extension, the user can install it as a dev extension in the Zed client application.
|