pub struct OpencodeMcp {
pub config_path: PathBuf,
}Expand description
opencode MCP 配置读写(~/.config/opencode/opencode.json)
官方格式(opencode.ai/docs/mcp-servers,V1 稳定版,V2 beta 兼容):
顶层 mcp 键 → 服务器名 → { "type": "local", "command": [...], "enabled": true }。全局与项目配置按服务器名逐条合并、项目覆盖全局;
本 writer 只写用户级(install 拍板:一次注册所有仓库可用,
server 以工作区为 cwd,无需 –root)。
Fields§
§config_path: PathBuf用户级 opencode.json 路径
Implementations§
Source§impl OpencodeMcp
impl OpencodeMcp
Sourcepub fn global_path() -> Result<PathBuf>
pub fn global_path() -> Result<PathBuf>
用户级 opencode 配置路径(~/.config/opencode/opencode.json)
Auto Trait Implementations§
impl Freeze for OpencodeMcp
impl RefUnwindSafe for OpencodeMcp
impl Send for OpencodeMcp
impl Sync for OpencodeMcp
impl Unpin for OpencodeMcp
impl UnsafeUnpin for OpencodeMcp
impl UnwindSafe for OpencodeMcp
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more