@fonoster/mcp 0.9.25
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 +120 -0
- package/dist/env.d.ts +4 -0
- package/dist/env.js +33 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +59 -0
- package/dist/prompts/createCallPrompt.d.ts +31 -0
- package/dist/prompts/createCallPrompt.js +81 -0
- package/dist/prompts/index.d.ts +24 -0
- package/dist/prompts/index.js +12 -0
- package/dist/schemas.d.ts +53 -0
- package/dist/schemas.js +38 -0
- package/dist/tools/createCreateCall.d.ts +32 -0
- package/dist/tools/createCreateCall.js +86 -0
- package/dist/tools/createListApplications.d.ts +32 -0
- package/dist/tools/createListApplications.js +93 -0
- package/dist/tools/createListNumbers.d.ts +32 -0
- package/dist/tools/createListNumbers.js +90 -0
- package/dist/tools/index.d.ts +7 -0
- package/dist/tools/index.js +33 -0
- package/dist/utils/createClient.d.ts +20 -0
- package/dist/utils/createClient.js +72 -0
- package/package.json +39 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Fonoster Inc
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Fonoster MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://discord.gg/4QWgSz4hTC)  
|
|
4
|
+
|
|
5
|
+
MCP Server for the Fonoster API, enabling MCP clients to interact with Fonoster's telephony services. This module is part of the [Fonoster](https://fonoster.com) open-source project. For more information about the project, please visit [https://github.com/fonoster/fonoster](https://github.com/fonoster/fonoster).
|
|
6
|
+
|
|
7
|
+
## Tools
|
|
8
|
+
|
|
9
|
+
1. `list_numbers`
|
|
10
|
+
- Returns a list of numbers from Fonoster in a table format (using markdown)
|
|
11
|
+
- Optional inputs:
|
|
12
|
+
- `page_size` (number): Maximum number of numbers to return
|
|
13
|
+
- `page_token` (string): Pagination token for next page
|
|
14
|
+
- Returns: List of numbers with their refs, names, and telUrls
|
|
15
|
+
|
|
16
|
+
2. `list_applications`
|
|
17
|
+
- Lists applications from Fonoster in a table format (using markdown)
|
|
18
|
+
- Optional inputs:
|
|
19
|
+
- `page_size` (number): Maximum number of applications to return
|
|
20
|
+
- `page_token` (string): Pagination token for next page
|
|
21
|
+
- Returns: List of applications with their refs, names, endpoints, creation dates, update dates, and types
|
|
22
|
+
|
|
23
|
+
3. `create_call`
|
|
24
|
+
- Creates a call from Fonoster
|
|
25
|
+
- Required inputs:
|
|
26
|
+
- `from` (string): The number to call from
|
|
27
|
+
- `to` (string): The number to call to
|
|
28
|
+
- `app_ref` (string): The reference to the application to use for the call
|
|
29
|
+
- Returns: Call creation confirmation with reference ID
|
|
30
|
+
|
|
31
|
+
## Prompts
|
|
32
|
+
|
|
33
|
+
1. `create_call_prompt`
|
|
34
|
+
- A prompt for creating a call step by step
|
|
35
|
+
- Guides Claude through the process of:
|
|
36
|
+
- Asking the user for the number to call
|
|
37
|
+
- Offering a list of available numbers using the `list_numbers` tool
|
|
38
|
+
- Asking for the application name and finding its reference
|
|
39
|
+
- Creating a call using the `create_call` tool
|
|
40
|
+
|
|
41
|
+
## Setup
|
|
42
|
+
|
|
43
|
+
### Usage with Claude Desktop
|
|
44
|
+
|
|
45
|
+
Add the following to your `claude_desktop_config.json`:
|
|
46
|
+
|
|
47
|
+
#### npx
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"fonoster": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": [
|
|
55
|
+
"-y",
|
|
56
|
+
"@fonoster/mcp"
|
|
57
|
+
],
|
|
58
|
+
"env": {
|
|
59
|
+
"MCP_WORKSPACE_ACCESS_KEY_ID": "your-workspace-access-key-id",
|
|
60
|
+
"MCP_ACCESS_KEY_ID": "your-apikey-access-key-id",
|
|
61
|
+
"MCP_ACCESS_KEY_SECRET": "your-apikey-access-key-secret"
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
#### docker
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"mcpServers": {
|
|
73
|
+
"fonoster": {
|
|
74
|
+
"command": "docker",
|
|
75
|
+
"args": [
|
|
76
|
+
"run",
|
|
77
|
+
"-i",
|
|
78
|
+
"--rm",
|
|
79
|
+
"-e",
|
|
80
|
+
"MCP_WORKSPACE_ACCESS_KEY_ID",
|
|
81
|
+
"-e",
|
|
82
|
+
"MCP_ACCESS_KEY_ID",
|
|
83
|
+
"-e",
|
|
84
|
+
"MCP_ACCESS_KEY_SECRET",
|
|
85
|
+
"fonoster/mcp"
|
|
86
|
+
],
|
|
87
|
+
"env": {
|
|
88
|
+
"MCP_WORKSPACE_ACCESS_KEY_ID": "your-workspace-access-key-id",
|
|
89
|
+
"MCP_ACCESS_KEY_ID": "your-apikey-access-key-id",
|
|
90
|
+
"MCP_ACCESS_KEY_SECRET": "your-apikey-access-key-secret"
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Testing with the MCP Inspector
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
MCP_WORKSPACE_ACCESS_KEY_ID="your-workspace-access-key-id" \
|
|
101
|
+
MCP_ACCESS_KEY_ID="your-apikey-access-key-id" \
|
|
102
|
+
MCP_ACCESS_KEY_SECRET="your-apikey-access-key_secret" \
|
|
103
|
+
npx @modelcontextprotocol/inspector \
|
|
104
|
+
node /Users/psanders/Projects/fonoster/mods/mcp/dist/index.js
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Troubleshooting
|
|
108
|
+
|
|
109
|
+
If you encounter authentication errors, verify that:
|
|
110
|
+
1. Your Fonoster credentials are correct
|
|
111
|
+
2. The environment variables are properly set
|
|
112
|
+
3. You have the necessary permissions to access the Fonoster API
|
|
113
|
+
|
|
114
|
+
## Build
|
|
115
|
+
|
|
116
|
+
Docker build:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
docker build -t fonoster/mcp -f Dockerfile .
|
|
120
|
+
```
|
package/dist/env.d.ts
ADDED
package/dist/env.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ACCESS_KEY_SECRET = exports.ACCESS_KEY_ID = exports.WORKSPACE_ACCESS_KEY_ID = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const common_1 = require("@fonoster/common");
|
|
23
|
+
(0, common_1.assertEnvsAreSet)([
|
|
24
|
+
"MCP_WORKSPACE_ACCESS_KEY_ID",
|
|
25
|
+
"MCP_ACCESS_KEY_ID",
|
|
26
|
+
"MCP_ACCESS_KEY_SECRET"
|
|
27
|
+
]);
|
|
28
|
+
const WORKSPACE_ACCESS_KEY_ID = process.env.MCP_WORKSPACE_ACCESS_KEY_ID;
|
|
29
|
+
exports.WORKSPACE_ACCESS_KEY_ID = WORKSPACE_ACCESS_KEY_ID;
|
|
30
|
+
const ACCESS_KEY_ID = process.env.MCP_ACCESS_KEY_ID;
|
|
31
|
+
exports.ACCESS_KEY_ID = ACCESS_KEY_ID;
|
|
32
|
+
const ACCESS_KEY_SECRET = process.env.MCP_ACCESS_KEY_SECRET;
|
|
33
|
+
exports.ACCESS_KEY_SECRET = ACCESS_KEY_SECRET;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**
|
|
13
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
14
|
+
* http://github.com/fonoster/fonoster
|
|
15
|
+
*
|
|
16
|
+
* This file is part of Fonoster
|
|
17
|
+
*
|
|
18
|
+
* Licensed under the MIT License (the "License");
|
|
19
|
+
* you may not use this file except in compliance with
|
|
20
|
+
* the License. You may obtain a copy of the License at
|
|
21
|
+
*
|
|
22
|
+
* https://opensource.org/licenses/MIT
|
|
23
|
+
*
|
|
24
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
25
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
26
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
27
|
+
* See the License for the specific language governing permissions and
|
|
28
|
+
* limitations under the License.
|
|
29
|
+
*/
|
|
30
|
+
const fs_1 = require("fs");
|
|
31
|
+
const path_1 = require("path");
|
|
32
|
+
const logger_1 = require("@fonoster/logger");
|
|
33
|
+
const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
|
|
34
|
+
const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
|
|
35
|
+
const index_1 = require("./prompts/index");
|
|
36
|
+
const index_2 = require("./tools/index");
|
|
37
|
+
const logger = (0, logger_1.getLogger)({ service: "mcp", filePath: __filename });
|
|
38
|
+
function main() {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
// Read package.json using fs module
|
|
41
|
+
const packageJsonPath = (0, path_1.join)(__dirname, "..", "package.json");
|
|
42
|
+
const packageJson = JSON.parse((0, fs_1.readFileSync)(packageJsonPath, "utf8"));
|
|
43
|
+
const server = new mcp_js_1.McpServer({
|
|
44
|
+
name: "Fonoster MCP Server",
|
|
45
|
+
version: packageJson.version
|
|
46
|
+
});
|
|
47
|
+
// Register all prompts
|
|
48
|
+
(0, index_1.registerPrompts)(server);
|
|
49
|
+
// Register all tools
|
|
50
|
+
yield (0, index_2.registerTools)(server);
|
|
51
|
+
const transport = new stdio_js_1.StdioServerTransport();
|
|
52
|
+
yield server.connect(transport);
|
|
53
|
+
logger.info("Fonoster MCP Server running on stdio");
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
main().catch((error) => {
|
|
57
|
+
logger.error("Error starting MCP server:", error);
|
|
58
|
+
process.exit(1);
|
|
59
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* Returns the createCallPrompt content
|
|
21
|
+
* @returns The prompt content
|
|
22
|
+
*/
|
|
23
|
+
export declare function createCallPrompt(): Promise<{
|
|
24
|
+
messages: {
|
|
25
|
+
role: "assistant";
|
|
26
|
+
content: {
|
|
27
|
+
type: "text";
|
|
28
|
+
text: string;
|
|
29
|
+
};
|
|
30
|
+
}[];
|
|
31
|
+
}>;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
4
|
+
* http://github.com/fonoster/fonoster
|
|
5
|
+
*
|
|
6
|
+
* This file is part of Fonoster
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the MIT License (the "License");
|
|
9
|
+
* you may not use this file except in compliance with
|
|
10
|
+
* the License. You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* https://opensource.org/licenses/MIT
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
21
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
22
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
23
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
24
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
25
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
26
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.createCallPrompt = createCallPrompt;
|
|
31
|
+
/**
|
|
32
|
+
* Returns the createCallPrompt content
|
|
33
|
+
* @returns The prompt content
|
|
34
|
+
*/
|
|
35
|
+
function createCallPrompt() {
|
|
36
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
return {
|
|
38
|
+
messages: [
|
|
39
|
+
{
|
|
40
|
+
role: "assistant",
|
|
41
|
+
content: {
|
|
42
|
+
type: "text",
|
|
43
|
+
text: `
|
|
44
|
+
## Role:
|
|
45
|
+
You are a call originator that can create calls to Fonoster.
|
|
46
|
+
|
|
47
|
+
## Capabilities:
|
|
48
|
+
- You can list numbers from Fonoster by using the 'listNumbers' tool.
|
|
49
|
+
- You can list applications from Fonoster by using the 'listApplications' tool.
|
|
50
|
+
- You can create a call to Fonoster by using the 'createCall' tool.
|
|
51
|
+
|
|
52
|
+
## Steps:
|
|
53
|
+
1. Ask the user for the number to call if not already provided.
|
|
54
|
+
2. Offer the user a list of numbers to use for the call using the 'listNumbers' tool.
|
|
55
|
+
4. Then ask for the name of application and use that to find the 'ref' of the application.
|
|
56
|
+
5. Create a call to the selected application using the 'createCall' tool.
|
|
57
|
+
|
|
58
|
+
## Example:
|
|
59
|
+
User: I want to call +1234567890
|
|
60
|
+
Assistant: Here are some numbers you can use:
|
|
61
|
+
|
|
62
|
+
- +1234567890
|
|
63
|
+
- +1234567891
|
|
64
|
+
- +1234567892
|
|
65
|
+
|
|
66
|
+
User: I want to use the number +1234567890
|
|
67
|
+
Assistant: Perfect, I will use the number +1234567890 for the call. Which application do you want to use?
|
|
68
|
+
|
|
69
|
+
User: I want to use the application called "My App"
|
|
70
|
+
Assistant: Perfect, the application "My App" has the following ref:
|
|
71
|
+
- 586d7421-542f-49cc-b1ed-dc65378da01a
|
|
72
|
+
|
|
73
|
+
User: That's the one. Please create the call.
|
|
74
|
+
Assistant: Call created with REF: 586d7421-542f-49cc-b1ed-dc65378da01a
|
|
75
|
+
`
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
20
|
+
/**
|
|
21
|
+
* Registers all prompts with the MCP server
|
|
22
|
+
* @param server The MCP server instance
|
|
23
|
+
*/
|
|
24
|
+
export declare function registerPrompts(server: McpServer): void;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerPrompts = registerPrompts;
|
|
4
|
+
const createCallPrompt_1 = require("./createCallPrompt");
|
|
5
|
+
/**
|
|
6
|
+
* Registers all prompts with the MCP server
|
|
7
|
+
* @param server The MCP server instance
|
|
8
|
+
*/
|
|
9
|
+
function registerPrompts(server) {
|
|
10
|
+
// Register the createCallPrompt
|
|
11
|
+
server.prompt("create_call_prompt", "A predefined prompt for creating a call", createCallPrompt_1.createCallPrompt);
|
|
12
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import { z } from "zod";
|
|
20
|
+
declare const ListApplicationsSchema: z.ZodObject<{
|
|
21
|
+
page_size: z.ZodOptional<z.ZodNumber>;
|
|
22
|
+
page_token: z.ZodOptional<z.ZodString>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
page_size?: number;
|
|
25
|
+
page_token?: string;
|
|
26
|
+
}, {
|
|
27
|
+
page_size?: number;
|
|
28
|
+
page_token?: string;
|
|
29
|
+
}>;
|
|
30
|
+
declare const ListNumbersSchema: z.ZodObject<{
|
|
31
|
+
page_size: z.ZodOptional<z.ZodNumber>;
|
|
32
|
+
page_token: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, "strip", z.ZodTypeAny, {
|
|
34
|
+
page_size?: number;
|
|
35
|
+
page_token?: string;
|
|
36
|
+
}, {
|
|
37
|
+
page_size?: number;
|
|
38
|
+
page_token?: string;
|
|
39
|
+
}>;
|
|
40
|
+
declare const CreateCallSchema: z.ZodObject<{
|
|
41
|
+
from: z.ZodString;
|
|
42
|
+
to: z.ZodString;
|
|
43
|
+
app_ref: z.ZodString;
|
|
44
|
+
}, "strip", z.ZodTypeAny, {
|
|
45
|
+
from?: string;
|
|
46
|
+
to?: string;
|
|
47
|
+
app_ref?: string;
|
|
48
|
+
}, {
|
|
49
|
+
from?: string;
|
|
50
|
+
to?: string;
|
|
51
|
+
app_ref?: string;
|
|
52
|
+
}>;
|
|
53
|
+
export { ListApplicationsSchema, CreateCallSchema, ListNumbersSchema };
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListNumbersSchema = exports.CreateCallSchema = exports.ListApplicationsSchema = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
6
|
+
* http://github.com/fonoster/fonoster
|
|
7
|
+
*
|
|
8
|
+
* This file is part of Fonoster
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the MIT License (the "License");
|
|
11
|
+
* you may not use this file except in compliance with
|
|
12
|
+
* the License. You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* https://opensource.org/licenses/MIT
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const zod_1 = require("zod");
|
|
23
|
+
const ListApplicationsSchema = zod_1.z.object({
|
|
24
|
+
page_size: zod_1.z.number().optional().describe("Number of applications per page"),
|
|
25
|
+
page_token: zod_1.z.string().optional().describe("Token for pagination")
|
|
26
|
+
});
|
|
27
|
+
exports.ListApplicationsSchema = ListApplicationsSchema;
|
|
28
|
+
const ListNumbersSchema = zod_1.z.object({
|
|
29
|
+
page_size: zod_1.z.number().optional().describe("Number of numbers per page"),
|
|
30
|
+
page_token: zod_1.z.string().optional().describe("Token for pagination")
|
|
31
|
+
});
|
|
32
|
+
exports.ListNumbersSchema = ListNumbersSchema;
|
|
33
|
+
const CreateCallSchema = zod_1.z.object({
|
|
34
|
+
from: zod_1.z.string().describe("The phone number to call from"),
|
|
35
|
+
to: zod_1.z.string().describe("The phone number to call to"),
|
|
36
|
+
app_ref: zod_1.z.string().describe("The application reference to use for the call")
|
|
37
|
+
});
|
|
38
|
+
exports.CreateCallSchema = CreateCallSchema;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import * as SDK from "@fonoster/sdk";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import { CreateCallSchema } from "../schemas";
|
|
22
|
+
/**
|
|
23
|
+
* Creates a call from Fonoster
|
|
24
|
+
* @param client The Fonoster client
|
|
25
|
+
* @returns A function that creates a call
|
|
26
|
+
*/
|
|
27
|
+
export declare function createCreateCall(client: SDK.Client): (params: z.infer<typeof CreateCallSchema>) => Promise<{
|
|
28
|
+
content: {
|
|
29
|
+
type: "text";
|
|
30
|
+
text: string;
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.createCreateCall = createCreateCall;
|
|
46
|
+
/**
|
|
47
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
48
|
+
* http://github.com/fonoster/fonoster
|
|
49
|
+
*
|
|
50
|
+
* This file is part of Fonoster
|
|
51
|
+
*
|
|
52
|
+
* Licensed under the MIT License (the "License");
|
|
53
|
+
* you may not use this file except in compliance with
|
|
54
|
+
* the License. You may obtain a copy of the License at
|
|
55
|
+
*
|
|
56
|
+
* https://opensource.org/licenses/MIT
|
|
57
|
+
*
|
|
58
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
59
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
60
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
61
|
+
* See the License for the specific language governing permissions and
|
|
62
|
+
* limitations under the License.
|
|
63
|
+
*/
|
|
64
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
65
|
+
/**
|
|
66
|
+
* Creates a call from Fonoster
|
|
67
|
+
* @param client The Fonoster client
|
|
68
|
+
* @returns A function that creates a call
|
|
69
|
+
*/
|
|
70
|
+
function createCreateCall(client) {
|
|
71
|
+
return function createCall(params) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const calls = new SDK.Calls(client);
|
|
74
|
+
const call = yield calls.createCall({
|
|
75
|
+
from: params.from,
|
|
76
|
+
to: params.to,
|
|
77
|
+
appRef: params.app_ref
|
|
78
|
+
});
|
|
79
|
+
return {
|
|
80
|
+
content: [
|
|
81
|
+
{ type: "text", text: `Call created with REF: ${call.ref}` }
|
|
82
|
+
]
|
|
83
|
+
};
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import * as SDK from "@fonoster/sdk";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import { ListApplicationsSchema } from "../schemas";
|
|
22
|
+
/**
|
|
23
|
+
* Lists applications from Fonoster
|
|
24
|
+
* @param client The Fonoster client
|
|
25
|
+
* @returns A function that lists applications
|
|
26
|
+
*/
|
|
27
|
+
export declare function createListApplications(client: SDK.Client): (params: z.infer<typeof ListApplicationsSchema>) => Promise<{
|
|
28
|
+
content: {
|
|
29
|
+
type: "text";
|
|
30
|
+
text: string;
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.createListApplications = createListApplications;
|
|
46
|
+
/**
|
|
47
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
48
|
+
* http://github.com/fonoster/fonoster
|
|
49
|
+
*
|
|
50
|
+
* This file is part of Fonoster
|
|
51
|
+
*
|
|
52
|
+
* Licensed under the MIT License (the "License");
|
|
53
|
+
* you may not use this file except in compliance with
|
|
54
|
+
* the License. You may obtain a copy of the License at
|
|
55
|
+
*
|
|
56
|
+
* https://opensource.org/licenses/MIT
|
|
57
|
+
*
|
|
58
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
59
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
60
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
61
|
+
* See the License for the specific language governing permissions and
|
|
62
|
+
* limitations under the License.
|
|
63
|
+
*/
|
|
64
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
65
|
+
/**
|
|
66
|
+
* Lists applications from Fonoster
|
|
67
|
+
* @param client The Fonoster client
|
|
68
|
+
* @returns A function that lists applications
|
|
69
|
+
*/
|
|
70
|
+
function createListApplications(client) {
|
|
71
|
+
return function listApplications(params) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const apps = new SDK.Applications(client);
|
|
74
|
+
const response = yield apps.listApplications({
|
|
75
|
+
pageSize: params.page_size,
|
|
76
|
+
pageToken: params.page_token
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
content: response.items.map((app) => ({
|
|
80
|
+
type: "text",
|
|
81
|
+
text: JSON.stringify({
|
|
82
|
+
ref: app.ref,
|
|
83
|
+
name: app.name,
|
|
84
|
+
endpoint: app.endpoint,
|
|
85
|
+
createdAt: app.createdAt,
|
|
86
|
+
updatedAt: app.updatedAt,
|
|
87
|
+
type: app.type
|
|
88
|
+
})
|
|
89
|
+
}))
|
|
90
|
+
};
|
|
91
|
+
});
|
|
92
|
+
};
|
|
93
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import * as SDK from "@fonoster/sdk";
|
|
20
|
+
import { z } from "zod";
|
|
21
|
+
import { ListNumbersSchema } from "../schemas";
|
|
22
|
+
/**
|
|
23
|
+
* Lists numbers from Fonoster
|
|
24
|
+
* @param client The Fonoster client
|
|
25
|
+
* @returns A function that lists numbers
|
|
26
|
+
*/
|
|
27
|
+
export declare function createListNumbers(client: SDK.Client): (params: z.infer<typeof ListNumbersSchema>) => Promise<{
|
|
28
|
+
content: {
|
|
29
|
+
type: "text";
|
|
30
|
+
text: string;
|
|
31
|
+
}[];
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.createListNumbers = createListNumbers;
|
|
46
|
+
/**
|
|
47
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
48
|
+
* http://github.com/fonoster/fonoster
|
|
49
|
+
*
|
|
50
|
+
* This file is part of Fonoster
|
|
51
|
+
*
|
|
52
|
+
* Licensed under the MIT License (the "License");
|
|
53
|
+
* you may not use this file except in compliance with
|
|
54
|
+
* the License. You may obtain a copy of the License at
|
|
55
|
+
*
|
|
56
|
+
* https://opensource.org/licenses/MIT
|
|
57
|
+
*
|
|
58
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
59
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
60
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
61
|
+
* See the License for the specific language governing permissions and
|
|
62
|
+
* limitations under the License.
|
|
63
|
+
*/
|
|
64
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
65
|
+
/**
|
|
66
|
+
* Lists numbers from Fonoster
|
|
67
|
+
* @param client The Fonoster client
|
|
68
|
+
* @returns A function that lists numbers
|
|
69
|
+
*/
|
|
70
|
+
function createListNumbers(client) {
|
|
71
|
+
return function listNumbers(params) {
|
|
72
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
73
|
+
const numbers = new SDK.Numbers(client);
|
|
74
|
+
const response = yield numbers.listNumbers({
|
|
75
|
+
pageSize: params.page_size,
|
|
76
|
+
pageToken: params.page_token
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
content: response.items.map((app) => ({
|
|
80
|
+
type: "text",
|
|
81
|
+
text: JSON.stringify({
|
|
82
|
+
ref: app.ref,
|
|
83
|
+
name: app.name,
|
|
84
|
+
telUrl: app.telUrl
|
|
85
|
+
})
|
|
86
|
+
}))
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
|
+
/**
|
|
3
|
+
* Registers all tools with the MCP server
|
|
4
|
+
* @param server The MCP server instance
|
|
5
|
+
* @param client The Fonoster client
|
|
6
|
+
*/
|
|
7
|
+
export declare function registerTools(server: McpServer): Promise<void>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.registerTools = registerTools;
|
|
13
|
+
const schemas_1 = require("../schemas");
|
|
14
|
+
const createCreateCall_1 = require("./createCreateCall");
|
|
15
|
+
const createListApplications_1 = require("./createListApplications");
|
|
16
|
+
const createListNumbers_1 = require("./createListNumbers");
|
|
17
|
+
const createClient_1 = require("../utils/createClient");
|
|
18
|
+
/**
|
|
19
|
+
* Registers all tools with the MCP server
|
|
20
|
+
* @param server The MCP server instance
|
|
21
|
+
* @param client The Fonoster client
|
|
22
|
+
*/
|
|
23
|
+
function registerTools(server) {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const client = yield (0, createClient_1.createClient)();
|
|
26
|
+
// Register the listNumbers tool
|
|
27
|
+
server.tool("list_numbers", "Returns a list of numbers from Fonoster in a table format (using markdown)", schemas_1.ListNumbersSchema.shape, (0, createListNumbers_1.createListNumbers)(client));
|
|
28
|
+
// Register the listApplications tool
|
|
29
|
+
server.tool("list_applications", "Lists applications from Fonoster in a table format (using markdown)", schemas_1.ListApplicationsSchema.shape, (0, createListApplications_1.createListApplications)(client));
|
|
30
|
+
// Register the createCall tool
|
|
31
|
+
server.tool("create_call", "Creates a call from Fonoster", schemas_1.CreateCallSchema.shape, (0, createCreateCall_1.createCreateCall)(client));
|
|
32
|
+
});
|
|
33
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
3
|
+
* http://github.com/fonoster/fonoster
|
|
4
|
+
*
|
|
5
|
+
* This file is part of Fonoster
|
|
6
|
+
*
|
|
7
|
+
* Licensed under the MIT License (the "License");
|
|
8
|
+
* you may not use this file except in compliance with
|
|
9
|
+
* the License. You may obtain a copy of the License at
|
|
10
|
+
*
|
|
11
|
+
* https://opensource.org/licenses/MIT
|
|
12
|
+
*
|
|
13
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
* See the License for the specific language governing permissions and
|
|
17
|
+
* limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
import * as SDK from "@fonoster/sdk";
|
|
20
|
+
export declare function createClient(): Promise<SDK.Client>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.createClient = createClient;
|
|
46
|
+
/**
|
|
47
|
+
* Copyright (C) 2025 by Fonoster Inc (https://fonoster.com)
|
|
48
|
+
* http://github.com/fonoster/fonoster
|
|
49
|
+
*
|
|
50
|
+
* This file is part of Fonoster
|
|
51
|
+
*
|
|
52
|
+
* Licensed under the MIT License (the "License");
|
|
53
|
+
* you may not use this file except in compliance with
|
|
54
|
+
* the License. You may obtain a copy of the License at
|
|
55
|
+
*
|
|
56
|
+
* https://opensource.org/licenses/MIT
|
|
57
|
+
*
|
|
58
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
59
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
60
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
61
|
+
* See the License for the specific language governing permissions and
|
|
62
|
+
* limitations under the License.
|
|
63
|
+
*/
|
|
64
|
+
const SDK = __importStar(require("@fonoster/sdk"));
|
|
65
|
+
const env_1 = require("../env");
|
|
66
|
+
function createClient() {
|
|
67
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const client = new SDK.Client({ accessKeyId: env_1.WORKSPACE_ACCESS_KEY_ID });
|
|
69
|
+
yield client.loginWithApiKey(env_1.ACCESS_KEY_ID, env_1.ACCESS_KEY_SECRET);
|
|
70
|
+
return client;
|
|
71
|
+
});
|
|
72
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fonoster/mcp",
|
|
3
|
+
"version": "0.9.25",
|
|
4
|
+
"description": "Model Context Protocol for Fonoster",
|
|
5
|
+
"author": "Pedro Sanders <psanders@fonoster.com>",
|
|
6
|
+
"homepage": "https://github.com/fonoster/fonoster#readme",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"main": "dist/index",
|
|
9
|
+
"types": "dist/index",
|
|
10
|
+
"directories": {
|
|
11
|
+
"src": "src",
|
|
12
|
+
"test": "test"
|
|
13
|
+
},
|
|
14
|
+
"scripts": {
|
|
15
|
+
"prebuild": "rimraf ./dist tsconfig.tsbuildinfo",
|
|
16
|
+
"build": "tsc -b tsconfig.json",
|
|
17
|
+
"clean": "rimraf ./dist node_modules tsconfig.tsbuildinfo"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@fonoster/common": "^0.9.22",
|
|
21
|
+
"@fonoster/logger": "^0.9.22",
|
|
22
|
+
"@fonoster/sdk": "^0.9.22",
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.4.0"
|
|
24
|
+
},
|
|
25
|
+
"files": [
|
|
26
|
+
"dist"
|
|
27
|
+
],
|
|
28
|
+
"publishConfig": {
|
|
29
|
+
"access": "public"
|
|
30
|
+
},
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/fonoster/fonoster.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/fonoster/fonoster/issues"
|
|
37
|
+
},
|
|
38
|
+
"gitHead": "7fb41c18b755c07fd168e6d43f4651e733353afc"
|
|
39
|
+
}
|