Building MCP Tooling

Create your own MCP servers with FastMCP and integrate them into MeinGPT

Overview

With the Model Context Protocol (MCP), you can create your own tools and data sources for MeinGPT. FastMCP is a Python framework that lets you stand up MCP servers quickly and integrate them via HTTP Streamable Transport into MeinGPT.

What is MCP?

The Model Context Protocol (MCP) is a standardized protocol for communication between LLMs and external tools. MCP servers can:

  • Provide Tools - functions that the LLM can execute
  • Offer Resources - data sources that the LLM can read
  • Define Prompts - reusable templates for interactions

Building an MCP server with FastMCP

FastMCP handles the protocol boilerplate for you. A minimal server looks like this:

pip install fastmcp uvicorn
from fastmcp import FastMCP
 
mcp = FastMCP("My MCP Server")
 
@mcp.tool()
def add(a: int, b: int) -> int:
    """Add two numbers"""
    return a + b
 
# Start with: uvicorn main:mcp --port 8000

Everything beyond this — FastAPI integration, authentication, resources, error handling, context/progress reporting, dependency injection, and best practices for tool documentation and structured responses — is covered with full code examples in the FastMCP documentation. It's maintained directly by the FastMCP team, so it stays more current than any copy kept here.

Integration with MeinGPT

  1. Start your MCP server.
  2. Add it as a Custom MCP Server, either under Settings → Connections → Custom MCP servers → Add MCP server, or directly in the assistant editor via the Tools → Custom MCP tab.
  3. Fill in the form:
    • Name: Your server name
    • URL: http://localhost:8000/mcp
    • Optional: Headers for authentication
    • Optional: Authorization (OAuth) or Signed user identity, if your server needs it

For details on the fields, OAuth precedence, and JWT identity forwarding, see Custom MCP Server. For a worked example with n8n as the counterpart: Connecting to n8n MCP. To decide when a Custom MCP Server is the right choice over connectors or data pools: Data Integration Guide.

Deployment

For production, containerization is recommended:

FROM python:3.12-slim
 
WORKDIR /app
 
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
 
COPY . .
 
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"]

Your server needs to be reachable from MeinGPT. If it runs on your own network instead of publicly, plan the connection via Connections (Cloud/On-Prem).

Further Resources

Was this page helpful?