modelcontextprotocol / modelcontextprotocol/python-sdk
Specifying capabilities w/ FastMCP Server
Nadie ha tomado este issue todavía.
- #1043 de @gspencergoog — cerrado sin fusionar
- Lenguaje dominante
- Python
- Estrellas
- 24.3k
- Forks
- 4k
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 31
Descripción
Question
I noticed that the FastMCP server does not have the options to manually specify the capabilities of the server, however it is possible to do so with the low-level server.
My current workaround to advertise the capabilities is like so:
mcp = FastMCP("test-server")
# Manually set notification options
lowlevel_server: Server = mcp._mcp_server
lowlevel_server.notification_options.resources_changed = True
lowlevel_server.notification_options.tools_changed = True
# Now, we override the mcp.run()
async def main():
async with stdio_server() as (r, w):
init_opts = lowlevel_server.create_initialization_options(
lowlevel_server.notification_options,
{}
)
await lowlevel_server.run(r, w, init_opts)
if __name__ == "__main__":
anyio.run(main)
Is there any other way to specify the capabilities of the FastMCP server? Is there a reason not to?
Thanks!
Additional Context
No response
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Empieza leyendo el punto de entrada de FastMCP y los métodos de bajo nivel de Server mostrados en el informe: notification_options, create_initialization_options y run. Determina cómo la inicialización de FastMCP expone actualmente las capabilities y define «done» como permitir especificar esas capabilities sin sobrescribir mcp.run().
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- python
- Área
- api
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100