Skip to main content
Glama

DollhouseMCP

by DollhouseMCP
CLAUDE_CODE_INTEGRATION.mdโ€ข11.3 kB
# Claude MCP Test Environment - Docker Integration ## Overview This document provides the complete configuration and setup for running Claude Code and DollhouseMCP together in a Docker container. This creates an isolated testing environment where both tools run together with Claude Code using DollhouseMCP as its MCP server. ## Quick Start Commands ```bash # 1. Build the container docker build -f docker/test-configs/Dockerfile.claude-testing -t claude-mcp-test-env . # 2. Set your API key export ANTHROPIC_API_KEY="sk-ant-api03-..." # 3. Run Claude Code with DollhouseMCP docker run -it --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` ## Critical Configuration Details ### MCP Configuration Path **IMPORTANT**: The MCP configuration MUST be explicitly loaded using: ``` --mcp-config /root/.config/claude-code/config.json ``` Without this flag, Claude Code will NOT connect to DollhouseMCP. ### Model Selection Use `--model sonnet` for Claude 3.5 Sonnet (recommended for testing) ### API Key Requirement The container requires `ANTHROPIC_API_KEY` environment variable to function. ## MCP Configuration File Location in container: `/root/.config/claude-code/config.json` ```json { "mcpServers": { "dollhousemcp": { "command": "node", "args": ["/app/dollhousemcp/dist/index.js"], "env": { "DOLLHOUSE_PORTFOLIO_DIR": "/app/portfolio", "DOLLHOUSE_CACHE_DIR": "/app/cache", "NODE_ENV": "development", "LOG_LEVEL": "debug" } } }, "defaultMcpServer": "dollhousemcp" } ``` ## Verified Working Configuration ### Software Versions - **Claude Code**: v1.0.110 - **DollhouseMCP**: v1.7.3 - **Node.js**: 20-slim - **npm package**: `@anthropic-ai/claude-code` ### Available MCP Tools (29 total) Successfully detected and accessible: - Element management tools (list, activate, create, edit, delete) - Portfolio operations (sync, status, config) - Collection browsing and searching - GitHub authentication and integration - User identity management - Configuration tools ## Docker Commands Reference ### Build ```bash docker build -f docker/test-configs/Dockerfile.claude-testing -t claude-mcp-test-env . ``` ### Run Interactive Session ```bash docker run -it --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` ### Run Single Command ```bash echo "Your prompt here" | docker run -i --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` ### Debug Commands ```bash # Get shell access docker run -it --rm --entrypoint /bin/bash claude-dollhouse-test # Check Claude Code installation docker run --rm --entrypoint /bin/bash claude-dollhouse-test -c "claude --version" # View MCP configuration docker run --rm --entrypoint /bin/bash claude-dollhouse-test -c \ "cat /root/.config/claude-code/config.json" # Test MCP server directly docker run --rm claude-dollhouse-test test-mcp ``` ## Testing MCP Integration ### Test 1: List MCP Tools ```bash echo "List all available MCP tools" | docker run -i --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` Expected: Should list the following DollhouseMCP tools with `mcp__dollhousemcp__` prefix: ### Complete List of MCP Tools (43 total) #### Element Management (13 tools) 1. `list_elements` - List all available elements of a specific type 2. `activate_element` - Activate a specific element by name 3. `get_active_elements` - Get information about currently active elements 4. `deactivate_element` - Deactivate a specific element 5. `get_element_details` - Get detailed information about a specific element 6. `reload_elements` - Reload elements of a specific type from filesystem 7. `render_template` - Render a template element with provided variables 8. `execute_agent` - Execute an agent element with a specific goal 9. `create_element` - Create a new element of any type 10. `edit_element` - Edit an existing element of any type 11. `validate_element` - Validate an element for correctness and best practices 12. `delete_element` - Delete an element and optionally its associated data files 13. `import_persona` - Import a persona from a file path or JSON string #### Collection & Marketplace (7 tools) 14. `browse_collection` - Browse content from the DollhouseMCP collection 15. `search_collection` - Search for content in the collection by keywords 16. `search_collection_enhanced` - Enhanced search with pagination and filtering 17. `get_collection_content` - Get detailed information about collection content 18. `install_content` - Install elements from the collection to local portfolio 19. `submit_content` - Upload element to GitHub portfolio and optionally submit to collection 20. `get_collection_cache_health` - Get health status and statistics for collection cache #### Portfolio Management (6 tools) 21. `portfolio_status` - Check the status of your GitHub portfolio repository 22. `init_portfolio` - Initialize a new GitHub portfolio repository 23. `portfolio_config` - Configure portfolio settings (auto-sync, visibility, etc.) 24. `sync_portfolio` - Sync ALL elements between local and GitHub portfolio 25. `search_portfolio` - Search your local portfolio by content, metadata, keywords 26. `search_all` - Search across all sources (local, GitHub, collection) #### User & Authentication (8 tools) 27. `set_user_identity` - Set your username for persona attribution 28. `get_user_identity` - Get current user identity information 29. `clear_user_identity` - Clear user identity and return to anonymous mode 30. `setup_github_auth` - Set up GitHub authentication using device flow 31. `check_github_auth` - Check current GitHub authentication status 32. `clear_github_auth` - Remove GitHub authentication and disconnect 33. `configure_oauth` - Configure GitHub OAuth client ID for authentication 34. `oauth_helper_status` - Get diagnostic information about OAuth helper process #### Configuration (6 tools) 35. `configure_indicator` - Configure how active persona indicators are displayed 36. `get_indicator_config` - Get current persona indicator configuration 37. `configure_collection_submission` - Configure automatic collection submission settings 38. `get_collection_submission_config` - Get current collection submission configuration 39. `dollhouse_config` - Unified configuration management (experimental) 40. `sync_portfolio` - Sync portfolio with remote repository (duplicate of #24) #### System Information (1 tool) 41. `get_build_info` - Get comprehensive build and runtime information about the server Note: Some tools may be disabled or in experimental status depending on the version ### Test 2: Use MCP Tool ```bash echo "Use mcp__dollhousemcp__list_elements to list personas" | docker run -i --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` Expected: Claude will request permission to use the tool (security feature) ### Test 3: Check Build Info ```bash echo "Use mcp__dollhousemcp__get_build_info to show version" | docker run -i --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` ## Volume Mounts for Development ### Mount Local DollhouseMCP Source ```bash docker run -it --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ -v $(pwd):/app/dollhousemcp \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` ### Mount Local Portfolio ```bash docker run -it --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ -v ~/.dollhouse/portfolio:/app/portfolio \ claude-mcp-test-env \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json ``` ## Environment Variables ### Required - `ANTHROPIC_API_KEY`: Your Anthropic API key ### Optional (set in container) - `DOLLHOUSE_PORTFOLIO_DIR`: `/app/portfolio` - `DOLLHOUSE_CACHE_DIR`: `/app/cache` - `NODE_ENV`: `development` - `LOG_LEVEL`: `debug` ## File Structure in Container ``` /app/ โ”œโ”€โ”€ dollhousemcp/ โ”‚ โ”œโ”€โ”€ dist/ # Built DollhouseMCP โ”‚ โ”œโ”€โ”€ src/ # Source code โ”‚ โ”œโ”€โ”€ package.json โ”‚ โ””โ”€โ”€ node_modules/ โ”œโ”€โ”€ portfolio/ โ”‚ โ”œโ”€โ”€ personas/ โ”‚ โ”œโ”€โ”€ skills/ โ”‚ โ”œโ”€โ”€ templates/ โ”‚ โ”œโ”€โ”€ agents/ โ”‚ โ”œโ”€โ”€ memories/ โ”‚ โ””โ”€โ”€ ensembles/ โ””โ”€โ”€ cache/ /root/.config/claude-code/ โ””โ”€โ”€ config.json # MCP configuration /usr/local/bin/ โ””โ”€โ”€ claude # Claude Code executable ``` ## Known Issues and Solutions ### Issue: MCP tools not detected **Solution**: Always use `--mcp-config /root/.config/claude-code/config.json` ### Issue: Permission required for MCP tools **Expected behavior**: Claude Code asks for permission before using MCP tools ### Issue: TTY required for interactive mode **Solution**: Use `-it` flags or pipe input with `-i` for non-interactive ### Issue: Build fails with "tsc not found" **Solution**: Ensure Dockerfile uses `npm ci` (not `npm ci --only=production`) ## Performance Metrics - **Build time**: ~2-3 minutes (first build) - **Image size**: ~1.2GB - **Startup time**: ~2 seconds - **Memory usage**: ~200MB idle, ~400MB active - **MCP tools detected**: 29 ## Security Notes 1. **API Key**: Never hardcode in Dockerfile, always pass via environment 2. **Container runs as root**: Consider adding non-root user for production 3. **MCP Permission**: Claude Code requires approval for MCP tool usage 4. **Network isolation**: Container has full network access by default ## CI/CD Integration Example ```yaml # .github/workflows/test-integration.yml name: Test Claude Code Integration on: [push, pull_request] jobs: test: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Build Docker image run: docker build -f docker/test-configs/Dockerfile.claude-testing -t test:${{ github.sha }} . - name: Test MCP tools detection env: ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }} run: | echo "List all MCP tools" | docker run -i --rm \ -e ANTHROPIC_API_KEY="$ANTHROPIC_API_KEY" \ test:${{ github.sha }} \ claude --model sonnet --mcp-config /root/.config/claude-code/config.json \ | grep -q "mcp__dollhousemcp" ``` ## Success Criteria โœ… **All Confirmed Working:** - Claude Code v1.0.110 installed - DollhouseMCP v1.7.3 built - MCP configuration loaded - 29 tools detected - API key passes through - Model selection works - Container runs successfully ## Last Tested - **Date**: September 10, 2025 - **Time**: 6:45 PM PST - **Branch**: `feature/docker-claude-code-testing` - **Result**: Full success --- *This configuration enables complete integration testing of DollhouseMCP with Claude Code in an isolated Docker environment.*

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/DollhouseMCP/DollhouseMCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server