Class McpServerProvider

java.lang.Object
org.noear.solon.ai.mcp.server.McpServerProvider
All Implemented Interfaces:
org.noear.solon.core.Lifecycle

public class McpServerProvider extends Object implements org.noear.solon.core.Lifecycle
Mcp 服务端提供者
Since:
3.1
Author:
noear
  • Constructor Summary

    Constructors
    Constructor
    Description
    McpServerProvider(org.noear.solon.core.AppContext appContext, McpServerProperties serverProperties)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addTool(org.noear.solon.ai.chat.tool.FunctionTool functionTool)
    登记工具
    void
    addTool(org.noear.solon.ai.chat.tool.ToolProvider toolProvider)
    登记工具
    protected void
    addToolSpec(io.modelcontextprotocol.server.McpServer.AsyncSpecification mcpServerSpec, org.noear.solon.ai.chat.tool.FunctionTool functionTool)
     
    protected org.noear.snack.ONode
    buildJsonSchema(org.noear.solon.ai.chat.tool.FunctionTool functionTool)
     
    void
     
    void
     
    void
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface org.noear.solon.core.Lifecycle

    preStop
  • Constructor Details

    • McpServerProvider

      public McpServerProvider(org.noear.solon.core.AppContext appContext, McpServerProperties serverProperties)
  • Method Details

    • addTool

      public void addTool(org.noear.solon.ai.chat.tool.FunctionTool functionTool)
      登记工具
    • addTool

      public void addTool(org.noear.solon.ai.chat.tool.ToolProvider toolProvider)
      登记工具
    • start

      public void start() throws Throwable
      Specified by:
      start in interface org.noear.solon.core.Lifecycle
      Throws:
      Throwable
    • postStart

      public void postStart() throws Throwable
      Specified by:
      postStart in interface org.noear.solon.core.Lifecycle
      Throws:
      Throwable
    • stop

      public void stop() throws Throwable
      Specified by:
      stop in interface org.noear.solon.core.Lifecycle
      Throws:
      Throwable
    • addToolSpec

      protected void addToolSpec(io.modelcontextprotocol.server.McpServer.AsyncSpecification mcpServerSpec, org.noear.solon.ai.chat.tool.FunctionTool functionTool)
    • buildJsonSchema

      protected org.noear.snack.ONode buildJsonSchema(org.noear.solon.ai.chat.tool.FunctionTool functionTool)