@managebetcodes/mcp 0.0.0-stage → 1.0.0
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 +21 -0
- package/README.md +58 -2
- package/dist/catalog.d.ts +31 -0
- package/dist/catalog.js +746 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.js +42 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2 -0
- package/dist/server.d.ts +35 -0
- package/dist/server.js +634 -0
- package/package.json +51 -4
package/dist/cli.d.ts
ADDED
package/dist/cli.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/** stdio entry point for @managebetcodes/mcp */
|
|
3
|
+
import { McpServer } from "./server.js";
|
|
4
|
+
function main() {
|
|
5
|
+
const server = new McpServer();
|
|
6
|
+
let buffer = "";
|
|
7
|
+
process.stdin.setEncoding("utf8");
|
|
8
|
+
process.stdin.on("data", (chunk) => {
|
|
9
|
+
buffer += chunk;
|
|
10
|
+
let newlineIndex = buffer.indexOf("\n");
|
|
11
|
+
while (newlineIndex !== -1) {
|
|
12
|
+
const line = buffer.slice(0, newlineIndex).trim();
|
|
13
|
+
buffer = buffer.slice(newlineIndex + 1);
|
|
14
|
+
newlineIndex = buffer.indexOf("\n");
|
|
15
|
+
if (!line)
|
|
16
|
+
continue;
|
|
17
|
+
let parsed;
|
|
18
|
+
try {
|
|
19
|
+
parsed = JSON.parse(line);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
process.stdout.write(JSON.stringify({
|
|
23
|
+
jsonrpc: "2.0",
|
|
24
|
+
id: null,
|
|
25
|
+
error: { code: -32700, message: "Parse error" },
|
|
26
|
+
}) + "\n");
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
server
|
|
30
|
+
.handleMessage(parsed)
|
|
31
|
+
.then((response) => {
|
|
32
|
+
if (response !== null) {
|
|
33
|
+
process.stdout.write(JSON.stringify(response) + "\n");
|
|
34
|
+
}
|
|
35
|
+
})
|
|
36
|
+
.catch((err) => {
|
|
37
|
+
process.stderr.write(`[managebetcodes-mcp] unhandled error: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
main();
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { MCP_PROMPTS, MCP_RESOURCES, MCP_TOOLS, } from "./catalog.js";
|
|
2
|
+
export type { McpPromptDefinition, McpResourceDefinition, McpToolDefinition, } from "./catalog.js";
|
|
3
|
+
export { BASE_URL, McpServer, SERVER_NAME, VERSION, } from "./server.js";
|
|
4
|
+
export type { JsonRpcRequest, JsonRpcResponse, McpServerOptions, } from "./server.js";
|
package/dist/index.js
ADDED
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export declare const VERSION = "1.0.0";
|
|
2
|
+
export declare const BASE_URL = "https://api.managebetcodes.app/v1";
|
|
3
|
+
export declare const SERVER_NAME = "managebetcodes-mcp";
|
|
4
|
+
export interface McpServerOptions {
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
baseUrl?: string;
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
}
|
|
9
|
+
export interface JsonRpcRequest {
|
|
10
|
+
jsonrpc: "2.0";
|
|
11
|
+
id?: string | number | null;
|
|
12
|
+
method: string;
|
|
13
|
+
params?: Record<string, unknown>;
|
|
14
|
+
}
|
|
15
|
+
export interface JsonRpcResponse {
|
|
16
|
+
jsonrpc: "2.0";
|
|
17
|
+
id: string | number | null;
|
|
18
|
+
result?: unknown;
|
|
19
|
+
error?: {
|
|
20
|
+
code: number;
|
|
21
|
+
message: string;
|
|
22
|
+
data?: unknown;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare class McpServer {
|
|
26
|
+
readonly baseUrl: string;
|
|
27
|
+
private readonly apiKey;
|
|
28
|
+
private readonly timeoutMs;
|
|
29
|
+
constructor(options?: McpServerOptions);
|
|
30
|
+
private apiRequest;
|
|
31
|
+
private callTool;
|
|
32
|
+
private readResource;
|
|
33
|
+
private getPrompt;
|
|
34
|
+
handleMessage(msg: JsonRpcRequest): Promise<JsonRpcResponse | null>;
|
|
35
|
+
}
|