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:
| Server | Package | Import | What it does |
|---|---|---|---|
| largefile | largefile | from mcp.server.fastmcp import FastMCP | Large file navigation/editing |
| diffchunk | diffchunk | from mcp.server.fastmcp import FastMCP | Diff analysis for code review |
| md-server | md-server | from mcp.server.fastmcp import FastMCP | Document-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:
| Server | Purpose | FastMCP advantage |
|---|---|---|
| memory-mcp | SQLite hybrid search for memory | Context for state, composition into gateway |
| cred-proxy | Credential injection for tool calls | Auth checks, per-tool scoping |
| browser-mcp | Playwright/Stagehand browser automation | Task support for long operations |
| scheduler-mcp | Cron/heartbeat scheduling | Custom routes for status dashboard |
| any REST API | Wrap external APIs as tools | OpenAPI import (auto-generate) |
Key Design Decisions
- Standalone fastmcp over mcp SDK - more features, actively maintained, backward-compatible
- Composition over subprocess - single gateway is more efficient than N subprocesses
- Namespace activation - dynamic server selection per request (maps to Goose pattern)
- OpenAPI import first - for any REST API, try auto-import before hand-writing tools
- Auth at gateway level - FastMCP auth on the gateway, credential proxy for outbound calls