
ContextManager
io.github.nushey由 GitHub 账号 nushey 发布v1.3.5更新于 Nov 3, 2026
为AI编码代理提供基于Roslyn的结构化上下文和C#解决方案的依赖图。
AI 翻译由 AI 模型根据下方的原文描述翻译,可能有误。
原文描述
Roslyn-powered structural context and a dependency graph of C# solutions for AI coding agents.
概览
ContextManager 的本地 MCP 服务;无需登录;STDIO。
暂无 AI 概览:以下信息来自注册中心条目和服务本身。
安装
在 SourceWeft 中
- 打开 控制台中的 ContextManager,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
ContextManager
Structural C# context for AI coding agents, powered by Roslyn.
Navigate before you read.
Install • Tools • How to use it • FAQ • Full install guide
ContextManager is an MCP server that saves an agent from reading whole C# files. It does two things:
- Inspects files. It turns a
.csfile into a JSON contract with its types, public members, constructor dependencies, base types, interfaces, and events. Method bodies, private members, and XML docs are left out; each method carries its line range so the agent can read only the body it needs. - Maps the solution. It builds a knowledge graph of a
.slnso the agent can find which files matter, and how risky a change is, before opening any of them.
Install
You need the .NET 10 SDK or later.
macOS / Linux:
Windows (PowerShell):
The installer installs or updates the ContextManager .NET global tool and runs
context-manager setup, a wizard that adds the server to the MCP clients you pick (Claude Code,
Claude Desktop, Codex, Antigravity, Kilo Code, Cursor, Devin, Opencode).
To install by hand instead:
For other clients, flags, config-file paths, and troubleshooting, see INSTALL.md.
project_scanon.NET Framework 4.8solutions only works on Windows and needs Visual Studio Build Tools with the .NET desktop build tools workload. Everything else works on any platform.
Tools
Graph tools take the path of the .sln and keep the graph up to date on their own: before
answering, they re-extract only what changed since the last scan. The graph is saved in
.context-manager/<solution name>.graph.json next to the .sln, so every session on that solution
shares it.
How to use it
Start from a file
When the user mentions a file, start there:
inspect_file(path): read the type and build its node ID asNamespace.TypeName.graph_get_dependencies(solutionPath, nodeId): find the neighbors worth reading.inspect_fileon those neighbors only.graph_impact_analysis(solutionPath, nodeId): check the blast radius before changing anything.
A short impact list means the change is contained. A long one means the type's public contract is load-bearing and should be preserved; it does not mean the agent has to read every file in it.
Node IDs use Roslyn's fully qualified format, for example MyApp.Orders.OrderService or
MyApp.Orders.OrderService.GetOrderAsync(System.Guid). Pass the IDs that the graph tools return
as they are.
Find code by name
When you know roughly what something is called but not which file it is in, and you have no node ID,
call graph_search with several candidate names:
What it searches. A term matches when it appears anywhere in a file name (without .cs) or a
method name (without its signature). Matching is ordinal and ignores case, and any one term is enough.
It searches every method already in the graph, private ones included, and finds constructors under
their type name. It does not search directory paths, parameter types, method bodies, or namespaces.
Valid terms. Terms are trimmed and must have at least 3 characters. An empty list, or a single
term that is too short, rejects the whole query before the graph is synchronized, with code
invalid_query and message
Provide at least one query term; each term must be at least 3 characters long after trimming whitespace.
Order and limit. Exact matches come first, then partial ones; within each group, results keep
the order in which they appear in the graph. A name that matches several terms does not rank higher.
The search keeps at most 50 matches, and the limit counts matches, not files: each matching file
counts once and each matching method ID counts once, even when several terms match it. There is no
pagination. When truncated is true, at least one match was left out; use more specific names to
narrow the search.
Response. The response is one line of compact JSON, grouped by file. Every file entry has file,
namespaces, fileMatched, and methods, and empty arrays stay as []. namespaces lists every
namespace in the file. fileMatched is true when the file's own name is one of the matches kept
within the limit. A file can also appear only because one of its methods was kept, even if its name
matched too but fell outside the limit. With no matches, the response is
{"results":[],"truncated":false}.
From there, call inspect_file on a returned file, or pass a method's nodeId unchanged to the
other graph tools. A graph saved by an older version is re-extracted once to add names and
namespaces; later queries reuse the updated graph while nothing changes.
To make your agent follow these workflows, copy docs/AGENTS-template.md
into the AGENTS.md of your project.
FAQ
Is it a background service? No. It is an MCP stdio server: the client starts it when a session opens and stops it when the session ends.
What state does it keep? Only the graph files written next to each .sln. The inspection tools
read the files you pass and keep nothing.
Does it read my whole solution? Only the graph tools do. inspect_file and inspect_context
read just the files you give them.
Build and test
License
MIT © nushey
来源:README.md,提交 84a9f33
工具
0版本历史
4- v1.3.5最新Nov 3, 2026
- v1.3.4Nov 1, 2026
- v1.3.3Nov 1, 2026
- v1.3.2Oct 31, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分