-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
49 lines (40 loc) · 1.64 KB
/
Program.cs
File metadata and controls
49 lines (40 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Configuration;
using TxTextControl.McpServer.Services;
using TxTextControl.McpServer.Tools;
var builder = WebApplication.CreateBuilder(args);
// Use fully qualified names to avoid ambiguity with ModelContextProtocol.Server.McpServerOptions
builder.Services.Configure<TxTextControl.McpServer.Options.McpServerOptions>(
builder.Configuration.GetSection(TxTextControl.McpServer.Options.McpServerOptions.SectionName));
// Core services for simplified implementation
builder.Services.AddSingleton<TxTextControl.McpServer.Services.PathResolver>();
builder.Services.AddSingleton<DocumentSessionService>();
builder.Services.AddSingleton<ITxDocumentEngine, ServerTextControlDocumentEngine>();
builder.Services.AddSingleton<DocumentWorkflowService>();
builder.Services.AddHostedService<FileCleanupService>();
// MCP Server tools split by responsibility
builder.Services
.AddMcpServer()
.WithHttpTransport(options =>
{
// Recommended for servers that don't need server-to-client requests.
options.Stateless = true;
})
.WithTools<DocumentTools>()
.WithTools<ContentTools>();
var app = builder.Build();
app.MapGet("/", () => Results.Ok(new
{
name = "TX Text Control Document MCP Server (Simplified)",
version = "1.0",
status = "ok",
description = "Session-based document management and manipulation with InternalUnicodeFormat storage",
mcp = "/mcp",
documentFormat = "InternalUnicodeFormat"
}));
app.MapMcp("/mcp");
app.Run();
public partial class Program;