Skip to main content

MCP server for HumanChain — AI agents pause for human expert guidance via the consult() tool.

Project description

humanchain-mcp

MCP server for HumanChain — AI agents pause for human expert guidance via a single consult tool.

Wires HumanChain into any MCP-aware coding agent (Claude Desktop, Cursor, Continue, Claude Code, Cody, …). When your agent hits a question that needs human judgment, it calls consult(); a vetted human answers; the agent continues with a grounded response. If no human is online, a single-voice LLM fallback (Groq Llama 3.3 70B) answers in their place.

Full documentation: https://humanchain.ai/docs

Install

pip install humanchain-mcp

Requires Python 3.10+.

Configure your agent

Sign up at https://humanchain.ai/signup and grab an API key, then add the server to your agent's MCP config:

{
  "mcpServers": {
    "humanchain": {
      "command": "python",
      "args": ["-m", "humanchain_mcp"],
      "env": {
        "HUMANCHAIN_API_KEY": "hc_your_key_here"
      }
    }
  }
}

Restart your agent. The consult tool is now available.

Environment variables

Variable Default Description
HUMANCHAIN_API_KEY (required) Your account API key.
HUMANCHAIN_BACKEND https://humanchain-hub-demo.fly.dev Hub backend URL. Override for self-hosted.
HUMANCHAIN_MODE live Set to sandbox to return synthetic responses without network calls.
HUMANCHAIN_TIMEOUT_MS 5000 HTTP timeout for Hub calls. (Distinct from consult.wait_seconds.)
HUMANCHAIN_LOG_LEVEL INFO Server log level.

The consult tool

The MCP server registers a single tool named consult. Its signature matches the documented Python SDK:

consult(
    question: str,
    domain_tags: list[str] | None = None,
    target_responses: int = 1,
    approval_method: Literal[
        "fastest", "consensus", "best_of_n", "all_must_agree"
    ] = "fastest",
    wait_seconds: int = 60,
    bypass_on_timeout: bool = True,
    require_human: bool = False,
    context_brief: str | None = None,
) -> ConsultResponse

See the API reference for the full parameter and response shape, error types, and the @hc/... shorthand mapping.

Sandbox mode

Set HUMANCHAIN_MODE=sandbox and the server returns structurally-valid synthetic ConsultResponse objects without hitting the network. Use this in CI, agent unit tests, and during integration development — no credits burned, no humans woken.

Self-hosted backend

If you're running a self-hosted Hub, set HUMANCHAIN_BACKEND to your deployment URL. The MCP server speaks the same /api/agent/consult contract regardless of where the Hub is hosted.

Development

git clone https://github.com/M-C-Sigma/humanchain-the-hub
cd humanchain-the-hub/humanchain-mcp
pip install -e ".[dev]"
pytest

License

MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

humanchain_mcp-0.17.0.tar.gz (22.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

humanchain_mcp-0.17.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file humanchain_mcp-0.17.0.tar.gz.

File metadata

  • Download URL: humanchain_mcp-0.17.0.tar.gz
  • Upload date:
  • Size: 22.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.0

File hashes

Hashes for humanchain_mcp-0.17.0.tar.gz
Algorithm Hash digest
SHA256 488fd85c969e228675d671e47008be01bee37578333caf75add1264936b2fa75
MD5 000da73db4185357fb786f7e34a624dc
BLAKE2b-256 7caf9fed7a0e90f6ec945d1764a96cea0cf9763f40071f75597ecbae9246142e

See more details on using hashes here.

File details

Details for the file humanchain_mcp-0.17.0-py3-none-any.whl.

File metadata

File hashes

Hashes for humanchain_mcp-0.17.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4399ff3ca1a16bd9ee3ee6c23a045abf45822ab764a5f2b3143c59cb036b0d9e
MD5 e79691a6424a35edbaa8461035b8b2b7
BLAKE2b-256 b5ef9a9c8cd7c2a222c48b74aa6b7b6e728db9584371a62b2967e1608e4245e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page