public class McpProviders extends Object implements ToolProvider, ResourceProvider, PromptProvider, Closeable
| Constructor and Description |
|---|
McpProviders(Map<String,McpClientProvider> providers) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
关闭
|
static McpClientProvider |
fromMcpServer(McpServerParameters serverParameters)
根据 serverParameters 配置加载客户端
|
static McpProviders |
fromMcpServers(Map<String,McpServerParameters> mcpServers)
根据 mcpServers 配置加载客户端
|
static McpProviders |
fromMcpServers(org.noear.snack.ONode configDom)
根据 mcpServers 配置加载客户端
|
static McpProviders |
fromMcpServers(String uri)
根据 mcpServers 配置加载客户端
|
Collection<FunctionPrompt> |
getPrompts()
获取提示语
|
McpClientProvider |
getProvider(String key)
获取提供者
|
Map<String,McpClientProvider> |
getProviders()
获取所有提供者
|
Collection<FunctionResource> |
getResources()
获取资源
|
Collection<FunctionTool> |
getTools()
获取工具
|
static Map<String,McpServerParameters> |
parseMcpServers(org.noear.snack.ONode configDom)
根据 mcpServers 配置解析出参数
|
static Map<String,McpServerParameters> |
parseMcpServers(String uri)
根据 mcpServers 配置解析出参数
|
int |
size()
数量
|
public McpProviders(Map<String,McpClientProvider> providers)
public Map<String,McpClientProvider> getProviders()
public McpClientProvider getProvider(String key)
key - 服务名public int size()
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic Collection<FunctionTool> getTools()
getTools in interface ToolProviderpublic Collection<FunctionPrompt> getPrompts()
getPrompts in interface PromptProviderpublic Collection<FunctionResource> getResources()
getResources in interface ResourceProviderpublic static Map<String,McpServerParameters> parseMcpServers(String uri) throws IOException
uri - 配置资源地址IOExceptionpublic static Map<String,McpServerParameters> parseMcpServers(org.noear.snack.ONode configDom) throws IOException
configDom - 配置文档IOExceptionpublic static McpProviders fromMcpServers(String uri) throws IOException
uri - 配置资源地址IOExceptionpublic static McpProviders fromMcpServers(org.noear.snack.ONode configDom) throws IOException
configDom - 配置文档IOExceptionpublic static McpProviders fromMcpServers(Map<String,McpServerParameters> mcpServers) throws IOException
mcpServers - 配置集合IOExceptionpublic static McpClientProvider fromMcpServer(McpServerParameters serverParameters) throws IOException
serverParameters - 配置参数IOExceptionCopyright © 2025. All rights reserved.