Skip to content

Commit 2826932

Browse files
committed
Clean code, merge PizzaBot.MCPServer into WebStarter.
1 parent f577a05 commit 2826932

16 files changed

Lines changed: 40 additions & 86 deletions

File tree

BotSharp.sln

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Plugin.DeepSeekAI"
127127
EndProject
128128
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Core.Realtime", "src\Infrastructure\BotSharp.Core.Realtime\BotSharp.Core.Realtime.csproj", "{781F1465-365C-0F22-1775-25025DAFA4C7}"
129129
EndProject
130-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.PizzaBot.MCPServer", "tests\BotSharp.PizzaBot.MCPServer\BotSharp.PizzaBot.MCPServer.csproj", "{8D2AD45F-836A-516F-DE6A-71443CEBB18A}"
131-
EndProject
132130
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Test.ComputerUse", "tests\BotSharp.Test.ComputerUse\BotSharp.Test.ComputerUse.csproj", "{C19D9AC1-97DD-8E65-E8DB-D295A095AA2D}"
133131
EndProject
134132
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BotSharp.Plugin.OsDriver", "src\Plugins\BotSharp.Plugin.OsDriver\BotSharp.Plugin.OsDriver.csproj", "{B268E2F0-060F-8466-7D81-ABA4D735CA59}"
@@ -549,14 +547,6 @@ Global
549547
{781F1465-365C-0F22-1775-25025DAFA4C7}.Release|Any CPU.Build.0 = Release|Any CPU
550548
{781F1465-365C-0F22-1775-25025DAFA4C7}.Release|x64.ActiveCfg = Release|Any CPU
551549
{781F1465-365C-0F22-1775-25025DAFA4C7}.Release|x64.Build.0 = Release|Any CPU
552-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
553-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Debug|Any CPU.Build.0 = Debug|Any CPU
554-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Debug|x64.ActiveCfg = Debug|Any CPU
555-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Debug|x64.Build.0 = Debug|Any CPU
556-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Release|Any CPU.ActiveCfg = Release|Any CPU
557-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Release|Any CPU.Build.0 = Release|Any CPU
558-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Release|x64.ActiveCfg = Release|Any CPU
559-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A}.Release|x64.Build.0 = Release|Any CPU
560550
{C19D9AC1-97DD-8E65-E8DB-D295A095AA2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
561551
{C19D9AC1-97DD-8E65-E8DB-D295A095AA2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
562552
{C19D9AC1-97DD-8E65-E8DB-D295A095AA2D}.Debug|x64.ActiveCfg = Debug|Any CPU
@@ -730,7 +720,6 @@ Global
730720
{AFD64412-4D6A-452E-82A2-79E5D8842E29} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
731721
{AF329442-B48E-4B48-A18A-1C869D1BA6F5} = {D5293208-2BEF-42FC-A64C-5954F61720BA}
732722
{781F1465-365C-0F22-1775-25025DAFA4C7} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}
733-
{8D2AD45F-836A-516F-DE6A-71443CEBB18A} = {32FAFFFE-A4CB-4FEE-BF7C-84518BBC6DCC}
734723
{C19D9AC1-97DD-8E65-E8DB-D295A095AA2D} = {32FAFFFE-A4CB-4FEE-BF7C-84518BBC6DCC}
735724
{B268E2F0-060F-8466-7D81-ABA4D735CA59} = {51AFE054-AE99-497D-A593-69BAEFB5106F}
736725
{970BE341-9AC8-99A5-6572-E703C1E02FCB} = {E29DC6C4-5E57-48C5-BCB0-6B8F84782749}

Directory.Packages.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@
9898
<PackageVersion Include="MSTest.TestAdapter" Version="4.0.2" />
9999
<PackageVersion Include="MSTest.TestFramework" Version="4.0.2" />
100100
<PackageVersion Include="Shouldly" Version="4.3.0" />
101-
<PackageVersion Include="ModelContextProtocol" Version="0.4.0-preview.3" />
102-
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="0.4.0-preview.3" />
101+
<PackageVersion Include="ModelContextProtocol" Version="1.2.0" />
102+
<PackageVersion Include="ModelContextProtocol.AspNetCore" Version="1.2.0" />
103103
</ItemGroup>
104104
<ItemGroup>
105105
<PackageVersion Include="BotSharp.Core" Version="$(BotSharpVersion)" />

src/BotSharp.AppHost/BotSharp.AppHost.csproj

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<Project Sdk="Microsoft.NET.Sdk">
1+
<Project Sdk="Microsoft.NET.Sdk">
22

33
<Sdk Name="Aspire.AppHost.Sdk" Version="9.5.2" />
44
<PropertyGroup>
@@ -17,7 +17,6 @@
1717
</ItemGroup>
1818

1919
<ItemGroup>
20-
<ProjectReference Include="..\..\tests\BotSharp.PizzaBot.MCPServer\BotSharp.PizzaBot.MCPServer.csproj" />
2120
<ProjectReference Include="..\BotSharp.ServiceDefaults\BotSharp.ServiceDefaults.csproj" />
2221
<ProjectReference Include="..\WebStarter\WebStarter.csproj" />
2322
</ItemGroup>

src/Infrastructure/BotSharp.OpenAPI/BotSharp.OpenAPI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
<PackageReference Include="AspNet.Security.OAuth.Weixin" />
3333
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" />
3434
<PackageReference Include="Microsoft.AspNetCore.SpaServices.Extensions" />
35+
<PackageReference Include="ModelContextProtocol.AspNetCore" />
3536
</ItemGroup>
3637

3738
<ItemGroup>

src/Infrastructure/BotSharp.OpenAPI/BotSharpOpenApiExtensions.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
using BotSharp.Abstraction.Messaging.JsonConverters;
2+
using BotSharp.Core.MCP.Settings;
23
using BotSharp.Core.Users.Services;
4+
using BotSharp.OpenAPI.BackgroundServices;
5+
using Microsoft.AspNetCore.Authentication;
36
using Microsoft.AspNetCore.Authentication.Cookies;
47
using Microsoft.AspNetCore.Authentication.JwtBearer;
58
using Microsoft.AspNetCore.Builder;
69
using Microsoft.Extensions.Configuration;
710
using Microsoft.Extensions.Hosting;
11+
using Microsoft.IdentityModel.JsonWebTokens;
812
using Microsoft.IdentityModel.Logging;
913
using Microsoft.IdentityModel.Tokens;
1014
using Microsoft.Net.Http.Headers;
11-
using Microsoft.IdentityModel.JsonWebTokens;
12-
using BotSharp.OpenAPI.BackgroundServices;
13-
using System.Text.Json.Serialization;
14-
using Microsoft.AspNetCore.Authentication;
1515
using Microsoft.OpenApi;
16+
using System.Text.Json.Serialization;
1617
#if NET8_0
1718
using Microsoft.OpenApi.Models;
1819
#endif

src/WebStarter/Program.cs

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
using BotSharp.Abstraction.Messaging.JsonConverters;
12
using BotSharp.Core;
23
using BotSharp.Core.MCP;
3-
using BotSharp.OpenAPI;
44
using BotSharp.Logger;
5+
using BotSharp.OpenAPI;
6+
using BotSharp.PizzaBot.MCPServer.Tools;
57
using BotSharp.Plugin.ChatHub;
8+
using BotSharp.Plugin.MultiTenancy.Extensions;
69
using Serilog;
7-
using BotSharp.Abstraction.Messaging.JsonConverters;
810
using StackExchange.Redis;
9-
using BotSharp.Plugin.MultiTenancy.Extensions;
1011

1112
var builder = WebApplication.CreateBuilder(args);
1213

@@ -43,6 +44,13 @@
4344
{
4445
o.Configuration.ChannelPrefix = RedisChannel.Literal("botsharp");
4546
})*/;
47+
48+
builder.Services.AddMcpServer()
49+
.WithHttpTransport()
50+
.WithTools<MakePaymentTool>()
51+
.WithTools<PizzaPricesTool>()
52+
.WithTools<PlaceOrderTool>();
53+
4654
var app = builder.Build();
4755

