Resumen
Qué controla este paquete en el runtime
MCP adds a decorator-driven server builder for Model Context Protocol servers. It registers tools, prompts, resources, and lifecycle hooks inside the xtaskjs runtime, and it can bridge the official @modelcontextprotocol/sdk transports for stdio or Streamable HTTP.
Qué ofrece
- McpServer(), McpTool(), McpPrompt(), and McpResource() declare server capabilities with DI-friendly classes.
- OnMcpServerStart() and OnMcpServerStop() hook server lifecycle into application startup and shutdown.
- InjectMcpService() and InjectMcpLifecycleManager() expose the runtime through DI-managed services.
- createMcpSdkServerAdapter(), connectMcpSdkStdio(), and bindMcpSdkStreamableHttp() integrate with official MCP SDK transports.
Cómo encaja
- Pairs with @xtaskjs/core so the MCP runtime initializes and shuts down alongside the rest of the application.
- Useful when an app needs to expose tools, prompts, resources, or authenticated endpoints over /mcp.
- Demonstrated by the 28-mcp_server_app and 29-mcp_auth_http_app samples.