feat(mcp): Dabit.Mcp 초기 공개 (리네임 + colors 수정 + scroll 검증)

- refactor: DabitChe.Mcp → Dabit.Mcp (namespace, csproj, exe 모두)
- fix: display_message colors를 쉼표 구분 문자열로 변경 (ModelContextProtocol 1.3.0 배열 바인딩 버그 우회)
- docs: scroll 4방향(left/right/up/down) 실기 검증 완료 (DIBD600T V3.6.1)

20 도구 (읽기 4 + 콘텐츠 2 + 설정 14), stdio 전송, Windows exe.
실기 검증: scroll/fill_screen 8색/display_message 글자별색 모두 정상.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
insulee
2026-06-02 11:20:49 +09:00
parent 94dd74bd5c
commit 640c9a3380
109 changed files with 7146 additions and 0 deletions

40
Dabit.Mcp/Program.cs Normal file
View File

@@ -0,0 +1,40 @@
using System.Text;
using Dabit.Mcp.Config;
using Dabit.Mcp.Services;
using DibdProtocol.Transport;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
// EUC-KR 인코딩 등록 — PacketBuilder/PacketParser가 의존한다. 누락 시 런타임 예외.
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
var builder = Host.CreateApplicationBuilder(args);
// ★ stdio transport는 stdout을 JSON-RPC 채널로 쓴다.
// 기본 로깅 provider(Windows EventLog 포함)를 모두 제거한 뒤 콘솔 로그를 전부 stderr로 보낸다.
// EventLog는 표준 사용자 계정에서 '.NET Runtime' 소스 쓰기 실패로 예외를 던져 MCP 요청을 깨뜨릴 수 있다(codex 교차 리뷰 P2).
builder.Logging.ClearProviders();
builder.Logging.AddConsole(o => o.LogToStandardErrorThreshold = LogLevel.Trace);
// 전광판 연결 설정 (환경변수 DABIT_*)
builder.Services.AddSingleton(McpConnectionSettings.FromEnvironment());
// Transport 레지스트리 — Serial + TcpClient 등록 (AutoSend과 동일 범위)
builder.Services.AddSingleton(_ =>
{
var registry = new TransportRegistry();
registry.Register(TransportType.Serial, new SerialTransport());
registry.Register(TransportType.TcpClient, new TcpClientTransport());
return registry;
});
builder.Services.AddSingleton<LedControlService>();
// MCP 서버 — stdio transport + 어셈블리에서 [McpServerToolType] 도구 자동 검색
builder.Services
.AddMcpServer()
.WithStdioServerTransport()
.WithToolsFromAssembly();
await builder.Build().RunAsync();