mdgen-mcp 0.1.0 → 0.1.2
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/LICENSE +21 -0
- package/README.md +20 -5
- package/dist/client.js +0 -6
- package/dist/index.js +1 -6
- package/package.json +7 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Shien Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -76,10 +76,25 @@ env = { MDGEN_TOKEN = "<your token>" }
|
|
|
76
76
|
## Development
|
|
77
77
|
|
|
78
78
|
```bash
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
79
|
+
npm install
|
|
80
|
+
npm run dev # run from source (tsx)
|
|
81
|
+
npm run build # emit dist/
|
|
82
|
+
npm test # unit tests
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
## Publishing
|
|
86
|
+
|
|
87
|
+
Releases publish to npm via GitHub Actions on `v*` tags, using
|
|
88
|
+
[npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers) (OIDC, no token)
|
|
89
|
+
with build provenance.
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
npm version patch # bump version + create commit/tag
|
|
93
|
+
git push && git push --tags
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
|
|
98
|
+
MIT © Shien Inc.
|
|
99
|
+
|
|
100
|
+
Part of [mdgen](https://mdgen.app).
|
package/dist/client.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
// mdgen backend(documents API)を PAT(Bearer)で叩く薄いクライアント。
|
|
2
|
-
// 認証・データ分離は API 側(#151 Phase 1)が担う。ここは HTTP 呼び出しとエラー整形のみ。
|
|
3
|
-
/** API エラー。status と人間可読メッセージを持つ。 */
|
|
4
1
|
export class MdgenApiError extends Error {
|
|
5
2
|
status;
|
|
6
3
|
constructor(status, message) {
|
|
@@ -41,7 +38,6 @@ export function createMdgenClient(baseUrl, token, fetchImpl = fetch) {
|
|
|
41
38
|
detail = body.error ?? body.code ?? "";
|
|
42
39
|
}
|
|
43
40
|
catch {
|
|
44
|
-
// non-JSON error body
|
|
45
41
|
}
|
|
46
42
|
const retryAfter = res.status === 429 ? res.headers.get("retry-after") : null;
|
|
47
43
|
throw new MdgenApiError(res.status, humanMessage(res.status, detail, retryAfter));
|
|
@@ -72,8 +68,6 @@ export function createMdgenClient(baseUrl, token, fetchImpl = fetch) {
|
|
|
72
68
|
});
|
|
73
69
|
return res.json();
|
|
74
70
|
},
|
|
75
|
-
// 指定フィールドのみ変更する。API の PUT は全項目を上書きするため、
|
|
76
|
-
// 既存を読んで未指定フィールドを保持してから送る(title/mode の消失を防ぐ)。
|
|
77
71
|
async updateDocument(id, patch) {
|
|
78
72
|
const current = (await (await request(`/api/documents/${encodeURIComponent(id)}`)).json());
|
|
79
73
|
await request(`/api/documents/${encodeURIComponent(id)}`, {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// mdgen MCP サーバ(#151)。
|
|
3
|
-
// ユーザー自身の MCP クライアント(Claude Desktop / Claude Code / Codex 等)から、
|
|
4
|
-
// ユーザーの PAT(MDGEN_TOKEN)で mdgen のドキュメントを読み書きする stdio サーバ。
|
|
5
2
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
6
3
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
4
|
import { z } from "zod";
|
|
@@ -14,7 +11,6 @@ if (!token) {
|
|
|
14
11
|
process.exit(1);
|
|
15
12
|
}
|
|
16
13
|
const client = createMdgenClient(apiUrl, token);
|
|
17
|
-
/** ツールハンドラ共通: 例外を人間可読なエラー結果に変換する。 */
|
|
18
14
|
async function run(fn) {
|
|
19
15
|
try {
|
|
20
16
|
return { content: [{ type: "text", text: await fn() }] };
|
|
@@ -28,7 +24,7 @@ async function run(fn) {
|
|
|
28
24
|
return { content: [{ type: "text", text: message }], isError: true };
|
|
29
25
|
}
|
|
30
26
|
}
|
|
31
|
-
const server = new McpServer({ name: "mdgen-mcp", version: "0.1.
|
|
27
|
+
const server = new McpServer({ name: "mdgen-mcp", version: "0.1.2" });
|
|
32
28
|
server.registerTool("list_documents", {
|
|
33
29
|
title: "List documents",
|
|
34
30
|
description: "List the current user's saved mdgen documents (id, title, mode, updatedAt).",
|
|
@@ -90,4 +86,3 @@ server.registerTool("delete_document", {
|
|
|
90
86
|
}));
|
|
91
87
|
const transport = new StdioServerTransport();
|
|
92
88
|
await server.connect(transport);
|
|
93
|
-
// stdio サーバはここで待機する(プロセスは MCP クライアントが管理)。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mdgen-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "MCP server for mdgen — read/write your mdgen documents from Claude / Codex and other MCP clients",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"dev": "tsx src/index.ts",
|
|
19
19
|
"test": "vitest run",
|
|
20
20
|
"typecheck": "tsc --noEmit",
|
|
21
|
-
"prepublishOnly": "
|
|
21
|
+
"prepublishOnly": "npm run build"
|
|
22
22
|
},
|
|
23
23
|
"keywords": [
|
|
24
24
|
"mcp",
|
|
@@ -30,8 +30,11 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "https://github.com/Shien-Inc/
|
|
34
|
-
|
|
33
|
+
"url": "https://github.com/Shien-Inc/mdgen-mcp.git"
|
|
34
|
+
},
|
|
35
|
+
"homepage": "https://github.com/Shien-Inc/mdgen-mcp#readme",
|
|
36
|
+
"bugs": {
|
|
37
|
+
"url": "https://github.com/Shien-Inc/mdgen-mcp/issues"
|
|
35
38
|
},
|
|
36
39
|
"publishConfig": {
|
|
37
40
|
"access": "public"
|