MyLocalGPT Integration Notes

How FastMCP fits into the MyLocalGPT MCP ecosystem and what to consider when building new tools.

Current State

Three MCP servers already ship as PyPI packages:

ServerPackageImportWhat it does
largefilelargefilefrom mcp.server.fastmcp import FastMCPLarge file navigation/editing
diffchunkdiffchunkfrom mcp.server.fastmcp import FastMCPDiff analysis for code review
md-servermd-serverfrom mcp.server.fastmcp import FastMCPDocument-to-markdown conversion

All three use FastMCP v1 (bundled in the mcp SDK). They work fine but miss v2 features.

Migration Path (v1 to v2)

Minimal change - swap the import:

# Before (mcp SDK bundled FastMCP v1)
from mcp.server.fastmcp import FastMCP

# After (standalone FastMCP v2+)
from fastmcp import FastMCP

Then update pyproject.toml:

# Before
dependencies = ["mcp[cli]"]

# After
dependencies = ["fastmcp"]

Everything else (decorators, tool definitions, type hints) stays the same. The v2 API is backward-compatible with v1 patterns.

What v2 Unlocks for Each Server

largefile: Custom HTTP routes for health checks. Output schemas for structured responses. Task support for long file operations.

diffchunk: Composition - mount diffchunk into a larger code review server alongside other analysis tools.

md-server: OpenAPI import - if md-server wraps any REST APIs for document conversion, those can be auto-imported.

Template for New MCP Servers

Based on the existing patterns, here’s the template for new MyLocalGPT MCP servers:

# src/my_tool/main.py
from fastmcp import FastMCP, Context
from mcp.types import ToolAnnotations

mcp = FastMCP(
    "my-tool",
    instructions="What this server does and when to use it.",
)


@mcp.tool(
    annotations=ToolAnnotations(
        readOnlyHint=True,  # or False for write operations
    )
)
async def my_operation(
    arg1: str,
    arg2: int = 10,
    context: Context = None,
) -> dict:
    """Clear description of what this tool does."""
    if context:
        await context.send_message("info", f"Processing {arg1}...")
    return {"result": "..."}


def cli_main():
    mcp.run()
# pyproject.toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "my-tool"
version = "0.1.0"
requires-python = ">=3.10"
dependencies = ["fastmcp"]

[project.scripts]
my-tool = "my_tool.main:cli_main"

Composition Strategy

For MyLocalGPT’s gateway, the composition model:

from fastmcp import FastMCP
from fastmcp.server.providers import FastMCPProvider, ProxyProvider

gateway = FastMCP("mylocalgpt-tools")

# Mount each server
from largefile.main import mcp as largefile_mcp
from diffchunk.main import mcp as diffchunk_mcp
from md_server.main import mcp as md_mcp

gateway.add_provider(FastMCPProvider(largefile_mcp, namespace="largefile"))
gateway.add_provider(FastMCPProvider(diffchunk_mcp, namespace="diffchunk"))
gateway.add_provider(FastMCPProvider(md_mcp, namespace="md"))

# Dynamic enable/disable (maps to MyLocalGPT's dynamic server selection)
gateway.disable_namespace("diffchunk")  # not needed right now
gateway.enable_namespace("diffchunk")   # enable when reviewing code

This replaces the current model where each server runs as a separate subprocess. A single gateway process is more efficient and enables cross-server coordination.

New MCP Server Ideas

Based on MyLocalGPT’s feature gaps and the tool ecosystem:

ServerPurposeFastMCP advantage
memory-mcpSQLite hybrid search for memoryContext for state, composition into gateway
cred-proxyCredential injection for tool callsAuth checks, per-tool scoping
browser-mcpPlaywright/Stagehand browser automationTask support for long operations
scheduler-mcpCron/heartbeat schedulingCustom routes for status dashboard
any REST APIWrap external APIs as toolsOpenAPI import (auto-generate)

Key Design Decisions

  1. Standalone fastmcp over mcp SDK - more features, actively maintained, backward-compatible
  2. Composition over subprocess - single gateway is more efficient than N subprocesses
  3. Namespace activation - dynamic server selection per request (maps to Goose pattern)
  4. OpenAPI import first - for any REST API, try auto-import before hand-writing tools
  5. Auth at gateway level - FastMCP auth on the gateway, credential proxy for outbound calls