Skip to content

Latest commit

 

History

History
106 lines (65 loc) · 2.82 KB

File metadata and controls

106 lines (65 loc) · 2.82 KB

Bdash Server

This is a web application for sharing SQL queries and data analysis results from Bdash.

Bdash Server is powered by Blitz.js using Next.js and Prisma.

Related blog post: https://techlife.cookpad.com/entry/2021/06/11/120000

Key Features

  • Share SQL queries, query results, and charts from the Bdash client as a web page
  • Add descriptions to your queries
  • Search queries across all users

screenshot

MCP Server

/api/mcp is an endpoint that provides MCP server (Streamable HTTP Transport).

It provides a tool called search_bdash_queries that allows keyword searching of queries.

Authentication

Set the Authorization header with either:

  • Bearer <user_access_token> - User's access token from the web interface
  • Bearer <service_key> - Service key created with the batch script

Service Key Management

Create a service key using the batch script:

# Generate random key
$ DATABASE_URL=mysql://... npm run task task/create_service_key.ts -- --name "my-app"

# Use specific key with expiration
$ DATABASE_URL=mysql://... npm run task task/create_service_key.ts -- --name "my-app" --key "your-key" --expires "2025-12-31"

Delete a service key by name:

# Delete service key
$ DATABASE_URL=mysql://... npm run task task/delete_service_key.ts -- --name "my-app"

Configuration

Below is an example of Cursor's mcp.json configuration. You can also add this configuration using the "Add to Cursor" button in the settings screen.

mcp1

mcp2

Setup

1. Set Environment Variables

Create a local environment file by copying the example:

$ cp .env.local.example .env.local

2. Configure Google OAuth

Add your GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET for authentication.

You can generate OAuth web client credentials by following these steps: https://support.google.com/workspacemigrate/answer/9222992

Configure your OAuth settings:

  • Set http://localhost:3000 as Authorized JavaScript origins
  • Set http://localhost:3000/api/auth/google/callback as Authorized redirect URIs

3. Setup Local Database

Start the Docker containers:

$ docker compose -f docker-compose-dev.yml up

Create databases using Prisma:

$ yarn db:push

Development

Start the Docker containers:

$ docker compose -f docker-compose-dev.yml up

Start the development server:

$ yarn dev

License

MIT