@moxn/mcp-kb 0.5.0 → 0.6.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/README.md CHANGED
@@ -67,6 +67,7 @@ back to OAuth.
67
67
  | `MOXN_AUTH_SERVER` | Override auth server URL (for local development) |
68
68
  | `MOXN_CLIENT_ID` | Use a pre-registered OAuth client ID (when dynamic registration is unavailable) |
69
69
  | `MOXN_CLIENT_SECRET` | Optional client secret for `MOXN_CLIENT_ID` |
70
+ | `MOXN_CHECKOUT_ROOT` | Directory that holds `.moxn/checkouts/` for `pull` and `push`. Defaults to the client's first MCP root, else the working directory |
70
71
 
71
72
  ### Connecting without this package (direct HTTP + static key)
72
73
 
@@ -93,13 +94,14 @@ silently ignored.
93
94
 
94
95
  ## Available Tools
95
96
 
96
- Once connected, Claude Code has access to these Knowledge Base tools:
97
+ The proxy forwards the server's tool list (`find`, `search`, `read`, `documents`, `edit`, and the rest), so that list is always the deployment's own.
97
98
 
98
- - **find** - List documents, sections, or folders
99
- - **read** - Read document/section content
100
- - **documents** - Create, update, delete documents; manage branches and tags
101
- - **sections** - Create, update, delete, reorder sections
102
- - **search** - Search content across the knowledge base
99
+ It also serves two tools locally:
100
+
101
+ - **pull** - Write a markdown document to `.moxn/checkouts/` and return its path, not its body. The agent searches and edits the file with its own file tools.
102
+ - **push** - Commit that file's body back to the branch it was pulled from, guarded by the pulled revision, then refresh it from the server. Tags and metadata are left alone; editing the file's front-matter is refused.
103
+
104
+ A body moved this way never passes through the model. The caller cannot choose a path: paths derive from the document id and branch, and symlinks and hard links are refused, so a prompt-injected document cannot turn `push` into an upload of a local file. The checkout lands under the client's first MCP root, else the working directory; set `MOXN_CHECKOUT_ROOT` to override. Over a direct HTTP connection these tools do not exist.
103
105
 
104
106
  ## Development
105
107
 
@@ -0,0 +1,86 @@
1
+ export interface ToolResult {
2
+ content: Array<{
3
+ type: 'text';
4
+ text: string;
5
+ }>;
6
+ isError?: boolean;
7
+ [key: string]: unknown;
8
+ }
9
+ export interface CheckoutEnv {
10
+ workspace: string;
11
+ /** The deployment this connection talks to; document ids are not portable. */
12
+ baseUrl: string;
13
+ /** The directory that holds `.moxn/`. Resolved per call: roots can change. */
14
+ root: () => Promise<string>;
15
+ callTool: (name: string, args: Record<string, unknown>) => Promise<ToolResult>;
16
+ }
17
+ export declare const checkoutTools: ({
18
+ name: string;
19
+ description: string;
20
+ inputSchema: {
21
+ type: string;
22
+ additionalProperties: boolean;
23
+ required: string[];
24
+ properties: {
25
+ documentId: {
26
+ type: string;
27
+ format: string;
28
+ description: string;
29
+ };
30
+ branchName: {
31
+ type: string;
32
+ description: string;
33
+ };
34
+ commitId: {
35
+ type: string;
36
+ format: string;
37
+ description: string;
38
+ };
39
+ overwrite: {
40
+ type: string;
41
+ description: string;
42
+ };
43
+ commitMessage?: undefined;
44
+ };
45
+ };
46
+ } | {
47
+ name: string;
48
+ description: string;
49
+ inputSchema: {
50
+ type: string;
51
+ additionalProperties: boolean;
52
+ required: string[];
53
+ properties: {
54
+ documentId: {
55
+ type: string;
56
+ format: string;
57
+ description: string;
58
+ };
59
+ branchName: {
60
+ type: string;
61
+ description: string;
62
+ };
63
+ commitMessage: {
64
+ type: string;
65
+ description: string;
66
+ };
67
+ commitId?: undefined;
68
+ overwrite?: undefined;
69
+ };
70
+ };
71
+ })[];
72
+ export declare function isCheckoutTool(name: string): boolean;
73
+ /**
74
+ * Where `.moxn/` lives: an explicit override, else the client's first MCP root
75
+ * (the directory the agent's own file tools can reach without prompting), else
76
+ * the working directory. A client launched from `/` has no project at all, so
77
+ * that case lands in the home directory rather than at the filesystem root.
78
+ */
79
+ export declare function resolveCheckoutRoot(deps: {
80
+ override?: string;
81
+ listRoots: () => Promise<string[]>;
82
+ cwd: string;
83
+ home: string;
84
+ }): Promise<string>;
85
+ export declare function runCheckoutTool(name: string, args: Record<string, unknown> | undefined, env: CheckoutEnv): Promise<ToolResult>;
86
+ //# sourceMappingURL=checkout.d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