@0xmonaco/mcp-server 0.1.1 → 0.1.5

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/CHANGELOG.md CHANGED
@@ -1,19 +1,13 @@
1
1
  # @0xmonaco/mcp-server
2
2
 
3
- ## 0.1.1
3
+ ## 0.1.5
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - ce9ff98: Initial 0.1.0 release - Early development version
8
-
9
- ## 2.0.0
10
-
11
- ### Documentation Updates
7
+ - 5afd153: Release v0.1.5
12
8
 
13
- - Updated package information and dependencies
14
-
15
- ## 1.0.0
9
+ ## 0.1.1
16
10
 
17
- ### Major Changes
11
+ ### Patch Changes
18
12
 
19
- - 82a856a: Initial release
13
+ - ce9ff98: Initial 0.1.0 release - Early development version
package/bin/cli.js CHANGED
@@ -1,46 +1,49 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { fileURLToPath } from 'node:url';
4
- import { dirname, resolve } from 'node:path';
5
- import { spawn } from 'node:child_process';
6
- import { createRequire } from 'node:module';
3
+ import { fileURLToPath } from "node:url";
4
+ import { dirname, resolve } from "node:path";
5
+ import { spawn } from "node:child_process";
6
+ import { createRequire } from "node:module";
7
7
 
8
8
  const __filename = fileURLToPath(import.meta.url);
9
9
  const __dirname = dirname(__filename);
10
10
  const require = createRequire(import.meta.url);
11
11
 
12
12
  // Path to the main MCP server
13
- const scriptPath = resolve(__dirname, '../src/index.js');
13
+ const scriptPath = resolve(__dirname, "../src/index.js");
14
14
 
15
15
  try {
16
- // Check if the built files exist
17
- require.resolve(scriptPath);
18
-
19
- // Execute the server
20
- const server = spawn('node', [scriptPath], {
21
- stdio: 'inherit',
22
- shell: false
23
- });
24
-
25
- server.on('error', (err) => {
26
- console.error('Failed to start server:', err);
27
- process.exit(1);
28
- });
29
-
30
- // Handle clean shutdown
31
- const cleanup = () => {
32
- if (!server.killed) {
33
- server.kill();
34
- }
35
- };
36
-
37
- process.on('SIGINT', cleanup);
38
- process.on('SIGTERM', cleanup);
39
- process.on('exit', cleanup);
40
-
16
+ // Check if the built files exist
17
+ require.resolve(scriptPath);
18
+
19
+ // Execute the server
20
+ const server = spawn("node", [scriptPath], {
21
+ stdio: "inherit",
22
+ shell: false,
23
+ });
24
+
25
+ server.on("error", (err) => {
26
+ console.error("Failed to start server:", err);
27
+ process.exit(1);
28
+ });
29
+
30
+ // Handle clean shutdown
31
+ const cleanup = () => {
32
+ if (!server.killed) {
33
+ server.kill();
34
+ }
35
+ };
36
+
37
+ process.on("SIGINT", cleanup);
38
+ process.on("SIGTERM", cleanup);
39
+ process.on("exit", cleanup);
41
40
  } catch (error) {
42
- console.error('Error: Server files not found. The package may not be built correctly.');
43
- console.error('Please try reinstalling the package or contact the maintainers.');
44
- console.error(error);
45
- process.exit(1);
46
- }
41
+ console.error(
42
+ "Error: Server files not found. The package may not be built correctly.",
43
+ );
44
+ console.error(
45
+ "Please try reinstalling the package or contact the maintainers.",
46
+ );
47
+ console.error(error);
48
+ process.exit(1);
49
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xmonaco/mcp-server",
3
- "version": "0.1.1",
3
+ "version": "0.1.5",
4
4
  "type": "module",
5
5
  "description": "MCP server for the Monaco documentation",
