@koseha/api-mcp 0.0.2 โ†’ 0.0.4

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/dist/index.js CHANGED
@@ -12,9 +12,9 @@ async function main() {
12
12
  const transport = new StdioServerTransport();
13
13
  await server.connect(transport);
14
14
  // ๐Ÿ‘‡ ์ด ์ค„์ด ํ•ต์‹ฌ
15
- process.stdin.resume();
15
+ // process.stdin.resume();
16
16
  }
17
- main().catch((err) => {
18
- process.stderr.write(err.stack + "\n");
19
- process.exit(1);
20
- });
17
+ // main().catch((err) => {
18
+ // process.stderr.write(err.stack + "\n");
19
+ // process.exit(1);
20
+ // });
@@ -8,7 +8,7 @@ const __filename = fileURLToPath(import.meta.url);
8
8
  const __dirname = dirname(__filename);
9
9
  let cache = null;
10
10
  let cachedAt = 0;
11
- const TTL = 5 * 60 * 1000;
11
+ const TTL = 5 * 60 * 1000; // 5๋ถ„
12
12
  export async function loadSwagger() {
13
13
  if (cache && Date.now() - cachedAt < TTL) {
14
14
  return cache;
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Tool: API ์ƒ์„ธ ์กฐํšŒ
3
+ */
4
+ import { z } from "zod";
5
+ import { loadSwagger } from "../swagger/swaggerLoader.js";
6
+ export function registerGetApiDetail(server) {
7
+ server.registerTool("getApiDetail", {
8
+ title: "API ์ƒ์„ธ ์กฐํšŒ",
9
+ description: "API ์ƒ์„ธ๋ฅผ ์กฐํšŒํ•ฉ๋‹ˆ๋‹ค.",
10
+ inputSchema: {
11
+ requestUrl: z.string(),
12
+ httpMethod: z.enum(["get", "post", "put", "delete", "patch"]),
13
+ },
14
+ }, async ({ requestUrl, httpMethod }) => {
15
+ if (!requestUrl || !httpMethod) {
16
+ return {
17
+ content: [
18
+ { type: "text", text: "requestUrl ๋˜๋Š” httpMethod๊ฐ€ ์—†์Šต๋‹ˆ๋‹ค." },
19
+ ],
20
+ };
21
+ }
22
+ const swagger = await loadSwagger();
23
+ const api = swagger.paths[requestUrl][httpMethod];
24
+ return {
25
+ content: [{ type: "text", text: JSON.stringify(api) }],
26
+ };
27
+ });
28
+ }
@@ -0,0 +1 @@
1
+ "use strict";
@@ -3,7 +3,9 @@
3
3
  */
4
4
  import { registerAddTool } from "./add.tool.js";
5
5
  import { registerGetApiList } from "./getApiList.tool.js";
6
+ import { registerGetApiDetail } from "./getApiDetail.tool.js";
6
7
  export function registerTools(server) {
7
8
  registerAddTool(server);
8
9
  registerGetApiList(server);
10
+ registerGetApiDetail(server);
9
11
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koseha/api-mcp",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
4
  "description": "An API MCP based on Swagger docs",
5
5
  "keywords": [],
6
6
  "homepage": "https://github.com/koseha/api-mcp#readme",
@@ -25,7 +25,6 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@modelcontextprotocol/sdk": "^1.25.1",
28
- "yaml": "^2.8.2",
29
28
  "zod": "^4.2.1"
30
29
  },
31
30
  "devDependencies": {