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:
@@ -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");
|
||||
}
|
||||
}
|
||||
@@ -6,17 +6,10 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ModelContextProtocol" Version="1.1.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MoneyMap.Core\MoneyMap.Core.csproj" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MoneyMap.Core;
|
||||
using MoneyMap.Mcp;
|
||||
using MoneyMap.Services;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
builder.Logging.ClearProviders();
|
||||
builder.Logging.AddConsole(options => options.LogToStandardErrorThreshold = LogLevel.Trace);
|
||||
|
||||
builder.Services.AddMoneyMapCore(builder.Configuration);
|
||||
builder.Services.AddSingleton<IReceiptStorageOptions, ConfigReceiptStorageOptions>();
|
||||
builder.Services.AddHttpClient<MoneyMapApiClient>(client =>
|
||||
{
|
||||
client.BaseAddress = new Uri(builder.Configuration["MoneyMapApi:BaseUrl"]!);
|
||||
});
|
||||
|
||||
builder.Services
|
||||
.AddMcpServer()
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"MoneyMapDb": "Server=barge.lan;Database=MoneyMap;User Id=moneymap;Password=Cn87oXQPj7EEkx;TrustServerCertificate=True;"
|
||||
},
|
||||
"Receipts": {
|
||||
"StoragePath": "\\\\TRUENAS\\receipts"
|
||||
"MoneyMapApi": {
|
||||
"BaseUrl": "http://barge.lan:5010/"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user