MCP Setup Guide
This guide walks through connecting your MCP server to HiveForge for metered tool usage.
Prerequisites
- A HiveForge deployment on the Trial tier or above
- An MCP server implementing the Model Context Protocol
- Access to the HiveForge dashboard for credential management
Step 1: Choose Your Integration Mode
| Mode | When to Use |
|---|---|
| Stdio | Your MCP server runs locally (e.g., Claude Code, CLI agent) |
| Service-to-Service | Your MCP server is hosted alongside your application |
Step 2: Get Credentials
Stdio Mode Credentials
Generate an API key from your HiveForge dashboard. The key follows the format hf_live_... and is tied to your organization.
- Go to Settings > API Keys in the HiveForge dashboard
- Click Create API Key
- Copy the key -- it will not be shown again
Service-to-Service Credentials
For hosted MCP servers, you need a shared service key configured on both the HiveForge API and your MCP server.
- Set the
HIVEFORGE_MCP_SERVICE_KEYenvironment variable on the HiveForge API - Use the same value as the
X-MCP-Service-Keyheader in your MCP server's requests
Keep your service key secret. It grants full access to entitlement checking and usage recording for all deployments. Rotate it immediately if compromised.
Step 3: Configure Environment Variables
Set these in the environment where your MCP server runs:
HIVEFORGE_API_URL=https://api.hiveforge.dev
HIVEFORGE_API_KEY=hf_live_a1b2c3d4e5f6g7h8i9j0...Step 4: Register Your MCP Tools
HiveForge uses a tool-name-to-action mapping to determine credit costs. Your tool names must match the registered names in the platform. The current registered tools are:
# TaskCrush
taskcrush_list_tasks, taskcrush_create_task, taskcrush_update_task,
taskcrush_list_goals, taskcrush_create_goal, taskcrush_chat
# HornetHive
hornethive_execute_crew, hornethive_generate,
hornethive_rag_search, hornethive_ingest
# Tao-Data
taodata_log_trace, taodata_evaluate,
taodata_get_analytics, taodata_search_traces
# HiveForge Platform
hiveforge_list_templates, hiveforge_list_instances, hiveforge_get_instance,
hiveforge_create_instance, hiveforge_delete_instance, hiveforge_redeploy_instance,
hiveforge_get_pipeline_status, hiveforge_promote_instance, hiveforge_get_instance_healthUnrecognized tool names default to the platform_basic credit action. To add new tool mappings, update the TOOL_ACTION_MAP in the HiveForge API configuration.
Step 5: Test the Connection
curl -X POST https://api.hiveforge.dev/api/v1/mcp/stdio/check-entitlement \
-H "Authorization: Bearer hf_live_your_key_here" \
-H "Content-Type: application/json" \
-d '{"tool_name": "taskcrush_list_tasks"}'Expected response:
{
"allowed": true,
"credit_cost": 1,
"tier": "launch",
"reason": null
}Integration Flow
Once connected, your MCP server should follow this flow for every tool call:
- Check entitlement before executing the tool
- Execute the tool only if
allowedistrue - Record usage after successful execution
- Handle denials gracefully when
allowedisfalse
See Entitlements for detailed guidance on handling the entitlement flow.
Troubleshooting
| Issue | Cause | Fix |
|---|---|---|
401 Unauthorized | Missing or invalid credentials | Verify your API key or service key |
allowed: false with sandbox_tier | Deployment is on Sandbox tier | Upgrade to Trial or above |
allowed: false with insufficient_credits | No credits remaining | Purchase a credit pack or wait for monthly reset |
no_deployment_found | User/org has no active deployment | Check that the deployment exists and is in active status |