7134-easy-mcp-server

easynet-world/7134-easy-mcp-server

3.2

If you are the rightful owner of 7134-easy-mcp-server 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.

Easy MCP Server is a dynamic API framework that simplifies the integration of MCP tools and OpenAPI specifications.

easy-mcp-server

License: MIT Node.js Version

Transform any function into a complete API ecosystem with AI integration

🎯 What You Get

Write ONE function → Get EVERYTHING:

  • REST API - Instant HTTP endpoints
  • MCP Tools - AI models can call your functions
  • MCP Prompts - Template-based prompts with parameters
  • MCP Resources - Documentation and data access
  • OpenAPI - Complete API documentation
  • Swagger UI - Interactive API explorer

3 Simple Rules

RuleExampleResult
File Path = API Pathapi/users/profile/get.jsGET /users/profile
File Name = HTTP Methodpost.jsPOST
One Function = Everythingprocess(req, res)REST + MCP + OpenAPI

Quick Example

const BaseAPI = require('easy-mcp-server/base-api');

class MyAPI extends BaseAPI {
  process(req, res) {
    res.json({ message: 'Hello World' });
  }
}

module.exports = MyAPI;

🚀 Quick Start

1. Install & Setup

npm install easy-mcp-server
mkdir -p api/users && touch api/users/get.js

2. Write Your API

// api/users/get.js
const BaseAPI = require('easy-mcp-server/base-api');

class GetUsers extends BaseAPI {
  process(req, res) {
    res.json({ users: [] });
  }
}

module.exports = GetUsers;

3. Start & Access

npx easy-mcp-server

Access Points:

4. Optional: Add MCP Features

# Add prompts
mkdir -p mcp/prompts/my-category
echo '{"description": "My AI prompt", "instructions": "..."}' > mcp/prompts/my-category/my-prompt.json

# Add resources  
mkdir -p mcp/resources/docs
echo '# My Guide' > mcp/resources/docs/my-guide.md

📚 Documentation

DocumentPurposeBest For
Complete framework documentationDeep dive, production setup
AI agent integration guideBuilding AI-powered applications
Monitoring and observabilityProduction monitoring
LLM-specific informationAI model integration

📋 Quick Reference


🛠 Advanced Features

Enhanced API (LLM + Logging)

const { BaseAPIEnhanced } = require('easy-mcp-server/lib/base-api-enhanced');

class MyEnhancedAPI extends BaseAPIEnhanced {
  constructor() {
    super('my-service', {
      llm: { provider: 'openai', apiKey: process.env.OPENAI_API_KEY }
    });
  }

  async process(req, res) {
    // this.llm, this.responseUtils available
    this.responseUtils.sendSuccessResponse(res, { data: 'Hello World' });
  }
}

Auto-Generated OpenAPI with JSDoc

/**
 * @description Get user information
 * @summary Retrieve user details
 * @tags users
 * @requestBody { "type": "object", "required": ["userId"], "properties": { "userId": { "type": "string" } } }
 */
class GetUser extends BaseAPI {
  process(req, res) {
    // Your code here
  }
}

🔧 Configuration

Environment Variables

PORT=3000                    # REST API port
MCP_PORT=3001               # MCP server port  
OPENAI_API_KEY=your-key-here      # OpenAI API key

CLI Options

easy-mcp-server --port 3000 --mcp-port 3001 --api-dir ./api

📦 What You Get

FeatureDescriptionAuto-Generated
REST APIHTTP endpoints from file structure
MCP ToolsAI-callable functions
OpenAPI DocsComplete API documentation
Swagger UIInteractive API explorer
MCP PromptsTemplate-based AI prompts
MCP ResourcesDocumentation & data access

File Structure → API Endpoints

api/users/get.js          →  GET /users
api/users/post.js         →  POST /users  
api/users/profile/put.js  →  PUT /users/profile

MCP Prompts & Resources

Prompts - Template-based AI prompts:

mcp/prompts/category/prompt.json

Resources - Documentation & data:

mcp/resources/category/resource.md

Example Prompt:

{
  "description": "Generate API documentation",
  "arguments": { "type": "object", "properties": { "endpoint": { "type": "string" } } },
  "instructions": "You are an API expert..."
}

🚀 Production Ready

FeatureDescription
Hot ReloadingInstant updates during development
MCP ProtocolFull AI model integration
LLM IntegrationAI service integration
Health MonitoringBuilt-in health checks
Structured LoggingComprehensive logging
Rate LimitingBuilt-in rate limiting

📄 License

MIT License - see file for details.


🤝 Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📞 Support

  • Issues: GitHub Issues
  • Documentation:
  • Examples: Check the api/example/ directory