You can create an MCP server configuration in a number of ways. In this example, we’ll use FastMCP to create a server configuration from scratch.
1Create a server.py file that instantiates a FastMCP server.
For example, add the following code:
from mcp.server.fastmcp import FastMCP mcp = FastMCP("My API Server")
2Define at least one MCP tool.
The following sample tool takes the prompt and conversation ID as parameters, posts them through the REST API, and returns the AI agent's response if successful: