File tree Expand file tree Collapse file tree 4 files changed +36
-8
lines changed
Infrastructure/BotSharp.Core.MCP Expand file tree Collapse file tree 4 files changed +36
-8
lines changed Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ public static class BotSharpMcpExtensions
1818 /// <returns></returns>
1919 public static IServiceCollection AddBotSharpMCP ( this IServiceCollection services , IConfiguration config )
2020 {
21- var settings = config . GetSection ( "MCPSettings " ) . Get < McpSettings > ( ) ;
21+ var settings = config . GetSection ( "MCP " ) . Get < McpSettings > ( ) ;
2222 services . AddScoped < McpSettings > ( provider => { return settings ; } ) ;
2323 if ( settings != null && ! settings . McpServerConfigs . IsNullOrEmpty ( ) )
2424 {
Original file line number Diff line number Diff line change @@ -5,19 +5,18 @@ namespace BotSharp.Core.MCP.Managers;
55
66public class McpClientManager : IDisposable
77{
8+ private readonly McpSettings _mcpSettings ;
89
9- private readonly McpSettings mcpSettings ;
10-
11- public McpClientManager ( McpSettings settings )
10+ public McpClientManager ( McpSettings mcpSettings )
1211 {
13- mcpSettings = settings ;
12+ _mcpSettings = mcpSettings ;
1413 }
1514
1615 public async Task < IMcpClient > GetMcpClientAsync ( string serverId )
1716 {
1817 return await McpClientFactory . CreateAsync (
19- mcpSettings . McpServerConfigs . Where ( x=> x . Name == serverId ) . First ( ) ,
20- mcpSettings . McpClientOptions ) ;
18+ _mcpSettings . McpServerConfigs . Where ( x=> x . Name == serverId ) . First ( ) ,
19+ _mcpSettings . McpClientOptions ) ;
2120 }
2221
2322 public void Dispose ( )
Original file line number Diff line number Diff line change 1+ using BotSharp . Abstraction . Plugins . Models ;
2+ using BotSharp . Abstraction . Plugins ;
3+ using BotSharp . Abstraction . Settings ;
4+ using BotSharp . Core . MCP . Settings ;
5+ using Microsoft . Extensions . Configuration ;
6+
7+ namespace BotSharp . Core . MCP ;
8+
9+ public class McpPlugin : IBotSharpPlugin
10+ {
11+ public string Id => "0cfb486a-229e-4470-a4c6-d2d4a5fdc727" ;
12+ public string Name => "Model context protocol" ;
13+ public string Description => "Model context protocol" ;
14+
15+ public SettingsMeta Settings =>
16+ new SettingsMeta ( "MCP" ) ;
17+
18+ public object GetNewSettingsInstance ( ) =>
19+ new McpSettings ( ) ;
20+
21+ public void RegisterDI ( IServiceCollection services , IConfiguration config )
22+ {
23+ }
24+
25+ public bool AttachMenu ( List < PluginMenuDef > menu )
26+ {
27+ return true ;
28+ }
29+ }
Original file line number Diff line number Diff line change 172172 }
173173 },
174174
175- "MCPSettings " : {
175+ "MCP " : {
176176 "McpClientOptions" : {
177177 "ClientInfo" : {
178178 "Name" : " SimpleToolsBotsharp" ,
You can’t perform that action at this time.
0 commit comments