6
6
  "engines": {
package/src/connect.js CHANGED
@@ -1,41 +1,41 @@
1
1
  var __awaiter =
2
- (this && this.__awaiter) ||
3
- function (thisArg, _arguments, P, generator) {
4
- function adopt(value) {
5
- return value instanceof P
6
- ? value
7
- : new P(function (resolve) {
8
- resolve(value);
9
- });
10
- }
11
- return new (P || (P = Promise))(function (resolve, reject) {
12
- function fulfilled(value) {
13
- try {
14
- step(generator.next(value));
15
- } catch (e) {
16
- reject(e);
17
- }
18
- }
19
- function rejected(value) {
20
- try {
21
- step(generator["throw"](value));
22
- } catch (e) {
23
- reject(e);
24
- }
25
- }
26
- function step(result) {
27
- result.done
28
- ? resolve(result.value)
29
- : adopt(result.value).then(fulfilled, rejected);
30
- }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
2
+ (this && this.__awaiter) ||
3
+ function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P
6
+ ? value
7
+ : new P(function (resolve) {
8
+ resolve(value);
9
+ });
10
+ }
11
+ return new (P || (P = Promise))(function (resolve, reject) {
12
+ function fulfilled(value) {
13
+ try {
14
+ step(generator.next(value));
15
+ } catch (e) {
16
+ reject(e);
17
+ }
18
+ }
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+ function step(result) {
27
+ result.done
28
+ ? resolve(result.value)
29
+ : adopt(result.value).then(fulfilled, rejected);
30
+ }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
34
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
35
35
  export function connectServer(server) {
36
- return __awaiter(this, void 0, void 0, function* () {
37
- const transport = new StdioServerTransport();
38
- yield server.connect(transport);
39
- console.error("MCP Server running on stdio");
40
- });
36
+ return __awaiter(this, void 0, void 0, function* () {
37
+ const transport = new StdioServerTransport();
38
+ yield server.connect(transport);
39
+ console.error("MCP Server running on stdio");
40
+ });
41
41
  }
package/src/index.js CHANGED
@@ -1,50 +1,50 @@
1
1
  var __awaiter =
2
- (this && this.__awaiter) ||
3
- function (thisArg, _arguments, P, generator) {
4
- function adopt(value) {
5
- return value instanceof P
6
- ? value
7
- : new P(function (resolve) {
8
- resolve(value);
9
- });
10
- }
11
- return new (P || (P = Promise))(function (resolve, reject) {
12
- function fulfilled(value) {
13
- try {
14
- step(generator.next(value));
15
- } catch (e) {
16
- reject(e);
17
- }
18
- }
19
- function rejected(value) {
20
- try {
21
- step(generator["throw"](value));
22
- } catch (e) {
23
- reject(e);
24
- }
25
- }
26
- function step(result) {
27
- result.done
28
- ? resolve(result.value)
29
- : adopt(result.value).then(fulfilled, rejected);
30
- }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
2
+ (this && this.__awaiter) ||
3
+ function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P
6
+ ? value
7
+ : new P(function (resolve) {
8
+ resolve(value);
9
+ });
10
+ }
11
+ return new (P || (P = Promise))(function (resolve, reject) {
12
+ function fulfilled(value) {
13
+ try {
14
+ step(generator.next(value));
15
+ } catch (e) {
16
+ reject(e);
17
+ }
18
+ }
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+ function step(result) {
27
+ result.done
28
+ ? resolve(result.value)
29
+ : adopt(result.value).then(fulfilled, rejected);
30
+ }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
34
  import { connectServer } from "./connect.js";
35
35
  import { initialize } from "./initialize.js";
36
36
  import { createSearchTool } from "./search.js";
37
37
  import { createTools } from "./tools/index.js";
38
38
  function main() {
39
- return __awaiter(this, void 0, void 0, function* () {
40
- const server = initialize();
41
- const existingTools = new Set();
42
- yield createSearchTool(server);
43
- yield createTools(server, existingTools);
44
- yield connectServer(server);
45
- });
39
+ return __awaiter(this, void 0, void 0, function* () {
40
+ const server = initialize();
41
+ const existingTools = new Set();
42
+ yield createSearchTool(server);
43
+ yield createTools(server, existingTools);
44
+ yield connectServer(server);
45
+ });
46
46
  }
47
47
  main().catch((error) => {
48
- console.error("Fatal error in trying to initialize MCP server: ", error);
49
- process.exit(1);
48
+ console.error("Fatal error in trying to initialize MCP server: ", error);
49
+ process.exit(1);
50
50
  });
package/src/initialize.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { SERVER_NAME, SERVER_VERSION } from "../settings.js";
3
3
  export function initialize() {
4
- console.error("Initializing MCP Server...");
5
- const server = new McpServer({
6
- name: SERVER_NAME,
7
- version: SERVER_VERSION,
8
- });
9
- return server;
4
+ console.error("Initializing MCP Server...");
5
+ const server = new McpServer({
6
+ name: SERVER_NAME,
7
+ version: SERVER_VERSION,
8
+ });
9
+ return server;
10
10
  }
package/src/search.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
2
  import { InitializationConfiguration } from "./types.js";
3
3
  export declare function fetchSearchConfigurationAndTools(
4
- subdomain: string,
4
+ subdomain: string,
5
5
  ): Promise<InitializationConfiguration>;
6
6
  export declare function createSearchTool(server: McpServer): Promise<void>;
package/src/search.js CHANGED
@@ -1,36 +1,36 @@
1
1
  var __awaiter =
2
- (this && this.__awaiter) ||
3
- function (thisArg, _arguments, P, generator) {
4
- function adopt(value) {
5
- return value instanceof P
6
- ? value
7
- : new P(function (resolve) {
8
- resolve(value);
9
- });
10
- }
11
- return new (P || (P = Promise))(function (resolve, reject) {
12
- function fulfilled(value) {
13
- try {
14
- step(generator.next(value));
15
- } catch (e) {
16
- reject(e);
17
- }
18
- }
19
- function rejected(value) {
20
- try {
21
- step(generator["throw"](value));
22
- } catch (e) {
23
- reject(e);
24
- }
25
- }
26
- function step(result) {
27
- result.done
28
- ? resolve(result.value)
29
- : adopt(result.value).then(fulfilled, rejected);
30
- }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
2
+ (this && this.__awaiter) ||
3
+ function (thisArg, _arguments, P, generator) {
4
+ function adopt(value) {
5
+ return value instanceof P
6
+ ? value
7
+ : new P(function (resolve) {
8
+ resolve(value);
9
+ });
10
+ }
11
+ return new (P || (P = Promise))(function (resolve, reject) {
12
+ function fulfilled(value) {
13
+ try {
14
+ step(generator.next(value));
15
+ } catch (e) {
16
+ reject(e);
17
+ }
18
+ }
19
+ function rejected(value) {
20
+ try {
21
+ step(generator["throw"](value));
22
+ } catch (e) {
23
+ reject(e);
24
+ }
25
+ }
26
+ function step(result) {
27
+ result.done
28
+ ? resolve(result.value)
29
+ : adopt(result.value).then(fulfilled, rejected);
30
+ }
31
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
32
+ });
33
+ };
34
34
  import axios from "axios";
35
35
  import { TrieveSDK } from "trieve-ts-sdk";
36
36
  import { z } from "zod";
@@ -39,80 +39,80 @@ import { SERVER_URL } from "./config.readonly.js";
39
39
  import { formatErr, throwOnAxiosError } from "./utils.js";
40
40
  const DEFAULT_BASE_URL = "https://api.mintlifytrieve.com";
41
41
  export function fetchSearchConfigurationAndTools(subdomain) {
42
- return __awaiter(this, void 0, void 0, function* () {
43
- try {
44
- const response = yield axios.get(
45
- `${SERVER_URL}/api/mcp/config/${subdomain}`,
46
- {
47
- validateStatus() {
48
- return true;
49
- },
50
- },
51
- );
52
- throwOnAxiosError(response, "Failed to fetch MCP config");
53
- return response.data;
54
- } catch (err) {
55
- throw new Error(
56
- formatErr(err).replace(
57
- "Request failed with status code 404",
58
- `${subdomain} not found`,
59
- ),
60
- );
61
- }
62
- });
42
+ return __awaiter(this, void 0, void 0, function* () {
43
+ try {
44
+ const response = yield axios.get(
45
+ `${SERVER_URL}/api/mcp/config/${subdomain}`,
46
+ {
47
+ validateStatus() {
48
+ return true;
49
+ },
50
+ },
51
+ );
52
+ throwOnAxiosError(response, "Failed to fetch MCP config");
53
+ return response.data;
54
+ } catch (err) {
55
+ throw new Error(
56
+ formatErr(err).replace(
57
+ "Request failed with status code 404",
58
+ `${subdomain} not found`,
59
+ ),
60
+ );
61
+ }
62
+ });
63
63
  }
64
64
  function search(query, config) {
65
- return __awaiter(this, void 0, void 0, function* () {
66
- const trieve = new TrieveSDK({
67
- apiKey: config.trieveApiKey,
68
- datasetId: config.trieveDatasetId,
69
- baseUrl: DEFAULT_BASE_URL,
70
- });
71
- const data = yield trieve.autocomplete({
72
- page_size: 10,
73
- query,
74
- search_type: "fulltext",
75
- extend_results: true,
76
- score_threshold: 1,
77
- });
78
- if (data.chunks === undefined || data.chunks.length === 0) {
79
- throw new Error("No results found");
80
- }
81
- return data.chunks.map((result) => {
82
- const { chunk } = result;
83
- // TODO: Append custom domain to the link
84
- return {
85
- title: chunk.metadata.title,
86
- content: chunk.chunk_html,
87
- link: chunk.link,
88
- };
89
- });
90
- });
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const trieve = new TrieveSDK({
67
+ apiKey: config.trieveApiKey,
68
+ datasetId: config.trieveDatasetId,
69
+ baseUrl: DEFAULT_BASE_URL,
70
+ });
71
+ const data = yield trieve.autocomplete({
72
+ page_size: 10,
73
+ query,
74
+ search_type: "fulltext",
75
+ extend_results: true,
76
+ score_threshold: 1,
77
+ });
78
+ if (data.chunks === undefined || data.chunks.length === 0) {
79
+ throw new Error("No results found");
80
+ }
81
+ return data.chunks.map((result) => {
82
+ const { chunk } = result;
83
+ // TODO: Append custom domain to the link
84
+ return {
85
+ title: chunk.metadata.title,
86
+ content: chunk.chunk_html,
87
+ link: chunk.link,
88
+ };
89
+ });
90
+ });
91
91
  }
92
92
  export function createSearchTool(server) {
93
- return __awaiter(this, void 0, void 0, function* () {
94
- const config = yield fetchSearchConfigurationAndTools(SUBDOMAIN);
95
- server.tool(
96
- "search",
97
- `Search across the ${config.name} documentation to fetch relevant context for a given query`,
98
- {
99
- query: z.string(),
100
- },
101
- (_a) =>
102
- __awaiter(this, [_a], void 0, function* ({ query }) {
103
- const results = yield search(query, config);
104
- const content = results.map((result) => {
105
- const { title, content, link } = result;
106
- const text = `Title: ${title}\nContent: ${content}\nLink: ${link}`;
107
- return {
108
- type: "text",
109
- text,
110
- };
111
- });
112
- return {
113
- content,
114
- };
115
- }),
116
- );
117
- });
93
+ return __awaiter(this, void 0, void 0, function* () {
94
+ const config = yield fetchSearchConfigurationAndTools(SUBDOMAIN);
95
+ server.tool(
96
+ "search",
97
+ `Search across the ${config.name} documentation to fetch relevant context for a given query`,
98
+ {
99
+ query: z.string(),
100
+ },
101
+ (_a) =>
102
+ __awaiter(this, [_a], void 0, function* ({ query }) {
103
+ const results = yield search(query, config);
104
+ const content = results.map((result) => {
105
+ const { title, content, link } = result;
106
+ const text = `Title: ${title}\nContent: ${content}\nLink: ${link}`;
107
+ return {
108
+ type: "text",
109
+ text,
110
+ };
111
+ });
112
+ return {
113
+ content,
114
+ };
115
+ }),
116
+ );
117
+ });
118
118
  }
@@ -7,39 +7,39 @@ import { ServerParams, ToolWithEndpoint } from "../types.js";
7
7
  import { NestedRecord, SimpleRecord } from "../utils.js";
8
8
  export declare function convertStrToTitle(str: string): string;
9
9
  export declare function findNextIteration(
10
- set: Set<string>,
11
- str: string,
10
+ set: Set<string>,
11
+ str: string,
12
12
  ): number;
13
13
  export declare function getMcpEnabledEndpointsFromOpenApiSpec(
14
- spec: OpenAPI.Document,
14
+ spec: OpenAPI.Document,
15
15
  ): Endpoint<DataSchemaArray>[];
16
16
  export declare function convertEndpointToTool(
17
- endpoint: Endpoint<DataSchemaArray>,
17
+ endpoint: Endpoint<DataSchemaArray>,
18
18
  ): Omit<Tool, "inputSchema">;
19
19
  export declare function getMcpToolsAndEndpointsFromOpenApiSpec(
20
- spec: OpenAPI.Document,
20
+ spec: OpenAPI.Document,
21
21
  ): ToolWithEndpoint[];
22
22
  export declare function getEndpointsFromOpenApi(
23
- specification: OpenAPI.Document,
23
+ specification: OpenAPI.Document,
24
24
  ): Endpoint<DataSchemaArray>[];
25
25
  export declare function loadEnv(key: string): SimpleRecord;
26
26
  export declare function convertSecurityParameterSection(
27
- securityParameters: SecurityParameterGroup,
28
- envVariables: SimpleRecord,
29
- location: string,
27
+ securityParameters: SecurityParameterGroup,
28
+ envVariables: SimpleRecord,
29
+ location: string,
30
30
  ): {
31
- key: string;
32
- value: NestedRecord | undefined;
31
+ key: string;
32
+ value: NestedRecord | undefined;
33
33
  }[];
34
34
  export declare function convertEndpointToCategorizedZod(
35
- envKey: string,
36
- endpoint: Endpoint,
35
+ envKey: string,
36
+ endpoint: Endpoint,
37
37
  ): {
38
- url: string;
39
- method: HttpMethod;
40
- paths: ServerParams;
41
- queries: ServerParams;
42
- body: ServerParams | undefined;
43
- headers: ServerParams;
44
- cookies: ServerParams;
38
+ url: string;
39
+ method: HttpMethod;
40
+ paths: ServerParams;
41
+ queries: ServerParams;
42
+ body: ServerParams | undefined;
43
+ headers: ServerParams;
44
+ cookies: ServerParams;
45
45
  };