template-express-no-auth

granular-software/template-express-no-auth

3.2

If you are the rightful owner of template-express-no-auth and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

This template provides a simple MCP server without authentication, ideal for public APIs and development environments.

{{PROJECT_NAME}}

{{PROJECT_DESCRIPTION}}

This template provides a simple MCP server without authentication, perfect for public APIs and development.

Features

  • āœ… No authentication required
  • āœ… Express.js server
  • āœ… Simple setup
  • āœ… Perfect for public APIs
  • āœ… Development-friendly
  • āœ… TypeScript with full type safety

Quick Start

Prerequisites

  • Node.js 18+
  • npm or yarn

1. Clone and Setup

# Clone this template
git clone https://github.com/granular-software/template-express-no-auth.git my-mcp-server
cd my-mcp-server

# Install dependencies
npm install

2. Environment Configuration

Copy the example environment file and configure it:

cp env.example .env

Edit .env with your configuration:

# Server Configuration
SERVER_URL=http://localhost:3000
PORT=3000

3. Development

# Start development server
npm run dev

# The server will be available at http://localhost:3000
# MCP Inspector: http://localhost:3000

4. Production

# Build the application
npm run build

# Start production server
npm start

Project Structure

ā”œā”€ā”€ src/
│   ā”œā”€ā”€ server.ts              # Main server file
│   └── resources/
│       └── example.ts        # Example MCP resource
ā”œā”€ā”€ env.example               # Environment variables template
└── README.md                 # This file

API Access

Since this template has no authentication, all API endpoints are publicly accessible. This makes it perfect for:

  • Public data APIs
  • Development and testing
  • Internal services with network-level security
  • Prototyping and demos

Environment Variables

VariableDescriptionRequiredDefault
SERVER_URLBase URL of your serverYes-
PORTServer portNo3000

Development

Adding Resources

Create new MCP resources in src/resources/:

import { z } from "zod";
import { createResource } from "mcpresso";

const MyResourceSchema = z.object({
  id: z.string(),
  name: z.string(),
  // ... your schema
});

export const myResource = createResource({
  name: "my-resource",
  schema: MyResourceSchema,
  uri_template: "my-resources/{id}",
  methods: {
    get: {
      handler: async ({ id }) => {
        // Your implementation
      },
    },
    // ... other methods
  },
});

Example Resource

The template includes an example note resource that demonstrates:

  • CRUD operations (Create, Read, Update, Delete)
  • Search functionality
  • Schema validation with Zod
  • Error handling

Production Considerations

  1. Security: Since there's no authentication, ensure network-level security
  2. Rate Limiting: Consider adding rate limiting for public APIs
  3. SSL: Ensure HTTPS is enabled in production
  4. Monitoring: Add logging and monitoring
  5. CORS: Configure CORS if needed for web clients

Troubleshooting

Common Issues

  1. Port Conflicts: Change PORT in .env if 3000 is in use
  2. CORS Issues: Add CORS middleware if needed
  3. Network Access: Ensure firewall allows connections

Logs

Check logs for debugging:

# Application logs
npm run dev

License

MIT License - see LICENSE file for details.

Support