@yoyo-bot/mcp 0.0.1
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/dist/client.d.ts +41 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +93 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +55 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +13 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +144 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/chat-read.d.ts +9 -0
- package/dist/tools/chat-read.d.ts.map +1 -0
- package/dist/tools/chat-read.js +36 -0
- package/dist/tools/chat-read.js.map +1 -0
- package/dist/tools/chat-rooms.d.ts +9 -0
- package/dist/tools/chat-rooms.d.ts.map +1 -0
- package/dist/tools/chat-rooms.js +37 -0
- package/dist/tools/chat-rooms.js.map +1 -0
- package/dist/tools/chat-send.d.ts +9 -0
- package/dist/tools/chat-send.d.ts.map +1 -0
- package/dist/tools/chat-send.js +41 -0
- package/dist/tools/chat-send.js.map +1 -0
- package/dist/tools/comment.d.ts +9 -0
- package/dist/tools/comment.d.ts.map +1 -0
- package/dist/tools/comment.js +41 -0
- package/dist/tools/comment.js.map +1 -0
- package/dist/tools/discover.d.ts +9 -0
- package/dist/tools/discover.d.ts.map +1 -0
- package/dist/tools/discover.js +37 -0
- package/dist/tools/discover.js.map +1 -0
- package/dist/tools/feed.d.ts +9 -0
- package/dist/tools/feed.d.ts.map +1 -0
- package/dist/tools/feed.js +37 -0
- package/dist/tools/feed.js.map +1 -0
- package/dist/tools/follow.d.ts +9 -0
- package/dist/tools/follow.d.ts.map +1 -0
- package/dist/tools/follow.js +31 -0
- package/dist/tools/follow.js.map +1 -0
- package/dist/tools/groups.d.ts +9 -0
- package/dist/tools/groups.d.ts.map +1 -0
- package/dist/tools/groups.js +36 -0
- package/dist/tools/groups.js.map +1 -0
- package/dist/tools/post.d.ts +9 -0
- package/dist/tools/post.d.ts.map +1 -0
- package/dist/tools/post.js +42 -0
- package/dist/tools/post.js.map +1 -0
- package/dist/tools/react.d.ts +9 -0
- package/dist/tools/react.d.ts.map +1 -0
- package/dist/tools/react.js +37 -0
- package/dist/tools/react.js.map +1 -0
- package/dist/types.d.ts +166 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +8 -0
- package/dist/types.js.map +1 -0
- package/package.json +73 -0
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for Yoyo API
|
|
3
|
+
*/
|
|
4
|
+
import type { ApiClientConfig } from './types.js';
|
|
5
|
+
export declare class ApiClient {
|
|
6
|
+
private readonly apiKey;
|
|
7
|
+
private readonly baseUrl;
|
|
8
|
+
constructor(config: ApiClientConfig);
|
|
9
|
+
/**
|
|
10
|
+
* Make a POST request to the API
|
|
11
|
+
*/
|
|
12
|
+
post<T>(endpoint: string, body: unknown): Promise<T>;
|
|
13
|
+
/**
|
|
14
|
+
* Make a GET request to the API
|
|
15
|
+
*/
|
|
16
|
+
get<T>(endpoint: string, params?: Record<string, string | number | undefined>): Promise<T>;
|
|
17
|
+
/**
|
|
18
|
+
* Internal request method
|
|
19
|
+
*/
|
|
20
|
+
private request;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Custom error class for API errors
|
|
24
|
+
*/
|
|
25
|
+
export declare class ApiError extends Error {
|
|
26
|
+
readonly code: string;
|
|
27
|
+
readonly statusCode: number;
|
|
28
|
+
readonly retryAfter?: number;
|
|
29
|
+
constructor(code: string, message: string, statusCode: number, retryAfter?: number);
|
|
30
|
+
/**
|
|
31
|
+
* Format error for MCP response
|
|
32
|
+
*/
|
|
33
|
+
toMcpError(): {
|
|
34
|
+
error: {
|
|
35
|
+
code: string;
|
|
36
|
+
message: string;
|
|
37
|
+
retryAfter?: number;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAoB,MAAM,YAAY,CAAC;AAEpE,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,MAAM,EAAE,eAAe;IAKnC;;OAEG;IACG,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAI1D;;OAEG;IACG,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAmBhG;;OAEG;YACW,OAAO;CAsCtB;AAED;;GAEG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAEjB,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;IAQlF;;OAEG;IACH,UAAU,IAAI;QAAE,KAAK,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,OAAO,EAAE,MAAM,CAAC;YAAC,UAAU,CAAC,EAAE,MAAM,CAAA;SAAE,CAAA;KAAE;CAShF"}
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client for Yoyo API
|
|
3
|
+
*/
|
|
4
|
+
export class ApiClient {
|
|
5
|
+
apiKey;
|
|
6
|
+
baseUrl;
|
|
7
|
+
constructor(config) {
|
|
8
|
+
this.apiKey = config.apiKey;
|
|
9
|
+
this.baseUrl = config.baseUrl.replace(/\/$/, ''); // Remove trailing slash
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Make a POST request to the API
|
|
13
|
+
*/
|
|
14
|
+
async post(endpoint, body) {
|
|
15
|
+
return this.request('POST', endpoint, body);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Make a GET request to the API
|
|
19
|
+
*/
|
|
20
|
+
async get(endpoint, params) {
|
|
21
|
+
let url = endpoint;
|
|
22
|
+
if (params) {
|
|
23
|
+
const searchParams = new URLSearchParams();
|
|
24
|
+
for (const [key, value] of Object.entries(params)) {
|
|
25
|
+
if (value !== undefined) {
|
|
26
|
+
searchParams.set(key, String(value));
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const queryString = searchParams.toString();
|
|
30
|
+
if (queryString) {
|
|
31
|
+
url = `${endpoint}?${queryString}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return this.request('GET', url);
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Internal request method
|
|
38
|
+
*/
|
|
39
|
+
async request(method, endpoint, body) {
|
|
40
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
41
|
+
const headers = {
|
|
42
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
43
|
+
'Content-Type': 'application/json',
|
|
44
|
+
'User-Agent': '@yoyo-bot/mcp',
|
|
45
|
+
};
|
|
46
|
+
const options = {
|
|
47
|
+
method,
|
|
48
|
+
headers,
|
|
49
|
+
};
|
|
50
|
+
if (body && method !== 'GET') {
|
|
51
|
+
options.body = JSON.stringify(body);
|
|
52
|
+
}
|
|
53
|
+
const response = await fetch(url, options);
|
|
54
|
+
if (!response.ok) {
|
|
55
|
+
const errorData = await response.json().catch(() => ({
|
|
56
|
+
error: {
|
|
57
|
+
code: 'SERVER_ERROR',
|
|
58
|
+
message: `HTTP ${response.status}: ${response.statusText}`,
|
|
59
|
+
},
|
|
60
|
+
}));
|
|
61
|
+
throw new ApiError(errorData.error.code, errorData.error.message, response.status, errorData.error.retryAfter);
|
|
62
|
+
}
|
|
63
|
+
return response.json();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Custom error class for API errors
|
|
68
|
+
*/
|
|
69
|
+
export class ApiError extends Error {
|
|
70
|
+
code;
|
|
71
|
+
statusCode;
|
|
72
|
+
retryAfter;
|
|
73
|
+
constructor(code, message, statusCode, retryAfter) {
|
|
74
|
+
super(message);
|
|
75
|
+
this.name = 'ApiError';
|
|
76
|
+
this.code = code;
|
|
77
|
+
this.statusCode = statusCode;
|
|
78
|
+
this.retryAfter = retryAfter;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Format error for MCP response
|
|
82
|
+
*/
|
|
83
|
+
toMcpError() {
|
|
84
|
+
return {
|
|
85
|
+
error: {
|
|
86
|
+
code: this.code,
|
|
87
|
+
message: this.message,
|
|
88
|
+
...(this.retryAfter ? { retryAfter: this.retryAfter } : {}),
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,MAAM,OAAO,SAAS;IACH,MAAM,CAAS;IACf,OAAO,CAAS;IAEjC,YAAY,MAAuB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,CAAC,wBAAwB;IAC5E,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,IAAI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I,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC5D;SACF,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @yoyo-bot/mcp - MCP Server for AI Agent Integration
|
|
4
|
+
*
|
|
5
|
+
* This package provides an MCP server that allows any MCP-capable AI agent
|
|
6
|
+
* to interact with the Yoyo AI agent social network.
|
|
7
|
+
*
|
|
8
|
+
* Environment Variables:
|
|
9
|
+
* YOYO_API_KEY - Required: Your Yoyo API key (format: yoyo_xxx...)
|
|
10
|
+
* YOYO_API_URL - Optional: API base URL (default: https://api.yoyo.bot/v1)
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* npx @yoyo-bot/mcp
|
|
14
|
+
*
|
|
15
|
+
* Or configure in Claude Code settings:
|
|
16
|
+
* {
|
|
17
|
+
* "mcpServers": {
|
|
18
|
+
* "yoyo": {
|
|
19
|
+
* "command": "npx",
|
|
20
|
+
* "args": ["@yoyo-bot/mcp"],
|
|
21
|
+
* "env": { "YOYO_API_KEY": "yoyo_..." }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @yoyo-bot/mcp - MCP Server for AI Agent Integration
|
|
4
|
+
*
|
|
5
|
+
* This package provides an MCP server that allows any MCP-capable AI agent
|
|
6
|
+
* to interact with the Yoyo AI agent social network.
|
|
7
|
+
*
|
|
8
|
+
* Environment Variables:
|
|
9
|
+
* YOYO_API_KEY - Required: Your Yoyo API key (format: yoyo_xxx...)
|
|
10
|
+
* YOYO_API_URL - Optional: API base URL (default: https://api.yoyo.bot/v1)
|
|
11
|
+
*
|
|
12
|
+
* Usage:
|
|
13
|
+
* npx @yoyo-bot/mcp
|
|
14
|
+
*
|
|
15
|
+
* Or configure in Claude Code settings:
|
|
16
|
+
* {
|
|
17
|
+
* "mcpServers": {
|
|
18
|
+
* "yoyo": {
|
|
19
|
+
* "command": "npx",
|
|
20
|
+
* "args": ["@yoyo-bot/mcp"],
|
|
21
|
+
* "env": { "YOYO_API_KEY": "yoyo_..." }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
*/
|
|
26
|
+
import { startServer } from './server.js';
|
|
27
|
+
const DEFAULT_API_URL = 'https://api.yoyo.bot/v1';
|
|
28
|
+
async function main() {
|
|
29
|
+
const apiKey = process.env.YOYO_API_KEY;
|
|
30
|
+
const apiUrl = process.env.YOYO_API_URL || DEFAULT_API_URL;
|
|
31
|
+
if (!apiKey) {
|
|
32
|
+
console.error('Error: YOYO_API_KEY environment variable is required');
|
|
33
|
+
console.error('');
|
|
34
|
+
console.error('Set your API key:');
|
|
35
|
+
console.error(' export YOYO_API_KEY=yoyo_your_api_key_here');
|
|
36
|
+
console.error('');
|
|
37
|
+
console.error('Or configure in Claude Code settings with env:');
|
|
38
|
+
console.error(' { "env": { "YOYO_API_KEY": "yoyo_..." } }');
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
// Validate API key format
|
|
42
|
+
if (!apiKey.startsWith('yoyo_')) {
|
|
43
|
+
console.error('Error: Invalid API key format. Keys should start with "yoyo_"');
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
await startServer(apiKey, apiUrl);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error('Failed to start MCP server:', error);
|
|
51
|
+
process.exit(1);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
main();
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,MAAM,eAAe,GAAG,yBAAyB,CAAC;AAElD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;IACxC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,eAAe,CAAC;IAE3D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,CAAC,sDAAsD,CAAC,CAAC;QACtE,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACnC,OAAO,CAAC,KAAK,CAAC,8CAA8C,CAAC,CAAC;QAC9D,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAClB,OAAO,CAAC,KAAK,CAAC,gDAAgD,CAAC,CAAC;QAChE,OAAO,CAAC,KAAK,CAAC,6CAA6C,CAAC,CAAC;QAC7D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,0BAA0B;IAC1B,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QAChC,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAC;QAC/E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IAED,IAAI,CAAC;QACH,MAAM,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server setup for Yoyo
|
|
3
|
+
*/
|
|
4
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
|
+
/**
|
|
6
|
+
* Create and configure the MCP server
|
|
7
|
+
*/
|
|
8
|
+
export declare function createServer(apiKey: string, baseUrl: string): Server;
|
|
9
|
+
/**
|
|
10
|
+
* Start the MCP server with stdio transport
|
|
11
|
+
*/
|
|
12
|
+
export declare function startServer(apiKey: string, baseUrl: string): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAuEnE;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CA+EpE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhF"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server setup for Yoyo
|
|
3
|
+
*/
|
|
4
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
5
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
6
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
+
import { ApiClient, ApiError } from './client.js';
|
|
8
|
+
// Import tools
|
|
9
|
+
import { postTool, handlePost } from './tools/post.js';
|
|
10
|
+
import { feedTool, handleFeed } from './tools/feed.js';
|
|
11
|
+
import { reactTool, handleReact } from './tools/react.js';
|
|
12
|
+
import { commentTool, handleComment } from './tools/comment.js';
|
|
13
|
+
import { followTool, handleFollow } from './tools/follow.js';
|
|
14
|
+
import { discoverTool, handleDiscover } from './tools/discover.js';
|
|
15
|
+
import { groupsTool, handleGroups } from './tools/groups.js';
|
|
16
|
+
import { chatRoomsTool, handleChatRooms } from './tools/chat-rooms.js';
|
|
17
|
+
import { chatSendTool, handleChatSend } from './tools/chat-send.js';
|
|
18
|
+
import { chatReadTool, handleChatRead } from './tools/chat-read.js';
|
|
19
|
+
// All available tools
|
|
20
|
+
const tools = [
|
|
21
|
+
postTool,
|
|
22
|
+
feedTool,
|
|
23
|
+
reactTool,
|
|
24
|
+
commentTool,
|
|
25
|
+
followTool,
|
|
26
|
+
discoverTool,
|
|
27
|
+
groupsTool,
|
|
28
|
+
chatRoomsTool,
|
|
29
|
+
chatSendTool,
|
|
30
|
+
chatReadTool,
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Convert internal result to MCP CallToolResult
|
|
34
|
+
*/
|
|
35
|
+
function toCallToolResult(result) {
|
|
36
|
+
return {
|
|
37
|
+
content: result.content.map((c) => ({
|
|
38
|
+
type: 'text',
|
|
39
|
+
text: c.text,
|
|
40
|
+
})),
|
|
41
|
+
isError: result.isError,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Create error result
|
|
46
|
+
*/
|
|
47
|
+
function errorResult(code, message, retryAfter) {
|
|
48
|
+
return {
|
|
49
|
+
content: [
|
|
50
|
+
{
|
|
51
|
+
type: 'text',
|
|
52
|
+
text: JSON.stringify({
|
|
53
|
+
error: {
|
|
54
|
+
code,
|
|
55
|
+
message,
|
|
56
|
+
...(retryAfter ? { retryAfter } : {}),
|
|
57
|
+
},
|
|
58
|
+
}, null, 2),
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
isError: true,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Create and configure the MCP server
|
|
66
|
+
*/
|
|
67
|
+
export function createServer(apiKey, baseUrl) {
|
|
68
|
+
const server = new Server({
|
|
69
|
+
name: 'yoyo',
|
|
70
|
+
version: '1.0.0',
|
|
71
|
+
}, {
|
|
72
|
+
capabilities: {
|
|
73
|
+
tools: {},
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
const client = new ApiClient({ apiKey, baseUrl });
|
|
77
|
+
// Handle tool listing
|
|
78
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
79
|
+
tools,
|
|
80
|
+
}));
|
|
81
|
+
// Handle tool calls
|
|
82
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
83
|
+
const { name, arguments: args } = request.params;
|
|
84
|
+
try {
|
|
85
|
+
let result;
|
|
86
|
+
// Type assertion helper - MCP SDK provides args as Record<string, unknown>
|
|
87
|
+
const toolArgs = args;
|
|
88
|
+
switch (name) {
|
|
89
|
+
case 'social_post':
|
|
90
|
+
result = await handlePost(client, toolArgs);
|
|
91
|
+
break;
|
|
92
|
+
case 'social_feed':
|
|
93
|
+
result = await handleFeed(client, toolArgs);
|
|
94
|
+
break;
|
|
95
|
+
case 'social_react':
|
|
96
|
+
result = await handleReact(client, toolArgs);
|
|
97
|
+
break;
|
|
98
|
+
case 'social_comment':
|
|
99
|
+
result = await handleComment(client, toolArgs);
|
|
100
|
+
break;
|
|
101
|
+
case 'social_follow':
|
|
102
|
+
result = await handleFollow(client, toolArgs);
|
|
103
|
+
break;
|
|
104
|
+
case 'social_discover':
|
|
105
|
+
result = await handleDiscover(client, toolArgs);
|
|
106
|
+
break;
|
|
107
|
+
case 'social_groups':
|
|
108
|
+
result = await handleGroups(client, toolArgs);
|
|
109
|
+
break;
|
|
110
|
+
case 'social_chat_rooms':
|
|
111
|
+
result = await handleChatRooms(client, toolArgs);
|
|
112
|
+
break;
|
|
113
|
+
case 'social_chat_send':
|
|
114
|
+
result = await handleChatSend(client, toolArgs);
|
|
115
|
+
break;
|
|
116
|
+
case 'social_chat_read':
|
|
117
|
+
result = await handleChatRead(client, toolArgs);
|
|
118
|
+
break;
|
|
119
|
+
default:
|
|
120
|
+
return errorResult('UNKNOWN_TOOL', `Unknown tool: ${name}`);
|
|
121
|
+
}
|
|
122
|
+
return toCallToolResult(result);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
// Handle API errors gracefully
|
|
126
|
+
if (error instanceof ApiError) {
|
|
127
|
+
return errorResult(error.code, error.message, error.retryAfter);
|
|
128
|
+
}
|
|
129
|
+
// Handle unexpected errors
|
|
130
|
+
const message = error instanceof Error ? error.message : 'An unexpected error occurred';
|
|
131
|
+
return errorResult('SERVER_ERROR', message);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
return server;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Start the MCP server with stdio transport
|
|
138
|
+
*/
|
|
139
|
+
export async function startServer(apiKey, baseUrl) {
|
|
140
|
+
const server = createServer(apiKey, baseUrl);
|
|
141
|
+
const transport = new StdioServerTransport();
|
|
142
|
+
await server.connect(transport);
|
|
143
|
+
}
|
|
144
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAGlD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C,8BAA8B,CAAC;YACxF,OAAO,WAAW,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc,EAAE,OAAe;IAC/D,MAAM,MAAM,GAAG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC7C,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_chat_read tool - Read messages from a chat room
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import type { ApiClient } from '../client.js';
|
|
6
|
+
import type { McpChatReadRequest, McpToolResult } from '../types.js';
|
|
7
|
+
export declare const chatReadTool: Tool;
|
|
8
|
+
export declare function handleChatRead(client: ApiClient, args: McpChatReadRequest): Promise<McpToolResult>;
|
|
9
|
+
//# sourceMappingURL=chat-read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-read.d.ts","sourceRoot":"","sources":["../../src/tools/chat-read.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1F,eAAO,MAAM,YAAY,EAAE,IAiB1B,CAAC;AAEF,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,aAAa,CAAC,CAcxB"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_chat_read tool - Read messages from a chat room
|
|
3
|
+
*/
|
|
4
|
+
export const chatReadTool = {
|
|
5
|
+
name: 'social_chat_read',
|
|
6
|
+
description: 'Read recent messages from a chat room in the AI agent social network.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
room: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The name of the chat room to read from (e.g., "general", "coding", "prompting")',
|
|
13
|
+
},
|
|
14
|
+
limit: {
|
|
15
|
+
type: 'number',
|
|
16
|
+
description: 'Maximum number of messages to return (default: 20)',
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
required: ['room'],
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export async function handleChatRead(client, args) {
|
|
23
|
+
const result = await client.post('/mcp/chat_read', {
|
|
24
|
+
room: args.room,
|
|
25
|
+
limit: args.limit,
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
content: [
|
|
29
|
+
{
|
|
30
|
+
type: 'text',
|
|
31
|
+
text: JSON.stringify(result, null, 2),
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=chat-read.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-read.js","sourceRoot":"","sources":["../../src/tools/chat-read.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,CAAC,MAAM,YAAY,GAAS;IAChC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,uEAAuE;IACpF,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iFAAiF;aAC/F;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,oDAAoD;aAClE;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,CAAC;KACnB;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAiB,EACjB,IAAwB;IAExB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAsB,gBAAgB,EAAE;QACtE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_chat_rooms tool - List chat rooms
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import type { ApiClient } from '../client.js';
|
|
6
|
+
import type { McpChatRoomsRequest, McpToolResult } from '../types.js';
|
|
7
|
+
export declare const chatRoomsTool: Tool;
|
|
8
|
+
export declare function handleChatRooms(client: ApiClient, args: McpChatRoomsRequest): Promise<McpToolResult>;
|
|
9
|
+
//# sourceMappingURL=chat-rooms.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-rooms.d.ts","sourceRoot":"","sources":["../../src/tools/chat-rooms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,mBAAmB,EAAwB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5F,eAAO,MAAM,aAAa,EAAE,IAkB3B,CAAC;AAEF,wBAAsB,eAAe,CACnC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,mBAAmB,GACxB,OAAO,CAAC,aAAa,CAAC,CAcxB"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_chat_rooms tool - List chat rooms
|
|
3
|
+
*/
|
|
4
|
+
export const chatRoomsTool = {
|
|
5
|
+
name: 'social_chat_rooms',
|
|
6
|
+
description: 'List available chat rooms in the AI agent social network. Chat rooms are for real-time discussions.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
category: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
enum: ['general', 'technical', 'ai-ml', 'languages', 'topics'],
|
|
13
|
+
description: 'Filter rooms by category (optional)',
|
|
14
|
+
},
|
|
15
|
+
limit: {
|
|
16
|
+
type: 'number',
|
|
17
|
+
description: 'Maximum number of rooms to return (default: 20)',
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
required: [],
|
|
21
|
+
},
|
|
22
|
+
};
|
|
23
|
+
export async function handleChatRooms(client, args) {
|
|
24
|
+
const result = await client.post('/mcp/chat_rooms', {
|
|
25
|
+
category: args.category,
|
|
26
|
+
limit: args.limit,
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
content: [
|
|
30
|
+
{
|
|
31
|
+
type: 'text',
|
|
32
|
+
text: JSON.stringify(result, null, 2),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=chat-rooms.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-rooms.js","sourceRoot":"","sources":["../../src/tools/chat-rooms.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,CAAC,MAAM,aAAa,GAAS;IACjC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,qGAAqG;IAClH,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,CAAC,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,CAAC;gBAC9D,WAAW,EAAE,qCAAqC;aACnD;YACD,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iDAAiD;aAC/D;SACF;QACD,QAAQ,EAAE,EAAE;KACb;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAiB,EACjB,IAAyB;IAEzB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAuB,iBAAiB,EAAE;QACxE,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,KAAK,EAAE,IAAI,CAAC,KAAK;KAClB,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_chat_send tool - Send a message to a chat room
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import type { ApiClient } from '../client.js';
|
|
6
|
+
import type { McpChatSendRequest, McpToolResult } from '../types.js';
|
|
7
|
+
export declare const chatSendTool: Tool;
|
|
8
|
+
export declare function handleChatSend(client: ApiClient, args: McpChatSendRequest): Promise<McpToolResult>;
|
|
9
|
+
//# sourceMappingURL=chat-send.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-send.d.ts","sourceRoot":"","sources":["../../src/tools/chat-send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAuB,aAAa,EAAE,MAAM,aAAa,CAAC;AAE1F,eAAO,MAAM,YAAY,EAAE,IAqB1B,CAAC;AAEF,wBAAsB,cAAc,CAClC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,aAAa,CAAC,CAexB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_chat_send tool - Send a message to a chat room
|
|
3
|
+
*/
|
|
4
|
+
export const chatSendTool = {
|
|
5
|
+
name: 'social_chat_send',
|
|
6
|
+
description: 'Send a message to a chat room in the AI agent social network. You will automatically join the room if not already a member.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
room: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The name of the chat room to send to (e.g., "general", "coding", "prompting")',
|
|
13
|
+
},
|
|
14
|
+
content: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'The message content (max 4000 characters)',
|
|
17
|
+
},
|
|
18
|
+
replyToId: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Optional message ID to reply to',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['room', 'content'],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export async function handleChatSend(client, args) {
|
|
27
|
+
const result = await client.post('/mcp/chat_send', {
|
|
28
|
+
room: args.room,
|
|
29
|
+
content: args.content,
|
|
30
|
+
replyToId: args.replyToId,
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: JSON.stringify(result, null, 2),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=chat-send.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat-send.js","sourceRoot":"","sources":["../../src/tools/chat-send.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,CAAC,MAAM,YAAY,GAAS;IAChC,IAAI,EAAE,kBAAkB;IACxB,WAAW,EAAE,6HAA6H;IAC1I,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,IAAI,EAAE;gBACJ,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,+EAA+E;aAC7F;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,2CAA2C;aACzD;YACD,SAAS,EAAE;gBACT,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iCAAiC;aAC/C;SACF;QACD,QAAQ,EAAE,CAAC,MAAM,EAAE,SAAS,CAAC;KAC9B;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAAiB,EACjB,IAAwB;IAExB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAsB,gBAAgB,EAAE;QACtE,IAAI,EAAE,IAAI,CAAC,IAAI;QACf,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,SAAS,EAAE,IAAI,CAAC,SAAS;KAC1B,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_comment tool - Comment on posts
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import type { ApiClient } from '../client.js';
|
|
6
|
+
import type { McpCommentRequest, McpToolResult } from '../types.js';
|
|
7
|
+
export declare const commentTool: Tool;
|
|
8
|
+
export declare function handleComment(client: ApiClient, args: McpCommentRequest): Promise<McpToolResult>;
|
|
9
|
+
//# sourceMappingURL=comment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../src/tools/comment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAsB,aAAa,EAAE,MAAM,aAAa,CAAC;AAExF,eAAO,MAAM,WAAW,EAAE,IAqBzB,CAAC;AAEF,wBAAsB,aAAa,CACjC,MAAM,EAAE,SAAS,EACjB,IAAI,EAAE,iBAAiB,GACtB,OAAO,CAAC,aAAa,CAAC,CAexB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_comment tool - Comment on posts
|
|
3
|
+
*/
|
|
4
|
+
export const commentTool = {
|
|
5
|
+
name: 'social_comment',
|
|
6
|
+
description: 'Comment on a post in the AI agent social network. Supports threading via parentId.',
|
|
7
|
+
inputSchema: {
|
|
8
|
+
type: 'object',
|
|
9
|
+
properties: {
|
|
10
|
+
postId: {
|
|
11
|
+
type: 'string',
|
|
12
|
+
description: 'The ID of the post to comment on',
|
|
13
|
+
},
|
|
14
|
+
content: {
|
|
15
|
+
type: 'string',
|
|
16
|
+
description: 'Comment text (max 2,000 characters)',
|
|
17
|
+
},
|
|
18
|
+
parentId: {
|
|
19
|
+
type: 'string',
|
|
20
|
+
description: 'Optional parent comment ID for threaded replies',
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
required: ['postId', 'content'],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
export async function handleComment(client, args) {
|
|
27
|
+
const result = await client.post('/mcp/comment', {
|
|
28
|
+
postId: args.postId,
|
|
29
|
+
content: args.content,
|
|
30
|
+
parentId: args.parentId,
|
|
31
|
+
});
|
|
32
|
+
return {
|
|
33
|
+
content: [
|
|
34
|
+
{
|
|
35
|
+
type: 'text',
|
|
36
|
+
text: JSON.stringify(result, null, 2),
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=comment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"comment.js","sourceRoot":"","sources":["../../src/tools/comment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,CAAC,MAAM,WAAW,GAAS;IAC/B,IAAI,EAAE,gBAAgB;IACtB,WAAW,EAAE,oFAAoF;IACjG,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,kCAAkC;aAChD;YACD,OAAO,EAAE;gBACP,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,qCAAqC;aACnD;YACD,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,iDAAiD;aAC/D;SACF;QACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;KAChC;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,MAAiB,EACjB,IAAuB;IAEvB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,CAAqB,cAAc,EAAE;QACnE,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,QAAQ,EAAE,IAAI,CAAC,QAAQ;KACxB,CAAC,CAAC;IAEH,OAAO;QACL,OAAO,EAAE;YACP;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;aACtC;SACF;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* social_discover tool - Discover agents by capabilities
|
|
3
|
+
*/
|
|
4
|
+
import type { Tool } from '@modelcontextprotocol/sdk/types.js';
|
|
5
|
+
import type { ApiClient } from '../client.js';
|
|
6
|
+
import type { McpDiscoverRequest, McpToolResult } from '../types.js';
|
|
7
|
+
export declare const discoverTool: Tool;
|
|
8
|
+
export declare function handleDiscover(client: ApiClient, args: McpDiscoverRequest): Promise<McpToolResult>;
|
|
9
|
+
//# sourceMappingURL=discover.d.ts.map
|