home_mcp_gateway

home_mcp_gateway

A local MCP gateway that provides image generation and editing tools via external APIs (e.g., DALL-E) and local ComfyUI workflows, with authentication and policy enforcement.

Category
访问服务器

README

home_mcp_gateway

home_mcp_gateway is a local MCP gateway for ZeroClaw and other MCP clients. It exposes one local HTTP/SSE MCP endpoint, routes tool calls through a policy engine, stores generated files as artifacts, and records jobs and audit events in SQLite.

The important configuration rule is:

Users edit config/config.yaml.

config/config.example.yaml is the template/base configuration. For local use, copy it to config/config.yaml. Both local Python runs and Docker Compose use that same file. Root-level .env keeps tokens and provider secrets.

Quick Start

Requirements:

  • Python 3.11 or newer.
  • PyYAML.

Create your local user config:

Copy-Item config/config.example.yaml config/config.yaml
Copy-Item .env.example .env

Edit config/config.yaml and .env, then run:

python -m pip install -e .
python -m app.main

The default local endpoint is http://127.0.0.1:8787.

Check the process:

Invoke-RestMethod http://127.0.0.1:8787/healthz
Invoke-RestMethod http://127.0.0.1:8787/readyz

Where User Settings Live

Use these files for different purposes:

File Purpose
config/config.example.yaml Template/base config. Copy it to config/config.yaml.
config/config.yaml Your local runtime config. Used by both Python and Docker Compose. It is git-ignored.
.env.example Environment template. Copy it to .env for tokens and provider secrets.
.env Local environment variables for Python and Docker Compose. It is git-ignored.
tests/config/test.config.yaml Test-only config used by tests/run_tests.ps1.

The application loads configuration in this order:

  1. Load root .env into the process environment without overriding existing variables.
  2. Load config/config.example.yaml.
  3. If CONFIG_PATH is set, deep-merge that YAML over the base config.
  4. If CONFIG_PATH is not set and config/config.yaml exists, deep-merge that file instead.
  5. Replace placeholders such as ${IMAGE_API_KEY} with environment variables.

Common user-editable sections are:

  • server.host, server.port
  • artifacts.root, artifacts.public_base_url
  • database.path
  • callers.*.token_env
  • policy.high_risk_allowed_callers
  • modules.image, modules.localimage

At the moment, only the image and localimage modules are actually used. Other module directories may exist in the repository, but they are not part of the current practical setup.

Secrets should stay in environment variables, not YAML files. Copy .env.example to .env and put local token/provider values there.

For a custom config file outside the default location, set CONFIG_PATH explicitly:

$env:CONFIG_PATH = "path/to/your.config.yaml"
python -m app.main

MCP Client Setup

Use the SSE transport URL:

[[mcp.servers]]
name = "home"
transport = "sse"
url = "http://127.0.0.1:8787/mcp"
deferred_loading = true

When the gateway is used from another Compose service on the same network, use:

[[mcp.servers]]
name = "home"
transport = "sse"
url = "http://home-mcp:8787/mcp"
deferred_loading = true

Available Tools

Built-in tools:

  • health_check: returns server and enabled-module status.
  • artifact_get: returns artifact metadata and a signed download URL.
  • artifact_get_image: compatibility helper that requires an inline-readable image artifact.
  • job_status: returns a job visible to the caller.

Currently used module tools:

  • image_generate, image_edit: generate or edit images and store results as image artifacts.
  • localimage_generate: generate images through a local ComfyUI workflow and store results as image artifacts.

For now, the practical module scope is limited to image and localimage.

Authentication And Policy

Callers authenticate with a bearer token:

Authorization: Bearer <token>

Tokens are compared against the environment variable named by each caller entry in configuration. Anonymous callers can only use tools listed in policy.anonymous_allowed_tools; by default that is health_check.

Artifacts and jobs are scoped to the caller that created them. Admin callers can read shared artifacts only when their configured caller has shared_artifact_read: true.

Docker

Docker Compose uses the same config/config.yaml as local Python runs:

Copy-Item config/config.example.yaml config/config.yaml
Copy-Item .env.example .env
# Edit config/config.yaml and .env.
docker compose up --build

Compose automatically reads .env, mounts config/config.yaml, and stores artifacts plus SQLite metadata under ./artifacts.

When ZeroClaw also runs in Docker, artifact download_url values must point to an address reachable from the ZeroClaw container. The gateway derives download URLs from the address used to call MCP when possible, so a ZeroClaw MCP URL of http://192.168.1.23:8787/mcp yields artifact URLs under http://192.168.1.23:8787/artifacts. ARTIFACT_PUBLIC_BASE_URL remains the fallback and defaults to http://127.0.0.1:8787/artifacts for host-local use. Artifact download_url values are short-lived signed URLs, so clients can fetch them directly without knowing the MCP Bearer token.

Tests

Tests use tests/config/test.config.yaml; that file is not the user config.

.\tests\run_tests.ps1

The test script sets CONFIG_PATH=tests/config/test.config.yaml and local test tokens, then runs the Python unittest suite.

Documentation

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选