# π§ λͺ¨λ 3: Microsoft Foundry Toolkitλ₯Ό νμ©ν κ³ κΈ MCP κ°λ°





## π― νμ΅ λͺ©ν
μ΄ μ€μ΅μ μλ£νλ©΄ λ€μμ ν μ μμ΅λλ€:
- β
Microsoft Foundry Toolkitμ μ¬μ©ν΄ 컀μ€ν
MCP μλ² μμ±
- β
μ΅μ MCP Python SDK(v1.9.3) κ΅¬μ± λ° μ¬μ©
- β
λλ²κΉ
μ μν MCP Inspector μ€μ λ° νμ©
- β
Agent Builderμ Inspector νκ²½μμ MCP μλ² λλ²κΉ
- β
κ³ κΈ MCP μλ² κ°λ° μν¬νλ‘μ° μ΄ν΄
## π μ¬μ μ€λΉ μ¬ν
- λ© 2 (MCP κΈ°μ΄) μλ£
- Microsoft Foundry Toolkit νμ₯ νλ‘κ·Έλ¨μ΄ μ€μΉλ VS Code
- Python 3.10+ νκ²½
- Inspector μ€μ μ μν Node.js λ° npm
## ποΈ λ§λ€κ² λ νλ‘μ νΈ
μ΄ μ€μ΅μμλ Weather MCP Serverλ₯Ό λ§λ€μ΄ λ€μμ 보μ¬μ€λλ€:
- 컀μ€ν
MCP μλ² κ΅¬ν
- Microsoft Foundry Toolkit Agent Builderμ ν΅ν©
- μ λ¬Έμ μΈ λλ²κΉ
μν¬νλ‘μ°
- μ΅μ MCP SDK νμ© ν¨ν΄
---
## π§ ν΅μ¬ κ΅¬μ± μμ κ°μ
### π MCP Python SDK
Model Context Protocol Python SDKλ 컀μ€ν
MCP μλ²λ₯Ό ꡬμΆνλ κΈ°λ°μ μ 곡ν©λλ€. λ²μ 1.9.3μ μ¬μ©νλ©° ν₯μλ λλ²κΉ
κΈ°λ₯μ΄ ν¬ν¨λμ΄ μμ΅λλ€.
### π MCP Inspector
κ°λ ₯ν λλ²κΉ
λκ΅¬λ‘ λ€μ κΈ°λ₯μ μ 곡ν©λλ€:
- μ€μκ° μλ² λͺ¨λν°λ§
- λꡬ μ€ν μκ°ν
- λ€νΈμν¬ μμ²/μλ΅ κ²μ¬
- μΈν°λν°λΈ ν
μ€νΈ νκ²½
---
## π λ¨κ³λ³ ꡬν
### 1λ¨κ³: Agent Builderμμ WeatherAgent μμ±
1. VS Codeμμ Microsoft Foundry Toolkit νμ₯ νλ‘κ·Έλ¨μ ν΅ν΄ **Agent Builder μ€ν**
2. λ€μ ꡬμ±μΌλ‘ **μ μμ΄μ νΈ μμ±**:
- μμ΄μ νΈ μ΄λ¦: `WeatherAgent`

### 2λ¨κ³: MCP μλ² νλ‘μ νΈ μ΄κΈ°ν
1. Agent Builderμμ **Tools** β **Add Tool** μ΄λ
2. μ¬μ© κ°λ₯ν μ΅μ
μ€ **"MCP Server" μ ν**
3. **"Create A new MCP Server" μ ν**
4. **`python-weather` ν
νλ¦Ώ μ ν**
5. μλ² μ΄λ¦ μ§μ : `weather_mcp`

