Serveur MCP ContextManager
Commit 2 nov. 2026Fournit le contexte structurel C# et les graphes de dépendances pour les agents de codage IA en utilisant Roslyn pour naviguer dans les solutions sans lire l'intégralité des fichiers.
Aussi connu sous nushey/ContextManager
- Étoiles
- 1
- Outils
- 7
- Téléchargements, 30 jours
- —
- Dernière version
- 1.3.5
- Dernier commit
- 2 nov. 2026
- Licence
- MIT
Qu'est-ce que ContextManager MCP ?
ContextManager est un serveur MCP. Fournit le contexte structurel C# et les graphes de dépendances pour les agents de codage IA en utilisant Roslyn pour naviguer dans les solutions sans lire l'intégralité des fichiers. Il expose 7 outils, comme inspect_file, inspect_context, project_scan.
Résumé généré à partir du README du projet
À propos du MCP server ContextManager
ContextManager permet aux agents de codage IA de naviguer dans des solutions C# complexes sans avoir à lire chaque ligne de code. En utilisant Roslyn pour analyser les données structurelles, ce MCP server permet aux agents de comprendre les types, les membres publics et les dépendances de constructeur via des contrats JSON compacts. Cette approche évite d'avoir à ingérer des fichiers entiers, économisant ainsi de l'espace dans la fenêtre de contexte et du temps de traitement.
Les développeurs peuvent utiliser ce serveur localement avec des clients tels que Claude Desktop, Cursor ou Claude Code. Il fonctionne en construisant un graphe de connaissances à partir d'un fichier .sln, lequel est stocké dans un répertoire local à côté de la solution. Ce graphe permet une navigation avancée grâce à des outils comme graph_search pour trouver des méthodes par nom et graph_impact_analysis pour déterminer comment un changement pourrait affecter d'autres parties du système. Bien que la plupart des fonctionnalités soient disponibles sur toutes les plateformes, l'analyse des solutions .NET Framework 4.8 nécessite Windows et Visual Studio Build Tools.
Extrait du README du projet. Chaque cas d'utilisation est vérifié par rapport à une citation du document.
Outils MCP ContextManager 7
Détectés depuis le READMEinspect_fileinspect_contextproject_scangraph_searchgraph_get_dependenciesgraph_impact_analysisgraph_path_find
| inspect_file | — | |
| inspect_context | — | |
| project_scan | — | |
| graph_search | — | |
| graph_get_dependencies | — | |
| graph_impact_analysis | — | |
| graph_path_find | — |
Vérifications automatisées
Exécuté le 13 nov. 2026Rapport complet →Pas encore vérifié. Un serveur nécessite un score de 80, aucune faille sérieuse et suffisamment de données pour que nous puissions effectuer les vérifications. Fonctionnement des vérifications · Ce qu'il faut corriger pour gagner des points
- Dépôt source lié et accessiblenushey/contextmanager is public and reachablegithub.com/nushey/contextmanager ↗Réussi
- Le nom du package correspond au dépôt sourceNon vérifié
- Provenance du build (attestation Sigstore)Non vérifié
- Licence open source (OSI)MITspdx.org/licenses/MIT.html ↗Réussi
- Commit ou version publiée au cours de l'année écouléeLast commit or release 2026-11-02github.com/nushey/contextmanager ↗Réussi
- OpenSSF ScorecardNon vérifié
- Nom du package non proche d'un package populaireNon vérifié
- Aucun avis critique dans le package ou ses dépendancesNon vérifié
- Aucune instruction cachée destinée au modèle7 tool descriptions and the README read; no override phrases, credential paths or hidden charactersRéussi
- Les outils destructifs sont étiquetésNo tool named like delete, drop or execRéussi
- Le point de terminaison distant répond à la poignée de main MCPNon vérifié
README
Voir sur GitHubContextManager 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:
curl -fsSL https://raw.githubusercontent.com/nushey/ContextManager/main/scripts/install.sh | bash
Windows (PowerShell):
irm https://raw.githubusercontent.com/nushey/ContextManager/main/scripts/install.ps1 | iex
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:
dotnet tool install -g ContextManager
claude mcp add --scope user context-manager -- context-manager # Claude Code
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
| Tool | What it returns |
|---|---|
inspect_file |
The structural contract of one .cs file. |
inspect_context |
A compact view of up to 15 .cs files plus the references between them; unresolved lists the user types missing from the set. |
project_scan |
Builds or refreshes the solution's graph and reports its coverage. |
graph_search |
Files and methods matching possible names, grouped by file with namespaces and method node IDs. |
graph_get_dependencies |
The neighbors of a node, rolled up to their declaring type, with edge counts per kind. |
graph_impact_analysis |
Every type that depends on a node, directly or transitively, with its file. |
graph_path_find |
The shortest dependency path between two nodes. |
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.
// graph_impact_analysis("/abs/path/MyApp.sln", "MyApp.Orders.IOrderRepository")
{
"affectedIds": ["MyApp.Orders.OrderService", "MyApp.Api.OrdersController"],
"affectedFiles": {
"MyApp.Orders.OrderService": "/abs/path/Orders/OrderService.cs",
"MyApp.Api.OrdersController": "/abs/path/Api/OrdersController.cs"
}
}
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:
{"solutionPath":"/abs/path/MyApp.sln","queries":["Login","Authentication","SignIn"]}
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.
{"results":[{"file":"/abs/path/Auth/Session.cs","namespaces":["MyApp.Auth"],"fileMatched":false,"methods":[{"name":"Login","nodeId":"MyApp.Auth.Session.Login()"}]}],"truncated":false}
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
dotnet build
dotnet test
License
MIT © nushey
Questions sur ContextManager MCP
Quels outils ContextManager MCP fournit-il ?
Il expose 7 outils, dont inspect_file, inspect_context, project_scan, graph_search, graph_get_dependencies.
Est-ce que ContextManager est un service d'arrière-plan ?
Non, il s'agit d'un MCP server stdio que le client lance à l'ouverture d'une session et arrête à la fin de celle-ci.
Le serveur lit-il l'intégralité de ma solution ?
Seuls les outils de graphe lisent l'ensemble de la solution ; les outils d'inspection ne lisent que les fichiers spécifiques que vous fournissez.
Quel type d'état le serveur maintient-il ?
Il conserve uniquement les fichiers de graphe qui sont écrits à côté de chaque fichier .sln.