Token导航 LogoToken导航TokenDH.com
Simple MCP Aspire logo
开发工具未说明官方级别未说明来源级核验

Simple MCP Aspire

MCP Server

一个使用Streamable HTTP传输和Aspire构建的简单MCP服务器,支持Open Telemetry和MCP Inspector集成。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
开发工具C#HTTP传输

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

dahlsailrunner

提供方

dahlsailrunner

最后核验

2026/5/17 20:20

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

详细介绍

使用Aspire的简单MCP服务器

这是一个非常简单的MCP服务器,使用Aspire的Streamable HTTP传输。

MCP服务器非常紧密地基于 此示例来自C#MCP SDK.

它在Aspire仪表板上显示了Aspire与Open Telemetry的编排,以及 包括 社区工具包中的MCP检查器集成, 其具有 一个好的readme/repo.

https连接成功

我终于能够通过使用以下代码使https连接正常工作 -这应该是一种扩展方法 呼叫附加到 AddMcpInspector() AppHost中的方法:

.WithCertificateTrustConfiguration((ctx) =>
{
    if (ctx.Scope == CertificateTrustScope.Append)
    {
        ctx.EnvironmentVariables["NODE_EXTRA_CA_CERTS"] = ctx.CertificateBundlePath;
    }
    else
    {
        if (ctx.EnvironmentVariables.TryGetValue("NODE_OPTIONS", out var existingOptionsObj))
        {
            ctx.EnvironmentVariables["NODE_OPTIONS"] = existingOptionsObj switch
            {
                // Attempt to append to existing NODE_OPTIONS if possible, otherwise overwrite
                string s when !string.IsNullOrEmpty(s) => $"{s} --use-openssl-ca",
                ReferenceExpression re => ReferenceExpression.Create($"{re} --use-openssl-ca"),
                _ => "--use-openssl-ca",
            };
        }
        else
        {
            ctx.EnvironmentVariables["NODE_OPTIONS"] = "--use-openssl-ca";
        }
    }

    return Task.CompletedTask;
})

关于使用https或http失败的原始说明

不知道为什么,但由于某种原因,如果没有这个,MCP检查器将无法连接到MCP服务器 线路输入 apphost.cs 在...之下 AddMcpInspector() 线路:

.WithEnvironment("NODE_TLS_REJECT_UNAUTHORIZED", "0")

这可以通过以下方式解决。NET 10.0.1可能 需要创建新的本地。NET证书:

以下是对Aspire 13不同设置方法的回顾以及我看到的结果。

使用http配置文件

使用 launchSettings.json-http 作为真实 launchSettings.json 文件。这将产生此错误:

Failed to create resource mcp-inspector System.InvalidOperationException: The endpoint `https` is not allocated for the resource `mcp`. at Aspire.Hosting.ApplicationModel.EndpointReference.get_AllocatedEndpoint() in /_/src/Aspire.Hosting/ApplicationModel/EndpointReference.cs:line 134 at Aspire.Hosting.ApplicationModel.EndpointReference.get_Url() in /_/src/Aspire.Hosting/ApplicationModel/EndpointReference.cs:line 128 at Aspire.Hosting.McpInspectorResourceBuilderExtensions.<>c.b__1_7(McpServerMetadata s) in /_/src/CommunityToolkit.Aspire.Hosting.McpInspector/McpInspectorResourceBuilderExtensions.cs:line 82

使用https配置文件

使用内置 launchSettings.json 其具有https配置文件。这将导致下面的错误,除非你有这行 apphost.cs 在...之下 AddMcpInspector 线路:

.WithEnvironment("NODE_TLS_REJECT_UNAUTHORIZED", "0")

下面建议的修复方法-使用 --use-system-ca 我试的时候没用。

🚀 MCP Inspector is up and running at:

[http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=%7EuG%7BwKeA-%21DxJ42A%7E8mqM%29](http://localhost:6274/?MCP_PROXY_AUTH_TOKEN=%7EuG%7BwKeA-%21DxJ42A%7E8mqM%29)

New StreamableHttp connection request

Query parameters: {"url":"[https://localhost:7229/](https://localhost:7229/)","transportType":"streamable-http"}
Created StreamableHttp client transport
Client  Proxy sessionId: 068ebc44-8d6c-46d2-aa19-af3c0d9ac433

Error from MCP server: FetchError: request to [https://localhost:7229/](https://localhost:7229/) failed, reason: self-signed certificate; if the root CA is installed locally, try running Node.js with --use-system-ca
at ClientRequest. (file:///E:/demos/mcp-sample/node_modules/node-fetch/src/index.js:108:11)
at ClientRequest.emit (node:events:520:35)
at emitErrorEvent (node:_http_client:108:11)
at TLSSocket.socketErrorListener (node:_http_client:575:5)
at TLSSocket.emit (node:events:508:28)
Starting process... {"Executable": "/mcp-bekavwzd", "Reconciliation": 6, "Cmd": "C:\\Program Files\\dotnet\\dotnet.exe", "Args": ["run", "--project", "E:\\demos\\mcp-sample\\HelloMcp\\HelloMcp.csproj", "--no-build", "--configuration", "Debug", "--no-launch-profile"]}
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:89:21) {
type: 'system',
errno: 'DEPTH_ZERO_SELF_SIGNED_CERT',
code: 'DEPTH_ZERO_SELF_SIGNED_CERT',
erroredSysCall: undefined
}

目录标签

目录标签

开发工具C#HTTP传输MCP服务器本地部署AspireOpenTelemetry

接入字段

传输方式(transport,传输协议)

未说明

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

未说明none部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

仍需确认:installCommand

来源信息

继续浏览同类 MCP