# Function closeServer

MCP exports - MCP server implementation Split from index.ts for file size compliance (Issue #285) Updated Issue #538: Added missing tool registration exports

- closeServer(
  server: McpServer,
  logger?: ILogger,
  ): Promise<Result<void, ServerError>>

  Gracefully closes the server connection.

  #### Parameters

  - server: McpServer

    The MCP server to close

  - `Optional` logger: ILogger

    Optional logger

  #### Returns Promise<Result<void, ServerError>>

  Result indicating success or failure

  - Defined in packages/nexus-agents/src/mcp/server.ts:230