Quickstart Guide

Get up and running with mcponce in less than 2 minutes.


๐Ÿ“ฆ Installation #

npm install mcponce

Requirements:

  • Node.js: v20.0.0 or higher
  • Bun: v1.1.0 or higher (optional)

๐Ÿ› ๏ธ Creating Your Server #

Create a file named server.ts (or server.js):

TS
import { createMcpServer } from 'mcponce';

// 1. Initialize the MCP application
const app = createMcpServer({
  name: 'my-assistant',
  version: '1.0.0',
  port: 8080 // optional: defaults to 3000 or dynamic open port
});

// 2. Define your first tool with shorthand schema
app.tool({
  name: 'greet_user',
  description: 'Returns a friendly greeting with user status',
  inputSchema: {
    username: 'string',
    vip: { type: 'boolean', default: false }
  },
  handler: ({ username, vip }) => {
    return {
      message: `Hello ${vip ? 'VIP member' : ''} ${username}! Welcome back.`,
      timestamp: new Date().toISOString()
    };
  }
});

// 3. Define a mathematical calculation tool with caching
app.tool({
  name: 'fibonacci',
  description: 'Calculates the Nth Fibonacci number with in-memory caching',
  inputSchema: {
    n: { type: 'number', default: 10 }
  },
  cache: { ttlMs: 60_000 },
  handler: ({ n }) => {
    function fib(num: number): number {
      if (num <= 1) return num;
      let a = 0, b = 1;
      for (let i = 2; i <= num; i++) {
        const c = a + b;
        a = b;
        b = c;
      }
      return b;
    }
    return { n, result: fib(n) };
  }
});

// 4. Run the server
app.run();

๐Ÿƒ Running the Server #

node server.js

The server will start and print connection details:

โœ“ MCP server "my-assistant" (v1.0.0) running in foreground
HTTP: http://127.0.0.1:8080
MCP Endpoint: http://127.0.0.1:8080/mcp
Health: http://127.0.0.1:8080/health
Metrics: http://127.0.0.1:8080/metrics

๐Ÿ”Œ Connecting to LLM Clients #

Instead of editing configuration files manually, run the auto-installer:

BASH
# Automatically configures both Claude Desktop and Cursor!
node server.js install

(Or specify node server.js install claude or node server.js install cursor). See Client Auto-Installer for details.


Manual Configuration #

If you prefer to configure clients manually:

Claude Desktop

Open your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

Add your mcponce server configuration:

JSON
{
  "mcpServers": {
    "my-assistant": {
      "command": "node",
      "args": ["/absolute/path/to/server.js", "--background"]
    }
  }
}
Why use `--background` with Claude Desktop?

Whenever Claude Desktop spawns an MCP process, --background coordinates all requests to a single background daemon. When Claude restarts or opens multiple windows, your database connections and caches remain warm!

Cursor / Antigravity

In Cursor:

  1. Open Settings โž” Features โž” MCP Servers.
  2. Click Add New MCP Server.
  3. Choose Type: command.
  4. Command: node /path/to/server.js --background.

๐Ÿงช Testing Tools via Terminal (No LLM Required!) #

mcponce comes with a built-in parametric CLI caller:

BASH
# List all registered tools and parameter signatures:
npx mcponce call --list

# Call greet_user:
npx mcponce call greet_user --username=Ahmet --vip=true

# Call fibonacci with JSON output:
npx mcponce call fibonacci --n 20 --json

Next Steps #

Updated