mirror of
https://github.com/samvallad33/vestige.git
synced 2026-05-09 07:42: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 uri = &request.uri;
|
||||||
let content = if uri.starts_with("memory://") {
|
// Normalize URI: strip provider prefix (e.g., "vestige/") for scheme matching
|
||||||
resources::memory::read(&self.storage, uri).await
|
// OpenCode and other MCP clients may send "vestige/memory://recent"
|
||||||
} else if uri.starts_with("codebase://") {
|
// but we register resources as "memory://recent"
|
||||||
resources::codebase::read(&self.storage, uri).await
|
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 {
|
} else {
|
||||||
Err(format!("Unknown resource scheme: {}", uri))
|
Err(format!("Unknown resource scheme: {}", uri))
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue