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
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
Rule | Example | Result |
---|---|---|
File Path = API Path | api/users/profile/get.js | GET /users/profile |
File Name = HTTP Method | post.js | POST |
One Function = Everything | process(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:
- 🌐 REST API: http://localhost:3000
- 🤖 MCP Server: http://localhost:3001
- 📚 OpenAPI: http://localhost:3000/openapi.json
- 🔍 Swagger UI: http://localhost:3000/docs
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
Document | Purpose | Best For |
---|---|---|
Complete framework documentation | Deep dive, production setup | |
AI agent integration guide | Building AI-powered applications | |
Monitoring and observability | Production monitoring | |
LLM-specific information | AI model integration |
📋 Quick Reference
- Getting Started: Quick Start →
- AI Integration: → MCP Integration
- Production: Production Ready →
- Advanced: Advanced Features →
🛠 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
Feature | Description | Auto-Generated |
---|---|---|
REST API | HTTP endpoints from file structure | ✅ |
MCP Tools | AI-callable functions | ✅ |
OpenAPI Docs | Complete API documentation | ✅ |
Swagger UI | Interactive API explorer | ✅ |
MCP Prompts | Template-based AI prompts | ✅ |
MCP Resources | Documentation & 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
Feature | Description |
---|---|
Hot Reloading | Instant updates during development |
MCP Protocol | Full AI model integration |
LLM Integration | AI service integration |
Health Monitoring | Built-in health checks |
Structured Logging | Comprehensive logging |
Rate Limiting | Built-in rate limiting |
📄 License
MIT License - see file for details.
🤝 Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
📞 Support
- Issues: GitHub Issues
- Documentation:
- Examples: Check the
api/example/
directory