mirror of
https://github.com/samvallad33/vestige.git
synced 2026-05-08 23:32:37 +02:00
fix(mcp): strip provider prefix from resource URIs
Handle 'vestige/memory://' and 'vestige/codebase://' URIs by stripping the provider prefix before scheme matching. This fixes compatibility with MCP clients like OpenCode that prepend the provider name to resource URIs. Fixes #19
This commit is contained in:
parent
760957f5ac
commit
37af5059c9
1 changed files with 8 additions and 4 deletions
|
|
@ -811,10 +811,14 @@ impl McpServer {
|
|||
};
|
||||
|
||||
let uri = &request.uri;
|
||||
let content = if uri.starts_with("memory://") {
|
||||
resources::memory::read(&self.storage, uri).await
|
||||
} else if uri.starts_with("codebase://") {
|
||||
resources::codebase::read(&self.storage, uri).await
|
||||
// Normalize URI: strip provider prefix (e.g., "vestige/") for scheme matching
|
||||
// OpenCode and other MCP clients may send "vestige/memory://recent"
|
||||
// but we register resources as "memory://recent"
|
||||
let normalized_uri = uri.strip_prefix("vestige/").unwrap_or(uri);
|
||||
let content = if normalized_uri.starts_with("memory://") {
|
||||
resources::memory::read(&self.storage, normalized_uri).await
|
||||
} else if normalized_uri.starts_with("codebase://") {
|
||||
resources::codebase::read(&self.storage, normalized_uri).await
|
||||
} else {
|
||||
Err(format!("Unknown resource scheme: {}", uri))
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue