Hatago Mcp Hub

io.github.himorishige由 GitHub 账号 himorishige 发布v0.0.16更新于 Nov 10, 2026

Unified MCP Hub for managing multiple Model Context Protocol servers

已验证STDIO仅桌面效率与工作流开发者工具

概览

AI 生成的概览

一个本地枢纽,把多个 MCP 服务器聚合到单一端点,让助手通过一个连接使用它们的全部工具。

可以做什么
Hatago MCP Hub 作为本地进程运行,可同时连接多个 MCP 服务器并通过统一接口对外提供。它支持 STDIO、HTTP 和 SSE 传输,可通过 npx 启动 npm 发布的服务器,也能代理远程 HTTP MCP 服务器。它提供基于标签的过滤、配置继承、环境变量展开,以及列出已连接服务器状态与工具的内置资源。
适用场景
当你已使用多个 MCP 服务器,希望用一份配置文件统一管理,而不必在 Claude Code、Codex CLI、Cursor、Windsurf 或 VS Code 中逐个注册时适用。也适合用标签和共享基础配置按环境或团队分组管理服务器。
运行要求
需要 Node.js 与 npm,以便通过 npx 或全局安装运行该包。STDIO 模式必须提供配置文件,HTTP 模式可无配置启动。下游服务器的凭据通过配置中的环境变量或请求头提供,连接远程服务器需要网络访问。
安装前请注意
该枢纽本身未声明身份验证,其暴露的 HTTP 端点可能被本机或网络上的其他程序访问。它会从环境变量或配置请求头读取 GITHUB_TOKEN、API_KEY、INTERNAL_TOKEN 等凭据并传给子服务器,因此应保护好配置文件和 env 文件。配置变更需要重启,且它会以子进程方式启动其他 MCP 服务器。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Hatago Mcp Hub,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

English | 日本語

🏮 Hatago MCP Hub

[npm] [GitHub Release] [Ask DeepWiki]

Hatago (旅籠) — A relay point connecting modern AI tools with MCP servers.

Overview

Hatago MCP Hub is a lightweight hub that unifies access to multiple MCP (Model Context Protocol) servers from tools like Claude Code, Codex CLI, Cursor, Windsurf, and VS Code.

Documentation

Dev.to: Getting Started with Multi-MCP Using Hatago MCP Hub — One Config to Connect Them All

✨ Features

🚀 Performance (v0.0.14)

  • 8.44x Faster Startup - 85.66ms → 10.14ms
  • 17% Smaller Package - 1.04MB → 854KB
  • Simplified Architecture - Direct server management without abstraction layers

🎯 Simple & Lightweight

  • Zero Configuration Start (HTTP mode) - npx @himorishige/hatago-mcp-hub serve --http
  • Non-invasive to Existing Projects - Doesn't pollute your project directory

🔌 Rich Connectivity

  • Multi-Transport Support - STDIO / HTTP / SSE
  • Remote MCP Proxy - Transparent connection to HTTP-based MCP servers
  • NPX Server Integration - Dynamic management of npm package MCP servers

🏮 Additional Features

Configuration Updates
  • Manual Restart Required - Configuration changes require server restart
  • Alternative Solutions:
    • Use process managers (PM2, nodemon) for auto-restart
    • Example: nodemon --exec "hatago serve --http" --watch hatago.config.json
    • Or with PM2: pm2 start "hatago serve" --watch hatago.config.json
  • Dynamic Tool List Updates - Supports notifications/tools/list_changed notification
Progress Notification Forwarding
  • Child Server Notification Forwarding - Transparent forwarding of notifications/progress
  • Long-running Operation Support - Real-time progress updates
  • Local/Remote Support - Works with many MCP server types
Built-in Internal Resource
  • hatago://servers - JSON snapshot of currently connected servers (id, status, type, tools, resources, prompts)
Enhanced Features
  • Environment Variable Expansion - Claude Code compatible ${VAR} and ${VAR:-default} syntax
  • Configuration Validation - Type-safe configuration with Zod schemas
  • Tag-based Server Filtering - Group and filter servers using tags
  • Configuration Inheritance - Extend base configurations with extends field for DRY principle

Minimal Hub Interface (IHub)

External packages (server/test-utils) use a thin IHub interface to avoid tight coupling with the concrete class.

ts
import type { IHub } from '@himorishige/hatago-hub';import { createHub } from '@himorishige/hatago-hub/node';
const hub: IHub = createHub({  preloadedConfig: { data: { version: 1, mcpServers: {} } }}) as IHub;await hub.start();hub.on('tool:called', (evt) => {  /* metrics, logs */});await hub.stop();

Extracted modules for thin hub:

  • RPC handlers: packages/hub/src/rpc/handlers.ts
  • HTTP handler: packages/hub/src/http/handler.ts

📁 Project Structure

packages/├── mcp-hub/        # Main npm package (@himorishige/hatago-mcp-hub)├── server/         # Server implementation (@himorishige/hatago-server)├── hub/            # Hub core (@himorishige/hatago-hub)├── core/           # Shared types (@himorishige/hatago-core)├── runtime/        # Runtime components (@himorishige/hatago-runtime)├── transport/      # Transport layer (@himorishige/hatago-transport)├── cli/            # CLI tools (@himorishige/hatago-cli)├── hub-management/ # Management components (@himorishige/hatago-hub-management)└── test-fixtures/  # Test utilities

📦 Installation

Quick Start (No Installation)

bash
# Initialize configurationnpx @himorishige/hatago-mcp-hub init
# Start in STDIO mode (for Claude Code)# NOTE: STDIO requires a config file pathnpx @himorishige/hatago-mcp-hub serve --stdio --config ./hatago.config.json
# Or start in HTTP mode without a config (demo/dev)npx @himorishige/hatago-mcp-hub serve --http

Global Installation

bash
# Install globallynpm install -g @himorishige/hatago-mcp-hub
# Use with hatago commandhatago inithatago serve

As Project Dependency

bash
# Install as dependencynpm install @himorishige/hatago-mcp-hub
# Add to package.json scripts{  "scripts": {    "mcp": "hatago serve"  }}

🚀 Usage

Claude Code, Codex CLI, Gemini CLI

STDIO Mode (Recommended)
Claude Code / Gemini CLI

Add to .mcp.json:

json
{  "mcpServers": {    "hatago": {      "command": "npx",      "args": [        "@himorishige/hatago-mcp-hub",        "serve",        "--stdio",        "--config",        "./hatago.config.json"      ]    }  }}
Codex CLI

Add to ~/.codex/config.toml:

toml
[mcp_servers.hatago]command = "npx"args = ["-y", "@himorishige/hatago-mcp-hub", "serve", "--stdio", "--config", "./hatago.config.json"]
HTTP Mode
Claude Code / Gemini CLI

Add to .mcp.json:

json
{  "mcpServers": {    "hatago": {      "url": "http://localhost:3535/mcp"    }  }}
Codex CLI

Add to ~/.codex/config.toml:

toml
[mcp_servers.hatago]command = "npx"args = ["-y", "mcp-remote", "http://localhost:3535/mcp"]

MCP Inspector

For testing and debugging:

bash
# Start in HTTP modehatago serve --http --port 3535
# Connect with MCP Inspector# Endpoint: http://localhost:3535/mcp

Visit MCP Inspector

Metrics (opt-in)

Enable lightweight in-memory metrics and expose an HTTP endpoint:

bash
HATAGO_METRICS=1 hatago serve --http --port 3535# Then visit: http://localhost:3535/metrics

Notes:

  • Metrics are disabled by default and add near-zero overhead when off.
  • JSON logs are available when HATAGO_LOG=json (respecting HATAGO_LOG_LEVEL).

⚙️ Configuration

Basic Configuration

Create hatago.config.json:

json
{  "$schema": "https://raw.githubusercontent.com/himorishige/hatago-mcp-hub/main/schemas/config.schema.json",  "version": 1,  "logLevel": "info",  "mcpServers": {    "filesystem": {      "command": "npx",      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]    },    "github": {      "command": "npx",      "args": ["-y", "@modelcontextprotocol/server-github"],      "env": {        "GITHUB_TOKEN": "${GITHUB_TOKEN}"      }    }  }}

Remote Server Configuration

json
{  "mcpServers": {    "deepwiki": {      "url": "https://mcp.deepwiki.com/sse",      "type": "sse"    },    "custom-api": {      "url": "https://api.example.com/mcp",      "type": "http",      "headers": {        "Authorization": "Bearer ${API_KEY}"      }    }  }}

Configuration Strategies

Strategy 1: Tag-based Filtering

Group servers with tags in a single configuration file:

json
{  "mcpServers": {    "filesystem-dev": {      "command": "npx",      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."],      "tags": ["dev", "local"]    },    "github-prod": {      "url": "https://api.github.com/mcp",      "type": "http",      "tags": ["production", "github"]    },    "database": {      "command": "mcp-server-postgres",      "tags": ["dev", "production", "database"]    }  }}

Start with specific tags:

bash
# Only start servers tagged as "dev"hatago serve --tags dev
# Start servers with either "dev" or "test" tagshatago serve --tags dev,test
# Japanese tags are supportedhatago serve --tags 開発,テスト
Strategy 2: Configuration Inheritance

Split configurations by environment using the extends field:

Base configuration (~/.hatago/base.config.json):

json
{  "version": 1,  "logLevel": "info",  "mcpServers": {    "github": {      "command": "npx",      "args": ["-y", "@modelcontextprotocol/server-github"],      "env": {        "GITHUB_TOKEN": "${GITHUB_TOKEN}"      }    },    "filesystem": {      "command": "npx",      "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]    }  }}

Work configuration (./work.config.json):

json
{  "extends": "~/.hatago/base.config.json",  "logLevel": "debug",  "mcpServers": {    "github": {      "env": {        "GITHUB_TOKEN": "${WORK_GITHUB_TOKEN}",        "DEBUG": null      }    },    "internal-tools": {      "url": "https://internal.company.com/mcp",      "type": "http",      "headers": {        "Authorization": "Bearer ${INTERNAL_TOKEN}"      }    }  }}

Features:

  • Inheritance: Child configs override parent values
  • Multiple parents: "extends": ["./base1.json", "./base2.json"]
  • Path resolution: Supports ~, relative, and absolute paths
  • Environment deletion: Use null to remove inherited env vars
Choosing a Strategy
StrategyTag-basedInheritance-based
FilesSingle configMultiple configs
Switch--tags option--config option
ManagementCentralizedDistributed
Best forTeam sharing, Simple setupsComplex environments, Personal customization

Environment Variable Expansion

Supports Claude Code compatible syntax:

  • ${VAR} - Expands to the value of VAR (error if undefined)
  • ${VAR:-default} - Uses default value if VAR is undefined

📋 Commands

hatago init

Create configuration file with interactive setup:

bash
hatago init                    # Interactive modehatago init --mode stdio       # STDIO mode confighatago init --mode http        # HTTP mode confighatago init --force            # Overwrite existing

hatago serve

Start MCP Hub server:

bash
hatago serve --stdio --config ./hatago.config.json  # STDIO mode (default, requires config)hatago serve --http                                     # HTTP mode (config optional)hatago serve --config custom.json  # Custom confighatago serve --verbose         # Debug logginghatago serve --tags dev,test   # Filter servers by tagshatago serve --env-file ./.env # Load variables from .env before start (repeatable)hatago serve --env-override    # Override existing env vars when using --env-file
Loading Environment Variables from Files

Use --env-file <path...> to load variables before config parsing. This helps resolve ${VAR} and ${VAR:-default} placeholders without exporting variables globally.

  • Format: KEY=VALUE, export KEY=VALUE, # comments, blank lines.
  • Quotes are stripped; supports escaped \n, \r, \t.
  • Paths: relative to CWD, ~/ expanded to home.
  • Precedence: files are applied in the given order; existing process.env keys are preserved unless --env-override is provided.

✨ Performance Improvements (v0.0.14)

  • 8.44x faster startup: 85.66ms → 10.14ms
  • 17% smaller package: 1.04MB → 854KB (181KB reduction)
  • Simplified architecture: Removed EnhancedHub and management layers
  • Trade-off: Built-in config watching removed (use nodemon/PM2 instead)

🔧 Advanced Usage

Programmatic API

typescript
import { startServer } from '@himorishige/hatago-mcp-hub';
// Start server programmaticallyawait startServer({  mode: 'stdio',  config: './hatago.config.json',  logLevel: 'info'});

Creating Custom Hub

typescript
import { createHub } from '@himorishige/hatago-mcp-hub';
const hub = createHub({  mcpServers: {    memory: {      command: 'npx',      args: ['@modelcontextprotocol/server-memory']    }  }});
// Use hub directly in your applicationconst tools = await hub.listTools();

🏗️ Architecture

Client (Claude Code, etc.)    ↓Hatago Hub (Router + Registry)    ↓MCP Servers (Local, NPX, Remote)

Supported MCP Servers

Local Servers
  • Any executable MCP server
  • Python, Node.js, or binary servers
  • Custom scripts with MCP protocol
NPX Servers
  • @modelcontextprotocol/server-filesystem
  • @modelcontextprotocol/server-github
  • @modelcontextprotocol/server-memory
  • Any npm-published MCP server
Remote Servers
  • DeepWiki MCP (https://mcp.deepwiki.com/sse)
  • Any HTTP-based MCP endpoint
  • Custom API servers with MCP protocol

🐛 Troubleshooting

Common Issues

  1. "No onNotification handler set" warning

    • Normal in HTTP mode with StreamableHTTP transport
    • Hub handles notifications appropriately
  2. Server connection failures

    • Verify environment variables are set
    • Check remote server URLs are accessible
    • Use --verbose flag for detailed logs
  3. Tool name collisions

    • Hatago automatically prefixes with server ID
    • Original names preserved in hub

Debug Mode

bash
# Enable verbose logginghatago serve --verbose
# Check server statushatago status

📚 Documentation

🤝 Contributing

Contributions are welcome! Please see our GitHub repository for more information.

📄 License

MIT License

🔗 Links

🙏 Credits

Built with the Hono and the Model Context Protocol SDK by Anthropic.

来源:README.md,提交 fcb2bef

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.0.16最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分