4856
app.UseWebSockets();
@@ -60,4 +68,7 @@
6068
.UseBotSharpOpenAPI(app.Environment)
6169
.UseBotSharpUI();
6270

71+
// Map MCP endpoint – clients connect to: https://<host>/mcp
72+
app.MapMcp("/mcp");
73+
6374
app.Run();

src/WebStarter/appsettings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,7 @@
669669
},
670670

671671
"MCP": {
672-
"Enabled": false,
672+
"Enabled": true,
673673
"McpClientOptions": {
674674
"ClientInfo": {
675675
"Name": "SimpleToolsBotsharp",
@@ -681,7 +681,7 @@
681681
// "Id": "PizzaServer",
682682
// "Name": "PizzaServer",
683683
// "SseConfig": {
684-
// "Endpoint": "http://localhost:58905/sse"
684+
// "Endpoint": "http://localhost:5500/mcp"
685685
// }
686686
//}
687687
]

tests/BotSharp.PizzaBot.MCPServer/BotSharp.PizzaBot.MCPServer.csproj

Lines changed: 0 additions & 17 deletions
This file was deleted.

tests/BotSharp.PizzaBot.MCPServer/Program.cs

Lines changed: 0 additions & 10 deletions
This file was deleted.

tests/BotSharp.PizzaBot.MCPServer/Properties/launchSettings.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)