MCP server
csls-mcp exposes the language intelligence and guarded edit operations from a
live csls session through the official Model Context Protocol C# SDK.
Start a workspace-owned session directly:
dotnet tool install --global csls-mcpcsls agent mcp --workspace ./MySolution.slnxDirect mode starts a real language-server worker, loads the requested directory, solution, or project, and owns that worker for the MCP process lifetime.
To use an editor-owned session, find its process identifier and attach:
csls sessions listcsls agent mcp --session 12345An MCP client may also pass the absolute socket path with --socket. Exactly one
of --workspace, --session, or --socket is required.
csls-mcp remains a separate .NET tool and may also be invoked directly. The
nested csls agent mcp command finds that installed tool, forwards the selected
connection, and supervises its lifetime. Run csls agent init to create a
reusable SKILL.md that documents the supported CLI and MCP operations.
The server provides tools for diagnostics, completion, hover, navigation, symbol search, signature help, rename, formatting, code actions, workspace inspection, restore, reload, build-host restart, cache clearing, live request inspection, request cancellation, and bounded request tracing.
list_requests returns active correlation identifiers and the current trace
state. cancel_request delivers cancellation to one live request. start_trace
begins a new in-memory trace, and stop_trace returns its retained lifecycle
entries. Tool annotations mark cancellation as destructive and all state-changing
tools as non-read-only.
Resources expose the current session and workspace plus individual projects, documents, and document diagnostics. Prompts cover C# diagnosis, explanations, review, refactoring, and csls troubleshooting.
The MCP reference is generated by listing the tools, resources, templates, and prompts from a real server session.
Edit tools preview changes unless the caller explicitly requests an apply step. Code-action requests accept an exact zero-based UTF-16 range, including missing-using and interface implementation quick fixes that return guarded edit plans. Attached sessions remain owned by their editor. Direct sessions stop with the MCP process.