Introduce a Helm-chart-like template system for MCP servers. Templates are YAML files in templates/ that get seeded into the DB on startup. Users can browse them with `mcpctl get templates`, inspect with `mcpctl describe template`, and instantiate with `mcpctl create server --from-template=`. Also adds Portainer deployment scripts, mcplocal systemd service, Streamable HTTP MCP endpoint, and RPM packaging for mcpctl-local. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
32 lines
1023 B
TypeScript
32 lines
1023 B
TypeScript
import type { FastifyInstance } from 'fastify';
|
|
import type { TemplateService } from '../services/template.service.js';
|
|
|
|
export function registerTemplateRoutes(
|
|
app: FastifyInstance,
|
|
service: TemplateService,
|
|
): void {
|
|
app.get<{ Querystring: { name?: string } }>('/api/v1/templates', async (request) => {
|
|
const namePattern = request.query.name;
|
|
return service.list(namePattern);
|
|
});
|
|
|
|
app.get<{ Params: { id: string } }>('/api/v1/templates/:id', async (request) => {
|
|
return service.getById(request.params.id);
|
|
});
|
|
|
|
app.post('/api/v1/templates', async (request, reply) => {
|
|
const template = await service.create(request.body);
|
|
reply.code(201);
|
|
return template;
|
|
});
|
|
|
|
app.put<{ Params: { id: string } }>('/api/v1/templates/:id', async (request) => {
|
|
return service.update(request.params.id, request.body);
|
|
});
|
|
|
|
app.delete<{ Params: { id: string } }>('/api/v1/templates/:id', async (request, reply) => {
|
|
await service.delete(request.params.id);
|
|
reply.code(204);
|
|
});
|
|
}
|