Add MCP Server to expose Cast refactoring commands as standardized tools#13
Draft
Add MCP Server to expose Cast refactoring commands as standardized tools#13
Conversation
…ands Co-authored-by: AdamFrisby <114041+AdamFrisby@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Create MCP Server to expose Commands
Add MCP Server to expose Cast refactoring commands as standardized tools
Jul 12, 2025
AdamFrisby
requested changes
Jul 12, 2025
Cast.Tool.McpServer/CastMcpServer.cs
Outdated
Owner
There was a problem hiding this comment.
Try build this from the commands themselves, rather than duplicating this.
Owner
|
@copilot please continue until done (see review comments) |
…andRegistry Co-authored-by: AdamFrisby <114041+AdamFrisby@users.noreply.github.com>
Contributor
Author
Completed! I've eliminated the command description duplication by creating a shared |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.