MCP Server Setup
The ThinkHive MCP Server can be set up in multiple ways depending on your use case.
Installation Options
No installation required - run directly with npx:
npx @thinkhive/mcp-explainerConfiguration
Environment Variables
| Variable | Required | Default | Description |
|---|---|---|---|
THINKHIVE_API_KEY | Yes | - | Your ThinkHive API key |
THINKHIVE_API_URL | No | https://demo.thinkhive.ai | API endpoint |
MCP_TRANSPORT | No | stdio | Transport mode (stdio or http) |
MCP_PORT | No | 3001 | HTTP server port (when using HTTP transport) |
STDIO Transport (Default)
For CLI tools like Claude Code, use STDIO transport:
THINKHIVE_API_KEY=thk_your_key npx @thinkhive/mcp-explainerHTTP Transport
For web applications, use HTTP/SSE transport:
THINKHIVE_API_KEY=thk_your_key \
MCP_TRANSPORT=http \
MCP_PORT=3001 \
npx @thinkhive/mcp-explainerThe server exposes:
GET /mcp/sse- Server-Sent Events streamPOST /mcp/messages- Send messages
Claude Code Integration
Locate settings file
Claude Code settings are stored at:
- macOS/Linux:
~/.claude/settings.json - Windows:
%USERPROFILE%\.claude\settings.json
Add MCP server configuration
~/.claude/settings.json
{
"mcpServers": {
"thinkhive": {
"command": "npx",
"args": ["@thinkhive/mcp-explainer"],
"env": {
"THINKHIVE_API_KEY": "thk_your_api_key_here",
"THINKHIVE_API_URL": "https://demo.thinkhive.ai"
}
}
}
}Restart Claude Code
After saving the settings file, restart Claude Code to load the MCP server.
Verify connection
In Claude Code, the ThinkHive tools should now be available. Try:
> What ThinkHive tools are available?Programmatic Usage
STDIO Transport
import { startStdioServer } from '@thinkhive/mcp-explainer';
// Start the STDIO server
await startStdioServer();HTTP Transport
import express from 'express';
import { setupHttpTransport } from '@thinkhive/mcp-explainer';
const app = express();
app.use(express.json());
// Set up MCP endpoints
setupHttpTransport({
app,
basePath: '/mcp',
});
app.listen(3001, () => {
console.log('MCP server running on http://localhost:3001');
});Direct Tool Invocation
import { McpClient } from '@thinkhive/mcp-explainer';
const client = new McpClient({
apiKey: 'thk_your_api_key',
apiUrl: 'https://demo.thinkhive.ai',
});
// Invoke a tool
const result = await client.invokeTool('trace_explain', {
traceId: 'tr_abc123',
});
console.log(result);Verification
Test that the MCP server is working:
# Test STDIO mode (will wait for input)
echo '{"jsonrpc":"2.0","method":"tools/list","id":1}' | \
THINKHIVE_API_KEY=thk_your_key npx @thinkhive/mcp-explainer
# Test HTTP mode
curl http://localhost:3001/mcp/healthTroubleshooting
⚠️
Server not starting?
- Verify
THINKHIVE_API_KEYis set correctly - Check that the API key has the correct tier permissions
Claude Code not seeing tools?
- Restart Claude Code after changing settings
- Check
~/.claude/logsfor error messages - Verify the settings.json syntax is valid
Connection errors?
- Ensure network access to
demo.thinkhive.ai - Check if a firewall is blocking connections
Next Steps
- Available Tools - Complete tool reference
- Claude Code Guide - Detailed Claude Code usage