Skip to content

Latest commit

 

History

History
189 lines (133 loc) · 3.79 KB

File metadata and controls

189 lines (133 loc) · 3.79 KB

MCP Server Setup Guide

Current Status

You now have a Next.js Auth Setup MCP Server project with:

✅ MCP server implementation (src/mcp-server.ts.bak)
✅ Registry-ready README
✅ Package configuration
✅ Type definitions
✅ Utility functions

What's Needed to Complete

1. Template Files

Create src/templates/authjs.ts and src/templates/betterauth.ts with auth configuration templates (from your original CLI tool).

2. Setup Modules

Create src/setup/authjs-setup.ts and src/setup/betterauth-setup.ts with setup logic (from your original CLI tool).

3. Restore MCP Server

mv src/mcp-server.ts.bak src/mcp-server.ts

4. Install Dependencies

npm install

5. Build

npm run build

How to Use Your MCP Server

In Warp

  1. Open Warp Settings > MCP Servers
  2. Click "+ Add"
  3. Paste this configuration:
{
  "nextjs-auth-setup": {
    "command": "npx",
    "args": ["-y", "auth-setup"]
  }
}

Or for local development:

{
  "nextjs-auth-setup": {
    "command": "node",
    "args": [
      "/home/officialrajdeepsingh/opensource/auth-setup/dist/mcp-server.js"
    ]
  }
}

Testing with AI Agent

Once configured in Warp, you can ask:

"Set up Auth.js with Google OAuth in my Next.js project at /path/to/project"

The AI agent will:

  1. Call check_nextjs_project to validate
  2. Call setup_nextjs_auth with your parameters
  3. Report the created files and next steps

MCP Tools Exposed

setup_nextjs_auth

Parameters:

  • projectPath: "/absolute/path/to/nextjs/project"
  • authLibrary: "authjs" | "better-auth"
  • providers: ["google", "github", "credentials"] (optional, Auth.js only)
  • adapter: "prisma" | "drizzle" | "none" (optional)

Returns:

{
  "success": true,
  "filesCreated": ["auth.ts", "middleware.ts", ...],
  "nextSteps": ["Run: npm install", ...]
}

check_nextjs_project

Parameters:

  • projectPath: "/absolute/path/to/check"

Returns:

{
  "valid": true,
  "isNextJs": true,
  "hasAppRouter": true
}

Quick Start for Copying Templates

If you have the original auth-setup CLI project, copy these files:

# From original CLI project
cp ../auth-setup-cli/src/templates/* src/templates/
cp ../auth-setup-cli/src/setup/* src/setup/

Publishing to npm

  1. Update package.json with your author info
  2. Build: npm run build
  3. Test locally first
  4. Publish: npm publish

Adding to MCP Registry

Once published, you can submit to the MCP Registry:

Architecture

MCP Client (Warp Agent)
    ↓ calls tools
MCP Server (this package)
    ↓ validates & generates
Next.js Project
    ← auth files created

Key Differences from CLI

CLI Tool MCP Server
Interactive prompts Structured tool calls
User runs manually AI agent invokes
Terminal output JSON responses
inquirer for UI No UI - tool parameters

Example Agent Interaction

User: "Add Auth.js to my Next.js app"

Agent internal flow:

  1. Determines project path
  2. Calls check_nextjs_project(projectPath)
  3. Asks user: "Which providers? (Google, GitHub, Credentials)"
  4. User: "Google and GitHub"
  5. Calls setup_nextjs_auth({ projectPath, authLibrary: "authjs", providers: ["google", "github"] })
  6. Reports success and next steps to user

Next Steps

  1. Copy/create template files
  2. Copy/create setup modules
  3. Build and test
  4. Publish to npm
  5. Add to your Warp MCP configuration
  6. Try it out!

You're building a tool that lets AI agents set up auth automatically. Pretty cool! 🚀