Files
jenna-mcp/README.md
2025-10-08 07:46:06 +08:00

79 lines
3.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Jenna MCP
Full-stack management console for Jenna that runs entirely on Bun. The app bundles a React dashboard (Mantine UI) with an Elysia API for managing JWT-secured API keys and service credentials backed by PostgreSQL via Prisma.
## Features
- Protected dashboard with JWT cookie/session handling and seeded demo account.
- API key lifecycle management (create, list, delete) with long-lived signed tokens.
- Credential vault for storing connection details required by downstream tools.
- Auto-generated OpenAPI & Swagger UI exposed at `/docs`.
- Prisma/PostgreSQL data layer with reusable seed script.
## Tech Stack
- Bun ≥ 1.2.23 (runtime, bundler, and package manager)
- React 19, Vite-style Bun dev server, Mantine UI, SWR & Valtio
- Elysia 1.4 API framework with `@elysiajs/jwt` and Swagger plugin
- Prisma ORM targeting PostgreSQL
## Getting Started
1. **Install dependencies**
```bash
bun install
```
2. **Create your environment file**
Copy the snippet below into `.env` (adjust values to your setup):
```bash
DATABASE_URL="postgresql://USER:PASSWORD@localhost:5432/jenna_mcp"
JWT_SECRET="replace-with-a-strong-secret"
BUN_PUBLIC_BASE_URL="http://localhost:3000"
```
3. **Apply the Prisma schema & generate the client**
```bash
bunx prisma migrate dev --name init
bunx prisma generate
```
4. **Seed demo data (optional but helpful for local logins)**
```bash
bun run seed
```
This creates a `bip@bip.com / bip` user.
5. **Start the app**
```bash
bun dev
```
The server listens on `http://localhost:3000` and serves both the API and React UI. Swagger docs are available at `http://localhost:3000/docs`.
6. **Production build**
```bash
bun run build
bun start
```
`bun run build` emits the browser bundle to `dist/` and `bun start` runs the API/UI in production mode.
## Useful Commands
- `bun run build` Bundle the client for production.
- `bun start` Run the API/UI in production mode.
- `bunx prisma studio` Inspect your database through Prisma Studio.
## Project Structure
- `src/index.tsx` Bun entry point that wires the Elysia server and serves the React app.
- `src/pages/**` React pages for auth, dashboard, API key & credential management.
- `src/server/**` Elysia routes, middlewares, and Prisma helpers.
- `prisma/schema.prisma` Database schema for users, API keys, and credentials.
- `prisma/seed.ts` Seed script for demo data.
## Authentication Notes
- The dashboard uses cookie-based JWTs issued by `/auth/login`.
- Programmatic requests can send `Authorization: Bearer <token>` or `x-token` headers.
- Protected API routes are nested under `/api/**`.
## Troubleshooting
- Ensure `JWT_SECRET` is set before starting the server; the API throws on startup if it is missing.
- If Prisma complains about missing client files, rerun `bunx prisma generate`.
- When updating the schema, rerun `bunx prisma migrate dev` followed by `bun run seed` if you need fresh fixtures.