test-mcp-server

test-mcp-server

0

JavaOne MCP Server is a lightweight application that implements the Model Context Protocol, enabling AI models to efficiently access and process information. It supports integration with AI assistants and provides tools to manage and retrieve presentation data.

MCP Server

Thanks to the Dan Vega

This project is forked from https://github.com/danvega/javaone-mcp [https://www.youtube.com/watch?v=w5YVHG1j3Co](YouTube video is here)

A Model Context Protocol Server

JavaOne MCP Server is a lightweight Java application that implements the Model Context Protocol (MCP), allowing AI models to access information. This server exposes data through standardized MCP tools, making it easy to integrate with AI assistants that support the protocol.

Project Requirements

  • Java 18
  • Maven 3.8+
  • Model Context Protocol SDK 0.9.0
  • SLF4J for logging

Dependencies

This project relies on the following key components:

<!-- MCP SDK -->
<dependency>
    <groupId>io.modelcontextprotocol.sdk</groupId>
    <artifactId>mcp</artifactId>
</dependency>

<!-- Logging -->
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>slf4j-simple</artifactId>
</dependency>

Getting Started

After cloning the repository, you can build the project using Maven:

mvn clean package

Or run build-jar run configuration in IntelliJ IDEA.

This will create an executable JAR file in the target directory with all dependencies included.

How to Run the Application

Execute the JAR file to start the MCP server:

java -jar target/test-mcp-server-0.0.1.jar

The application starts an MCP server that communicates via standard input/output (STDIO) and provides access to data.

Understanding the Project Structure

Core Components

  • Application.java: Main entry point that configures and starts the MCP server

MCP Server Configuration

The server is configured with:

  • STDIO transport provider for communication
  • Server information (name and version)
  • Tool capabilities for accessing presentation data
McpSyncServer syncServer = McpServer.sync(transportProvider)
    .serverInfo("test-mcp-server", "0.0.1")
    .capabilities(McpSchema.ServerCapabilities.builder()
            .tools(true)
            .logging()
            .build())
    .tools(syncToolSpecification)
    .build();

Available Tools

The server exposes the following MCP tool:

  • get_list: Returns a list of all items by categories

Testing with MCP Inspector

The MCP Inspector is a helpful tool for testing and debugging your MCP server. Follow these steps to test your MCP Server:

  1. Install Node.js if you haven't already
  2. Navigate to your project directory and get the absolute path to the JAR file:
# On Linux/macOS
FULL_PATH=$(pwd)/target/test-mcp-server-0.0.1.jar
echo $FULL_PATH

# On Windows PowerShell
$FULL_PATH="$(Get-Location)\target\test-mcp-server-0.0.1.jar"
echo $FULL_PATH
  1. Run the MCP Inspector with your server using the full path:
npx @modelcontextprotocol/inspector java -jar $FULL_PATH
  1. In the Inspector interface:
    • Verify the server connection in the connection pane
    • Navigate to the "Tools" tab to see the get_list tool
    • Test the tool by clicking on it and viewing the response
    • Monitor logs in the Notifications pane

Integrating with Claude Desktop

To use this MCP server with Claude Desktop, add the following configuration:

  1. First, get the absolute path to your JAR file:
# On Linux/macOS
FULL_PATH=$(pwd)/target/test-mcp-server-0.0.1.jar
echo $FULL_PATH

# On Windows PowerShell
$FULL_PATH="$(Get-Location)\target\test-mcp-server-0.0.1.jar"
echo $FULL_PATH
  1. Open Claude Desktop preferences
  2. Navigate to the "MCP Servers" section
  3. Add a new server with the following configuration (replace the path with your actual full path):
{
  "javaone-mcp": {
    "command": "java",
    "args": [
      "-jar",
      "$FULL_PATH"
    ]
  }
}

Creating Additional MCP Tools

Implement more tools to expose different functionality:

// Example of adding a tool to search presentations by title
var searchToolSpec = new McpServerFeatures.SyncToolSpecification(
    new McpSchema.Tool("search_items", "Search items by title", searchSchema),
    (exchange, arguments) -> {
        String query = arguments.get("query").asText();
        List<Presentation> results = presentationTools.searchPresentations(query);
        // Convert results to MCP content and return
    }
);

Implementing Advanced Features

  • Add resource subscriptions for real-time updates
  • Implement asynchronous tools for long-running operations
  • Add authentication and authorization mechanisms

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is open source and available under the .

Further Resources