From 0d09a910e8dbc5366877b532c716fac63370a954 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=82=AB=E3=82=A4=E3=83=80?= Date: Mon, 6 Oct 2025 09:55:10 +0900 Subject: [PATCH 1/4] Upgrade to MCP SDK v0.14.0 --- build.gradle | 13 +++++----- .../java/reva/server/McpServerManager.java | 13 +++------- .../java/reva/tools/AbstractToolProvider.java | 4 +--- src/main/java/reva/tools/ToolProvider.java | 4 +--- .../tools/bookmarks/BookmarkToolProvider.java | 18 +++++--------- .../tools/comments/CommentToolProvider.java | 15 ++++-------- .../reva/tools/data/DataToolProvider.java | 12 ++++------ .../tools/datatypes/DataTypeToolProvider.java | 12 ++++------ .../decompiler/DecompilerToolProvider.java | 18 +++++--------- .../tools/functions/FunctionToolProvider.java | 15 ++++-------- .../reva/tools/memory/MemoryToolProvider.java | 9 +++---- .../tools/project/ProjectToolProvider.java | 24 +++++++------------ .../tools/strings/StringToolProvider.java | 15 ++++-------- .../structures/StructureToolProvider.java | 21 ++++++++-------- .../tools/symbols/SymbolToolProvider.java | 9 +++---- .../xrefs/CrossReferencesToolProvider.java | 6 ++--- 16 files changed, 73 insertions(+), 135 deletions(-) diff --git a/build.gradle b/build.gradle index df0b452..03b05f5 100644 --- a/build.gradle +++ b/build.gradle @@ -79,8 +79,8 @@ sourceSets { configurations { integrationTestImplementation.extendsFrom testImplementation - - // Force Jackson 2.17.0 to be compatible with MCP SDK v0.11.1 + + // Force Jackson 2.19.2 to be compatible with MCP SDK v0.14.0 all { resolutionStrategy { force 'com.fasterxml.jackson.core:jackson-core:2.19.2' @@ -108,16 +108,17 @@ repositories { dependencies { // Any external dependencies added here will automatically be copied to the lib/ directory when // this extension is built. - implementation platform("io.modelcontextprotocol.sdk:mcp-bom:0.12.1") + implementation platform("io.modelcontextprotocol.sdk:mcp-bom:0.14.0") implementation "io.modelcontextprotocol.sdk:mcp" + implementation "io.modelcontextprotocol.sdk:mcp-json-jackson2" implementation "jakarta.servlet:jakarta.servlet-api:6.1.0" // Add Jetty for embedded servlet support implementation "org.eclipse.jetty:jetty-server:11.0.26" implementation "org.eclipse.jetty:jetty-servlet:11.0.26" - - // Force Jackson 2.17.0 to be compatible with MCP SDK v0.11.1 + + // Force Jackson 2.19.2 to be compatible with MCP SDK v0.14.0 implementation "com.fasterxml.jackson.core:jackson-core:2.19.2" - implementation "com.fasterxml.jackson.core:jackson-databind:2.19.2" + implementation "com.fasterxml.jackson.core:jackson-databind:2.19.2" implementation "com.fasterxml.jackson.core:jackson-annotations:2.19.2" // Testing dependencies diff --git a/src/main/java/reva/server/McpServerManager.java b/src/main/java/reva/server/McpServerManager.java index 8555915..330636d 100644 --- a/src/main/java/reva/server/McpServerManager.java +++ b/src/main/java/reva/server/McpServerManager.java @@ -30,8 +30,6 @@ import java.util.EnumSet; import jakarta.servlet.DispatcherType; -import com.fasterxml.jackson.databind.ObjectMapper; - import generic.concurrent.GThreadPool; import ghidra.framework.plugintool.PluginTool; import ghidra.program.model.listing.Program; @@ -40,7 +38,6 @@ import io.modelcontextprotocol.server.McpServer; import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.server.transport.HttpServletStreamableServerTransportProvider; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import reva.plugin.ConfigManager; import reva.plugin.ConfigChangeListener; @@ -69,7 +66,6 @@ * the same server instance and coordinates program lifecycle events across tools. */ public class McpServerManager implements RevaMcpService, ConfigChangeListener { - private static final ObjectMapper JSON = new ObjectMapper(); private static final String MCP_MSG_ENDPOINT = "/mcp/message"; private static final String MCP_SERVER_NAME = "ReVa"; private static final String MCP_SERVER_VERSION = "1.0.0"; @@ -163,12 +159,9 @@ private void initializeToolProviders() { toolProviders.add(new BookmarkToolProvider(server)); // Register all tools with the server + // Note: As of MCP SDK v0.14.0, tool registration is idempotent and replaces duplicates for (ToolProvider provider : toolProviders) { - try { - provider.registerTools(); - } catch (McpError e) { - Msg.error(this, "Failed to register tools for provider: " + provider.getClass().getSimpleName(), e); - } + provider.registerTools(); } } @@ -403,8 +396,8 @@ private void recreateTransportProvider() { String baseUrl = "http://" + serverHost + ":" + serverPort; // Create new transport provider with updated configuration + // Note: As of MCP SDK v0.14.0, the builder uses McpJsonMapper.getDefault() automatically currentTransportProvider = HttpServletStreamableServerTransportProvider.builder() - .objectMapper(JSON) .mcpEndpoint(MCP_MSG_ENDPOINT) .keepAliveInterval(java.time.Duration.ofSeconds(30)) .build(); diff --git a/src/main/java/reva/tools/AbstractToolProvider.java b/src/main/java/reva/tools/AbstractToolProvider.java index e3d1823..1052d87 100644 --- a/src/main/java/reva/tools/AbstractToolProvider.java +++ b/src/main/java/reva/tools/AbstractToolProvider.java @@ -36,7 +36,6 @@ import reva.plugin.RevaProgramManager; import reva.util.ProgramLookupUtil; import io.modelcontextprotocol.server.McpSyncServer; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpSchema.Content; import io.modelcontextprotocol.spec.McpSchema.TextContent; @@ -134,9 +133,8 @@ protected McpSchema.CallToolResult createMultiJsonResult(List dataList) * Register a tool with the MCP server * @param tool The tool to register * @param handler The handler function for the tool - * @throws McpError if there's an error registering the tool */ - protected void registerTool(Tool tool, java.util.function.BiFunction handler) throws McpError { + protected void registerTool(Tool tool, java.util.function.BiFunction handler) { // Wrap the handler with safe execution java.util.function.BiFunction safeHandler = (exchange, request) -> { diff --git a/src/main/java/reva/tools/ToolProvider.java b/src/main/java/reva/tools/ToolProvider.java index 5d06e2e..42678ad 100644 --- a/src/main/java/reva/tools/ToolProvider.java +++ b/src/main/java/reva/tools/ToolProvider.java @@ -16,7 +16,6 @@ package reva.tools; import ghidra.program.model.listing.Program; -import io.modelcontextprotocol.spec.McpError; /** * Interface for MCP tool providers. @@ -26,9 +25,8 @@ public interface ToolProvider { /** * Register all tools with the MCP server - * @throws McpError if there's an error registering the tools */ - void registerTools() throws McpError; + void registerTools(); /** * Notify the provider that a program has been opened diff --git a/src/main/java/reva/tools/bookmarks/BookmarkToolProvider.java b/src/main/java/reva/tools/bookmarks/BookmarkToolProvider.java index da7b182..e067f5b 100644 --- a/src/main/java/reva/tools/bookmarks/BookmarkToolProvider.java +++ b/src/main/java/reva/tools/bookmarks/BookmarkToolProvider.java @@ -28,7 +28,6 @@ import ghidra.program.model.listing.BookmarkManager; import ghidra.program.model.listing.Program; import io.modelcontextprotocol.server.McpSyncServer; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; import reva.util.SchemaUtil; @@ -48,7 +47,7 @@ public BookmarkToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerSetBookmarkTool(); registerGetBookmarksTool(); registerRemoveBookmarkTool(); @@ -58,9 +57,8 @@ public void registerTools() throws McpError { /** * Register a tool to set or update a bookmark at an address - * @throws McpError if there's an error registering the tool */ - private void registerSetBookmarkTool() throws McpError { + private void registerSetBookmarkTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("addressOrSymbol", SchemaUtil.stringProperty("Address or symbol name where to set the bookmark")); @@ -122,9 +120,8 @@ private void registerSetBookmarkTool() throws McpError { /** * Register a tool to get bookmarks at an address or range - * @throws McpError if there's an error registering the tool */ - private void registerGetBookmarksTool() throws McpError { + private void registerGetBookmarksTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("addressOrSymbol", SchemaUtil.stringProperty("Address or symbol name to get bookmarks from (optional if using addressRange)")); @@ -222,9 +219,8 @@ private void registerGetBookmarksTool() throws McpError { /** * Register a tool to remove a bookmark - * @throws McpError if there's an error registering the tool */ - private void registerRemoveBookmarkTool() throws McpError { + private void registerRemoveBookmarkTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("addressOrSymbol", SchemaUtil.stringProperty("Address or symbol name of the bookmark")); @@ -281,9 +277,8 @@ private void registerRemoveBookmarkTool() throws McpError { /** * Register a tool to search bookmarks - * @throws McpError if there's an error registering the tool */ - private void registerSearchBookmarksTool() throws McpError { + private void registerSearchBookmarksTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("searchText", SchemaUtil.stringProperty("Text to search for in bookmark comments (optional)")); @@ -387,9 +382,8 @@ private void registerSearchBookmarksTool() throws McpError { /** * Register a tool to list bookmark categories for a type - * @throws McpError if there's an error registering the tool */ - private void registerListBookmarkCategoriesTool() throws McpError { + private void registerListBookmarkCategoriesTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("type", SchemaUtil.stringProperty("Bookmark type to get categories for")); diff --git a/src/main/java/reva/tools/comments/CommentToolProvider.java b/src/main/java/reva/tools/comments/CommentToolProvider.java index f57dd3c..6a42801 100644 --- a/src/main/java/reva/tools/comments/CommentToolProvider.java +++ b/src/main/java/reva/tools/comments/CommentToolProvider.java @@ -29,7 +29,6 @@ import ghidra.program.model.listing.Listing; import ghidra.program.model.listing.CodeUnitIterator; import io.modelcontextprotocol.server.McpSyncServer; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; import reva.util.AddressUtil; @@ -58,7 +57,7 @@ public CommentToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerSetCommentTool(); registerGetCommentsTool(); registerRemoveCommentTool(); @@ -67,9 +66,8 @@ public void registerTools() throws McpError { /** * Register a tool to set or update a comment at an address - * @throws McpError if there's an error registering the tool */ - private void registerSetCommentTool() throws McpError { + private void registerSetCommentTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("addressOrSymbol", SchemaUtil.stringProperty("Address or symbol name where to set the comment")); @@ -126,9 +124,8 @@ private void registerSetCommentTool() throws McpError { /** * Register a tool to get comments at an address or range - * @throws McpError if there's an error registering the tool */ - private void registerGetCommentsTool() throws McpError { + private void registerGetCommentsTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("addressOrSymbol", SchemaUtil.stringProperty("Address or symbol name to get comments from (optional if using addressRange)")); @@ -230,9 +227,8 @@ private void registerGetCommentsTool() throws McpError { /** * Register a tool to remove a comment at an address - * @throws McpError if there's an error registering the tool */ - private void registerRemoveCommentTool() throws McpError { + private void registerRemoveCommentTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("addressOrSymbol", SchemaUtil.stringProperty("Address or symbol name where to remove the comment")); @@ -286,9 +282,8 @@ private void registerRemoveCommentTool() throws McpError { /** * Register a tool to search for comments containing text - * @throws McpError if there's an error registering the tool */ - private void registerSearchCommentsTool() throws McpError { + private void registerSearchCommentsTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); properties.put("searchText", SchemaUtil.stringProperty("Text to search for in comments")); diff --git a/src/main/java/reva/tools/data/DataToolProvider.java b/src/main/java/reva/tools/data/DataToolProvider.java index bfe5aba..d336536 100644 --- a/src/main/java/reva/tools/data/DataToolProvider.java +++ b/src/main/java/reva/tools/data/DataToolProvider.java @@ -30,7 +30,6 @@ import ghidra.program.model.mem.MemoryAccessException; import ghidra.program.model.symbol.Symbol; import ghidra.program.model.symbol.SymbolTable; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpSchema.CallToolResult; @@ -54,7 +53,7 @@ public DataToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerGetDataTool(); registerApplyDataTypeTool(); registerCreateLabelTool(); @@ -62,9 +61,8 @@ public void registerTools() throws McpError { /** * Register a unified tool to get data by address or symbol name - * @throws McpError if there's an error registering the tool */ - private void registerGetDataTool() throws McpError { + private void registerGetDataTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -98,9 +96,8 @@ private void registerGetDataTool() throws McpError { /** * Register a tool to apply a data type to an address or symbol - * @throws McpError if there's an error registering the tool */ - private void registerApplyDataTypeTool() throws McpError { + private void registerApplyDataTypeTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -201,9 +198,8 @@ private void registerApplyDataTypeTool() throws McpError { /** * Register a tool to create a label at a specific address in a program - * @throws McpError if there's an error registering the tool */ - private void registerCreateLabelTool() throws McpError { + private void registerCreateLabelTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( diff --git a/src/main/java/reva/tools/datatypes/DataTypeToolProvider.java b/src/main/java/reva/tools/datatypes/DataTypeToolProvider.java index 6572515..67dadc6 100644 --- a/src/main/java/reva/tools/datatypes/DataTypeToolProvider.java +++ b/src/main/java/reva/tools/datatypes/DataTypeToolProvider.java @@ -28,7 +28,6 @@ import ghidra.program.model.listing.Program; import ghidra.util.Msg; import io.modelcontextprotocol.server.McpSyncServer; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import reva.plugin.RevaProgramManager; import reva.tools.AbstractToolProvider; @@ -49,7 +48,7 @@ public DataTypeToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerGetDataTypeArchivesTool(); registerGetDataTypesTool(); registerGetDataTypeByStringTool(); @@ -57,9 +56,8 @@ public void registerTools() throws McpError { /** * Register a tool to get data type archives for a specific program - * @throws McpError if there's an error registering the tool */ - private void registerGetDataTypeArchivesTool() throws McpError { + private void registerGetDataTypeArchivesTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -177,9 +175,8 @@ private void registerGetDataTypeArchivesTool() throws McpError { /** * Register a tool to get data types from an archive - * @throws McpError if there's an error registering the tool */ - private void registerGetDataTypesTool() throws McpError { + private void registerGetDataTypesTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -305,9 +302,8 @@ private void registerGetDataTypesTool() throws McpError { /** * Register a tool to get a data type by string representation (e.g., "char**") - * @throws McpError if there's an error registering the tool */ - private void registerGetDataTypeByStringTool() throws McpError { + private void registerGetDataTypeByStringTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( diff --git a/src/main/java/reva/tools/decompiler/DecompilerToolProvider.java b/src/main/java/reva/tools/decompiler/DecompilerToolProvider.java index ade04bb..eb7f9ca 100644 --- a/src/main/java/reva/tools/decompiler/DecompilerToolProvider.java +++ b/src/main/java/reva/tools/decompiler/DecompilerToolProvider.java @@ -57,7 +57,6 @@ import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.InvalidInputException; import ghidra.util.Msg; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.spec.McpSchema; import reva.plugin.ConfigManager; @@ -85,7 +84,7 @@ public DecompilerToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerGetDecompilationTool(); registerSearchDecompilationTool(); registerRenameVariablesTool(); @@ -113,9 +112,8 @@ private int getTimeoutSeconds() { /** * Register a tool to get decompiled code for a function with line range support (Claude Code style) - * @throws McpError if there's an error registering the tool */ - private void registerGetDecompilationTool() throws McpError { + private void registerGetDecompilationTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -324,9 +322,8 @@ private void registerGetDecompilationTool() throws McpError { /** * Register a tool to search decompilation across all functions - * @throws McpError if there's an error registering the tool */ - private void registerSearchDecompilationTool() throws McpError { + private void registerSearchDecompilationTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -404,9 +401,8 @@ private void registerSearchDecompilationTool() throws McpError { /** * Register a tool to rename variables in a decompiled function - * @throws McpError if there's an error registering the tool */ - private void registerRenameVariablesTool() throws McpError { + private void registerRenameVariablesTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -602,9 +598,8 @@ private void registerRenameVariablesTool() throws McpError { /** * Register a tool to change variable data types in a decompiled function - * @throws McpError if there's an error registering the tool */ - private void registerChangeVariableDataTypesTool() throws McpError { + private void registerChangeVariableDataTypesTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -1288,9 +1283,8 @@ private void addCommentIfExists(List> comments, CodeUnit cu, /** * Register a tool to set a comment from decompilation context - * @throws McpError if there's an error registering the tool */ - private void registerSetDecompilationCommentTool() throws McpError { + private void registerSetDecompilationCommentTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( diff --git a/src/main/java/reva/tools/functions/FunctionToolProvider.java b/src/main/java/reva/tools/functions/FunctionToolProvider.java index 23c966e..d150bc2 100644 --- a/src/main/java/reva/tools/functions/FunctionToolProvider.java +++ b/src/main/java/reva/tools/functions/FunctionToolProvider.java @@ -41,7 +41,6 @@ import ghidra.util.exception.CancelledException; import ghidra.util.exception.DuplicateNameException; import ghidra.util.exception.InvalidInputException; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; @@ -62,7 +61,7 @@ public FunctionToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerFunctionCountTool(); registerFunctionsTool(); registerFunctionsBySimilarityTool(); @@ -71,9 +70,8 @@ public void registerTools() throws McpError { /** * Register a tool to count the functions in a program - * @throws McpError if there's an error registering the tool */ - private void registerFunctionCountTool() throws McpError { + private void registerFunctionCountTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -125,9 +123,8 @@ private void registerFunctionCountTool() throws McpError { /** * Register a tool to list functions from a program - * @throws McpError if there's an error registering the tool */ - private void registerFunctionsTool() throws McpError { + private void registerFunctionsTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -214,9 +211,8 @@ private void registerFunctionsTool() throws McpError { /** * Register a tool to get functions from a program with pagination, sorted by similarity to a given function name. - * @throws McpError if there's an error registering the tool */ - private void registerFunctionsBySimilarityTool() throws McpError { + private void registerFunctionsBySimilarityTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -361,9 +357,8 @@ private Map createFunctionInfo(Function function) { /** * Register a tool to set or update a function prototype using C-style signatures - * @throws McpError if there's an error registering the tool */ - private void registerSetFunctionPrototypeTool() throws McpError { + private void registerSetFunctionPrototypeTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( diff --git a/src/main/java/reva/tools/memory/MemoryToolProvider.java b/src/main/java/reva/tools/memory/MemoryToolProvider.java index 7633166..90cb555 100644 --- a/src/main/java/reva/tools/memory/MemoryToolProvider.java +++ b/src/main/java/reva/tools/memory/MemoryToolProvider.java @@ -25,7 +25,6 @@ import ghidra.program.model.mem.Memory; import ghidra.program.model.mem.MemoryBlock; import io.modelcontextprotocol.server.McpSyncServer; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; import reva.util.MemoryUtil; @@ -46,16 +45,15 @@ public MemoryToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerMemoryBlocksTool(); registerReadMemoryTool(); } /** * Register a tool to list memory blocks from a program - * @throws McpError if there's an error registering the tool */ - private void registerMemoryBlocksTool() throws McpError { + private void registerMemoryBlocksTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); @@ -103,9 +101,8 @@ private void registerMemoryBlocksTool() throws McpError { /** * Register a tool to read memory content from a program - * @throws McpError if there's an error registering the tool */ - private void registerReadMemoryTool() throws McpError { + private void registerReadMemoryTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty("Path to the program in the Ghidra Project")); diff --git a/src/main/java/reva/tools/project/ProjectToolProvider.java b/src/main/java/reva/tools/project/ProjectToolProvider.java index 2349eac..61a00e6 100644 --- a/src/main/java/reva/tools/project/ProjectToolProvider.java +++ b/src/main/java/reva/tools/project/ProjectToolProvider.java @@ -42,7 +42,6 @@ import ghidra.plugins.importer.batch.BatchInfo; import ghidra.plugins.importer.tasks.ImportBatchTask; import ghidra.util.task.TaskLauncher; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.spec.McpSchema; import reva.plugin.RevaProgramManager; @@ -64,7 +63,7 @@ public ProjectToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerGetCurrentProgramTool(); registerListProjectFilesTool(); registerListOpenProgramsTool(); @@ -76,9 +75,8 @@ public void registerTools() throws McpError { /** * Register a tool to get the currently active program - * @throws McpError if there's an error registering the tool */ - private void registerGetCurrentProgramTool() throws McpError { + private void registerGetCurrentProgramTool() { // Define schema for the tool Map properties = new HashMap<>(); // This tool doesn't require any parameters @@ -121,9 +119,8 @@ private void registerGetCurrentProgramTool() throws McpError { /** * Register a tool to list files and folders in the Ghidra project - * @throws McpError if there's an error registering the tool */ - private void registerListProjectFilesTool() throws McpError { + private void registerListProjectFilesTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("folderPath", SchemaUtil.stringProperty( @@ -203,9 +200,8 @@ private void registerListProjectFilesTool() throws McpError { /** * Register a tool to list all open programs across all Ghidra tools - * @throws McpError if there's an error registering the tool */ - private void registerListOpenProgramsTool() throws McpError { + private void registerListOpenProgramsTool() { // Define schema for the tool Map properties = new HashMap<>(); // This tool doesn't require any parameters @@ -259,9 +255,8 @@ private void registerListOpenProgramsTool() throws McpError { /** * Register a tool to checkin (commit) a program to version control - * @throws McpError if there's an error registering the tool */ - private void registerCheckinProgramTool() throws McpError { + private void registerCheckinProgramTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty( @@ -431,9 +426,8 @@ private void collectFilesRecursive(DomainFolder folder, List /** * Register a tool to analyze a program with Ghidra's auto-analysis - * @throws McpError if there's an error registering the tool */ - private void registerAnalyzeProgramTool() throws McpError { + private void registerAnalyzeProgramTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty( @@ -488,9 +482,8 @@ private void registerAnalyzeProgramTool() throws McpError { /** * Register a tool to change the processor architecture of an existing program - * @throws McpError if there's an error registering the tool */ - private void registerChangeProcessorTool() throws McpError { + private void registerChangeProcessorTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.stringProperty( @@ -585,9 +578,8 @@ private void registerChangeProcessorTool() throws McpError { /** * Register a tool to import files into the Ghidra project - * @throws McpError if there's an error registering the tool */ - private void registerImportFileTool() throws McpError { + private void registerImportFileTool() { // Define schema for the tool Map properties = new HashMap<>(); diff --git a/src/main/java/reva/tools/strings/StringToolProvider.java b/src/main/java/reva/tools/strings/StringToolProvider.java index b24ab2e..344e84f 100644 --- a/src/main/java/reva/tools/strings/StringToolProvider.java +++ b/src/main/java/reva/tools/strings/StringToolProvider.java @@ -28,7 +28,6 @@ import ghidra.program.model.listing.DataIterator; import ghidra.program.model.listing.Program; import ghidra.program.model.mem.MemoryAccessException; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; @@ -49,7 +48,7 @@ public StringToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerStringsCountTool(); registerStringsTool(); registerStringsBySimilarityTool(); @@ -58,9 +57,8 @@ public void registerTools() throws McpError { /** * Register a tool to get the count of strings in a program - * @throws McpError if there's an error registering the tool */ - private void registerStringsCountTool() throws McpError { + private void registerStringsCountTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -102,9 +100,8 @@ private void registerStringsCountTool() throws McpError { /** * Register a tool to get strings from a program with pagination - * @throws McpError if there's an error registering the tool */ - private void registerStringsTool() throws McpError { + private void registerStringsTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -183,9 +180,8 @@ private void registerStringsTool() throws McpError { /** * Register a tool to get strings from a program with pagination, sorted by similarity. - * @throws McpError if there's an error registering the tool */ - private void registerStringsBySimilarityTool() throws McpError { + private void registerStringsBySimilarityTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -273,9 +269,8 @@ public String extract(Map item) { /** * Register a tool to search strings using regex pattern - * @throws McpError if there's an error registering the tool */ - private void registerStringsRegexSearchTool() throws McpError { + private void registerStringsRegexSearchTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( diff --git a/src/main/java/reva/tools/structures/StructureToolProvider.java b/src/main/java/reva/tools/structures/StructureToolProvider.java index bd5b02a..c71d193 100644 --- a/src/main/java/reva/tools/structures/StructureToolProvider.java +++ b/src/main/java/reva/tools/structures/StructureToolProvider.java @@ -32,7 +32,6 @@ import ghidra.util.data.DataTypeParser; import ghidra.util.data.DataTypeParser.AllowedDataTypes; import io.modelcontextprotocol.server.McpSyncServer; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; import reva.util.AddressUtil; @@ -53,7 +52,7 @@ public StructureToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerParseCStructureTool(); registerValidateCStructureTool(); registerCreateStructureTool(); @@ -68,7 +67,7 @@ public void registerTools() throws McpError { /** * Register tool to parse C-style structure definitions */ - private void registerParseCStructureTool() throws McpError { + private void registerParseCStructureTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("cDefinition", SchemaUtil.createStringProperty("C-style structure definition")); @@ -134,7 +133,7 @@ private void registerParseCStructureTool() throws McpError { /** * Register tool to validate C-style structure definitions without creating them */ - private void registerValidateCStructureTool() throws McpError { + private void registerValidateCStructureTool() { Map properties = new HashMap<>(); properties.put("cDefinition", SchemaUtil.createStringProperty("C-style structure definition to validate")); @@ -197,7 +196,7 @@ private void registerValidateCStructureTool() throws McpError { /** * Register tool to create an empty structure */ - private void registerCreateStructureTool() throws McpError { + private void registerCreateStructureTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("name", SchemaUtil.createStringProperty("Name of the structure")); @@ -275,7 +274,7 @@ private void registerCreateStructureTool() throws McpError { /** * Register tool to add fields to structures */ - private void registerAddStructureFieldTool() throws McpError { + private void registerAddStructureFieldTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("structureName", SchemaUtil.createStringProperty("Name of the structure")); @@ -405,7 +404,7 @@ private void registerAddStructureFieldTool() throws McpError { /** * Register tool to get structure information */ - private void registerGetStructureInfoTool() throws McpError { + private void registerGetStructureInfoTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("structureName", SchemaUtil.createStringProperty("Name of the structure")); @@ -449,7 +448,7 @@ private void registerGetStructureInfoTool() throws McpError { /** * Register tool to list structures */ - private void registerListStructuresTool() throws McpError { + private void registerListStructuresTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("category", SchemaUtil.createOptionalStringProperty("Filter by category path")); @@ -518,7 +517,7 @@ private void registerListStructuresTool() throws McpError { /** * Register tool to apply structure at address */ - private void registerApplyStructureTool() throws McpError { + private void registerApplyStructureTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("structureName", SchemaUtil.createStringProperty("Name of the structure")); @@ -601,7 +600,7 @@ private void registerApplyStructureTool() throws McpError { /** * Register tool to delete a structure */ - private void registerDeleteStructureTool() throws McpError { + private void registerDeleteStructureTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("structureName", SchemaUtil.createStringProperty("Name of the structure to delete")); @@ -659,7 +658,7 @@ private void registerDeleteStructureTool() throws McpError { /** * Register tool to parse C header files */ - private void registerParseCHeaderTool() throws McpError { + private void registerParseCHeaderTool() { Map properties = new HashMap<>(); properties.put("programPath", SchemaUtil.createStringProperty("Path of the program")); properties.put("headerContent", SchemaUtil.createStringProperty("C header file content")); diff --git a/src/main/java/reva/tools/symbols/SymbolToolProvider.java b/src/main/java/reva/tools/symbols/SymbolToolProvider.java index f60c5bc..ba35224 100644 --- a/src/main/java/reva/tools/symbols/SymbolToolProvider.java +++ b/src/main/java/reva/tools/symbols/SymbolToolProvider.java @@ -26,7 +26,6 @@ import ghidra.program.model.symbol.SymbolIterator; import ghidra.program.model.symbol.SymbolTable; import ghidra.program.model.symbol.SymbolType; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.server.McpSyncServer; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; @@ -45,16 +44,15 @@ public SymbolToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerSymbolsCountTool(); registerSymbolsTool(); } /** * Register a tool to get the count of symbols in a program - * @throws McpError if there's an error registering the tool */ - private void registerSymbolsCountTool() throws McpError { + private void registerSymbolsCountTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( @@ -117,9 +115,8 @@ private void registerSymbolsCountTool() throws McpError { /** * Register a tool to get symbols from a program with pagination - * @throws McpError if there's an error registering the tool */ - private void registerSymbolsTool() throws McpError { + private void registerSymbolsTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( diff --git a/src/main/java/reva/tools/xrefs/CrossReferencesToolProvider.java b/src/main/java/reva/tools/xrefs/CrossReferencesToolProvider.java index 389c0bc..66ff8f4 100644 --- a/src/main/java/reva/tools/xrefs/CrossReferencesToolProvider.java +++ b/src/main/java/reva/tools/xrefs/CrossReferencesToolProvider.java @@ -30,7 +30,6 @@ import ghidra.program.model.symbol.Symbol; import ghidra.program.model.symbol.SymbolTable; import io.modelcontextprotocol.server.McpSyncServer; -import io.modelcontextprotocol.spec.McpError; import io.modelcontextprotocol.spec.McpSchema; import reva.tools.AbstractToolProvider; import reva.util.AddressUtil; @@ -52,15 +51,14 @@ public CrossReferencesToolProvider(McpSyncServer server) { } @Override - public void registerTools() throws McpError { + public void registerTools() { registerCrossReferencesTool(); } /** * Register the unified cross references tool - * @throws McpError if there's an error registering the tool */ - private void registerCrossReferencesTool() throws McpError { + private void registerCrossReferencesTool() { // Define schema for the tool Map properties = new HashMap<>(); properties.put("programPath", Map.of( From de6f1fdf7f686e20bb2b88dcc04396b77cba3078 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 09:33:27 +0000 Subject: [PATCH 2/4] chore(deps): bump antoniovazquezblanco/setup-ghidra Bumps [antoniovazquezblanco/setup-ghidra](https://github.com/antoniovazquezblanco/setup-ghidra) from 2.0.13 to 2.0.14. - [Release notes](https://github.com/antoniovazquezblanco/setup-ghidra/releases) - [Commits](https://github.com/antoniovazquezblanco/setup-ghidra/compare/v2.0.13...v2.0.14) --- updated-dependencies: - dependency-name: antoniovazquezblanco/setup-ghidra dependency-version: 2.0.14 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- .github/workflows/publish-ghidra.yml | 2 +- .github/workflows/test-ghidra.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish-ghidra.yml b/.github/workflows/publish-ghidra.yml index 5f850c3..0bb1ac6 100644 --- a/.github/workflows/publish-ghidra.yml +++ b/.github/workflows/publish-ghidra.yml @@ -37,7 +37,7 @@ jobs: java-version: "21" distribution: "microsoft" - name: Install Ghidra 🐉 - uses: antoniovazquezblanco/setup-ghidra@v2.0.13 + uses: antoniovazquezblanco/setup-ghidra@v2.0.14 with: version: ${{ matrix.ghidra-version }} - name: Compile ReVa 👩‍💻✨ diff --git a/.github/workflows/test-ghidra.yml b/.github/workflows/test-ghidra.yml index 1ed0aa2..5879d9d 100644 --- a/.github/workflows/test-ghidra.yml +++ b/.github/workflows/test-ghidra.yml @@ -34,7 +34,7 @@ jobs: distribution: "microsoft" - name: Install Ghidra 🐉 - uses: antoniovazquezblanco/setup-ghidra@v2.0.13 + uses: antoniovazquezblanco/setup-ghidra@v2.0.14 with: version: ${{ matrix.ghidra-version }} @@ -96,7 +96,7 @@ jobs: distribution: "microsoft" - name: Install Ghidra 🐉 - uses: antoniovazquezblanco/setup-ghidra@v2.0.13 + uses: antoniovazquezblanco/setup-ghidra@v2.0.14 with: version: "latest" @@ -144,7 +144,7 @@ jobs: queries: security-extended,security-and-quality - name: Install Ghidra 🐉 - uses: antoniovazquezblanco/setup-ghidra@v2.0.13 + uses: antoniovazquezblanco/setup-ghidra@v2.0.14 with: version: "latest" From 78ab517b66842a3107c46fb49679d3bf81cec08e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 6 Oct 2025 09:33:42 +0000 Subject: [PATCH 3/4] chore(deps): bump gradle/actions from 4 to 5 Bumps [gradle/actions](https://github.com/gradle/actions) from 4 to 5. - [Release notes](https://github.com/gradle/actions/releases) - [Commits](https://github.com/gradle/actions/compare/v4...v5) --- updated-dependencies: - dependency-name: gradle/actions dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/test-ghidra.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-ghidra.yml b/.github/workflows/test-ghidra.yml index 1ed0aa2..49ed30d 100644 --- a/.github/workflows/test-ghidra.yml +++ b/.github/workflows/test-ghidra.yml @@ -46,7 +46,7 @@ jobs: - name: Setup Gradle 🔧 - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v5 with: gradle-version: "8.14" @@ -107,7 +107,7 @@ jobs: echo "DISPLAY=:99" >> $GITHUB_ENV - name: Setup Gradle 🔧 - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v5 with: gradle-version: "8.14" dependency-graph: generate-and-submit @@ -150,7 +150,7 @@ jobs: - name: Setup Gradle for CodeQL 🔧 - uses: gradle/actions/setup-gradle@v4 + uses: gradle/actions/setup-gradle@v5 with: gradle-version: "8.14" From c98e8208d84b3d7cc38b7fa24b23f8ba6e03af43 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Oct 2025 10:16:54 +0000 Subject: [PATCH 4/4] chore(deps): bump github/codeql-action from 3 to 4 Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4. - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/v3...v4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/test-ghidra.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-ghidra.yml b/.github/workflows/test-ghidra.yml index d27a657..b357d40 100644 --- a/.github/workflows/test-ghidra.yml +++ b/.github/workflows/test-ghidra.yml @@ -137,7 +137,7 @@ jobs: distribution: "microsoft" - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: java # Use security-extended queries for more thorough analysis @@ -158,6 +158,6 @@ jobs: run: gradle buildExtension - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 with: category: "/language:java"