@menapo/api
v0.2.0
Published
Typed REST operations on Hono: one object per method and URL, validated input and output, problem+json errors, a URL-keyed browser client, OpenAPI and MCP from the same definitions
Maintainers
Readme
@menapo/api
Typed REST operations on Hono: one object per method and URL, validated input and output, problem+json errors, a URL-keyed browser client, and OpenAPI, MCP, jobs and uploads from the same definitions.
export const projects = defineApi({
"/projects/:id": { get: { output: Project, run: ({ input, ctx }) => ctx.db.find(input.id) } },
});
export const app = api({ routes: [projects], context, use: [csrf(), session({ load })] });
const api = client<typeof app>("/api");
const project = await api.get("/projects/:id", { id }); // typed by the URL and the method| Entry | Role |
| --------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| @menapo/api | defineApi, api, fail, operation, middleware, job, upload, progress |
| @menapo/api/client | client(), ApiError, Input, Output: no Hono, no server code |
| @menapo/api/mcp | mcp(), prompt(), resource(): an MCP server on the official SDK (optional peers @modelcontextprotocol/server and /hono), with OAuth, streaming progress and sessions |
| @menapo/api/openapi | openapi(), document() |
| @menapo/api/test | testApi() |
| @menapo/api/vite | the plugin: precompiled route tables, the OpenAPI document |
The guide shows it end to end; the design and its measurements are in PLAN.md. Private until its first release.
