liveBook · Manning

MCP server

As explained in AI Agents and Applications

An MCP server is a service endpoint that exposes tools through the Model Context Protocol.

An agent that needs weather data could wrap a weather API in its own tool. Doing that again for every agent and service creates repetitive integration work. An MCP server moves the tool interface to the service: agents connect through an MCP client, discover the available tools, and invoke the ones they need. section 13.0 section 13.1.2

The pieces fit together as follows:

  • The agent or application is the MCP host. Its MCP client connects to one or more servers. section 13.1.2
  • Each server exposes a collection of tools. The agent discovers them and chooses which to call; the server performs the operation and returns a standardized result. section 13.5
  • A remote server commonly uses Streamable HTTP; a local server can use standard input/output, particularly for development or local resources. section 13.1.2

Replace a mock weather tool

Start with an API key from AccuWeather and put it in a project .env file. A Python server built with FastMCP 2 exposes get_weather_conditions(location): it resolves the supplied location through AccuWeather’s location-search endpoint, then requests current conditions. The agent can replace its made-up weather tool with this live tool while retaining its other local capabilities. section 13.3.1 section 13.4 section 13.4.1

async def get_accuweather_tools():  #1
    mcp_client = MultiServerMCPClient({  #2
        "accuweather": { #3
            "url": "http://127.0.0.1:8020/accu-mcp-server",
            "transport": "streamable_http"
        }
    })
    return await mcp_client.get_tools()  #4

This client configuration identifies the server URL and streamable_http transport; get_tools() retrieves its exposed tool for use by the agent. section 13.4.2

Verify the connection rather than assuming it works: inspect the agent’s tool list for both local and MCP tools, ask a weather question, then check the server terminal or LangSmith trace for the call. MCP Inspector can test a server interactively before agent integration. section 13.4.5 section 13.5

Check whether a service already publishes an MCP server before building one. Public servers can be consumed through OpenAI’s Responses API, but servers restricted to an organization may require a direct FastMCP client or a LangChain/LangGraph integration. Decide how remote calls will be authorized, including whether approval is automatic or interactive. section 13.5 section 13.2.3

How AI Agents and Applications covers it

How deep it goes
Works through server setup, client connection, and verification; focuses on tool exposure rather than MCP prompts and resources.
Examples
Uses an AccuWeather-backed weather server to replace a travel assistant’s mock tool, then checks its output and trace.
What it assumes
Assumes a working agent to upgrade and an AccuWeather API key, while establishing the MCP client/server roles before integration.
What you can do after
Build it from scratch with FastMCP 2, then connect and verify its tool in an agent alongside local tools.
How it connects
Connects MCP clients, agent hosts, tool calling, Streamable HTTP, standard input/output, and LangChain/LangGraph tools.

Also explained in

Compare how 12 books explain MCP server →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of AI Agents and Applications. The section links point to the parts of the book it draws on.