Implementation:24kchengYe MemoMind MCPExtension
| Knowledge Sources | |
|---|---|
| Domains | MCP, Extensibility |
| Last Updated | 2026-10-28 00:00 GMT |
Overview
MCP extension interface for registering additional MCP tools from external packages on the Hindsight MCP server.
Description
The MCPExtension ABC allows external packages (like hindsight-cloud) to register additional MCP tools on the Hindsight MCP server. Subclasses implement `register_tools()` which receives the FastMCP server instance and MemoryEngine for accessing memory operations. This enables tenant-specific tool visibility or cloud-specific tools without modifying core MCP tools.
Usage
Subclass this when building an extension package that adds custom MCP tools. Configure via `HINDSIGHT_API_MCP_EXTENSION`.
Code Reference
Source Location
- Repository: MemoMind
- File: engine/hindsight_api/extensions/mcp.py
- Lines: L1-42
Signature
class MCPExtension(Extension):
@abstractmethod
def register_tools(self, mcp: FastMCP, memory: MemoryEngine) -> None: ...
Import
from hindsight_api.extensions.mcp import MCPExtension
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| mcp | FastMCP | Yes | FastMCP server instance to register tools on |
| memory | MemoryEngine | Yes | Engine for accessing memory operations |
Outputs
| Name | Type | Description |
|---|---|---|
| (none) | None | MCP server mutated in-place with new tools |
Usage Examples
Registering Custom MCP Tools
from hindsight_api.extensions.mcp import MCPExtension
class CloudMCPExtension(MCPExtension):
def register_tools(self, mcp, memory):
@mcp.tool()
async def cloud_search(query: str) -> str:
return "cloud result"
@mcp.tool()
async def sync_status() -> dict:
return {"synced": True}