-
Notifications
You must be signed in to change notification settings - Fork 29
feat(prompts_sample): add sample for mcp prompts #343
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
0967e2a to
4a0b812
Compare
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.
Pull request overview
This PR adds a sample implementation demonstrating MCP (Model Context Protocol) prompts through a code refactoring assistant. The sample includes an MCP server with tools for analyzing Python code, detecting code smells, and generating structured refactoring guidance using prompts.
Key Changes
- Adds MCP server with code analysis tools and refactoring prompts
- Implements LangGraph agent that uses MCP tools to analyze code and select appropriate refactoring strategies
- Provides comprehensive refactoring guidance for extract method, simplify conditionals, remove duplication, and improve naming patterns
Reviewed changes
Copilot reviewed 21 out of 22 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| uv.lock | Adds dependencies for MCP, Anthropic SDK, cryptography, and related packages |
| pyproject.toml | Configures workspace to include new sample project |
| samples/mcp-refactoring-assistant/pyproject.toml | Project configuration with dependencies for MCP, LangChain, and LangGraph |
| samples/mcp-refactoring-assistant/server.py | MCP server exposing tools (complexity analysis, code smell detection, refactoring guide) and prompts |
| samples/mcp-refactoring-assistant/graph.py | LangGraph agent that orchestrates code analysis and refactoring recommendation workflow |
| samples/mcp-refactoring-assistant/tools/*.py | Implementation of code analysis heuristics and refactoring guidance mapping |
| samples/mcp-refactoring-assistant/prompts/*.py | Detailed refactoring prompts with examples and best practices |
| Configuration files | LangGraph config, UiPath config, entry points, and bindings |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -0,0 +1,169 @@ | |||
| """LangGraph agent for Code Refactoring Assistant. | |||
Copilot
AI
Dec 15, 2025
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.
The file starts with a zero-width non-breaking space (BOM) character (). This can cause unexpected parsing issues with some tools and should be removed.
| """LangGraph agent for Code Refactoring Assistant. | |
| """LangGraph agent for Code Refactoring Assistant. |
ba06bc0 to
5d267e0
Compare
5d267e0 to
70e86fe
Compare
This pull request introduces a comprehensive, production-ready sample for a code refactoring assistant agent using LangGraph and the UiPath Python SDK, with strong emphasis on structure, documentation, and extensibility. The main purpose of this pr s to show how can be used the available
get_prompt()LanGraph function for MCP servers.