Skip to content

Commit afc85c3

Browse files
authored
Merge pull request #90 from kernel/mason/development-environment-setup-8c16
Development environment setup
2 parents 66852bf + 4c6f302 commit afc85c3

1 file changed

Lines changed: 150 additions & 0 deletions

File tree

AGENTS.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# Project Setup Guide
2+
3+
## Package Manager
4+
5+
**IMPORTANT: This project uses `bun` as the package manager. You MUST use `bun` for all dependency management operations.**
6+
7+
- **DO NOT** use `npm`, `yarn`, or `pnpm`
8+
- **ALWAYS** use `bun install` to install dependencies
9+
- **ALWAYS** use `bun add <package>` to add new dependencies
10+
- **ALWAYS** use `bun remove <package>` to remove dependencies
11+
12+
The lock file is `bun.lock` - never commit changes from other package managers.
13+
14+
## Installing Dependencies
15+
16+
```bash
17+
bun install
18+
```
19+
20+
## Environment Setup
21+
22+
1. Copy the example environment file:
23+
24+
```bash
25+
cp .env.example .env.local
26+
```
27+
28+
2. Fill in the required environment variables (values can be found in 1password > DevEnvVars > MCP section)
29+
30+
## Development
31+
32+
Start the development server:
33+
34+
```bash
35+
bun run dev
36+
```
37+
38+
The server runs on port 3002 by default.
39+
40+
## Build
41+
42+
Build the project for production:
43+
44+
```bash
45+
bun run build
46+
```
47+
48+
## Production
49+
50+
Start the production server:
51+
52+
```bash
53+
bun run start
54+
```
55+
56+
## Code Quality
57+
58+
### Linting
59+
60+
Run ESLint (via Next.js):
61+
62+
```bash
63+
bun run lint
64+
```
65+
66+
### Formatting
67+
68+
This project uses Prettier for code formatting.
69+
70+
Check formatting:
71+
72+
```bash
73+
bun run format:check
74+
```
75+
76+
Fix formatting issues:
77+
78+
```bash
79+
bun run format
80+
```
81+
82+
Prettier formats the following file types: `*.ts`, `*.js`, `*.json`, `*.md`
83+
84+
## Project Structure
85+
86+
- `src/` - Source code directory
87+
- `public/` - Static assets
88+
- `next.config.ts` - Next.js configuration
89+
- `tsconfig.json` - TypeScript configuration
90+
91+
## Tech Stack
92+
93+
- **Framework**: Next.js 16
94+
- **Language**: TypeScript
95+
- **Styling**: Tailwind CSS 4
96+
- **Authentication**: Clerk
97+
- **Package Manager**: Bun (required)
98+
99+
## Cursor Cloud specific instructions
100+
101+
### Running commands
102+
103+
**Always use `make` targets instead of raw `bun` commands** to ensure 1Password (`op`) injects secrets from the `.env` file:
104+
105+
- `make dev` — start dev server (port 3002)
106+
- `make build` — production build
107+
- `make start` — start production server
108+
- `make install` — install dependencies
109+
- `make lint` — run linter
110+
111+
The `Makefile` wraps commands with `op run --env-file .env --` so that 1Password references (e.g., `op://DevServiceAccount/DevEnvVars/MCP/...`) in `.env` are resolved at runtime. The `OP_SERVICE_ACCOUNT_TOKEN` secret must be available in the environment for this to work.
112+
113+
### Lint caveat
114+
115+
`next lint` was removed in Next.js 16. The `bun run lint` / `make lint` script will fail with "Invalid project directory". This is a pre-existing codebase issue — the script in `package.json` needs to be updated to use ESLint directly. For now, use `bun run format:check` for code quality checks.
116+
117+
### Testing MCP tool calls locally
118+
119+
The MCP server supports API key authentication (non-JWT bearer tokens). To test locally:
120+
121+
```bash
122+
# Start the server
123+
make dev
124+
125+
# In another terminal, send MCP requests with curl:
126+
curl -s -X POST http://localhost:3002/mcp \
127+
-H "Content-Type: application/json" \
128+
-H "Accept: application/json, text/event-stream" \
129+
-H "Authorization: Bearer $KERNEL_API_KEY" \
130+
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test-client","version":"1.0.0"}}}'
131+
```
132+
133+
Key MCP methods: `initialize`, `tools/list`, `tools/call`, `resources/list`, `prompts/list`.
134+
135+
The `KERNEL_API_KEY` env var is passed as the Bearer token and forwarded to the Kernel SDK for API calls. The `search_docs` tool works without network restrictions; other tools (`manage_browsers`, etc.) require connectivity to the Kernel platform API.
136+
137+
### Required secrets
138+
139+
- `OP_SERVICE_ACCOUNT_TOKEN` — 1Password service account token for `op run` to resolve `.env` references
140+
- `KERNEL_API_KEY` — Kernel platform API key for testing MCP tool calls
141+
142+
### Services overview
143+
144+
| Service | Required | Notes |
145+
|---------|----------|-------|
146+
| Next.js dev server (port 3002) | Yes | `make dev` — the MCP server itself |
147+
| Clerk (SaaS) | Yes | OAuth 2.1 auth — config injected via `op run` |
148+
| Redis | Yes | OAuth org-context storage — URL injected via `op run` |
149+
| Kernel Platform API (SaaS) | Yes | Backend for all MCP tools — reached via SDK |
150+
| Mintlify (SaaS) | Optional | Only for `search_docs` tool |

0 commit comments

Comments
 (0)