By the end of this lab, you will be able to:
In this lab, you'll create a Weather MCP Server that demonstrates:
---
The Model Context Protocol Python SDK provides the foundation for building custom MCP servers. You'll use version 1.9.3 with enhanced debugging capabilities.
A powerful debugging tool that provides:
---
1. Launch Agent Builder in VS Code through the AI Toolkit extension
2. Create a new agent with the following configuration:
- Agent Name: WeatherAgent
1. Navigate to Tools → Add Tool in Agent Builder
2. Select "MCP Server" from the available options
3. Choose "Create A new MCP Server"
4. Select the python-weather template
5. Name your server: weather_mcp
1. Open the generated project in VS Code
2. Review the project structure:
```
weather_mcp/
├── src/
│ ├── __init__.py
│ └── server.py
├── inspector/
│ ├── package.json
│ └── package-lock.json
├── .vscode/
│ ├── launch.json
│ └── tasks.json
├── pyproject.toml
└── README.md
```
> 🔍 Why Upgrade? We want to use the latest MCP SDK (v1.9.3) and Inspector service (0.14.0) for enhanced features and better debugging capabilities.
Edit pyproject.toml: update ./code/weather_mcp/pyproject.toml
Edit inspector/package.json: update ./code/weather_mcp/inspector/package.json
Edit inspector/package-lock.json: update ./code/weather_mcp/inspector/package-lock.json
> 📝 Note: This file contains extensive dependency definitions. Below is the essential structure - the full content ensures proper dependency resolution.
> ⚡ Full Package Lock: The complete package-lock.json contains ~3000 lines of dependency definitions. The above shows the key structure - use the provided file for complete dependency resolution.
*Note: Please copy the file in the specified path to replace the corresponding local file*
Edit .vscode/launch.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
}
]
}
Edit .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"
}
]
}
---
After making the configuration changes, run the following commands:
Install Python dependencies:
uv sync
Install Inspector dependencies:
cd inspector
npm install
1. Press F5 or use the "Debug in Agent Builder" configuration
2. Select the compound configuration from the debug panel
3. Wait for the server to start and Agent Builder to open
4. Test your weather MCP server with natural language queries
Input prompt like this
SYSTEM_PROMPT
You are my weather assistant
USER_PROMPT
How's the weather like in Seattle
1. Use the "Debug in Inspector" configuration (Edge or Chrome)
2. Open the Inspector interface at http://localhost:6274
3. Explore the interactive testing environment:
- View available tools
- Test tool execution
- Monitor network requests
- Debug server responses
---
By completing this lab, you have:
| Feature | Description | Use Case |
|---------|-------------|----------|
| MCP Python SDK v1.9.3 | Latest protocol implementation | Modern server development |
| MCP Inspector 0.14.0 | Interactive debugging tool | Real-time server testing |
| VS Code Debugging | Integrated development environment | Professional debugging workflow |
| Agent Builder Integration | Direct AI Toolkit connection | End-to-end agent testing |
---
🎉 Congratulations! You've successfully completed Lab 3 and can now create, debug, and deploy custom MCP servers using professional development workflows.
Ready to apply your MCP skills to a real-world development workflow? Continue to Module 4: Practical MCP Development - Custom GitHub Clone Server where you'll:
이 실습을 마치면 다음을 할 수 있습니다:
이번 실습에서는 Weather MCP Server를 만들어 다음을 보여줍니다:
---
Model Context Protocol Python SDK는 맞춤형 MCP 서버 구축의 기반입니다. 디버깅 기능이 강화된 1.9.3 버전을 사용합니다.
강력한 디버깅 도구로 다음 기능을 제공합니다:
---
1. AI Toolkit 확장 프로그램을 통해 VS Code에서 Agent Builder 실행
2. 다음 설정으로 새 에이전트 생성:
- 에이전트 이름: WeatherAgent
1. Agent Builder에서 Tools → Add Tool로 이동
2. "MCP Server" 선택
3. "Create A new MCP Server" 선택
4. python-weather 템플릿 선택
5. 서버 이름 지정: weather_mcp
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
```
> 🔍 왜 업그레이드하나요? 최신 MCP SDK(v1.9.3)와 Inspector 서비스(0.14.0)를 사용해 향상된 기능과 디버깅 성능을 얻기 위함입니다.
pyproject.toml 편집: ./code/weather_mcp/pyproject.toml 업데이트
inspector/package.json 편집: ./code/weather_mcp/inspector/package.json 업데이트
inspector/package-lock.json 편집: ./code/weather_mcp/inspector/package-lock.json 업데이트
> 📝 참고: 이 파일은 방대한 의존성 정의를 포함합니다. 아래는 핵심 구조이며, 전체 내용은 올바른 의존성 해결을 위해 필요합니다.
> ⚡ 전체 패키지 락: package-lock.json 전체 파일은 약 3000줄에 달하는 의존성 정의를 포함합니다. 위는 주요 구조만 보여주며, 완전한 의존성 해결을 위해 제공된 파일을 사용하세요.
*참고: 지정된 경로의 파일을 복사하여 로컬 파일을 교체하세요*
.vscode/launch.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"
}
]
}
---
설정 변경 후 다음 명령어 실행:
Python 의존성 설치:
uv sync
Inspector 의존성 설치:
cd inspector
npm install
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
1. "Debug in Inspector" 구성 사용 (Edge 또는 Chrome)
2. http://localhost:6274에서 Inspector 인터페이스 열기
3. 인터랙티브 테스트 환경 탐색:
- 사용 가능한 도구 확인
- 도구 실행 테스트
- 네트워크 요청 모니터링
- 서버 응답 디버깅
---
이 실습을 완료하여 다음을 달성했습니다:
| 기능 | 설명 | 활용 사례 |
|---------|-------------|----------|
| MCP Python SDK v1.9.3 | 최신 프로토콜 구현 | 현대적인 서버 개발 |
| MCP Inspector 0.14.0 | 인터랙티브 디버깅 도구 | 실시간 서버 테스트 |
| VS Code 디버깅 | 통합 개발 환경 | 전문적인 디버깅 워크플로우 |
| Agent Builder 통합 | AI Toolkit과 직접 연결 | 엔드투엔드 에이전트 테스트 |
---
🎉 축하합니다! Lab 3을 성공적으로 완료하여 전문적인 개발 워크플로우로 맞춤형 MCP 서버를 생성, 디버깅, 배포할 수 있게 되었습니다.
실제 개발 워크플로우에 MCP 기술을 적용할 준비가 되셨나요? 모듈 4: 실전 MCP 개발 - 맞춤형 GitHub 클론 서버로 이동하여:
면책 조항:
이 문서는 AI 번역 서비스 Co-op Translator를 사용하여 번역되었습니다.
정확성을 위해 최선을 다하고 있으나, 자동 번역에는 오류나 부정확한 부분이 있을 수 있음을 유의하시기 바랍니다.
원문은 해당 언어의 원본 문서가 권위 있는 출처로 간주되어야 합니다.
중요한 정보의 경우 전문적인 인간 번역을 권장합니다.
본 번역 사용으로 인해 발생하는 오해나 잘못된 해석에 대해 당사는 책임을 지지 않습니다.