matome-mcp-server 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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 evilock
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
@@ -61,3 +61,5 @@ Even non-Matome users can retrieve data if they know someone’s public UID.
61
61
  ---
62
62
 
63
63
  License
64
+
65
+ The contents of this repository are subject to the Matome service's terms of use.
package/dist/index.js CHANGED
@@ -1,4 +1,83 @@
1
1
  #!/usr/bin/env node
2
- import { MCPServer } from "mcp-framework";
3
- const server = new MCPServer();
4
- server.start();
2
+ import "dotenv/config";
3
+ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
5
+ import { ListToolsRequestSchema, CallToolRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
6
+ const MATOME_API_BASE = "https://matome.url-storage.com//api/mcp";
7
+ const server = new Server({
8
+ name: "matome",
9
+ version: "1.0.0",
10
+ }, {
11
+ capabilities: {
12
+ tools: {},
13
+ },
14
+ });
15
+ async function makeMatomeRequest() {
16
+ try {
17
+ const Url = `${MATOME_API_BASE}`;
18
+ const UID = process.env.USER_ID;
19
+ const response = await fetch(Url, {
20
+ method: "GET",
21
+ headers: {
22
+ uid: UID ? UID : "",
23
+ },
24
+ });
25
+ if (response.status !== 200) {
26
+ return { content: [{ type: "text", text: "matome fetch Error!!" }] };
27
+ }
28
+ else {
29
+ const result = await response.json();
30
+ const resultlist = { content: [] };
31
+ result.list.forEach((item) => {
32
+ resultlist.content.push({ type: "text", text: item.url });
33
+ });
34
+ return resultlist;
35
+ }
36
+ }
37
+ catch {
38
+ return {
39
+ content: [
40
+ {
41
+ type: "text",
42
+ text: "matome url list is none",
43
+ },
44
+ ],
45
+ };
46
+ }
47
+ }
48
+ server.setRequestHandler(ListToolsRequestSchema, async () => {
49
+ return {
50
+ tools: [
51
+ {
52
+ name: "get_matome",
53
+ description: "Get bookmark url for matome",
54
+ inputSchema: {
55
+ type: "object",
56
+ },
57
+ },
58
+ ],
59
+ };
60
+ });
61
+ server.setRequestHandler(CallToolRequestSchema, async (request) => {
62
+ try {
63
+ if (request.params.name === "get_matome") {
64
+ const ar_Data = await makeMatomeRequest();
65
+ return ar_Data;
66
+ }
67
+ else {
68
+ return {
69
+ content: [
70
+ {
71
+ type: "text",
72
+ text: "Tool not found",
73
+ },
74
+ ],
75
+ };
76
+ }
77
+ }
78
+ catch {
79
+ throw new Error("Tool not found");
80
+ }
81
+ });
82
+ const transport = new StdioServerTransport();
83
+ await server.connect(transport);
package/package.json CHANGED
@@ -1,30 +1,25 @@
1
1
  {
2
2
  "name": "matome-mcp-server",
3
- "version": "0.0.2",
4
- "description": "matome-mcp-server MCP server",
5
- "type": "module",
6
- "author": "ebilock",
3
+ "version": "0.0.4",
4
+ "description": "matome",
7
5
  "license": "MIT",
6
+ "author": "matome",
7
+ "type": "module",
8
8
  "bin": {
9
9
  "matome-mcp-server": "./dist/index.js"
10
10
  },
11
+ "scripts": {
12
+ "build": "tsc && chmod 755 dist/index.js"
13
+ },
11
14
  "files": [
12
15
  "dist"
13
16
  ],
14
- "scripts": {
15
- "build": "tsc && mcp-build",
16
- "watch": "tsc --watch",
17
- "start": "node dist/index.js"
18
- },
19
17
  "dependencies": {
20
- "dotenv": "^16.5.0",
21
- "mcp-framework": "^0.2.2"
18
+ "@modelcontextprotocol/sdk": "^1.11.3",
19
+ "dotenv": "^16.5.0"
22
20
  },
23
21
  "devDependencies": {
24
- "@types/node": "^20.11.24",
25
- "typescript": "^5.3.3"
26
- },
27
- "engines": {
28
- "node": ">=18.19.0"
22
+ "@types/node": "^22.15.18",
23
+ "typescript": "^5.8.3"
29
24
  }
30
25
  }
@@ -1,16 +0,0 @@
1
- import { MCPTool } from "mcp-framework";
2
- import { z } from "zod";
3
- class ExampleTool extends MCPTool {
4
- name = "example_tool";
5
- description = "An example tool that processes messages";
6
- schema = {
7
- message: {
8
- type: z.string(),
9
- description: "Message to process",
10
- },
11
- };
12
- async execute(input) {
13
- return `Processed: ${input.message}`;
14
- }
15
- }
16
- export default ExampleTool;
@@ -1,40 +0,0 @@
1
- import { MCPTool } from "mcp-framework";
2
- import { z } from "zod";
3
- import "dotenv/config";
4
- class MatomeTool extends MCPTool {
5
- name = "get_matome_url_list";
6
- description = "Matomeに登録したurlを取得する";
7
- MATOME_API_BASE = "https://matome.ebi-generator.com/api/mcp";
8
- schema = {
9
- message: {
10
- type: z.string(),
11
- description: "Message to process",
12
- },
13
- };
14
- async execute() {
15
- try {
16
- const Url = `${this.MATOME_API_BASE}`;
17
- const UID = process.env.USER_ID;
18
- const response = await fetch(Url, {
19
- method: "POST",
20
- headers: {
21
- "Content-Type": "application/json",
22
- },
23
- body: JSON.stringify({ uid: UID }),
24
- });
25
- if (response.status !== 200) {
26
- return { content: [{ type: "text", text: "matome fetch Error!!" }] };
27
- }
28
- else {
29
- const result = await response.json();
30
- return result;
31
- }
32
- }
33
- catch {
34
- return {
35
- list: [{ type: "error", url: "" }],
36
- };
37
- }
38
- }
39
- }
40
- export default MatomeTool;