msbuild-mcp-server로 C++/C# 코드 빌드 결과를 LLM Agent에 연결하기
LLM Agent가 수정한 코드... 내가 왜 매번 검사하지?
GPT 기반의 코드 어시스턴트는 점점 똑똑해지고 있지만,
조금 사용하다보면 "빌드가 되는지" 확인하지 않고 코드를 생성합니다.
- 실행 안 되는 코드가 추가됨
- 결국 사람이 손으로 빌드하고 에러 복붙...
msbuild-mcp-server : AI님 코드 수정한 뒤엔 빌드 좀 해볼래요?
이 도구는 LLM Agent가 코드를 수정한 뒤, 직접 빌드도 해볼 수 있도록 도와주는 초경량 MCP 서버입니다.
- .sln 파일을 MSBuild로 빌드
- 컴파일 오류를 감지하고 구조화된 메시지로 반환하여 스스로 교정
- 설치 없이 바로 실행 가능
설치 없이 바로 실행하기
MCP를 지원하는 툴의 설정에 다음과 같이 추가하세요:
{
"mcpServers": {
"msbuild-mcp-server": {
"command": "uvx",
"args": [
"msbuild-mcp-server@latest"
]
}
}
}
VSCode: .vscode/mcp.json
Cursor: ~/.cursor/mcp.json or <project-root>/.cursor/mcp.json
Windsurf: ~/.codeium/windsurf/mcp_config.json
Cursor 에서 설정하기
사용 예시
Agent에게 "MyProject.sln" 파일을 빌드해달라고 요청하면:
{
"tool": "build_solution",
"params": {
"sln_path": "./%PATH%MyProject.sln",
"configuration": "Debug",
"platform": "x64"
}
}
결과는 다음처럼 반환됩니다:
{
"success": false,
"errors": [
{
"file": "Main.cpp",
"line": 42,
"message": "syntax error: missing ';' before 'return'"
}
]
}
LLM은 이 결과를 받아서 자동 수정까지 가능하겠죠?
어디에 유용할까?
- GPT 기반 Agent가 코드를 수정한 후, 실제 컴파일 가능 여부 확인
- 반복적인 빌드/수정 사이클 자동화
- 자동화된 테스트 or 리뷰 도구와 연동
마무리
msbuild-mcp-server는 단순한 아이디어에서 시작된 프로젝트입니다.
Agent의 손에 빌드 능력을 쥐어주고, 빌드 오류를 스스로 잡도록 해서 생산성을 올려봅시다.
https://github.com/zenoengine/msbuild-mcp-server
GitHub - zenoengine/msbuild-mcp-server: A lightweight MCP (Model Context Protocol) server for building MSBuild projects. Support
A lightweight MCP (Model Context Protocol) server for building MSBuild projects. Supports dynamic MSBuild discovery using vswhere and provides flexible build configuration options. - zenoengine/msb...
github.com