@tencentcloud/sdk-mcp 0.1.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.
Files changed (31) hide show
  1. package/README.md +20 -0
  2. package/index.js +16 -0
  3. package/index.js.map +1 -0
  4. package/package.json +37 -0
  5. package/resource/doc/tuicallkit/android/.gitkeep +0 -0
  6. package/resource/doc/tuicallkit/android/api_TUICallKit.md +663 -0
  7. package/resource/doc/tuicallkit/android/api_TUICallObserver.md +786 -0
  8. package/resource/doc/tuicallkit/android/how_to_integrated_android_callkit.md +302 -0
  9. package/resource/doc/tuicallkit/faq/faq.md +1068 -0
  10. package/resource/doc/tuicallkit/flutter/api_TUICallDefine.md +932 -0
  11. package/resource/doc/tuicallkit/flutter/api_TUICallKit.md +452 -0
  12. package/resource/doc/tuicallkit/flutter/api_TUICallObserver.md +926 -0
  13. package/resource/doc/tuicallkit/flutter/how_to_integrated_flutter_callkit.md +226 -0
  14. package/resource/doc/tuicallkit/flutter/how_to_run_flutter_callkit_demo.md +101 -0
  15. package/resource/doc/tuicallkit/iOS/api_TUICallKit.md +635 -0
  16. package/resource/doc/tuicallkit/iOS/api_TUICallObserver.md +779 -0
  17. package/resource/doc/tuicallkit/iOS/how_to_integrated_iOS_callkit.md +269 -0
  18. package/resource/doc/tuicallkit/iOS/how_to_run_iOS_callkit_demo.md +98 -0
  19. package/resource/doc/tuicallkit/react/.gitkeep +0 -0
  20. package/resource/doc/tuicallkit/react/api_TUICallKit.md +1909 -0
  21. package/resource/doc/tuicallkit/react/how_to_integrated_react_callkit.md +195 -0
  22. package/resource/doc/tuicallkit/react/how_to_run_react_callkit_demo.md +93 -0
  23. package/resource/doc/tuicallkit/vue/.gitkeep +0 -0
  24. package/resource/doc/tuicallkit/vue/api_TUICallKit.md +1909 -0
  25. package/resource/doc/tuicallkit/vue/api_TUICallObserver.md +926 -0
  26. package/resource/doc/tuicallkit/vue/how_to_integrated_vue_callkit.md +415 -0
  27. package/resource/doc/tuicallkit/vue/how_to_run_vue_callkit_demo.md +93 -0
  28. package/server.js +124 -0
  29. package/server.js.map +1 -0
  30. package/streamableHttp.js +74 -0
  31. package/streamableHttp.js.map +1 -0
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const express_1 = __importDefault(require("express"));
7
+ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamableHttp.js");
8
+ const server_js_1 = require("./server.js");
9
+ const app = (0, express_1.default)();
10
+ app.use(express_1.default.json());
11
+ const server = (0, server_js_1.createServer)();
12
+ const transport = new streamableHttp_js_1.StreamableHTTPServerTransport({
13
+ sessionIdGenerator: undefined, // set to undefined for stateless servers
14
+ });
15
+ // Setup routes for the server
16
+ const setupServer = async () => {
17
+ await server.connect(transport);
18
+ };
19
+ app.post('/mcp', async (req, res) => {
20
+ console.log('Received MCP request:', req.body);
21
+ try {
22
+ await transport.handleRequest(req, res, req.body);
23
+ }
24
+ catch (error) {
25
+ console.error('Error handling MCP request:', error);
26
+ if (!res.headersSent) {
27
+ res.status(500).json({
28
+ jsonrpc: '2.0',
29
+ error: {
30
+ code: -32603,
31
+ message: 'Internal server error',
32
+ },
33
+ id: null,
34
+ });
35
+ }
36
+ }
37
+ });
38
+ app.get('/mcp', async (req, res) => {
39
+ console.log('Received GET MCP request');
40
+ res.writeHead(405).end(JSON.stringify({
41
+ jsonrpc: "2.0",
42
+ error: {
43
+ code: -32000,
44
+ message: "Method not allowed."
45
+ },
46
+ id: null
47
+ }));
48
+ });
49
+ app.delete('/mcp', async (req, res) => {
50
+ console.log('Received DELETE MCP request');
51
+ res.writeHead(405).end(JSON.stringify({
52
+ jsonrpc: "2.0",
53
+ error: {
54
+ code: -32000,
55
+ message: "Method not allowed."
56
+ },
57
+ id: null
58
+ }));
59
+ });
60
+ // Start the server
61
+ const PORT = process.env.PORT || 3088;
62
+ setupServer().then(() => {
63
+ app.listen(PORT, (error) => {
64
+ if (error) {
65
+ console.error('Failed to start server:', error);
66
+ process.exit(1);
67
+ }
68
+ console.log(`Weather MCP Server listening on port ${PORT}`);
69
+ });
70
+ }).catch(error => {
71
+ console.error('Failed to set up the server:', error);
72
+ process.exit(1);
73
+ });
74
+ //# sourceMappingURL=streamableHttp.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"streamableHttp.js","sourceRoot":"","sources":["../src/streamableHttp.ts"],"names":[],"mappings":";;;;;AAAA,sDAAqD;AAErD,0FAAmG;AACnG,2CAA2C;AAE3C,MAAM,GAAG,GAAG,IAAA,iBAAO,GAAE,CAAC;AACtB,GAAG,CAAC,GAAG,CAAC,iBAAO,CAAC,IAAI,EAAE,CAAC,CAAC;AAExB,MAAM,MAAM,GAAc,IAAA,wBAAY,GAAE,CAAC;AAEzC,MAAM,SAAS,GAAkC,IAAI,iDAA6B,CAAC;IACjF,kBAAkB,EAAE,SAAS,EAAE,yCAAyC;CACzE,CAAC,CAAC;AAEH,8BAA8B;AAC9B,MAAM,WAAW,GAAG,KAAK,IAAI,EAAE;IAC7B,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAClC,CAAC,CAAC;AAEF,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,EAAE;IACrD,OAAO,CAAC,GAAG,CAAC,uBAAuB,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,CAAC;QACD,MAAM,SAAS,CAAC,aAAa,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC;YACrB,GAAG,CA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