### 3λ¨κ³: νλ‘μ νΈ μ΄κΈ° λ° κ²ν
1. VS Codeμμ μμ±λ νλ‘μ νΈ μ΄κΈ°
2. νλ‘μ νΈ κ΅¬μ‘° κ²ν :
```
weather_mcp/
βββ src/
β βββ __init__.py
β βββ server.py
βββ inspector/
β βββ package.json
β βββ package-lock.json
βββ .vscode/
β βββ launch.json
β βββ tasks.json
βββ pyproject.toml
βββ README.md
```
### 4λ¨κ³: μ΅μ MCP SDKλ‘ μ
κ·Έλ μ΄λ
> **π μ
κ·Έλ μ΄λ μ΄μ ?** μ΅μ MCP SDK (v1.9.3)μ Inspector μλΉμ€ (0.14.0)λ₯Ό μ¬μ©νμ¬ ν₯μλ κΈ°λ₯κ³Ό λ λμ λλ²κΉ
νκ²½μ ꡬνν©λλ€.
#### 4a. Python μ’
μμ± μ
λ°μ΄νΈ
**`pyproject.toml` νΈμ§:** [./code/weather_mcp/pyproject.toml](../../../../10-StreamliningAIWorkflowsBuildingAnMCPServerWithAIToolkit/lab3/code/weather_mcp/pyproject.toml) μ
λ°μ΄νΈ
#### 4b. Inspector κ΅¬μ± μ
λ°μ΄νΈ
**`inspector/package.json` νΈμ§:** [./code/weather_mcp/inspector/package.json](../../../../10-StreamliningAIWorkflowsBuildingAnMCPServerWithAIToolkit/lab3/code/weather_mcp/inspector/package.json) μ
λ°μ΄νΈ
#### 4c. Inspector μ’
μμ± μ
λ°μ΄νΈ
**`inspector/package-lock.json` νΈμ§:** [./code/weather_mcp/inspector/package-lock.json](../../../../10-StreamliningAIWorkflowsBuildingAnMCPServerWithAIToolkit/lab3/code/weather_mcp/inspector/package-lock.json) μ
λ°μ΄νΈ
> **π μ°Έκ³ :** μ΄ νμΌμλ λ°©λν μ’
μμ± μ μκ° ν¬ν¨λμ΄ μμ΅λλ€. μλλ ν΅μ¬ ꡬ쑰μ΄λ©°, μ 체 λ΄μ©μ μ¬μ©ν΄μΌ μ μμ μΌλ‘ μ’
μμ± ν΄κ²°μ΄ κ°λ₯ν©λλ€.
> **β‘ μ 체 ν¨ν€μ§ Lock:** package-lock.jsonμ μ½ 3000μ€μ μ’
μμ± μ μλ₯Ό ν¬ν¨ν©λλ€. μλ μ£Όμ κ΅¬μ‘°λ§ λ³΄μ¬μ£Όλ©° μ 체 νμΌμ μ¬μ©νμΈμ.
### 5λ¨κ³: VS Code λλ²κΉ
κ΅¬μ± μ€μ
*μ°Έκ³ : μ§μ λ κ²½λ‘μ νμΌμ 볡μ¬νμ¬ λ‘컬 νμΌκ³Ό κ΅μ²΄νμΈμ.*
#### 5a. μ€ν κ΅¬μ± μ
λ°μ΄νΈ
**`.vscode/launch.json` νΈμ§:**
```json
{
"version": "0.2.0",
"configurations": [
{
"name": "Attach to Local MCP",
"type": "debugpy",
"request": "attach",
"connect": {
"host": "localhost",
"port": 5678
},
"presentation": {
"hidden": true
},
"internalConsoleOptions": "neverOpen",
"postDebugTask": "Terminate All Tasks"
},
{
"name": "Launch Inspector (Edge)",
"type": "msedge",
"request": "launch",
"url": "http://localhost:6274?timeout=60000&serverUrl=http://localhost:3001/sse#tools",
"cascadeTerminateToConfigurations": [
"Attach to Local MCP"
],
"presentation": {
"hidden": true
},
"internalConsoleOptions": "neverOpen"
},
{
"name": "Launch Inspector (Chrome)",
"type": "chrome",
"request": "launch",
"url": "http://localhost:6274?timeout=60000&serverUrl=http://localhost:3001/sse#tools",
"cascadeTerminateToConfigurations": [
"Attach to Local MCP"
],
"presentation": {
"hidden": true
},
"internalConsoleOptions": "neverOpen"
}
],
"compounds": [
{
"name": "Debug in Agent Builder",
"configurations": [
"Attach to Local MCP"
],
"preLaunchTask": "Open Agent Builder",
},
{
"name": "Debug in Inspector (Edge)",
"configurations": [
"Launch Inspector (Edge)",
"Attach to Local MCP"
],
"preLaunchTask": "Start MCP Inspector",
"stopAll": true
},
{
"name": "Debug in Inspector (Chrome)",
"configurations": [
"Launch Inspector (Chrome)",
"Attach to Local MCP"
],
"preLaunchTask": "Start MCP Inspector",
"stopAll": true
}
]
}
```
**`.vscode/tasks.json` νΈμ§:**
```
{
"version": "2.0.0",
"tasks": [
{
"label": "Start MCP Server",
"type": "shell",
"command": "python -m debugpy --listen 127.0.0.1:5678 src/__init__.py sse",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}",
"env": {
"PORT": "3001"
}
},
"problemMatcher": {
"pattern": [
{
"regexp": "^.*$",
"file": 0,
"location": 1,
"message": 2
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".*",
"endsPattern": "Application startup complete|running"
}
}
},
{
"label": "Start MCP Inspector",
"type": "shell",
"command": "npm run dev:inspector",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/inspector",
"env": {
"CLIENT_PORT": "6274",
"SERVER_PORT": "6277",
}
},
"problemMatcher": {
"pattern": [
{
"regexp": "^.*$",
"file": 0,
"location": 1,
"message": 2
}
],
"background": {
"activeOnStart": true,
"beginsPattern": "Starting MCP inspector",
"endsPattern": "Proxy server listening on port"
}
},
"dependsOn": [
"Start MCP Server"
]
},
{
"label": "Open Agent Builder",
"type": "shell",
"command": "echo ${input:openAgentBuilder}",
"presentation": {
"reveal": "never"
},
"dependsOn": [
"Start MCP Server"
],
},
{
"label": "Terminate All Tasks",
"command": "echo ${input:terminate}",
"type": "shell",
"problemMatcher": []
}
],
"inputs": [
{
"id": "openAgentBuilder",
"type": "command",
"command": "ai-mlstudio.agentBuilder",
"args": {
"initialMCPs": [ "local-server-weather_mcp" ],
"triggeredFrom": "vsc-tasks"
}
},
{
"id": "terminate",
"type": "command",
"command": "workbench.action.tasks.terminate",
"args": "terminateAll"
}
]
}
```
---
## π MCP μλ² μ€ν λ° ν
μ€νΈ
### 6λ¨κ³: μ’
μμ± μ€μΉ
κ΅¬μ± λ³κ²½ ν λ€μ λͺ
λ Ήμ΄ μ€ν:
**Python μ’
μμ± μ€μΉ:**
```bash
uv sync
```
**Inspector μ’
μμ± μ€μΉ:**
```bash
cd inspector
npm install
```
### 7λ¨κ³: Agent Builderλ‘ λλ²κΉ
1. **F5 ν€λ₯Ό λλ₯΄κ±°λ** **"Debug in Agent Builder"** κ΅¬μ± μ€ν
2. λλ²κ·Έ ν¨λμμ λ³΅ν© κ΅¬μ± μ ν
3. μλ²κ° μμλκ³ Agent Builderκ° μ΄λ¦΄ λκΉμ§ λκΈ°
4. μμ°μ΄ μΏΌλ¦¬λ‘ λ μ¨ MCP μλ² ν
μ€νΈ
μλμ κ°μ μ
λ ₯ ν둬ννΈ μ¬μ©
SYSTEM_PROMPT
```
You are my weather assistant
```
USER_PROMPT
```
How's the weather like in Seattle
```

