liveBook · Manning

MCP host

As explained in Building LLM Applications with DSPy

The MCP host is the application that manages an MCP connection and decides when to invoke tools exposed by an MCP server.

An MCP host is the user-facing application that manages MCP clients and decides when to invoke tools provided by MCP servers. In a DSPy agent, the host discovers server tools and makes them available to a ReAct loop. section 9.6.1 section 9.6.3

Figure 9.5 During initialization, the agent connects to the set of MCP servers that may be used by the host, creating a pool of MCP clients to communicate with them. Whenever the agent chooses to execute an MCP-based tool, the appropriate MCP client communicates with its server, passing the necessary arguments and collecting the tool’s output.
figure

Shows the host’s flow: initialize connections to MCP servers, then route a selected tool call through the appropriate client. section 9.6.1

A DSPy-based host connects to a server and:

  • Discovers tools and their names, descriptions, and parameter schemas at runtime. section 9.6.3
  • Converts discovered tools into DSPy tools for a ReAct agent; selected tools execute in the server process. section 9.6.3

Wix support agent

A DSPy ReAct host can use MCP tools to search Wix knowledge-base articles and read an article returned by the search. section 9.6.3

How Building LLM Applications with DSPy covers it

How deep it goes
Explains host, client, and server roles and a DSPy connection workflow, but limits protocol coverage to integration essentials.
Examples
Uses a DSPy ReAct support agent to search Wix knowledge-base articles and read retrieved articles.
What you can do after
Builds a DSPy ReAct host that discovers MCP tools and invokes them through a server connection.
How it connects
Connects MCP hosts with MCP clients, MCP servers, DSPy, and ReAct agents.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building LLM Applications with DSPy. The section links point to the parts of the book it draws on.