Class PluginSettings
java.lang.Object
eu.mrapik.minecraftservermcp.config.PluginSettings
Immutable snapshot of the MCP plugin's
config.yml: HTTP listen options, global limits, and the mapping from
secret tokens to access profiles.
Load with load(JavaPlugin) after the default config has been saved or updated. The MCP HTTP server and
MinecraftServerMcp.reloadConfiguration() both replace the active settings
by reloading the file and constructing a new instance.
-
Method Summary
Modifier and TypeMethodDescriptionAddress Jetty binds to for MCP HTTP.static PluginSettingsload(JavaPlugin plugin) Reads top-level keys (bindAddress,port,mcpPath,maxReadBytes) and theaccesstree.longMaximum number of bytesfs_readmay return for one call (global cap; profiles can still tighten paths).mcpPath()Servlet path for the MCP endpoint (always starts with/).intport()TCP listen port for MCP HTTP.@Nullable TokenAccessProfileprofileByToken(String token) Looks up the profile for a token string exactly as sent in theAuthorizationorX-MCP-Tokenheader.ssl()Optional TLS listener; whenSslSettings.enabled()is true, clients may usehttpsonSslSettings.port().All configured token-to-profile mappings.
-
Method Details
-
load
Reads top-level keys (bindAddress,port,mcpPath,maxReadBytes) and theaccesstree. Each profile underaccessmust define a non-blanktoken; profiles without a token are skipped with a warning. Duplicate token strings cause the later profile in the file to override the earlier one (warning logged).- Parameters:
plugin- MCP plugin whoseJavaPlugin.getConfig()is used- Returns:
- new immutable settings
-
profileByToken
Looks up the profile for a token string exactly as sent in theAuthorizationorX-MCP-Tokenheader.- Parameters:
token- raw secret; may be null- Returns:
- the profile, or null if the token is unknown
-
bindAddress
Address Jetty binds to for MCP HTTP.- Returns:
- listen address for the embedded HTTP server (e.g.
0.0.0.0)
-
port
public int port()TCP listen port for MCP HTTP.- Returns:
- TCP port for the embedded HTTP server
-
mcpPath
Servlet path for the MCP endpoint (always starts with/).- Returns:
- context path segment, e.g.
/mcp
-
maxReadBytes
public long maxReadBytes()Maximum number of bytesfs_readmay return for one call (global cap; profiles can still tighten paths).- Returns:
- max read size in bytes
-
ssl
Optional TLS listener; whenSslSettings.enabled()is true, clients may usehttpsonSslSettings.port().- Returns:
- SSL settings from the last loaded config (never null; may be
SslSettings.disabled())
-
tokenToProfile
All configured token-to-profile mappings. Keys are the secret token strings.- Returns:
- immutable map from token to profile
-