refactor(mcp): remove Core dependency, switch to HttpClient-based architecture

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-20 20:37:45 -04:00
parent 6c4f4bea7f
commit 4bee73ba26
4 changed files with 7 additions and 32 deletions
@@ -1,15 +0,0 @@
using Microsoft.Extensions.Configuration;
using MoneyMap.Services;
namespace MoneyMap.Mcp;
public class ConfigReceiptStorageOptions : IReceiptStorageOptions
{
public string ReceiptsBasePath { get; }
public ConfigReceiptStorageOptions(IConfiguration config)
{
ReceiptsBasePath = config["Receipts:StoragePath"]
?? throw new InvalidOperationException("Receipts:StoragePath not configured");
}
}
+1 -8
View File
@@ -6,17 +6,10 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
</ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="ModelContextProtocol" Version="1.1.0" /> <PackageReference Include="ModelContextProtocol" Version="1.1.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.6" /> <PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
</ItemGroup> <PackageReference Include="Microsoft.Extensions.Http" Version="9.0.6" />
<ItemGroup>
<ProjectReference Include="..\MoneyMap.Core\MoneyMap.Core.csproj" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
+4 -4
View File
@@ -1,17 +1,17 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
using MoneyMap.Core;
using MoneyMap.Mcp; using MoneyMap.Mcp;
using MoneyMap.Services;
var builder = Host.CreateApplicationBuilder(args); var builder = Host.CreateApplicationBuilder(args);
builder.Logging.ClearProviders(); builder.Logging.ClearProviders();
builder.Logging.AddConsole(options => options.LogToStandardErrorThreshold = LogLevel.Trace); builder.Logging.AddConsole(options => options.LogToStandardErrorThreshold = LogLevel.Trace);
builder.Services.AddMoneyMapCore(builder.Configuration); builder.Services.AddHttpClient<MoneyMapApiClient>(client =>
builder.Services.AddSingleton<IReceiptStorageOptions, ConfigReceiptStorageOptions>(); {
client.BaseAddress = new Uri(builder.Configuration["MoneyMapApi:BaseUrl"]!);
});
builder.Services builder.Services
.AddMcpServer() .AddMcpServer()
+2 -5
View File
@@ -1,8 +1,5 @@
{ {
"ConnectionStrings": { "MoneyMapApi": {
"MoneyMapDb": "Server=barge.lan;Database=MoneyMap;User Id=moneymap;Password=Cn87oXQPj7EEkx;TrustServerCertificate=True;" "BaseUrl": "http://barge.lan:5010/"
},
"Receipts": {
"StoragePath": "\\\\TRUENAS\\receipts"
} }
} }