> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes. # enableMcpServer > Expose the agent's tools as an MCP server endpoint. [add-mcp-server]: /docs/server-sdks/reference/typescript/agents/agent-base/add-mcp-server [ref-agentbase]: /docs/server-sdks/reference/typescript/agents/agent-base Expose this agent's tools as a Model Context Protocol (MCP) server endpoint. Adds a `/mcp` route that speaks JSON-RPC 2.0, allowing external MCP clients (Claude Desktop, other agents, etc.) to discover and invoke the agent's tools. > **Note** > > This method exposes your agent's tools **as** an MCP server. To connect your agent > **to** an external MCP server as a client, use > [`addMcpServer()`][add-mcp-server]. ## **Parameters** None. ## **Returns** [`AgentBase`][ref-agentbase] -- Returns `this` for method chaining. ## **Example** ```typescript {20} import { AgentBase, FunctionResult } from '@signalwire/sdk'; const agent = new AgentBase({ name: 'assistant', route: '/assistant' }); agent.setPromptText('You are a helpful assistant.'); agent.defineTool({ name: 'get_weather', description: 'Get the current weather for a city', parameters: { type: 'object', properties: { city: { type: 'string', description: 'City name' }, }, }, handler: async (args) => { const city = args.city ?? 'Unknown'; const result = new FunctionResult(`The weather in ${city} is sunny.`); return result; }, }); agent.enableMcpServer(); await agent.serve(); ``` > Expose the agent's tools as an MCP server endpoint.