Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
3c528be
增加采样功能
walterlv Apr 3, 2026
57c1d0b
简化代码,添加采样功能的单元测试
walterlv Apr 3, 2026
c1f4f2f
添加人工测试的 MCP 采样工具
walterlv Apr 3, 2026
27efe1b
解决采样协议不被客户端认识的问题
walterlv Apr 3, 2026
c432af1
整理采样异常
walterlv Apr 3, 2026
e56fb0a
调整一些代码
walterlv Apr 7, 2026
b069d80
处理审查
walterlv Apr 7, 2026
e2c67fe
处理审查
walterlv Apr 7, 2026
da9028c
整理传输层读取请求或响应的分支
walterlv Apr 7, 2026
3db477f
避免不应该的双语注释
walterlv Apr 7, 2026
694a602
添加更多的调试日志
walterlv Apr 8, 2026
9acc4e6
兼容 MCP Inspector 的采样拒绝
walterlv Apr 8, 2026
3010535
记录客户端错误
walterlv Apr 8, 2026
e2eba44
修复指令中的协议版本
walterlv Apr 8, 2026
8dceafe
AI 增加的屎山代码:修复 SSE 消息流向
walterlv Apr 8, 2026
733ca8c
简化传输层的实现
walterlv Apr 8, 2026
c6292f6
处理遗留的双语问题
walterlv Apr 8, 2026
10002e6
重构以简化传输层的代码
walterlv Apr 8, 2026
128aa76
更新文档记录
walterlv Apr 8, 2026
5963987
处理审查意见
walterlv Apr 8, 2026
52670d8
处理审查意见
walterlv Apr 8, 2026
4b18f12
处理审查意见
walterlv Apr 8, 2026
3933fbe
处理审查意见
walterlv Apr 8, 2026
19a5117
处理审查意见:修复并发竞态、重复请求ID、SSE心跳、以及初始化请求分类等问题
Copilot Apr 8, 2026
c96610f
调整心跳时间
walterlv Apr 8, 2026
9888474
处理审查意见:协议版本运算符比较、SSE并发写互斥、重复请求ID、双语注释、ToArray优化
Copilot Apr 8, 2026
11e92fb
处理审查意见
walterlv Apr 8, 2026
a855395
修复 ServerTransportManager:PipeReader 资源释放和大小写不敏感属性查找
Copilot Apr 9, 2026
00bed63
使用更简单的 JsonElement,不需要 PipeReader
walterlv Apr 9, 2026
71549d1
我觉得没必要为了这个不规范的写法浪费性能
walterlv Apr 9, 2026
52f6e76
处理审查意见
walterlv Apr 9, 2026
0710443
添加辅助传输层日志记录的类(避免日志打太多)
walterlv Apr 9, 2026
9b5cd10
统一使用受管理的传输层原始日志记录,避免日志大幅影响控制台输出
walterlv Apr 9, 2026
bbb20b0
尝试消除竞态条件
walterlv Apr 9, 2026
3ba6c05
为 GET 添加日志
walterlv Apr 9, 2026
6032afa
记录更详细的原始日志
walterlv Apr 10, 2026
b2f9f65
ToString 可以输出文本内容
walterlv Apr 10, 2026
2f754ca
允许不传入 params
walterlv Apr 17, 2026
13ce538
对齐 MCP 传输层协议
walterlv Apr 27, 2026
750bebc
添加协议兼容与版本协商设计方案
walterlv Apr 27, 2026
cc5ee4e
协议兼容计划
walterlv Apr 27, 2026
bc99044
兼容 2024-11-05 版旧协议
walterlv Apr 27, 2026
c5112f5
默认兼容旧协议
walterlv Apr 27, 2026
156c96a
后续计划
walterlv Apr 27, 2026
7d3198c
版本兼容与版本协商
walterlv Apr 27, 2026
d200b58
代码审查和修复
walterlv Apr 27, 2026
ab43daf
核对官方 MCP 文档并修复实现问题
walterlv Apr 27, 2026
dc0e53c
删除已实现的两个计划
walterlv Apr 27, 2026
ec9bf9e
注释测试
walterlv Apr 27, 2026
a5e98fe
记录上游问题
walterlv Apr 30, 2026
ac1e063
加入 In-Process MCP
walterlv Apr 30, 2026
11dd8a6
补文档
walterlv Apr 30, 2026
bb03919
优化 CallToolResult.ToString 体验
walterlv Apr 30, 2026
e234f78
Json 序列化时,避免输出 `\uxxxx`
walterlv Apr 30, 2026
9e58f92
Add json serialize doc
walterlv May 8, 2026
cdd647f
IPC 计划
walterlv May 8, 2026
9822613
支持 IPC 传输层,支持 InProcess 一对多通信
walterlv May 9, 2026
5c78e66
确保可先创建后连接
walterlv May 9, 2026
ce426f9
简化一对多进程内 MCP 通信的代码结构
walterlv May 9, 2026
78bfe59
实现 MCP 客户端的 meta 注入
walterlv May 9, 2026
2172330
初版文档
walterlv May 9, 2026
8429728
第二版文档
walterlv May 9, 2026
35236ec
DeepSeek V4 Pro 润色
walterlv May 9, 2026
ab4a663
翻译文档
walterlv May 9, 2026
b200a39
提供一个让业务使用的扩展方法
walterlv May 11, 2026
43526ae
因为涉及到生成源,所以项目不应自带命名空间,应该由文件自己携带
walterlv May 11, 2026
b4588d4
恢复版本
walterlv May 11, 2026
bda0e2e
文档说明集合不允许作为返回值
walterlv May 11, 2026
7eaaa02
增加 MCP 工具的依赖注入说明
walterlv May 12, 2026
fcb67d7
MCP over IPC 单元测试
walterlv May 12, 2026
539153f
补上先连的 IpcProvider 后开 MCP 服务的测试
walterlv May 12, 2026
20d9d8f
修复预先启动的 IpcProvider,MCP 无法响应的问题
walterlv May 12, 2026
b4c3dc7
修正预先启动的单元测试的错误写法
walterlv May 12, 2026
c68d7c4
补充传输层的更多文档提示
walterlv May 12, 2026
3ea0576
修复对象中的集合属性被错误映射成 object 的 OutputSchema 导致无法通过类型校验的问题
walterlv May 12, 2026
953d0fa
修复示例错误
walterlv May 12, 2026
c022417
修复 OpenAI API 兼容性
walterlv May 15, 2026
4819eaf
优化文档,避免 AI 理解歧义
walterlv May 25, 2026
7d87b58
同步文档
walterlv May 25, 2026
3b0f1f0
提供函数功能和微软生态对接
lindexi May 25, 2026
b3e0bff
提供更多工具
lindexi May 25, 2026
2ab2187
整理依赖注入,并让会话补充更多客户端信息
walterlv May 27, 2026
dd6ee28
Merge pull request #9 from dotnet-campus/t/lindexi/AgentFramework
walterlv May 28, 2026
ab22b74
修复可空类型返回,让 MCP 客户端无法连接(不符合 MCP 协议)
walterlv May 27, 2026
4f076dd
预修改 MCP 工具返回值方案
walterlv May 29, 2026
0011537
Revert "预修改 MCP 工具返回值方案"
walterlv May 29, 2026
d7638c9
处理 MCP 协议兼容的工具返回值
walterlv May 29, 2026
9f04281
更新文档以匹配 MCP 工具中的返回值处理
walterlv May 31, 2026
7f8cb1c
MCP over CLI 设计
walterlv Jun 1, 2026
7a4af17
加入 mcp-to-cli 需求
walterlv Jun 3, 2026
5ded382
修复 Claude Code 客户端的兼容性问题
walterlv Jun 4, 2026
2246fa9
update .gitignore
walterlv Jun 6, 2026
d351f32
Remove legacy tasks.
walterlv Jun 6, 2026
db4e178
Add tasks
walterlv Jun 6, 2026
5b948ff
列举 AI 发现的 input/output schema 的问题
walterlv Jun 8, 2026
c85bf4c
更新多态机制文档
walterlv Jun 16, 2026
4db068b
同步更新其他语言文档
walterlv Jun 16, 2026
d438f30
允许区分不提供值和 null
walterlv Jun 18, 2026
c93267d
通过公共知识判断属性是否提供
walterlv Jun 18, 2026
15d3fb8
修复单元测试
walterlv Jul 2, 2026
92dbb60
实现 GenerateJsonSchemaAttribute
walterlv Jul 2, 2026
ed1625c
编写 GenerateJsonSchemaAttribute 相关的文档
walterlv Jul 2, 2026
098d7d1
提供多种语言的 [GenerateJsonSchema] 文档
walterlv Jul 2, 2026
78e2254
审查与修复文档错误
walterlv Jul 2, 2026
a01e93d
Schema 更多地支持 System.Text.Json 的契约
walterlv Jul 3, 2026
247ad83
简化 JsonContext 在源生成器中的传入
walterlv Jul 3, 2026
9996d26
删除使用 TypeConverter 的 JsonSchema,因为难以确认转换方法
walterlv Jul 8, 2026
9c0f69c
修复异常信息在返回过程中丢失的问题
walterlv Sep 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ src/DotNetCampus.ModelContextProtocol/
- 代码主要以最新版本协议进行编写
- 遇到需要兼容旧协议的部分,用 `Legacy` 命名相关代码并尽量减少代码量
- **协议消息类型规范**:详见 [/docs/knowledge/protocol-messages-guide.md](../docs/knowledge/protocol-messages-guide.md)
- 所有 Protocol 消息类型必须添加中英双语注释
- **仅** `Protocol/` 文件夹下的消息类型必须添加中英双语注释;其他所有代码(接口、实现类、传输层等)一律使用**纯中文注释**(注:当前存在一些遗留非协议代码仍使用双语注释,如果改到了相关代码,请顺手改为纯中文注释)
- 英文注释必须使用 MCP 官方 Schema 原文
- 当前使用协议版本:**2025-11-25**
- Schema 文件:[schema.ts](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-11-25/schema.ts)
Expand Down Expand Up @@ -75,8 +75,9 @@ src/DotNetCampus.ModelContextProtocol/

