granular-software/template-express-no-auth
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
Variable | Description | Required | Default |
---|---|---|---|
SERVER_URL | Base URL of your server | Yes | - |
PORT | Server port | No | 3000 |
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
- Security: Since there's no authentication, ensure network-level security
- Rate Limiting: Consider adding rate limiting for public APIs
- SSL: Ensure HTTPS is enabled in production
- Monitoring: Add logging and monitoring
- CORS: Configure CORS if needed for web clients
Troubleshooting
Common Issues
- Port Conflicts: Change
PORT
in.env
if 3000 is in use - CORS Issues: Add CORS middleware if needed
- 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
- GitHub Issues: https://github.com/granular-software/mcpresso
- Documentation: https://github.com/granular-software/mcpresso