Skip to main content

remove_mcp_server

Method
This is a method of the Agent class in the agent module.
Disconnect and deregister a previously attached MCP server. Removes the server’s tools from self.tools and shuts the connection down cleanly (no leaked background loops). Tools disappear on the next turn.

Signature

Parameters

str
required
The name used in add_mcp_server.

Returns

bool
True if a server was removed, False if no server by that name existed.

Uses

  • mcp.shutdown
  • logging.warning
  • refresh_tools
  • logging.debug

Source

View on GitHub

praisonaiagents/agent/agent.py at line 4910

MCP Concept

MCP Lifecycle