Skip to main content
Glama

TBC Guidelines Automation System

TEAM_SETUP.mdโ€ข10.5 kB
# ๐Ÿฆ TBC Guidelines MCP Server - Team Setup Guide ## ๐Ÿ“‹ Overview This repository provides an MCP (Model Context Protocol) server that loads TBC Bank development guidelines and integrates them with VS Code and GitHub Copilot for real-time, compliant code suggestions. ## ๐Ÿš€ Quick Team Setup ### 1. Clone the Repository ```bash git clone <repository-url> cd tbc-guidelines-mcp-server ``` ### 2. Install Dependencies ```bash npm install ``` ### 3. Configure Environment Create a `.env` file with your Confluence credentials: ```bash CONFLUENCE_BASE_URL=https://your-confluence.atlassian.net CONFLUENCE_EMAIL=your-email@tbc.ge CONFLUENCE_API_TOKEN=your-api-token CONFLUENCE_MAIN_PAGE_ID=your-main-page-id ``` ### 4. Start the MCP Server ```bash # Development mode (HTTP) npm run dev:http # Production mode npm run build npm run start:http ``` ### 5. Setup Your Project In your development project directory, run: ```bash bash /path/to/tbc-guidelines-mcp-server/setup-team-project.sh ``` This will: - Create `.vscode/` configuration for MCP integration - Configure GitHub Copilot for TBC context - Set up code quality tools ## ๐Ÿงช Testing the Integration ### Test 1: API Endpoint Naming Violations Create a C# controller with these **incorrect** patterns: ```csharp [ApiController] [Route("api/v1/users")] public class UsersController : ControllerBase { [HttpGet("get_user_profile")] // โŒ Uses underscores [HttpPost("create_new_user")] // โŒ Uses underscores [HttpPut("update_user_details")] // โŒ Uses underscores [HttpDelete("delete_user_account")] // โŒ Uses underscores public IActionResult GetUserProfile() { return Ok(); } } ``` **Expected:** Copilot should suggest kebab-case alternatives: - `get-user-profile` - `create-new-user` - `update-user-details` - `delete-user-account` ### Test 2: Controller Naming Violations ```csharp public class User_Controller : ControllerBase // โŒ Underscore in class name { // Should suggest: UserController } public class usercontroller : ControllerBase // โŒ Lowercase { // Should suggest: UserController (PascalCase) } ``` ### Test 3: Logging Violations ```csharp public class OrderService { public void ProcessOrder(int orderId) { Console.WriteLine("Processing order: " + orderId); // โŒ Console output System.Diagnostics.Debug.WriteLine("Debug info"); // โŒ Debug output throw new Exception("Order failed for ID: " + orderId); // โŒ String concatenation } } ``` **Expected Suggestions:** ```csharp public class OrderService { private readonly ILogger<OrderService> _logger; public void ProcessOrder(int orderId) { _logger.LogInformation("Processing order: {OrderId}", orderId); // โœ… Structured logging _logger.LogDebug("Debug info for order {OrderId}", orderId); // โœ… Proper debug logging throw new Exception($"Order failed for ID: {orderId}"); // โœ… String interpolation } } ``` ### Test 4: Database Query Issues ```csharp public class UserRepository { public List<User> GetAllUsers() { var users = dbContext.Users.ToList(); // โŒ Missing AsNoTracking() var activeUsers = dbContext.Users.Where(u => u.IsActive).ToList(); // โŒ Missing AsNoTracking() return users; } public User GetUser(int id) { return dbContext.Users.FirstOrDefault(u => u.Id == id); // โŒ Missing AsNoTracking() } } ``` **Expected Suggestions:** ```csharp public class UserRepository { public async Task<List<User>> GetAllUsersAsync() { return await dbContext.Users.AsNoTracking().ToListAsync(); // โœ… AsNoTracking + Async var activeUsers = await dbContext.Users.AsNoTracking().Where(u => u.IsActive).ToListAsync(); // โœ… Optimized } public async Task<User> GetUserAsync(int id) { return await dbContext.Users.AsNoTracking().FirstOrDefaultAsync(u => u.Id == id); // โœ… Async + AsNoTracking } } ``` ### Test 5: API Versioning Violations ```csharp [ApiController] [Route("api/users")] // โŒ Missing version public class UsersController : ControllerBase { [HttpGet("users")] // โŒ No versioning public IActionResult GetUsers() { return Ok(); } } ``` **Expected:** Should suggest `[Route("api/v1/users")]` and proper versioning. ### Test 6: Error Handling Violations ```csharp [HttpGet("{id}")] public IActionResult GetUser(int id) { try { var user = userService.GetUser(id); return Ok(user); } catch (Exception ex) { return BadRequest(ex.Message); // โŒ Exposing internal error details } } ``` **Expected Suggestions:** ```csharp [HttpGet("{id}")] public IActionResult GetUser(int id) { try { var user = userService.GetUser(id); if (user == null) { return NotFound(new { error = "User not found" }); } return Ok(user); } catch (Exception ex) { _logger.LogError(ex, "Error retrieving user {UserId}", id); return Problem( // โœ… RFC-7807 format detail: "An error occurred while retrieving the user", statusCode: 500, title: "Internal Server Error" ); } } ``` ### Test 7: Async Pattern Violations ```csharp public class UserService { public User GetUser(int id) // โŒ Synchronous method { return repository.GetUser(id); } public void SaveUser(User user) // โŒ No async, no return value { repository.Save(user); } } ``` **Expected Suggestions:** ```csharp public class UserService { public async Task<User> GetUserAsync(int id) // โœ… Async pattern { return await repository.GetUserAsync(id); } public async Task<bool> SaveUserAsync(User user) // โœ… Async with meaningful return { return await repository.SaveAsync(user); } } ``` ### Test 8: Clean Architecture Violations ```csharp [ApiController] public class UsersController : ControllerBase { private readonly AppDbContext _dbContext; // โŒ Direct DbContext in controller [HttpGet] public IActionResult GetUsers() { var users = _dbContext.Users.ToList(); // โŒ Direct data access in controller return Ok(users); // โŒ Returning entities, not DTOs } } ``` **Expected Suggestions:** ```csharp [ApiController] public class UsersController : ControllerBase { private readonly IMediator _mediator; // โœ… CQRS with MediatR [HttpGet] public async Task<IActionResult> GetUsersAsync() { var users = await _mediator.Send(new GetUsersQuery()); // โœ… Clean Architecture return Ok(users); // โœ… Returns DTOs from query } } ``` ### Test 9: Ask Copilot Chat - Comprehensive Review In VS Code, paste any of the above code and ask: ``` "Review this code for comprehensive TBC compliance and suggest all improvements" ``` **Expected:** Detailed analysis covering: - Naming conventions - Architecture patterns - Error handling - Logging standards - Database optimization - Security considerations ### Test 10: Ask for TBC-Compliant Code Generation Ask Copilot Chat: ``` "Generate a complete user management API following all TBC Bank standards" ``` **Expected:** Complete controller with: - Proper versioning (`api/v1/`) - Kebab-case endpoints - CQRS pattern - Structured logging - RFC-7807 error handling - Async patterns - Clean Architecture ## ๐Ÿ”ง Verification Steps ### 1. Check MCP Server is Running ```bash curl http://localhost:8080/mcp ``` Should return MCP server response with TBC context. ### 2. Verify VS Code Integration - Open Command Palette (`Cmd+Shift+P`) - Look for "GitHub Copilot" commands - Check that suggestions include TBC-specific patterns ### 3. Test Code Completions - Start typing a controller method - Copilot should suggest TBC-compliant patterns automatically ## ๐Ÿ“ Project Structure ``` tbc-guidelines-mcp-server/ โ”œโ”€โ”€ src/ โ”‚ โ”œโ”€โ”€ server.ts # Main MCP server โ”‚ โ”œโ”€โ”€ index.ts # Entry point โ”‚ โ””โ”€โ”€ guidelines/ โ”‚ โ”œโ”€โ”€ loader.ts # Loads TBC guidelines โ”‚ โ””โ”€โ”€ types.ts # Type definitions โ”œโ”€โ”€ .vscode/ # VS Code configuration โ”œโ”€โ”€ setup-team-project.sh # Team setup script โ”œโ”€โ”€ package.json โ””โ”€โ”€ README.md ``` ## ๐ŸŽฏ Available Scripts ```bash npm run dev # Start in stdio mode (VS Code integration) npm run dev:http # Start in HTTP mode (team access) npm run build # Build TypeScript to JavaScript npm run start # Run built server (stdio mode) npm run start:http # Run built server (HTTP mode) ``` ## ๐Ÿ› ๏ธ Troubleshooting ### MCP Server Not Starting 1. Check `.env` file exists and has correct Confluence credentials 2. Verify Node.js version (requires Node 16+) 3. Run `npm install` to ensure dependencies are installed ### No Code Suggestions 1. Verify MCP server is running: `curl http://localhost:8080/mcp` 2. Check VS Code settings include Copilot context configuration 3. Restart VS Code after setup 4. Ensure GitHub Copilot extension is installed and logged in ### Wrong Suggestions 1. Check MCP server logs for guideline loading 2. Verify TBC guidelines are being loaded from Confluence 3. Test with clear violations (underscores in API routes) ## ๐Ÿ”„ Updates and Maintenance ### Update Guidelines Guidelines are loaded from Confluence automatically. To refresh: 1. Restart the MCP server 2. New guidelines will be pulled from Confluence ### Update Team Projects When guidelines change, team members should: 1. Pull latest repository changes 2. Restart their MCP server 3. Restart VS Code ## ๐ŸŒ Network Access The MCP server runs on `http://localhost:8080/mcp` by default. For team-wide access: 1. Configure server on a shared development machine 2. Update `.vscode/mcp.json` with the server URL 3. Ensure firewall allows access to port 8080 ## ๐Ÿ“ž Support If you encounter issues: 1. Check the troubleshooting section above 2. Review MCP server logs for errors 3. Contact the development standards team --- **๐ŸŽฏ Goal:** Every team member gets real-time, TBC-compliant code suggestions automatically!

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/haripriyagullipalli/Mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server