Skip to content

Golden Path — From Zero to Prod in ~30 Minutes

Set up Hatago MCP Hub inside an existing Node.js project and reach a practical, shareable setup fast.

  • Hatago integrated into your project
  • At least one MCP server connected
  • Environment separation via tags
  • Self‑diagnosis steps for errors
  • Ready to share with the team
  1. Node version
    Terminal window
    node --version # v20.0.0+
  2. In project root
    Terminal window
    pwd && ls package.json
  3. (Optional) Global prefix
    Terminal window
    npm config get prefix
Terminal window
npm install --save-dev @himorishige/hatago-mcp-hub
# Add scripts
npm pkg set scripts.mcp="hatago serve"
npm pkg set scripts.mcp:dev="hatago serve --tags dev --watch"
npm pkg set scripts.mcp:prod="hatago serve --tags production"
  1. Create config
    Terminal window
    npx @himorishige/hatago-mcp-hub init --mode stdio
  2. Create env file
    Terminal window
    cat > .env.local << 'EOF'
    # Hatago MCP Hub
    MCP_LOG_LEVEL=info
    NODE_ENV=development
    # OPENAI_API_KEY=sk-...
    # GITHUB_TOKEN=ghp_...
    EOF
  3. gitignore
    Terminal window
    echo -e "\n# Hatago MCP Hub\nhatago-config.local.json\n.env.local" >> .gitignore
  1. Edit config
    hatago-config.json
    {
    "$schema": "https://raw.githubusercontent.com/himorishige/hatago-hub/main/schemas/config.schema.json",
    "version": 1,
    "logLevel": "info",
    "mcpServers": {
    "filesystem-local": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-filesystem", "./src"],
    "cwd": ".",
    "tags": ["dev", "local", "filesystem"],
    "env": { "NODE_ENV": "${NODE_ENV:-development}" }
    }
    }
    }
  2. Run
    Terminal window
    npm run mcp:dev
  3. Direct check
    Terminal window
    echo '{"jsonrpc":"2.0","method":"tools/list","id":1,"params":{}}' | npx @himorishige/hatago-mcp-hub serve --stdio

🏷️ Step 4: Environments via tags (5 min)

Section titled “🏷️ Step 4: Environments via tags (5 min)”

Add dev/mock/prod servers and start with tags.

hatago-config.json
{
"mcpServers": {
"filesystem-local": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-filesystem", "./src"],
"tags": ["dev", "local", "filesystem"]
},
"mock-api": {
"command": "node",
"args": ["./scripts/mock-server.js"],
"tags": ["dev", "mock", "api"],
"disabled": false
},
"production-api": {
"url": "https://api.production.example.com/mcp",
"type": "http",
"headers": { "Authorization": "Bearer ${PROD_API_TOKEN}" },
"tags": ["production", "api", "remote"],
"disabled": false
}
}
}

Start by environment:

Terminal window
npm run mcp:dev
PROD_API_TOKEN=xxx npm run mcp:prod

Create a tiny verification script:

scripts/verify-hatago.js
#!/usr/bin/env node
const { spawn } = require('child_process');
const readline = require('readline');
async function verify() {
const tests = [
{ name: 'read servers resource', req: { jsonrpc: '2.0', method: 'resources/read', id: 1, params: { uri: 'hatago://servers' } } }
];
const hatago = spawn('npx', ['@himorishige/hatago-mcp-hub', 'serve', '--stdio'], { stdio: ['pipe','pipe','pipe'] });
const rl = readline.createInterface({ input: hatago.stdout, crlfDelay: Infinity });
let i = 0; hatago.stdin.write(JSON.stringify(tests[0].req)+'\n');
rl.on('line', (line) => {
try {
const res = JSON.parse(line); console.log('', tests[i].name);
if (++i < tests.length) hatago.stdin.write(JSON.stringify(tests[i].req)+'\n'); else { console.log('🎉 done'); hatago.kill(); process.exit(0); }
} catch (e) { console.error('', e.message); hatago.kill(); process.exit(1); }
});
}
verify().catch(console.error);

Run it:

Terminal window
node scripts/verify-hatago.js

Common fixes:

ErrorCauseFix
ENOENT: hatago-config.jsonMissing confignpx @himorishige/hatago-mcp-hub init
Invalid JSONBroken configValidate JSON
${VAR} not foundMissing envExport or set in .env.local
Server failed to startChild server errorRun with --verbose
  1. Template config
    Terminal window
    cp hatago-config.json hatago-config.example.json
  2. Env template
    Terminal window
    cp .env.local .env.example
  3. README snippet
    README.md
    ## MCP Hub Setup
    1. Install deps: `npm install`
    2. Copy config: `cp hatago-config.example.json hatago-config.json`
    3. Copy env: `cp .env.example .env.local`
    4. Fill `.env.local`
    5. Start: `npm run mcp:dev`
  • Hatago installed
  • Config created
  • At least one server connected
  • Tag‑based environments set
  • Verification script passes
  • Team docs ready

Tag Filtering

Remote Servers

Config Inheritance