@flink-app/mcp 0.12.1-alpha.14

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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/dist/index.js +75 -0
  3. package/package.json +36 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License
2
+
3
+ Copyright (c) Frost Experience AB https://www.frost.se
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
13
+ all 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
21
+ THE SOFTWARE.
package/dist/index.js ADDED
@@ -0,0 +1,75 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
5
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
6
+ // API docs plugin API root
7
+ const apiRoot = process.argv[2] || "http://localhost:3333/docs/api";
8
+ // Create server instance
9
+ const server = new mcp_js_1.McpServer({
10
+ name: "Flink API",
11
+ version: "1.0.0",
12
+ });
13
+ // server.resource("api-docs", "api-docs://endpoints", async (uri) => {
14
+ // const apiDocs = await makeFlinkApiDocsRequest<any>();
15
+ // if (!apiDocs) {
16
+ // throw new Error("Failed to fetch API docs");
17
+ // }
18
+ // return {
19
+ // contents: [
20
+ // {
21
+ // uri: uri.toString(),
22
+ // mimeType: "application/json",
23
+ // text: JSON.stringify(apiDocs, null, 2),
24
+ // },
25
+ // ],
26
+ // };
27
+ // });
28
+ server.tool("api-endpoints", "Get all documented API endpoints and its request and response bodies.", async () => {
29
+ const apiDocs = await makeFlinkApiDocsRequest();
30
+ if (!apiDocs) {
31
+ throw new Error("Failed to fetch API docs");
32
+ }
33
+ return {
34
+ content: [
35
+ {
36
+ mimeType: "application/json",
37
+ text: JSON.stringify(apiDocs, null, 2),
38
+ type: "text",
39
+ },
40
+ ],
41
+ };
42
+ });
43
+ async function makeFlinkApiDocsRequest() {
44
+ const headers = {
45
+ Accept: "application/json",
46
+ };
47
+ console.error(`Fetching API docs from ${apiRoot}`);
48
+ try {
49
+ const response = await fetch(apiRoot, { headers });
50
+ if (!response.ok) {
51
+ throw new Error(`HTTP error! status: ${response.status}`);
52
+ }
53
+ return (await response.json());
54
+ }
55
+ catch (error) {
56
+ console.error("Error making request:", error);
57
+ return null;
58
+ }
59
+ }
60
+ // Connect the server to the transport
61
+ async function main() {
62
+ try {
63
+ // Create a stdio transport
64
+ const transport = new stdio_js_1.StdioServerTransport();
65
+ // Connect the server to the transport
66
+ await server.connect(transport);
67
+ console.error("Flink API MCP server started successfully");
68
+ }
69
+ catch (error) {
70
+ console.error("Failed to start Flink API MCP server:", error);
71
+ process.exit(1);
72
+ }
73
+ }
74
+ // Start the server
75
+ main();
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@flink-app/mcp",
3
+ "version": "0.12.1-alpha.14",
4
+ "description": "MCP server/client to expose API docs and possibly other things to LLM",
5
+ "bin": {
6
+ "flink-mcp": "./dist/index.js"
7
+ },
8
+ "scripts": {
9
+ "test": "echo \"Error: no test specified\"",
10
+ "prepare": "npm run build",
11
+ "build": "tsc && chmod 755 dist/index.js",
12
+ "watch": "tsc-watch",
13
+ "clean": "rm -rf dist",
14
+ "prestart": "npm run build",
15
+ "start": "node dist/index.js"
16
+ },
17
+ "files": [
18
+ "dist/**/*",
19
+ "*.md"
20
+ ],
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
24
+ "author": "joel@frost.se",
25
+ "license": "MIT",
26
+ "types": "dist/index.d.ts",
27
+ "main": "dist/index.js",
28
+ "devDependencies": {
29
+ "@types/node": "22.13.10",
30
+ "typescript": "5.4.5"
31
+ },
32
+ "dependencies": {
33
+ "@modelcontextprotocol/sdk": "^1.11.0"
34
+ },
35
+ "gitHead": "088dc1862f0ba1210340e4eda5c2e0038ec3cff9"
36
+ }