puseletso55 commited on
Commit
7f13f59
·
verified ·
1 Parent(s): 86b62d8

Create mcpClient.js

Browse files
Files changed (1) hide show
  1. tools/mcpClient.js +18 -0
tools/mcpClient.js ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ // mcpClient.js
2
+ export async function callMCP(method, params = {}) {
3
+ const response = await fetch("http://localhost:7860", {
4
+ method: "POST",
5
+ headers: {
6
+ "Content-Type": "application/json"
7
+ },
8
+ body: JSON.stringify({
9
+ jsonrpc: "2.0",
10
+ method,
11
+ params,
12
+ id: 1
13
+ })
14
+ });
15
+
16
+ const result = await response.json();
17
+ return result.result || result.error;
18
+ }