Skip to main content
Glama

add_mcp_server

Register a new MCP server with the discovery service by providing server name, description, endpoint, and tools list. Enables integration into MCP Router for efficient service routing.

Instructions

Register a new MCP server with the discovery service. Args: server_name: Unique name of the server server_description: Description of the server server_endpoint: Endpoint URL of the server tools: List of tools provided by the server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_descriptionYes
server_endpointYes
server_nameYes
toolsYes

Implementation Reference

  • The main handler function for the 'add_mcp_server' tool. It serializes the tools list to JSON and calls discovery_service.add_server to register the server, returning the result as JSON. The @mcp.tool() decorator registers it as an MCP tool.
    @mcp.tool() async def add_mcp_server( server_name: str, server_description: str, server_endpoint: str, tools: List[Dict[str, Any]] ) -> str: """ Register a new MCP server with the discovery service. Args: server_name: Unique name of the server server_description: Description of the server server_endpoint: Endpoint URL of the server tools: List of tools provided by the server """ try: # Serialize tools list to JSON string tools_json = json.dumps(tools, ensure_ascii=False) # Add server to discovery service result = discovery_service.add_server( server_name, server_description, server_endpoint, tools_json ) return json.dumps(result, ensure_ascii=False) except Exception as e: return json.dumps({"error": str(e)}, ensure_ascii=False)

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Maverick-LjXuan/mcp-router'

If you have feedback or need assistance with the MCP directory API, please join our Discord server