Skip to main content

routes.mcp

FastAPI routes for MCP server management.

get_catalog_servers

@router.get("/catalog", response_model=list[MCPServer])
async def get_catalog_servers() -> list[dict[str, Any]]

Get all MCP servers from the catalog (predefined servers).

These are servers that can be enabled on-demand via the /catalog/{server_name}/enable endpoint. They are NOT started automatically - users must explicitly enable them.

Note: Catalog servers are stored separately from config servers (mcp.json), so the same server ID can exist in both without conflict.

get_config_servers

@router.get("/config", response_model=list[MCPServer])
async def get_config_servers() -> list[dict[str, Any]]

Get all MCP Config servers from ~/.datalayer/mcp.json.

MCP Config servers are user-defined servers that are started automatically when the agent runtime starts. Users can select which config servers to include as toolsets for their agents.

This is separate from the MCP Catalog which contains predefined servers that must be explicitly enabled.

Returns only running config servers (not catalog servers).

get_available_servers

@router.get("/available", response_model=list[MCPServer])
async def get_available_servers() -> list[dict[str, Any]]

Get all available MCP servers - combines catalog servers with running config servers.

Config and catalog servers are managed separately, so the same ID can exist in both.

Returns:

  • All catalog servers (with isRunning status based on catalog server storage only)
  • All running config servers (from mcp.json, always with isRunning=True)

enable_catalog_server

@router.post("/catalog/{server_name}/enable",
response_model=MCPServer,
status_code=201)
async def enable_catalog_server(server_name: str) -> dict[str, Any]

Enable an MCP server from the catalog for the current session.

This starts the MCP server process and adds it to the active session. The server will not persist across restarts.

Config and catalog servers are separate - enabling a catalog server works even if a config server with the same ID exists.

Arguments:

  • server_name - The name/ID of the MCP server from the catalog (e.g., 'tavily', 'github', 'filesystem')

disable_catalog_server

@router.delete("/catalog/{server_name}/disable", status_code=204)
async def disable_catalog_server(server_name: str) -> None

Disable an MCP server from the current session (catalog servers only).

This stops the MCP server process and removes it from the active session.

Arguments:

  • server_name - The name/ID of the MCP server to disable

get_servers

@router.get("", response_model=list[MCPServer])
async def get_servers() -> list[dict[str, Any]]

Get all active/running MCP servers.

get_server

@router.get("/{server_id}", response_model=MCPServer)
async def get_server(server_id: str) -> dict[str, Any]

Get a specific MCP server by ID.

create_server

@router.post("", response_model=MCPServer, status_code=201)
async def create_server(server: MCPServer) -> dict[str, Any]

Add a new MCP server.

update_server

@router.put("/{server_id}", response_model=MCPServer)
async def update_server(server_id: str, server: MCPServer) -> dict[str, Any]

Update an existing MCP server.

delete_server

@router.delete("/{server_id}", status_code=204)
async def delete_server(server_id: str) -> None

Delete an MCP server.