Class ResourceInvocationGate
java.lang.Object
eu.mrapik.minecraftservermcp.internal.ResourceInvocationGate
Applies the same bearer-token and
ToolAccessConfig checks as ToolInvocationGate, but for MCP
resources/read requests. The policyToolId argument is the key under access.<profile>.tools
(for example fs_read).-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback executed afterResourceInvocationGatehas resolved the token profile and confirmed that the policy id is enabled. -
Method Summary
Modifier and TypeMethodDescriptionstatic io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceSpecificationwrapResource(String policyToolId, io.modelcontextprotocol.spec.McpSchema.Resource resource, Supplier<PluginSettings> settings, JavaPlugin mcpPlugin, ServerFilePaths paths, ResourceInvocationGate.ResourceHandler inner) Builds anMcpServerFeatures.AsyncResourceSpecificationwhose read handler validates the transport token and profile before invoking the delegate.static io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceTemplateSpecificationwrapTemplate(String policyToolId, io.modelcontextprotocol.spec.McpSchema.ResourceTemplate template, Supplier<PluginSettings> settings, JavaPlugin mcpPlugin, ServerFilePaths paths, ResourceInvocationGate.ResourceHandler inner) Builds anMcpServerFeatures.AsyncResourceTemplateSpecificationfor a URI template, with the same access checks aswrapResource(java.lang.String, io.modelcontextprotocol.spec.McpSchema.Resource, java.util.function.Supplier<eu.mrapik.minecraftservermcp.config.PluginSettings>, org.bukkit.plugin.java.JavaPlugin, eu.mrapik.minecraftservermcp.fs.ServerFilePaths, eu.mrapik.minecraftservermcp.internal.ResourceInvocationGate.ResourceHandler).
-
Method Details
-
wrapResource
public static io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceSpecification wrapResource(String policyToolId, io.modelcontextprotocol.spec.McpSchema.Resource resource, Supplier<PluginSettings> settings, JavaPlugin mcpPlugin, ServerFilePaths paths, ResourceInvocationGate.ResourceHandler inner) Builds anMcpServerFeatures.AsyncResourceSpecificationwhose read handler validates the transport token and profile before invoking the delegate.- Parameters:
policyToolId- config key underaccess.<profile>.tools.*used to loadToolAccessConfigresource- static resource metadata (URI, name, mime type) forMcpAsyncServer.addResource(io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceSpecification)settings- supplier for currentPluginSettings(token profiles)mcpPlugin- owning MCP plugin instancepaths- server root paths for handlers that need theminner- handler run only when the profile enablespolicyToolId- Returns:
- specification suitable for
McpAsyncServer.addResource(io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceSpecification)
-
wrapTemplate
public static io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceTemplateSpecification wrapTemplate(String policyToolId, io.modelcontextprotocol.spec.McpSchema.ResourceTemplate template, Supplier<PluginSettings> settings, JavaPlugin mcpPlugin, ServerFilePaths paths, ResourceInvocationGate.ResourceHandler inner) Builds anMcpServerFeatures.AsyncResourceTemplateSpecificationfor a URI template, with the same access checks aswrapResource(java.lang.String, io.modelcontextprotocol.spec.McpSchema.Resource, java.util.function.Supplier<eu.mrapik.minecraftservermcp.config.PluginSettings>, org.bukkit.plugin.java.JavaPlugin, eu.mrapik.minecraftservermcp.fs.ServerFilePaths, eu.mrapik.minecraftservermcp.internal.ResourceInvocationGate.ResourceHandler).- Parameters:
policyToolId- config key underaccess.<profile>.tools.*template- resource template (RFC 6570 URI template string) forMcpAsyncServer.addResourceTemplate(io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceTemplateSpecification)settings- supplier for currentPluginSettingsmcpPlugin- owning MCP plugin instancepaths- server root paths for handlers that need theminner- handler run only when the profile enablespolicyToolId- Returns:
- specification suitable for
McpAsyncServer.addResourceTemplate(io.modelcontextprotocol.server.McpServerFeatures.AsyncResourceTemplateSpecification)
-