create-m5kdev 0.38.21 → 0.39.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/minimal-app/apps/server/AGENTS.md.tpl +2 -5
- package/templates/minimal-app/apps/server/src/modules/posts/posts.module.ts.tpl +0 -11
- package/templates/minimal-app/apps/server/src/modules/posts/posts.trpc.ts.tpl +18 -0
- package/templates/minimal-app/pnpm-workspace.yaml.tpl +12 -12
- package/templates/minimal-app/template.manifest.json +0 -1
- package/templates/minimal-app/apps/server/src/modules/posts/posts.mcp.ts.tpl +0 -17
package/package.json
CHANGED
|
@@ -20,9 +20,6 @@ apps/server/src/modules/<module>/
|
|
|
20
20
|
├── <module>.repository.ts
|
|
21
21
|
├── <module>.service.ts
|
|
22
22
|
├── <module>.trpc.ts
|
|
23
|
-
// m5k:mcp:start
|
|
24
|
-
├── <module>.mcp.ts
|
|
25
|
-
// m5k:mcp:end
|
|
26
23
|
└── <module>.module.ts
|
|
27
24
|
```
|
|
28
25
|
|
|
@@ -32,7 +29,7 @@ apps/server/src/modules/<module>/
|
|
|
32
29
|
- Services own business rules, orchestration, and context-aware defaults.
|
|
33
30
|
- tRPC files own transport only and must delegate to services.
|
|
34
31
|
// m5k:mcp:start
|
|
35
|
-
-
|
|
32
|
+
- Opt a tRPC procedure into the MCP catalog with `.meta({ mcp: { name, description } })`. The MCP tool is the procedure; Grant checks always run. Write instruction-style descriptions for MCP clients.
|
|
36
33
|
// m5k:mcp:end
|
|
37
34
|
- Register Core Modules and app modules in `apps/server/src/app.ts` via `createBackendApp(config, [modules])`. Do not use `backendApp.use`. Optional Backend Modules (`@m5kdev/module-*`) are not scaffolded; add them only when the product needs Clay, Docx, Pdf, Social, or Video.
|
|
38
35
|
// m5k:ai:start
|
|
@@ -57,7 +54,7 @@ apps/server/src/modules/<module>/
|
|
|
57
54
|
- After changing Drizzle tables, run `pnpm --filter ./apps/server drizzle:generate` then `drizzle:migrate` — do not hand-edit SQL migrations in this repo.
|
|
58
55
|
|
|
59
56
|
// m5k:mcp:start
|
|
60
|
-
- `McpModule` is registered in `app.ts`. MCP clients authenticate with Better Auth MCP OAuth (not API keys). Compose `auth.oauth.db` plus `mcpAllowlistEntries`.
|
|
57
|
+
- `McpModule` is registered in `app.ts`. MCP clients authenticate with Better Auth MCP OAuth (not API keys). Compose `auth.oauth.db` plus `mcpAllowlistEntries`. Posts exposes `list-posts` / `create-post` through `meta.mcp` on its tRPC procedures. Omit the module to disable MCP.
|
|
61
58
|
// m5k:mcp:end
|
|
62
59
|
|
|
63
60
|
// m5k:notifications:start
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// biome-ignore-all assist/source/organizeImports: feature-gated posts.mcp import stays in marker blocks
|
|
2
1
|
import { createBackendRouterMap } from "@m5kdev/backend/app";
|
|
3
2
|
import {
|
|
4
3
|
BaseModule,
|
|
@@ -11,10 +10,6 @@ import { postsGrants } from "./posts.grants";
|
|
|
11
10
|
import { PostsRepository } from "./posts.repository";
|
|
12
11
|
import { PostsService } from "./posts.service";
|
|
13
12
|
import { createPostsTRPC } from "./posts.trpc";
|
|
14
|
-
// m5k:mcp:start
|
|
15
|
-
import type { ModuleMcpContext } from "@m5kdev/backend/modules/base/base.module";
|
|
16
|
-
import { createPostsMcp } from "./posts.mcp";
|
|
17
|
-
// m5k:mcp:end
|
|
18
13
|
|
|
19
14
|
type PostsModuleDeps = Record<string, never>;
|
|
20
15
|
type PostsModuleTables = typeof postsTables;
|
|
@@ -59,10 +54,4 @@ export class PostsModule extends BaseModule<
|
|
|
59
54
|
override trpc({ trpc, services }: ModuleTRPCContext<PostsModuleDeps, PostsModuleServices>) {
|
|
60
55
|
return createBackendRouterMap("posts", createPostsTRPC(trpc, services.posts));
|
|
61
56
|
}
|
|
62
|
-
|
|
63
|
-
// m5k:mcp:start
|
|
64
|
-
override mcp({ services }: ModuleMcpContext<PostsModuleDeps, PostsModuleServices>) {
|
|
65
|
-
return createPostsMcp(services.posts);
|
|
66
|
-
}
|
|
67
|
-
// m5k:mcp:end
|
|
68
57
|
}
|
|
@@ -8,11 +8,29 @@ export function createPostsTRPC(
|
|
|
8
8
|
) {
|
|
9
9
|
return router({
|
|
10
10
|
list: procedure
|
|
11
|
+
// m5k:mcp:start
|
|
12
|
+
.meta({
|
|
13
|
+
mcp: {
|
|
14
|
+
name: "list-posts",
|
|
15
|
+
description:
|
|
16
|
+
"List posts in an Organization. Call list-organizations first to learn organizationId values, then pass one as organizationId.",
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
// m5k:mcp:end
|
|
11
20
|
.input(postSchemas.input.list)
|
|
12
21
|
.output(postSchemas.output.list)
|
|
13
22
|
.query(async ({ ctx, input }) => handleTRPCResult(await postsService.list(input ?? {}, ctx))),
|
|
14
23
|
|
|
15
24
|
create: procedure
|
|
25
|
+
// m5k:mcp:start
|
|
26
|
+
.meta({
|
|
27
|
+
mcp: {
|
|
28
|
+
name: "create-post",
|
|
29
|
+
description:
|
|
30
|
+
"Create a draft post in an Organization. Call list-organizations first to learn organizationId values, then pass one as organizationId.",
|
|
31
|
+
},
|
|
32
|
+
})
|
|
33
|
+
// m5k:mcp:end
|
|
16
34
|
.input(postSchemas.input.create)
|
|
17
35
|
.output(postSchemas.output.single)
|
|
18
36
|
.mutation(async ({ ctx, input }) => handleTRPCResult(await postsService.create(input, ctx))),
|
|
@@ -7,18 +7,18 @@ catalogs:
|
|
|
7
7
|
"@heroui/react": 3.0.3
|
|
8
8
|
"@heroui/styles": 3.0.3
|
|
9
9
|
"@libsql/client": 0.17.4
|
|
10
|
-
"@m5kdev/backend": 0.
|
|
11
|
-
"@m5kdev/commons": 0.
|
|
12
|
-
"@m5kdev/config": 0.
|
|
13
|
-
"@m5kdev/email": 0.
|
|
14
|
-
"@m5kdev/expo": 0.
|
|
15
|
-
"@m5kdev/frontend": 0.
|
|
16
|
-
"@m5kdev/module-clay": 0.
|
|
17
|
-
"@m5kdev/module-docx": 0.
|
|
18
|
-
"@m5kdev/module-pdf": 0.
|
|
19
|
-
"@m5kdev/module-social": 0.
|
|
20
|
-
"@m5kdev/module-video": 0.
|
|
21
|
-
"@m5kdev/web-ui": 0.
|
|
10
|
+
"@m5kdev/backend": 0.39.0
|
|
11
|
+
"@m5kdev/commons": 0.39.0
|
|
12
|
+
"@m5kdev/config": 0.39.0
|
|
13
|
+
"@m5kdev/email": 0.39.0
|
|
14
|
+
"@m5kdev/expo": 0.39.0
|
|
15
|
+
"@m5kdev/frontend": 0.39.0
|
|
16
|
+
"@m5kdev/module-clay": 0.39.0
|
|
17
|
+
"@m5kdev/module-docx": 0.39.0
|
|
18
|
+
"@m5kdev/module-pdf": 0.39.0
|
|
19
|
+
"@m5kdev/module-social": 0.39.0
|
|
20
|
+
"@m5kdev/module-video": 0.39.0
|
|
21
|
+
"@m5kdev/web-ui": 0.39.0
|
|
22
22
|
"@mastra/core": 1.51.0
|
|
23
23
|
"@openrouter/ai-sdk-provider": 3.0.0
|
|
24
24
|
"@opentelemetry/api": 1.9.0
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { defineMcpCall } from "@m5kdev/backend/modules/mcp/mcp.define";
|
|
2
|
-
import type { McpOrganizationCallDefinition } from "@m5kdev/backend/modules/mcp/mcp.types";
|
|
3
|
-
import { postSchemas } from "./posts.dto";
|
|
4
|
-
import type { PostsService } from "./posts.service";
|
|
5
|
-
|
|
6
|
-
export function createPostsMcp(posts: PostsService): Record<string, McpOrganizationCallDefinition> {
|
|
7
|
-
return {
|
|
8
|
-
"list-posts": defineMcpCall()
|
|
9
|
-
.description("List posts in the selected Organization")
|
|
10
|
-
.input(postSchemas.input.list)
|
|
11
|
-
.handle(async (input, actor) => posts.list(input, { actor, user: { id: actor.userId } })),
|
|
12
|
-
"create-post": defineMcpCall()
|
|
13
|
-
.description("Create a draft post in the selected Organization")
|
|
14
|
-
.input(postSchemas.input.create)
|
|
15
|
-
.handle(async (input, actor) => posts.create(input, { actor, user: { id: actor.userId } })),
|
|
16
|
-
};
|
|
17
|
-
}
|