Skip to main content

Quick Start

In this guide, you’ll install the LeanMCP CLI, create a new project, and build a real image generation service using Gemini’s Nano Banana API — complete with tools, resources, and schema validation that AI agents can discover and use.

Prerequisites

  • Node.js >= 18
  • npm >= 9

Step 1: Install the CLI

Verify the installation:

Step 2: Create Your Project

The CLI will ask:
  • Install dependencies? → Yes
  • Start dev server? → Yes
Project structure:

Step 3: Server is Running

After creation, the server starts automatically:
To restart later:

Step 4: Test Your MCP

Use the MCP Inspector:
Or test with curl:

Step 5: Add Gemini Image Generation

Let’s build a real example: image generation with Gemini (Nano Banana). Create mcp/gemini/index.ts:
Add your API key to .env:
Get a free Gemini API key at aistudio.google.com/apikey

Step 6: Build for Production

Or set a custom port:

What You Built

You now have a working MCP server with:
  • Tool: generateImage - Generate images from text prompts
  • Resource: getModels - Lists available Gemini models
  • Auto-discovery - Services in mcp/ are automatically registered

Next Steps

Tools

Create more tools for AI to execute

Resources

Expose data to AI agents

Prompts

Template prompts for AI

Auth

Secure your MCP server

Deployment

Deploy to production

CLI Reference

All CLI commands