Para desarrolladores de servidores
Qué construiremos
get-alerts
y get-forecast
. Luego, conectaremos el servidor a un host MCP (en este caso, Claude for Desktop):

Conceptos centrales de MCP
1.
2.
3.
Conocimiento previo
Requisitos del sistema
Configura tu entorno
uv
y configuremos nuestro proyecto y entorno de Python:powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
uv
sea detectado.# Create a new directory for our project
uv init weather
cd weather
# Create virtual environment and activate it
uv venv
.venv\Scripts\activate
# Install dependencies
uv add mcp[cli] httpx
# Create our server file
new-item weather.py
# Create a new directory for our project
uv init weather
cd weather
# Create virtual environment and activate it
uv venv
.venv\Scripts\activate
# Install dependencies
uv add mcp[cli] httpx
# Create our server file
new-item weather.py
Construyendo tu servidor
Importando paquetes y configurando la instancia
weather.py
:
Funciones auxiliares
Implementando la ejecución de la herramienta
Ejecutando el servidor
uv run weather.py
para confirmar que todo funciona.Probando tu servidor con Claude for Desktop
~/Library/Application Support/Claude/claude_desktop_config.json
en un editor de texto. Asegúrate de crear el archivo si no existe.
code $env:AppData\Claude\claude_desktop_config.json
mcpServers
. Los elementos de la interfaz de usuario de MCP solo aparecerán en Claude for Desktop si al menos un servidor está configurado correctamente.{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/weather",
"run",
"weather.py"
]
}
}
}
{
"mcpServers": {
"weather": {
"command": "uv",
"args": [
"--directory",
"C:\\ABSOLUTE\\PATH\\TO\\PARENT\\FOLDER\\weather",
"run",
"weather.py"
]
}
}
}
Es posible que debas poner la ruta completa al ejecutable uv
en el campocommand
. Puedes obtener esto ejecutandowhich uv
en MacOS/Linux owhere uv
en Windows.
Asegúrate de pasar la ruta absoluta a tu servidor.
1.
2.
uv --directory /ABSOLUTE/PATH/TO/PARENT/FOLDER/weather run weather.py
Prueba con comandos
weather
. Puedes hacer esto buscando el icono del martillo 



Qué está pasando bajo el capó
1.
2.
3.
4.
5.
6.