Update mcp tool universe
Add rag utility
This commit is contained in:
6
pom.xml
6
pom.xml
@@ -39,6 +39,12 @@
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>de.shahondin1624</groupId>
|
||||
<artifactId>rag</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package mcp.app;
|
||||
|
||||
import de.shahondin1624.knowledgegraph.DatabaseLauncher;
|
||||
import de.shahondin1624.rag.LocalRagService;
|
||||
import mcp.server.McpServlet;
|
||||
import mcp.server.ToolRegistrationServlet;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.servlet.ServletContextHandler;
|
||||
import org.eclipse.jetty.servlet.ServletHolder;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.nio.file.Paths;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -18,11 +19,15 @@ public class McpLauncher {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
logger.info("Starting MCP App Launcher...");
|
||||
new DatabaseLauncher().start();
|
||||
// new DatabaseLauncher().start();
|
||||
|
||||
// Initialize RAG Service and index documentation
|
||||
LocalRagService ragService = LocalRagService.getInstance();
|
||||
ragService.indexDirectory(Paths.get("/home/shahondin1624/Projects/rag/test-data"));
|
||||
|
||||
// Scan both library tools and app tools
|
||||
Set<String> classpaths = Stream.concat(
|
||||
Stream.of("mcp.tools", "mcp.app.tools", "de.shahondin1624.knowledgegraph.tooling"),
|
||||
Stream.of("mcp.tools", "mcp.app.tools", /*"de.shahondin1624.knowledgegraph.tooling", */ "de.shahondin1624.rag.tooling"),
|
||||
args.length > 0 ? Stream.of(args[0].split(",")) : Stream.empty()
|
||||
).collect(Collectors.toSet());
|
||||
|
||||
|
||||
@@ -52,6 +52,6 @@ public class CalculatorTool extends McpValidatedTool {
|
||||
|
||||
Expression expression = new ExpressionBuilder(expressionStr).build();
|
||||
double result = expression.evaluate();
|
||||
return success(String.valueOf(result));
|
||||
return successResult(result);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,6 +55,6 @@ public class CurrentDateTimeTool extends McpValidatedTool {
|
||||
public McpSchema.CallToolResult callValidated(McpSchema.CallToolRequest request, Map<String, Object> arguments) {
|
||||
String now = LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
|
||||
logger.info("CurrentDateTimeTool called, returning: {}", now);
|
||||
return success(now);
|
||||
return successResult(now);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +50,6 @@ public class EchoTool extends McpValidatedTool {
|
||||
public McpSchema.CallToolResult callValidated(McpSchema.CallToolRequest request, Map<String, Object> arguments) {
|
||||
String message = (String) arguments.get("message");
|
||||
logger.debug("EchoTool called with message: {}", message);
|
||||
return success(message);
|
||||
return successResult(message);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user