Getting Started โ
Get up and running with PerchIQX in under 5 minutes. This guide walks you through installation, configuration, and connecting to Claude Desktop.
Prerequisites โ
Before you begin, ensure you have:
- Node.js 20.x or higher - Download here
- Cloudflare account with D1 databases - Sign up
- Cloudflare API token with D1 access
- Claude Desktop (optional, for MCP integration) - Download here
Installation โ
1. Clone the Repository โ
git clone https://github.com/semanticintent/semantic-perch-intelligence-mcp.git
cd semantic-perch-intelligence-mcp2. Install Dependencies โ
npm installThis installs all required packages including:
@modelcontextprotocol/sdk- MCP protocol implementationdotenv- Environment variable management- TypeScript and testing tools
3. Configure Environment โ
Copy the example configuration:
cp .env.example .envEdit .env with your Cloudflare credentials:
# Cloudflare Configuration
CLOUDFLARE_ACCOUNT_ID=your_cloudflare_account_id
CLOUDFLARE_API_TOKEN=your_cloudflare_api_token
# D1 Database Configuration - Development
D1_DEV_DATABASE_ID=your_dev_database_id
D1_DEV_DATABASE_NAME=your_dev_database_name
# D1 Database Configuration - Staging (Optional)
D1_STAGING_DATABASE_ID=your_staging_database_id
D1_STAGING_DATABASE_NAME=your_staging_database_name
# D1 Database Configuration - Production (Optional)
D1_PROD_DATABASE_ID=your_prod_database_id
D1_PROD_DATABASE_NAME=your_prod_database_nameNote: At least one database environment must be configured.
Getting Cloudflare Credentials โ
Get Your API Token โ
- Go to Cloudflare Dashboard
- Navigate to My Profile โ API Tokens
- Click Create Token
- Use the Edit Cloudflare Workers template
- Add D1 permissions:
D1:Read - Copy the token to your
.envfile
Get D1 Database IDs โ
# List all your D1 databases
wrangler d1 list
# Get specific database info
wrangler d1 info <database-name>Copy the database IDs and names to your .env file.
Build and Run โ
Build the Server โ
npm run buildThis compiles TypeScript to JavaScript in the dist/ directory.
Start the MCP Server โ
npm startOr use the provided shell script:
./start-d1-mcp.shYou should see:
๐ Starting PerchIQX MCP Server...
โ
PerchIQX MCP Server running on stdioConnect to Claude Desktop โ
To use PerchIQX with Claude Desktop, you need to add it to your MCP configuration.
1. Open Claude Desktop Configuration โ
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
Or use the menu: Settings โ Developer โ Edit Config
2. Add MCP Server Configuration โ
{
"mcpServers": {
"semantic-perch": {
"command": "node",
"args": [
"/absolute/path/to/semantic-perch-intelligence-mcp/dist/index.js"
],
"env": {
"CLOUDFLARE_ACCOUNT_ID": "your_account_id",
"CLOUDFLARE_API_TOKEN": "your_api_token",
"D1_DEV_DATABASE_ID": "your_dev_db_id",
"D1_DEV_DATABASE_NAME": "your_dev_db_name",
"D1_STAGING_DATABASE_ID": "your_staging_db_id",
"D1_STAGING_DATABASE_NAME": "your_staging_db_name",
"D1_PROD_DATABASE_ID": "your_prod_db_id",
"D1_PROD_DATABASE_NAME": "your_prod_db_name"
}
}
}
}Important: Replace /absolute/path/to/ with the actual absolute path to your installation.
3. Restart Claude Desktop โ
Close and reopen Claude Desktop for the changes to take effect.
4. Verify Installation โ
In Claude Desktop, you should see the PerchIQX tools available:
analyze_database_schemaget_table_relationshipsvalidate_database_schemasuggest_database_optimizations
First Query โ
Try asking Claude:
"Analyze my development database schema and show me the table structure"
Claude will use the analyze_database_schema tool to introspect your D1 database and provide detailed schema information.
Development Mode โ
For development, use watch mode to rebuild on changes:
npm run devRun tests:
# Run all tests
npm test
# Watch mode
npm run test:watch
# With UI
npm run test:ui
# Coverage report
npm run test:coverageNext Steps โ
- Tools Overview - Learn about all available MCP tools
- Architecture - Understand the hexagonal architecture
- API Reference - Detailed API documentation
- Contributing - Help improve PerchIQX
Troubleshooting โ
"Environment variable not set" error โ
Make sure your .env file contains all required variables:
CLOUDFLARE_ACCOUNT_IDCLOUDFLARE_API_TOKEN- At least one database configuration (dev, staging, or production)
"Permission denied" error โ
Verify your API token has D1 read permissions. Regenerate the token if needed.
Claude Desktop doesn't show tools โ
- Check that the path in
claude_desktop_config.jsonis correct and absolute - Verify the server builds successfully (
npm run build) - Restart Claude Desktop completely
- Check Claude Desktop logs for errors
Support โ
Need help?
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Documentation: docs.perchiqx.dev
