-
Notifications
You must be signed in to change notification settings - Fork 0
Add MCP Server to expose Cast refactoring commands as standardized tools #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ands Co-authored-by: AdamFrisby <114041+AdamFrisby@users.noreply.github.com>
Cast.Tool.McpServer/CastMcpServer.cs
Outdated
| private string GetCommandDescription(Type commandType, string commandName) | ||
| { | ||
| // Provide descriptions based on command names | ||
| return commandName switch |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try build this from the commands themselves, rather than duplicating this.
|
@copilot please continue until done (see review comments) |
…andRegistry Co-authored-by: AdamFrisby <114041+AdamFrisby@users.noreply.github.com>
Completed! I've eliminated the command description duplication by creating a shared |
This PR implements a complete Model Context Protocol (MCP) Server that exposes all 61+ Cast refactoring commands as standardized tools for AI agents and other MCP clients.
What's Added
New MCP Server Project
Cast.Tool.McpServer- New console application using the official ModelContextProtocol libraryKey Features
Complete Tool Coverage: All Cast commands exposed as MCP tools with
cast_prefix:cast_rename- Rename symbols at specified locationscast_extract_method- Extract methods from code selectionscast_add_using- Add missing using statementscast_convert_auto_property- Convert between auto and full propertiesProper MCP Protocol Support:
list_toolsrequests to discover available commandscall_toolrequests to execute refactoring operationsRich Parameter Schemas: Each tool includes detailed JSON schemas defining:
file_path,old_name/new_namefor rename)line_number,column_number,dry_run)Usage
Start the MCP server:
The server listens on stdin/stdout using the MCP protocol. AI agents can then:
list_toolsto see all 61+ available refactoring commandscall_toolwith JSON parameters:{ "name": "cast_rename", "arguments": { "file_path": "MyClass.cs", "line_number": 15, "old_name": "oldVariableName", "new_name": "newVariableName", "dry_run": true } }Architecture
Testing
Documentation
Cast.Tool.McpServer/README.mdwith full API documentationThis enables AI agents to perform sophisticated C# code refactoring through a standardized interface while leveraging Cast's battle-tested Roslyn-based refactoring engine.
Fixes #6.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.