8000 GitHub - satai/mcp-micronaut-poc: PoC for Micronaut Model Context Protocol integration
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

satai/mcp-micronaut-poc

Repository files navigation

MCPNaut Cli Example

PoC of MCP (Model Context Protocol) integration into Micronaut framework.

Build Status

Overview

This project demonstrates how to integrate the Model Context Protocol (MCP) with the Micronaut framework. It provides a way to expose Micronaut beans as MCP tools that can be called by AI models or other MCP clients.

Installation

Prerequisites

  • JDK 17 or higher

Building the Project

./gradlew build

Running the Application

./gradlew run

Usage

Creating an MCP Tool

  1. Create a Micronaut bean with methods annotated with @Tool:
@Singleton
class MyTool {
    @Tool(
        name = "myTool",
        description = "A tool that does something useful"
    )
    fun doSomething(
        @ToolArg(description = "First parameter") param1: String,
        @ToolArg(description = "Second parameter") param2: Int
    ): String {
        return "Result: $param1 $param2"
    }
}
  1. The tool will be automatically registered with the MCP server when the application starts.

  2. Clients can call the tool using the MCP protocol over standard input/output.

Project Structure

  • MicronautMcpCliCommand.kt - Main command class that sets up the MCP server
  • ServerWrapper.kt - Wrapper for the MCP server
  • ToolBuilder.kt - Processes methods annotated with @Tool and registers them as MCP tools
  • ToolAnnotations.kt - Defines the @Tool and @ToolArg annotations
  • TypeConverter.kt - Converts JDK types to MCP types
  • ArgumentConverter.kt - Converts MCP arguments to JDK types
  • FooTool.kt - Example tool implementation

Limitations

  • Not a library now, just example App
  • CLI (StdInOut) communication only
  • Tools only (no Prompts...)
  • Only int, boolean, number and strings and arrays (one or multidimensional) as parameters
  • Only one String on output, no pictures, music
  • no configuration of the server
  • Temporary (?) package

Contributing

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

License

This project is licensed under the Apache License 2.0.

About

PoC for Micronaut Model Context Protocol integration

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published
0