feat: add MoneyMap.Mcp project skeleton with stdio transport
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<Nullable>enable</Nullable>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<FrameworkReference Include="Microsoft.AspNetCore.App" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ModelContextProtocol" Version="0.*-*" />
|
||||
<PackageReference Include="Microsoft.Extensions.Hosting" Version="9.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MoneyMap.Core\MoneyMap.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="appsettings.json">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,22 @@
|
||||
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
|
||||
.AddMcpServer()
|
||||
.WithStdioServerTransport()
|
||||
.WithToolsFromAssembly(typeof(Program).Assembly);
|
||||
|
||||
var app = builder.Build();
|
||||
await app.RunAsync();
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"MoneyMapDb": "Server=barge.lan;Database=MoneyMap;User Id=moneymap;Password=Cn87oXQPj7EEkx;TrustServerCertificate=True;"
|
||||
},
|
||||
"Receipts": {
|
||||
"StoragePath": "\\\\TRUENAS\\receipts"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user