### 8λ¨κ³: MCP Inspectorλ‘ λλ²κΉ
1. **"Debug in Inspector"** κ΅¬μ± μ¬μ© (Edge λλ Chrome)
2. `http://localhost:6274` μμ Inspector μΈν°νμ΄μ€ μ΄κΈ°
3. μΈν°λν°λΈ ν
μ€νΈ νκ²½ νμ:
- μ¬μ© κ°λ₯ν λꡬ 보기
- λꡬ μ€ν ν
μ€νΈ
- λ€νΈμν¬ μμ² λͺ¨λν°λ§
- μλ² μλ΅ λλ²κΉ

---
## π― ν΅μ¬ νμ΅ μ±κ³Ό
μ΄ μ€μ΅μ μλ£νλ©΄ λ€μμ ν μ μμ΅λλ€:
- [x] Microsoft Foundry Toolkit ν
νλ¦ΏμΌλ‘ **컀μ€ν
MCP μλ² μμ±**
- [x] ν₯μλ κΈ°λ₯μ μν μ΅μ MCP SDK (v1.9.3)λ‘ μ
κ·Έλ μ΄λ
- [x] Agent Builder λ° Inspector λͺ¨λμ λν **μ λ¬Έ λλ²κΉ
μν¬νλ‘μ° κ΅¬μ±**
- [x] μΈν°λν°λΈ μλ² ν
μ€νΈλ₯Ό μν **MCP Inspector μ€μ **
- [x] MCP κ°λ°μ μν **VS Code λλ²κΉ
κ΅¬μ± λ§μ€ν°**
## π§ νμν κ³ κΈ κΈ°λ₯
| κΈ°λ₯ | μ€λͺ
| μ¬μ© μ¬λ‘ |
|---------|-------------|----------|
| **MCP Python SDK v1.9.3** | μ΅μ νλ‘ν μ½ κ΅¬ν | μ΅μ μλ² κ°λ° |
| **MCP Inspector 0.14.0** | μΈν°λν°λΈ λλ²κΉ
λꡬ | μ€μκ° μλ² ν
μ€νΈ |
| **VS Code λλ²κΉ
** | ν΅ν© κ°λ° νκ²½ | μ λ¬Έ λλ²κΉ
μν¬νλ‘μ° |
| **Agent Builder ν΅ν©** | Microsoft Foundry Toolkit μ§μ μ°κ²° | μλν¬μλ μμ΄μ νΈ ν
μ€νΈ |
## π μΆκ° μλ£
- [MCP Python SDK λ¬Έμ](https://modelcontextprotocol.io/docs/sdk/python)
- [Microsoft Foundry Toolkit νμ₯ κ°μ΄λ](https://code.visualstudio.com/docs/ai/ai-toolkit)
- [VS Code λλ²κΉ
λ¬Έμ](https://code.visualstudio.com/docs/editor/debugging)
- [Model Context Protocol μ¬μ](https://modelcontextprotocol.io/docs/concepts/architecture)
---
**π μΆνν©λλ€!** λͺ¨λ 3 μ€μ΅μ μ±κ³΅μ μΌλ‘ μλ£νμ΅λλ€. μ΄μ μ λ¬Έ κ°λ° μν¬νλ‘μ°λ₯Ό μ¬μ©νμ¬ μ»€μ€ν
MCP μλ²λ₯Ό μμ±, λλ²κΉ
, λ°°ν¬ν μ μμ΅λλ€.
### π λ€μ λͺ¨λλ‘ κ³μ μ§ν
νμ€ μΈκ³ κ°λ° μν¬νλ‘μ°μ MCP κΈ°μ μ μ μ©ν μ€λΉκ° λμ
¨λμ? λ€μ **[λͺ¨λ 4: μ€μ©μ μΈ MCP κ°λ° - 컀μ€ν
GitHub ν΄λ‘ μλ²](../lab4/README.md)** μμ:
- GitHub μ μ₯μ μμ
μ μλννλ νλ‘λμ
μ€λΉ MCP μλ² κ΅¬μΆ
- MCPλ₯Ό ν΅ν GitHub μ μ₯μ ν΄λ‘λ κΈ°λ₯ ꡬν
- VS Code λ° GitHub Copilot Agent Modeμ 컀μ€ν
MCP μλ² ν΅ν©
- νλ‘λμ
νκ²½μμ 컀μ€ν
MCP μλ² ν
μ€νΈ λ° λ°°ν¬
- κ°λ°μλ₯Ό μν μ€μ©μ μΈ μν¬νλ‘μ° μλν νμ΅
---
**λ©΄μ±
μ‘°ν**:
μ΄ λ¬Έμλ AI λ²μ μλΉμ€ [Co-op Translator](https://github.com/Azure/co-op-translator)λ₯Ό μ¬μ©νμ¬ λ²μλμμ΅λλ€. μ νμ±μ κΈ°νκΈ° μν΄ λ
Έλ ₯νκ³ μμΌλ, μλ λ²μμ μ€λ₯λ λΆμ νν λΆλΆμ΄ μμ μ μμμ μ μνμκΈ° λ°λλλ€. μλ³Έ λ¬Έμμ μμ΄λ³Έμ΄ κΆμ μλ μλ£λ‘ κ°μ£Όλμ΄μΌ ν©λλ€. μ€μν μ 보μ κ²½μ°, μ λ¬Έκ°μ μΈκ° λ²μμ κΆμ₯ν©λλ€. μ΄ λ²μ μ¬μ©μΌλ‘ μΈν΄ λ°μνλ μ€ν΄λ μλͺ»λ ν΄μμ λν΄ λΉμ¬λ μ±
μμ μ§μ§ μμ΅λλ€.