import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { apiRoutes } from './api';
import { mcpHandler } from './mcp';
const app = new Hono();
// Enable CORS for all routes
app.use('/*', cors());
// REST API routes
app.route('/api', apiRoutes);
// MCP endpoint - POST for JSON-RPC requests only
app.post('/mcp', mcpHandler);
// Root endpoint
app.get('/', (c) => {
return c.json({
message: 'CF-MCP: REST API + MCP Server',
endpoints: {
rest: {
products: 'GET /api/products',
product: 'GET /api/products/:id',
create: 'POST /api/products',
update: 'PUT /api/products/:id',
delete: 'DELETE /api/products/:id',
},
mcp: 'POST /mcp (Model Context Protocol endpoint)',
},
docs: 'https://github.com/heygarrison/cf-mcp',
});
});
export default app;