Package com.tnsai.mcp.goose
Class GooseExtensionLoader
java.lang.Object
com.tnsai.mcp.goose.GooseExtensionLoader
Loads Goose extensions and converts them to MCP-compatible format.
Goose extensions are typically JSON configuration files that reference
MCP servers. This loader reads those files and converts them to
McpServerEntry objects for registry integration.
Supported file formats:
- JSON (.json) - Full support
Example usage:
GooseExtensionLoader loader = new GooseExtensionLoader();
List<GooseExtension> extensions = loader.loadFromDirectory(Path.of("~/.goose/extensions"));
Optional<McpServerEntry> entry = loader.toServerEntry(extensions.get(0));
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordRepresents a Goose extension configuration. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionloadExtension(Path file) Loads a single Goose extension from a file.loadFromDirectory(Path dir) Loads all extensions from a directory.toServerEntry(GooseExtensionLoader.GooseExtension extension) Converts a Goose extension to an MCP server entry.
-
Constructor Details
-
GooseExtensionLoader
public GooseExtensionLoader()
-
-
Method Details
-
loadFromDirectory
Loads all extensions from a directory.Scans the directory for JSON files and attempts to parse each one as a Goose extension configuration.
- Parameters:
dir- the directory to scan- Returns:
- list of loaded extensions
- Throws:
IOException- if the directory cannot be read
-
loadExtension
Loads a single Goose extension from a file.- Parameters:
file- the file to load- Returns:
- the parsed extension
- Throws:
IOException- if the file cannot be read or parsed
-
toServerEntry
Converts a Goose extension to an MCP server entry.Only extensions of type "mcp" can be converted. Other types return an empty optional.
- Parameters:
extension- the Goose extension- Returns:
- the server entry, or empty if the extension is not MCP-compatible
-