Skip to main content

Configuration

Configure the Tokencraft MCP server to use it with Claude Desktop or other MCP clients.

Claude Desktop Configuration

1. Locate Configuration File

The Claude Desktop configuration file location varies by operating system:
~/Library/Application Support/Claude/claude_desktop_config.json

2. Edit Configuration

Open the file and add the Tokencraft MCP server:
claude_desktop_config.json
{
  "mcpServers": {
    "tokencraft": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_your_token_here"
      }
    }
  }
}
Replace dtk_your_token_here with your actual API token from app.tokencraft.dev/api-settings

3. Restart Claude Desktop

Close and reopen Claude Desktop for changes to take effect.

4. Verify Setup

In Claude, type:
Can you list my Tokencraft workspaces?
Claude should respond with your workspaces if everything is configured correctly.

Configuration Options

Basic Configuration

Minimal setup:
{
  "mcpServers": {
    "tokencraft": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_your_token_here"
      }
    }
  }
}

Custom API URL

For self-hosted or development environments:
{
  "mcpServers": {
    "tokencraft": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_your_token_here",
        "TOKENCRAFT_API_URL": "https://your-instance.com/api/v1"
      }
    }
  }
}

Using Global Install

If you installed globally:
{
  "mcpServers": {
    "tokencraft": {
      "command": "tokencraft-mcp",
      "args": [],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_your_token_here"
      }
    }
  }
}

Multiple Accounts

Configure multiple Tokencraft accounts:
{
  "mcpServers": {
    "tokencraft-production": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_production_token",
        "TOKENCRAFT_API_URL": "https://app.tokencraft.dev/api/v1"
      }
    },
    "tokencraft-staging": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_staging_token",
        "TOKENCRAFT_API_URL": "https://staging.tokencraft.dev/api/v1"
      }
    }
  }
}

Environment Variables

VariableRequiredDefaultDescription
TOKENCRAFT_API_TOKENYes-Your API token
TOKENCRAFT_API_URLNohttps://app.tokencraft.dev/api/v1API base URL

Security Best Practices

1. Token Security

Never commit configuration files with tokens to version control
✅ Good:
{
  "env": {
    "TOKENCRAFT_API_TOKEN": "dtk_actual_token"
  }
}
❌ Bad:
# Don't commit this to git
claude_desktop_config.json

2. Separate Tokens

Use different tokens for different purposes:
  • Development: dtk_dev_...
  • Production: dtk_prod_...
  • Claude: dtk_claude_...

3. Token Permissions

Create read-only tokens when possible (coming soon).

Verifying Configuration

Test 1: Basic Connection

You: Can you connect to Tokencraft?
Claude: [Should confirm connection and list available tools]

Test 2: List Workspaces

You: List my Tokencraft workspaces
Claude: [Should list your workspaces]

Test 3: Export Tokens

You: Export my tokens as CSS
Claude: [Should export tokens if workspace/tokenset exists]

Troubleshooting

Server Not Starting

Error: MCP server failed to start Solutions:
  1. Verify Node.js is installed: node --version
  2. Check token is valid
  3. Test manually: npx @tokencraft/mcp-server

Authentication Failed

Error: 401 Unauthorized Solutions:
  1. Verify API token is correct
  2. Check token hasn’t been revoked
  3. Create a new token if needed

Command Not Found

Error: npx: command not found Solutions:
  1. Install Node.js
  2. Use full path: /usr/local/bin/npx
  3. Use global install method

Claude Doesn’t See Server

Solutions:
  1. Restart Claude Desktop completely (Quit, not just close window)
  2. Check JSON syntax in config file
  3. Verify file location is correct
  4. Check logs:
~/Library/Logs/Claude/mcp-server-tokencraft.log

Other MCP Clients

Cline (VS Code)

Configure in VS Code settings:
settings.json
{
  "cline.mcpServers": {
    "tokencraft": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_your_token_here"
      }
    }
  }
}

Custom MCP Client

For custom implementations:
import { MCPClient } from '@modelcontextprotocol/sdk';

const client = new MCPClient({
  serverCommand: 'npx',
  serverArgs: ['-y', '@tokencraft/mcp-server'],
  env: {
    TOKENCRAFT_API_TOKEN: 'dtk_your_token_here'
  }
});

await client.connect();

Configuration Examples

Example 1: Simple Setup

{
  "mcpServers": {
    "tokencraft": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_abc123..."
      }
    }
  }
}

Example 2: With Other MCP Servers

{
  "mcpServers": {
    "tokencraft": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_abc123..."
      }
    },
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/path/to/allowed/files"]
    },
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": {
        "GITHUB_TOKEN": "ghp_..."
      }
    }
  }
}

Example 3: Development Setup

{
  "mcpServers": {
    "tokencraft-dev": {
      "command": "npx",
      "args": ["-y", "@tokencraft/mcp-server"],
      "env": {
        "TOKENCRAFT_API_TOKEN": "dtk_dev_token",
        "TOKENCRAFT_API_URL": "http://localhost:3000/api/v1"
      }
    }
  }
}

Next Steps

Support

If you’re having trouble:
  1. Check the troubleshooting section
  2. Review example configurations
  3. Test the REST API directly
  4. Contact support with your configuration (remove token first!)