
Complexity Analysis
io.github.rodri-oliveira-dev由 GitHub 账号 rodri-oliveira-dev 发布v1.0.1更新于 Oct 30, 2026
Analyze C# complexity, inspect member evidence, and compare deterministic snapshots.
概览
本地只读 MCP 服务器,让助手分析 C# 项目复杂度、查看成员证据并比较确定性快照。
- 可以做什么
- 分析根目录下的 .csproj、.sln 或 .slnx,支持完整模式与带明确截断计数的摘要模式
- 按稳定 ID 查询某个成员复杂度估算的依据,可复用已缓存的快照
- 比较基线与当前的 JSON 复杂度快照,只报告已证实的回归
- 返回确定性的分析 ID 与结构化只读结果,适合大型项目流程
- 适用场景
- 当助手需要理解 C# 代码复杂度时适用:查找项目或解决方案中的复杂度热点、解释某成员为何被估算为平方级,或确认改动是否引入已证实的复杂度回归。
- 运行要求
- 以本地 .NET 工具形式通过 stdio 运行(NuGet 包 ComplexityAnalysis.Mcp,命令 complexity-mcp);需要 .NET 10 运行时,本地工具清单建议安装 .NET 10 SDK。启动命令需提供绝对路径的 --root 目录,可选设置超时、输入大小与文件数量上限。无需账号、API 密钥或网络访问。
安装
在 SourceWeft 中
- 打开 控制台中的 Complexity Analysis,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
ComplexityAnalysis.Mcp
ComplexityAnalysis.Mcp is a local, read-only MCP server that lets compatible
agents analyze C# project complexity, inspect the evidence for a member, and
compare deterministic snapshots. It exposes analysis tools to an external
agent; it is not an autonomous agent and never edits source code.
Choose the right product
ComplexityAnalysis.Analyzersruns inside Roslyn builds and IDE analysis.ComplexityAnalysis.Toolis thecomplexity-analysisCLI for reports, snapshots, quality gates, and automation.ComplexityAnalysis.Mcpis thecomplexity-mcpstdio server for agent tool discovery and invocation. It reuses the CLI analysis implementation.
The MCP package installs independently and includes everything needed to run; it does not require a repository checkout or a prior CLI installation.
Requirements and installation
.NET 10 runtime is required. The .NET 10 SDK is recommended for local tool manifests.
After 1.0.0 is published, install globally:
Or pin it in a local manifest:
Update or uninstall a global installation with:
For a local manifest, omit --global; run with dotnet tool run complexity-mcp. A package built from source is not a published release: use an
explicit local source and local-only version when testing it.
Start the server
MCP clients normally start the process for you. The launch command is:
--root is the read boundary, not merely a working-directory hint. Use an
absolute path so the same configuration works regardless of the client's
working directory.
Use complexity-mcp --help for the installed version's options. --help and
--version print and exit before stdio protocol startup.
MCP tools
All tools are annotated read-only and return structured content.
analyze_project
Analyzes a .csproj, .sln, or .slnx below --root.
pathis required.responseModeisfullby default and preserves the v1 contract's complete snapshot underreport.responseMode: "summary"returns a compact member index undersummary.maxMembersapplies only to summary mode, defaults to100, and accepts1..500.
Summary truncation is never silent: isTruncated, totalMemberCount, and
returnedMemberCount state exactly what was omitted. Every response also
returns a deterministic analysisId. A bounded cache retains up to four exact
snapshots and at most 16 MiB in total; reusable reports whether the snapshot
was retained.
query_member_evidence
Looks up an exact StableId in a project or solution. Without analysisId, it
reanalyzes current files for backward compatibility. With an analysisId from
analyze_project, it reads that immutable cached snapshot and avoids repeating
Roslyn analysis. It fails explicitly if the snapshot was not retained or was
evicted; it never substitutes potentially stale current results.
compare_snapshots
Compares baseline and current .json complexity snapshots below --root.
Results are deterministic. An Unknown estimate is incomparable and is not
promoted to a proven regression.
Example agent workflow
Ask an agent:
- "Summarize complexity hotspots in
src/App/App.csproj." - "Why is member
M:App.Search(System.Int32[])reported as quadratic?" - "Compare
baseline.jsonwithcurrent.json; list only proven regressions." - "Which results are
Unknown, and what evidence explains each one?"
For large projects, the efficient sequence is:
- call
analyze_projectwithresponseMode: "summary"; - inspect
isTruncatedand the returned member index; - call
query_member_evidencewith the returnedanalysisIdand aStableId.
A shortened response looks like:
Unknown means the bounded analyzer could not prove a safe estimate. It is not
O(1), an error, or evidence that the method is efficient.
Client configuration
The common launch values are:
VS Code / GitHub Copilot
Create .vscode/mcp.json:
Then run MCP: List Servers and start or inspect the server. See the official VS Code MCP configuration reference.
Codex CLI and IDE extension
Register the installed stdio command:
Equivalent ~/.codex/config.toml:
Codex CLI and its IDE extension share this configuration. See the official Codex MCP documentation.
Claude Desktop
For a local developer-defined server, add this entry to
claude_desktop_config.json and fully restart Claude Desktop:
On Windows the file is under %APPDATA%\Claude; on macOS it is under
~/Library/Application Support/Claude. See the official MCP SDK's
real-host guide.
Windows, macOS, and Linux notes
- Ensure the .NET global tools directory is on the environment
PATHinherited by the client.dotnet tool list --globalconfirms the installation; if the client cannot resolve it, configure the absolutecomplexity-mcpexecutable discovered on that machine without committing the machine-specific path. - JSON Windows paths require escaped backslashes; forward slashes also work in .NET paths.
- GUI clients may inherit a different
PATHfrom an interactive shell. Restart the client after installation or configure the absolute executable path. --rootshould be absolute. The process working directory does not expand the read boundary.
Distribution and Official MCP Registry
The three publication channels have different purposes:
- NuGet.org hosts the installable .NET tool used by the commands above.
- GitHub Packages mirrors the same validated
.nupkgfor consumers of the repository package feed. - The Official MCP Registry stores discovery metadata for
io.github.rodri-oliveira-dev/complexity-analysis; itsnugetpackage entry points clients toComplexityAnalysis.Mcpon NuGet.org. It does not host a second executable or turn this server into a remote service.
Registry discovery does not change the local client configurations above:
clients still install or resolve the NuGet tool and start complexity-mcp over
stdio with an explicit --root.
Each manual main release derives the manifest and package versions from the
validated workflow input. After NuGet.org and the GitHub Release succeed, the
workflow waits for the NuGet README containing the ownership marker, validates
the manifest with a fixed, Sigstore-verified mcp-publisher, authenticates with
GitHub OIDC, publishes, and queries the Registry API to verify the exact name
and version. Pull-request runs validate the package and versioned manifest but
never authenticate or publish.
To verify a release, search the Official MCP Registry for the full server name, or query its public API:
Troubleshooting:
- OIDC login fails: confirm the run is a manual deployment from
main, the protectedreleaseenvironment approved it, andid-token: writeremains on the Registry job. No PAT or persistent Registry secret is expected. - Manifest validation fails: run
mcp-publisher validate .mcp/server.jsonand keep the server name, NuGet identifier, stdio transport, and schema valid. - Package is not available: wait for NuGet.org flat-container and README indexing, then rerun the same release workflow. Published package and release artifacts remain intact.
- Version conflict: Registry and NuGet versions are immutable. A retry is accepted only for compatible metadata; otherwise correct the source and use a new semantic version instead of attempting to replace the published one.
See the official package-type specification, GitHub Actions publishing guide, and .NET publishing guide.
Security and limitations
The server is local, stdio-only, and read-only. It has no HTTP transport,
network calls, telemetry, shell execution, source mutation, or write tools.
It rejects paths outside --root, unsupported extensions, traversal through
symbolic links/reparse points, and requests exceeding file, byte, or timeout
limits. Concurrent requests use independent limit and cancellation scopes.
Paths in reports are relative to --root; errors do not echo local absolute
paths. stdout is reserved for MCP JSON-RPC and logs go to stderr.
The analysis is conservative and bounded. It does not build the project, load MSBuild evaluation, execute code, or solve every valid C# program. Configuration is read from the project and source files supported by the shared CLI loader.
Project links
来源:src/ComplexityAnalysis.Mcp/README.md,提交 b664e78
工具
0版本历史
2- v1.0.1最新Oct 30, 2026
- v1.0.0Oct 26, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分