## 参考资源

- [MCP 官方规范 (2025-06-18)](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports) - **当前使用版本**
- [MCP Schema (2025-06-18)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-06-18/schema.ts) - **官方消息类型定义**
- [MCP 官方规范 (2025-11-25)](https://modelcontextprotocol.io/specification/2025-11-25/basic/transports) - **当前使用版本**
- [MCP Schema (2025-11-25)](https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-11-25/schema.ts) - **官方消息类型定义**
- [MCP 官方规范 (2025-06-18)](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports) - 旧版本(兼容支持)
- [MCP 官方规范 (2024-11-05)](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports) - 旧版本(兼容支持)
- [JSON-RPC 2.0 规范](https://www.jsonrpc.org/specification)
- [SSE 标准](https://html.spec.whatwg.org/multipage/server-sent-events.html)
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ jobs:

- name: Build with dotnet
run: dotnet build --configuration release
# - name: Test
# run: dotnet test --configuration release --no-build
- name: Test
run: dotnet test --configuration release --no-build
135 changes: 114 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,57 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore

# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
*.env

# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs

# Mono auto generated files
mono_crash.*

# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/

[Dd]ebug/x64/
[Dd]ebugPublic/x64/
[Rr]elease/x64/
[Rr]eleases/x64/
bin/x64/
obj/x64/

[Dd]ebug/x86/
[Dd]ebugPublic/x86/
[Rr]elease/x86/
[Rr]eleases/x86/
bin/x86/
obj/x86/

[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
[Aa][Rr][Mm]64[Ee][Cc]/
bld/
[Bb]in/
[Oo]bj/
[Oo]ut/
[Ll]og/
[Ll]ogs/

# Build results on 'Bin' directories
**/[Bb]in/*
# Uncomment if you have tasks that rely on *.refresh files to move binaries
# (https://github.com/github/gitignore/pull/3736)
#!**/[Bb]in/*.refresh

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand All @@ -38,10 +64,15 @@ Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*.trx

# NUNIT
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml

# Approval Tests result files
*.received.*

# Build Results of an ATL Project
[Dd]ebugPS/
Expand All @@ -55,6 +86,10 @@ BenchmarkDotNet.Artifacts/
project.lock.json
project.fragment.lock.json
artifacts/
.artifacts/

# ASP.NET Scaffolding
ScaffoldingReadMe.txt

# StyleCop
StyleCopReport.xml
Expand All @@ -66,13 +101,16 @@ StyleCopReport.xml
*.ilk
*.meta
*.obj
*.idb
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
# but not Directory.Build.rsp, as it configures directory-level build defaults
!Directory.Build.rsp
*.sbr
*.tlb
*.tli
Expand All @@ -81,6 +119,7 @@ StyleCopReport.xml
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
Expand Down Expand Up @@ -122,9 +161,6 @@ _ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user

# JustCode is a .NET coding add-in
.JustCode

# TeamCity is a build add-in
_TeamCity*

Expand All @@ -135,12 +171,18 @@ _TeamCity*
.axoCover/*
!.axoCover/settings.json

# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info

# Visual Studio code coverage results
*.coverage
*.coveragexml

# NCrunch
_NCrunch_*
.NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*

Expand Down Expand Up @@ -182,6 +224,8 @@ PublishScripts/

# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
Expand All @@ -206,6 +250,8 @@ BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload

# Visual Studio cache files
# files ending in .cache can be ignored
Expand Down Expand Up @@ -255,7 +301,9 @@ ServiceFabricBackup/
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- Backup*.rdl
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl

# Microsoft Fakes
FakesAssemblies/
Expand All @@ -276,6 +324,14 @@ node_modules/
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw

# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp

# Visual Studio 6 technical files
*.ncb
*.aps

# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
Expand All @@ -285,26 +341,22 @@ node_modules/
_Pvt_Extensions

# Paket dependency manager
.paket/paket.exe
**/.paket/paket.exe
paket-files/

# FAKE - F# Make
.fake/

# JetBrains Rider
.idea/
*.sln.iml
**/.fake/

# CodeRush personal settings
.cr/personal
**/.cr/personal

# Python Tools for Visual Studio (PTVS)
__pycache__/
**/__pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
#tools/**
#!tools/packages.config

# Tabs Studio
*.tss
Expand All @@ -326,15 +378,56 @@ ASALocalRun/

# MSBuild Binary and Structured Log
*.binlog
MSBuild_Logs/

# AWS SAM Build and Temporary Artifacts folder
.aws-sam

# NVidia Nsight GPU debugger configuration file
*.nvuser

# MFractors (Xamarin productivity tool) working folder
.mfractor/
**/.mfractor/

# Local History for Visual Studio
.localhistory/
**/.localhistory/

# Visual Studio History (VSHistory) files
.vshistory/

# BeatPulse healthcheck temp database
healthchecksdb

# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/

# Ionide (cross platform F# VS Code tools) working folder
**/.ionide/

# Fody - auto-generated XML schema
FodyWeavers.xsd

# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp

# Exclude Tools
.serena
.idea
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,14 @@
<PackageVersion Include="dotnetCampus.Ipc" Version="2.0.0-alpha434" />
<PackageVersion Include="DotNetCampus.LatestCSharpFeatures" Version="13.0.1" />
<PackageVersion Include="DotNetCampus.Logger" Version="1.3.1-alpha.2" />
<PackageVersion Include="Microsoft.Agents.AI" Version="1.6.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.4" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp" Version="4.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.11.0" />
<PackageVersion Include="Microsoft.Extensions.AI.Abstractions" Version="10.6.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="17.10.0" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.0.0" />
<PackageVersion Include="MSTest" Version="4.2.3" />
<PackageVersion Include="MSTest.TestAdapter" Version="3.4.3" />
<PackageVersion Include="MSTest.TestFramework" Version="3.4.3" />
<PackageVersion Include="System.Collections.Immutable" Version="8.0.0" />
Expand Down
Loading
Loading