@0xmonaco/mcp-server 0.5.6 → 0.5.8
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/README.md +142 -0
- package/dist/bin.js +119 -0
- package/package.json +24 -12
- package/CHANGELOG.md +0 -55
- package/bin/cli.js +0 -49
- package/settings.d.ts +0 -2
- package/settings.js +0 -2
- package/src/config.readonly.d.ts +0 -2
- package/src/config.readonly.js +0 -3
- package/src/connect.d.ts +0 -2
- package/src/connect.js +0 -41
- package/src/index.d.ts +0 -1
- package/src/index.js +0 -50
- package/src/initialize.d.ts +0 -2
- package/src/initialize.js +0 -10
- package/src/search.d.ts +0 -4
- package/src/search.js +0 -118
- package/src/tools/helpers.d.ts +0 -32
- package/src/tools/helpers.js +0 -278
- package/src/tools/index.d.ts +0 -2
- package/src/tools/index.js +0 -185
- package/src/tools/zod.d.ts +0 -5
- package/src/tools/zod.js +0 -207
- package/src/tools.json +0 -8
- package/src/utils.d.ts +0 -12
- package/src/utils.js +0 -61
package/package.json
CHANGED
|
@@ -1,28 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@0xmonaco/mcp-server",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/Monaco-Research/monaco-sdk.git",
|
|
8
8
|
"directory": "packages/mcp-server"
|
|
9
9
|
},
|
|
10
|
-
"description": "MCP server for the Monaco
|
|
10
|
+
"description": "MCP server for the Monaco SDK",
|
|
11
11
|
"engines": {
|
|
12
|
-
"node": ">=18
|
|
12
|
+
"node": ">=18"
|
|
13
13
|
},
|
|
14
|
-
"bin": "./bin
|
|
15
|
-
"
|
|
14
|
+
"bin": "./dist/bin.js",
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
16
18
|
"scripts": {
|
|
17
|
-
"
|
|
19
|
+
"build": "bun build src/bin.ts --outdir dist --target node --format esm --minify",
|
|
20
|
+
"dev": "bun --watch src/bin.ts",
|
|
21
|
+
"start": "bun dist/bin.js",
|
|
22
|
+
"clean": "rm -rf dist",
|
|
23
|
+
"lint": "biome lint .",
|
|
24
|
+
"test": "bun test"
|
|
18
25
|
},
|
|
19
26
|
"author": "@codebycarson",
|
|
20
27
|
"dependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"@
|
|
23
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
28
|
+
"@0xmonaco/core": "*",
|
|
29
|
+
"@0xmonaco/types": "*",
|
|
30
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
31
|
+
"node-fetch": "^3.3.2",
|
|
32
|
+
"viem": "^2.45.2",
|
|
33
|
+
"ws": "^8.19.0",
|
|
34
|
+
"zod": "^4.0.0"
|
|
35
|
+
},
|
|
36
|
+
"devDependencies": {
|
|
37
|
+
"@types/bun": "latest",
|
|
38
|
+
"@types/ws": "^8.18.1"
|
|
27
39
|
}
|
|
28
40
|
}
|
package/CHANGELOG.md
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
# @0xmonaco/mcp-server
|
|
2
|
-
|
|
3
|
-
## 0.5.6
|
|
4
|
-
|
|
5
|
-
## 0.5.5
|
|
6
|
-
|
|
7
|
-
## 0.5.4
|
|
8
|
-
|
|
9
|
-
## 0.5.3
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- a0163e3: chore: add auto-connect flag for authenticated ws channels
|
|
14
|
-
|
|
15
|
-
## 0.5.2
|
|
16
|
-
|
|
17
|
-
## 0.5.1
|
|
18
|
-
|
|
19
|
-
## 0.5.0
|
|
20
|
-
|
|
21
|
-
### Minor Changes
|
|
22
|
-
|
|
23
|
-
- 529e401: Refactor vault deposit/withdraw to use asset IDs
|
|
24
|
-
|
|
25
|
-
### Patch Changes
|
|
26
|
-
|
|
27
|
-
- d8fd27c: Switch balances query to use asset id rather than token contract address.
|
|
28
|
-
|
|
29
|
-
## 0.4.2
|
|
30
|
-
|
|
31
|
-
### Patch Changes
|
|
32
|
-
|
|
33
|
-
- c7c9b97: Orderbook websocket updates + websocket class removal in favor of functional websockets
|
|
34
|
-
|
|
35
|
-
## 0.4.1
|
|
36
|
-
|
|
37
|
-
## 0.4.0
|
|
38
|
-
|
|
39
|
-
## 0.3.2
|
|
40
|
-
|
|
41
|
-
## 0.3.1
|
|
42
|
-
|
|
43
|
-
## 0.3.0
|
|
44
|
-
|
|
45
|
-
## 0.1.5
|
|
46
|
-
|
|
47
|
-
### Patch Changes
|
|
48
|
-
|
|
49
|
-
- 5afd153: Release v0.1.5
|
|
50
|
-
|
|
51
|
-
## 0.1.1
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- ce9ff98: Initial 0.1.0 release - Early development version
|
package/bin/cli.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
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";
|
|
7
|
-
|
|
8
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
9
|
-
const __dirname = dirname(__filename);
|
|
10
|
-
const require = createRequire(import.meta.url);
|
|
11
|
-
|
|
12
|
-
// Path to the main MCP server
|
|
13
|
-
const scriptPath = resolve(__dirname, "../src/index.js");
|
|
14
|
-
|
|
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
|
-
} catch (error) {
|
|
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/settings.d.ts
DELETED
package/settings.js
DELETED
package/src/config.readonly.d.ts
DELETED
package/src/config.readonly.js
DELETED
package/src/connect.d.ts
DELETED
package/src/connect.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
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
|
-
};
|
|
34
|
-
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio";
|
|
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
|
-
});
|
|
41
|
-
}
|
package/src/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/src/index.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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
|
-
};
|
|
34
|
-
import { connectServer } from "./connect";
|
|
35
|
-
import { initialize } from "./initialize";
|
|
36
|
-
import { createSearchTool } from "./search";
|
|
37
|
-
import { createTools } from "./tools";
|
|
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
|
-
});
|
|
46
|
-
}
|
|
47
|
-
main().catch((error) => {
|
|
48
|
-
console.error("Fatal error in trying to initialize MCP server: ", error);
|
|
49
|
-
process.exit(1);
|
|
50
|
-
});
|
package/src/initialize.d.ts
DELETED
package/src/initialize.js
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
|
|
2
|
-
import { SERVER_NAME, SERVER_VERSION } from "../settings";
|
|
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;
|
|
10
|
-
}
|
package/src/search.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp";
|
|
2
|
-
import type { InitializationConfiguration } from "./types";
|
|
3
|
-
export declare function fetchSearchConfigurationAndTools(subdomain: string): Promise<InitializationConfiguration>;
|
|
4
|
-
export declare function createSearchTool(server: McpServer): Promise<void>;
|
package/src/search.js
DELETED
|
@@ -1,118 +0,0 @@
|
|
|
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
|
-
};
|
|
34
|
-
import axios from "axios";
|
|
35
|
-
import { TrieveSDK } from "trieve-ts-sdk";
|
|
36
|
-
import { z } from "zod";
|
|
37
|
-
import { SUBDOMAIN } from "./config.readonly";
|
|
38
|
-
import { SERVER_URL } from "./config.readonly";
|
|
39
|
-
import { formatErr, throwOnAxiosError } from "./utils";
|
|
40
|
-
const DEFAULT_BASE_URL = "https://api.mintlifytrieve.com";
|
|
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
|
-
});
|
|
63
|
-
}
|
|
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
|
-
});
|
|
91
|
-
}
|
|
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
|
-
});
|
|
118
|
-
}
|
package/src/tools/helpers.d.ts
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import type { OpenAPI } from "@mintlify/openapi-types";
|
|
2
|
-
import type { DataSchemaArray, Endpoint, HttpMethod, SecurityParameterGroup } from "@mintlify/validation";
|
|
3
|
-
import type { Tool } from "@modelcontextprotocol/sdk/types";
|
|
4
|
-
import type { ServerParams, ToolWithEndpoint } from "../types";
|
|
5
|
-
import type { NestedRecord, SimpleRecord } from "../utils";
|
|
6
|
-
export declare function convertStrToTitle(str: string): string;
|
|
7
|
-
export declare function findNextIteration(set: Set<string>, str: string): number;
|
|
8
|
-
export declare function getMcpEnabledEndpointsFromOpenApiSpec(spec: OpenAPI.Document): Endpoint<DataSchemaArray>[];
|
|
9
|
-
export declare function convertEndpointToTool(endpoint: Endpoint<DataSchemaArray>): Omit<Tool, "inputSchema">;
|
|
10
|
-
export declare function getMcpToolsAndEndpointsFromOpenApiSpec(spec: OpenAPI.Document): ToolWithEndpoint[];
|
|
11
|
-
export declare function getEndpointsFromOpenApi(specification: OpenAPI.Document): Endpoint<DataSchemaArray>[];
|
|
12
|
-
export declare function loadEnv(key: string): SimpleRecord;
|
|
13
|
-
export declare function convertSecurityParameterSection(
|
|
14
|
-
securityParameters: SecurityParameterGroup,
|
|
15
|
-
envVariables: SimpleRecord,
|
|
16
|
-
location: string,
|
|
17
|
-
): {
|
|
18
|
-
key: string;
|
|
19
|
-
value: NestedRecord | undefined;
|
|
20
|
-
}[];
|
|
21
|
-
export declare function convertEndpointToCategorizedZod(
|
|
22
|
-
envKey: string,
|
|
23
|
-
endpoint: Endpoint,
|
|
24
|
-
): {
|
|
25
|
-
url: string;
|
|
26
|
-
method: HttpMethod;
|
|
27
|
-
paths: ServerParams;
|
|
28
|
-
queries: ServerParams;
|
|
29
|
-
body: ServerParams | undefined;
|
|
30
|
-
headers: ServerParams;
|
|
31
|
-
cookies: ServerParams;
|
|
32
|
-
};
|