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
| // Non-generic version | |
| ILogger logger = NullLogger.Instance; | |
| // Generic version (most common) | |
| ILogger<MyClass> logger = NullLogger<MyClass>.Instance; |
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
| [Fact] | |
| public void CreateUser_ShouldSucceed() | |
| { | |
| var service = new UserService(NullLogger<UserService>.Instance); | |
| service.CreateUser("john"); | |
| // Assert your expectations... | |
| } |
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
| public class UserService | |
| { | |
| private readonly ILogger<UserService> _logger; | |
| public UserService(ILogger<UserService>? logger = null) | |
| { | |
| _logger = logger ?? NullLogger<UserService>.Instance; | |
| } | |
| public void CreateUser(string username) |
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
| ### Variables | |
| @baseUrl = http://localhost:3000 | |
| @contentType = application/json | |
| ### Initialize MCP Session | |
| POST {{baseUrl}}/mcp/initialize | |
| Content-Type: {{contentType}} | |
| { | |
| "jsonrpc": "2.0", |
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
| { | |
| "servers": { | |
| "AzureDevOpsProjectA": { | |
| "type": "http", | |
| "url": "https://servername/api/mcp/projectA/teamA" | |
| }, | |
| "AzureDevOpsProjectB": { | |
| "type": "http", | |
| "url": "https://servername/api/mcp/projectB" | |
| }, |
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
| using System; | |
| using Microsoft.AspNetCore.Http; | |
| using Microsoft.TeamFoundation.Core.WebApi; | |
| using Microsoft.VisualStudio.Services.Common; | |
| using Microsoft.VisualStudio.Services.WebApi; | |
| namespace VLM.SOFA.DevopsMCPServer; | |
| /// <summary> | |
| /// Scoped service that holds the project name and team name extracted from the route |
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
| // Needed so ProjectContext can read HttpContext.Items | |
| builder.Services.AddHttpContextAccessor(); |
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
| // Add MCP services | |
| builder.Services.AddMcpServer(); | |
| var app = builder.Build(); | |
| // Map MCP endpoints with project name and optional team name route parameters | |
| app.MapMcp("/{projectName}/{teamName?}"); | |
| app.Run(); |
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
| { | |
| "servers": { | |
| "MCPServer": { | |
| "type": "http", | |
| "url": "https://mcp.example.com/inlineParameter?version=v1&timeout=30000", | |
| "headers": { | |
| "X-API-Key": "your-api-key", | |
| "Authorization": "Bearer token123" | |
| } | |
| } |
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
| { | |
| "servers": { | |
| "MCPServer": { | |
| "Transport": "stdio", | |
| "Command": "node", | |
| "Arguments": ["server.js"], | |
| "Environment": { | |
| "API_KEY": "your-api-key", | |
| "BASE_URL": "https://api.example.com", | |
| "TIMEOUT": "30000" |
NewerOlder