Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

Commit 3fd2f1f

Browse files
ANcpLuaclaude
andcommitted
Merge Qyl.Agents.Http into Qyl.Agents and delete redundant package
McpEndpoints now supports shared server instances and well-known discovery paths. Removes the duplicate Qyl.Agents.Http project. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 7e1a9c2 commit 3fd2f1f

6 files changed

Lines changed: 23 additions & 127 deletions

File tree

README.md

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
[![NuGet](https://img.shields.io/nuget/v/Qyl.Agents.Abstractions?label=Abstractions&color=7C3AED)](https://www.nuget.org/packages/Qyl.Agents.Abstractions/)
33
[![NuGet](https://img.shields.io/nuget/v/Qyl.Agents.Generator?label=Generator&color=D97706)](https://www.nuget.org/packages/Qyl.Agents.Generator/)
44
[![NuGet](https://img.shields.io/nuget/v/Qyl.Agents?label=Runtime&color=059669)](https://www.nuget.org/packages/Qyl.Agents/)
5-
[![NuGet](https://img.shields.io/nuget/v/Qyl.Agents.Http?label=Http&color=2563EB)](https://www.nuget.org/packages/Qyl.Agents.Http/)
65
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)
76

87
# netagents
@@ -16,8 +15,7 @@
1615
| `NetAgents` | CLI tool for bootstrapping, installing, syncing, and trusting `.agents` skill repositories |
1716
| `Qyl.Agents.Abstractions` | `[McpServer]` and `[Tool]` marker attributes (`netstandard2.0`) |
1817
| `Qyl.Agents.Generator` | Source generator that emits MCP dispatch, schema, metadata, and OTel instrumentation |
19-
| `Qyl.Agents` | Runtime: MCP transport, protocol handler, hosting |
20-
| `Qyl.Agents.Http` | HTTP transport: `MapMcpServer` extension, well-known discovery paths |
18+
| `Qyl.Agents` | Runtime: MCP transport, protocol handler, HTTP hosting, well-known discovery |
2119

2220
## Installation
2321

@@ -29,9 +27,6 @@ dotnet tool install --global NetAgents
2927
dotnet add package Qyl.Agents.Abstractions
3028
dotnet add package Qyl.Agents.Generator
3129
dotnet add package Qyl.Agents
32-
33-
# HTTP transport (optional, for Kestrel hosting)
34-
dotnet add package Qyl.Agents.Http
3530
```
3631

3732
## Quick Start
@@ -47,7 +42,7 @@ public partial class CalcServer
4742
}
4843
```
4944

50-
The generator produces MCP dispatch and metadata at build time. The runtime package hosts the server over stdio; add `Qyl.Agents.Http` to serve over HTTP instead.
45+
The generator produces MCP dispatch and metadata at build time. The runtime package hosts the server over stdio or HTTP.
5146

5247
```bash
5348
netagents init

netagents.slnx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<Project Path="src/Qyl.Agents.Abstractions/Qyl.Agents.Abstractions.csproj"/>
55
<Project Path="src/Qyl.Agents.Generator/Qyl.Agents.Generator.csproj"/>
66
<Project Path="src/Qyl.Agents/Qyl.Agents.csproj"/>
7-
<Project Path="src/Qyl.Agents.Http/Qyl.Agents.Http.csproj"/>
87
</Folder>
98
<Folder Name="/tests/">
109
<Project Path="tests/NetAgents.Tests/NetAgents.Tests.csproj"/>

src/Qyl.Agents.Http/McpHttpHostExtensions.cs

Lines changed: 0 additions & 86 deletions
This file was deleted.

src/Qyl.Agents.Http/Qyl.Agents.Http.csproj

Lines changed: 0 additions & 17 deletions
This file was deleted.

src/Qyl.Agents/Hosting/McpEndpoints.cs

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,29 +8,37 @@ namespace Qyl.Agents.Hosting;
88

99
/// <summary>
1010
/// Extension methods for mapping an MCP server to ASP.NET Core endpoints.
11-
/// Exposes JSON-RPC over HTTP POST, plus SKILL.md and llms.txt discovery endpoints.
11+
/// Exposes JSON-RPC over HTTP POST, plus skill.md, llms.txt, and well-known discovery endpoints.
1212
/// </summary>
1313
public static class McpEndpoints
1414
{
1515
/// <summary>
16-
/// Maps MCP server endpoints under the given <paramref name="pattern" />.
16+
/// Maps MCP server endpoints using the default parameterless constructor.
17+
/// </summary>
18+
public static IEndpointRouteBuilder MapMcpServer<TServer>(
19+
this IEndpointRouteBuilder endpoints,
20+
string pattern = "/mcp") where TServer : class, IMcpServer, new()
21+
=> endpoints.MapMcpServer(new TServer(), pattern);
22+
23+
/// <summary>
24+
/// Maps an existing MCP server instance (for DI or factory patterns).
1725
/// <list type="bullet">
1826
/// <item><c>POST {pattern}</c> — handles JSON-RPC requests</item>
1927
/// <item><c>GET {pattern}/skill.md</c> — serves SKILL.md content</item>
2028
/// <item><c>GET {pattern}/llms.txt</c> — serves llms.txt content</item>
29+
/// <item><c>GET /.well-known/skills/default/skill.md</c> — well-known discovery</item>
2130
/// </list>
2231
/// </summary>
2332
public static IEndpointRouteBuilder MapMcpServer<TServer>(
2433
this IEndpointRouteBuilder endpoints,
25-
string pattern = "/mcp") where TServer : class, IMcpServer, new()
34+
TServer server,
35+
string pattern = "/mcp") where TServer : class, IMcpServer
2636
{
37+
var handler = new McpProtocolHandler<TServer>(server);
2738
var normalizedPattern = pattern.TrimEnd('/');
2839

2940
endpoints.MapPost(normalizedPattern, async (HttpContext context) =>
3041
{
31-
var server = new TServer();
32-
var handler = new McpProtocolHandler<TServer>(server);
33-
3442
JsonRpcRequest? request;
3543
try
3644
{
@@ -82,20 +90,18 @@ await JsonSerializer.SerializeAsync(
8290
}
8391
else
8492
{
85-
// Notification — no response body per JSON-RPC spec
8693
context.Response.StatusCode = StatusCodes.Status204NoContent;
8794
}
8895
});
8996

90-
endpoints.MapGet($"{normalizedPattern}/skill.md", (HttpContext context) =>
91-
{
92-
return Results.Text(TServer.SkillMd, "text/markdown");
93-
});
97+
endpoints.MapGet($"{normalizedPattern}/skill.md",
98+
() => Results.Text(TServer.SkillMd, "text/markdown"));
9499

95-
endpoints.MapGet($"{normalizedPattern}/llms.txt", (HttpContext context) =>
96-
{
97-
return Results.Text(TServer.LlmsTxt, "text/plain");
98-
});
100+
endpoints.MapGet($"{normalizedPattern}/llms.txt",
101+
() => Results.Text(TServer.LlmsTxt, "text/plain"));
102+
103+
endpoints.MapGet("/.well-known/skills/default/skill.md",
104+
() => Results.Text(TServer.SkillMd, "text/markdown"));
99105

100106
return endpoints;
101107
}

src/Qyl.Agents/Qyl.Agents.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
<ItemGroup>
1818
<InternalsVisibleTo Include="Qyl.Agents.Tests"/>
19-
<InternalsVisibleTo Include="Qyl.Agents.Http"/>
2019
</ItemGroup>
2120

2221
<ItemGroup>

0 commit comments

Comments
 (0)