@qverisai/sdk 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.
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/api/client.d.ts +122 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +174 -0
- package/dist/api/client.js.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +228 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/execute.d.ts +89 -0
- package/dist/tools/execute.d.ts.map +1 -0
- package/dist/tools/execute.js +73 -0
- package/dist/tools/execute.js.map +1 -0
- package/dist/tools/search.d.ts +71 -0
- package/dist/tools/search.d.ts.map +1 -0
- package/dist/tools/search.js +53 -0
- package/dist/tools/search.js.map +1 -0
- package/dist/types.d.ts +233 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 QverisAI
|
|
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,204 @@
|
|
|
1
|
+
# @qverisai/sdk
|
|
2
|
+
|
|
3
|
+
Official Qveris MCP Server SDK — Dynamically search and execute tools via natural language.
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@qverisai/sdk)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This SDK provides a [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that enables LLMs to discover and execute third-party tools through the Qveris API. With just two simple tools, your AI assistant can:
|
|
11
|
+
|
|
12
|
+
- **Search** for tools using natural language queries
|
|
13
|
+
- **Execute** any discovered tool with the appropriate parameters
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Using npx (recommended for MCP)
|
|
19
|
+
npx @qverisai/sdk
|
|
20
|
+
|
|
21
|
+
# Or install globally
|
|
22
|
+
npm add -g @qverisai/sdk
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
### 1. Get Your API Key
|
|
28
|
+
|
|
29
|
+
Visit [Qveris](https://qveris.ai) to get your API key.
|
|
30
|
+
|
|
31
|
+
### 2. Configure Your MCP Client
|
|
32
|
+
|
|
33
|
+
Add the Qveris server to your MCP client configuration:
|
|
34
|
+
|
|
35
|
+
**Claude Desktop** (`claude_desktop_config.json`):
|
|
36
|
+
|
|
37
|
+
```json
|
|
38
|
+
{
|
|
39
|
+
"mcpServers": {
|
|
40
|
+
"qveris": {
|
|
41
|
+
"command": "npx",
|
|
42
|
+
"args": ["@qverisai/sdk"],
|
|
43
|
+
"env": {
|
|
44
|
+
"QVERIS_API_KEY": "your-api-key-here"
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
**Cursor** (Settings → MCP Servers):
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"qveris": {
|
|
57
|
+
"command": "npx",
|
|
58
|
+
"args": ["@qverisai/sdk"],
|
|
59
|
+
"env": {
|
|
60
|
+
"QVERIS_API_KEY": "your-api-key-here"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 3. Start Using
|
|
68
|
+
|
|
69
|
+
Once configured, your AI assistant can search for and execute tools:
|
|
70
|
+
|
|
71
|
+
> "Find me a weather API and get the current weather in Tokyo"
|
|
72
|
+
|
|
73
|
+
The assistant will:
|
|
74
|
+
1. Call `search_tools` with query "weather API"
|
|
75
|
+
2. Review the results and select an appropriate tool
|
|
76
|
+
3. Call `execute_tool` with the tool_id and parameters
|
|
77
|
+
|
|
78
|
+
## Available Tools
|
|
79
|
+
|
|
80
|
+
### `search_tools`
|
|
81
|
+
|
|
82
|
+
Search for available tools based on natural language queries.
|
|
83
|
+
|
|
84
|
+
| Parameter | Type | Required | Description |
|
|
85
|
+
|-----------|------|----------|-------------|
|
|
86
|
+
| `query` | string | ✓ | Natural language description of the capability you need |
|
|
87
|
+
| `limit` | number | | Max results to return (1-100, default: 20) |
|
|
88
|
+
| `session_id` | string | | Session identifier for tracking (auto-generated if omitted) |
|
|
89
|
+
|
|
90
|
+
**Example:**
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"query": "send email notification",
|
|
95
|
+
"limit": 5
|
|
96
|
+
}
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### `execute_tool`
|
|
100
|
+
|
|
101
|
+
Execute a discovered tool with specific parameters.
|
|
102
|
+
|
|
103
|
+
| Parameter | Type | Required | Description |
|
|
104
|
+
|-----------|------|----------|-------------|
|
|
105
|
+
| `tool_id` | string | ✓ | Tool ID from search results |
|
|
106
|
+
| `search_id` | string | ✓ | Search ID from the search that found this tool |
|
|
107
|
+
| `params_to_tool` | string | ✓ | JSON string of parameters to pass to the tool |
|
|
108
|
+
| `session_id` | string | | Session identifier (auto-generated if omitted) |
|
|
109
|
+
| `max_data_size` | number | | Max response size in bytes (default: 20480) |
|
|
110
|
+
|
|
111
|
+
**Example:**
|
|
112
|
+
|
|
113
|
+
```json
|
|
114
|
+
{
|
|
115
|
+
"tool_id": "openweathermap_current_weather",
|
|
116
|
+
"search_id": "abc123",
|
|
117
|
+
"params_to_tool": "{\"city\": \"London\", \"units\": \"metric\"}"
|
|
118
|
+
}
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Session Management
|
|
122
|
+
|
|
123
|
+
The SDK automatically generates and maintains a session ID for the lifetime of the server process. This enables:
|
|
124
|
+
|
|
125
|
+
- Consistent user tracking across multiple tool calls
|
|
126
|
+
- Better analytics and usage patterns
|
|
127
|
+
- Improved tool recommendations over time
|
|
128
|
+
|
|
129
|
+
You can override the session ID by providing `session_id` in any tool call.
|
|
130
|
+
|
|
131
|
+
## Response Handling
|
|
132
|
+
|
|
133
|
+
### Successful Execution
|
|
134
|
+
|
|
135
|
+
```json
|
|
136
|
+
{
|
|
137
|
+
"execution_id": "exec-123",
|
|
138
|
+
"tool_id": "openweathermap_current_weather",
|
|
139
|
+
"success": true,
|
|
140
|
+
"result": {
|
|
141
|
+
"data": {
|
|
142
|
+
"temperature": 15.5,
|
|
143
|
+
"humidity": 72,
|
|
144
|
+
"description": "partly cloudy"
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
"execution_time": 0.847
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### Large Responses
|
|
152
|
+
|
|
153
|
+
When tool output exceeds `max_data_size`, you'll receive:
|
|
154
|
+
|
|
155
|
+
```json
|
|
156
|
+
{
|
|
157
|
+
"result": {
|
|
158
|
+
"message": "Result content is too long...",
|
|
159
|
+
"truncated_content": "[[1678233600000, \"22198.56...",
|
|
160
|
+
"full_content_file_url": "https://..."
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The `full_content_file_url` is valid for 120 minutes.
|
|
166
|
+
|
|
167
|
+
## Environment Variables
|
|
168
|
+
|
|
169
|
+
| Variable | Required | Description |
|
|
170
|
+
|----------|----------|-------------|
|
|
171
|
+
| `QVERIS_API_KEY` | ✓ | Your Qveris API authentication token |
|
|
172
|
+
|
|
173
|
+
## Requirements
|
|
174
|
+
|
|
175
|
+
- Node.js 18.0.0 or higher
|
|
176
|
+
- A valid Qveris API key
|
|
177
|
+
|
|
178
|
+
## Development
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Clone the repository
|
|
182
|
+
git clone https://github.com/qverisai/sdk.git
|
|
183
|
+
cd sdk
|
|
184
|
+
|
|
185
|
+
# Install dependencies
|
|
186
|
+
npm install
|
|
187
|
+
|
|
188
|
+
# Build
|
|
189
|
+
npm build
|
|
190
|
+
|
|
191
|
+
# Run locally
|
|
192
|
+
QVERIS_API_KEY=your-key node dist/index.js
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
MIT © [QverisAI](https://github.com/qverisai)
|
|
198
|
+
|
|
199
|
+
## Support
|
|
200
|
+
|
|
201
|
+
- 📖 [API Documentation](https://qveris.ai/docs)
|
|
202
|
+
- 🐛 [Issue Tracker](https://github.com/qverisai/sdk/issues)
|
|
203
|
+
- 💬 Contact: contact@qveris.ai
|
|
204
|
+
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Qveris API HTTP Client
|
|
3
|
+
*
|
|
4
|
+
* Provides a type-safe HTTP client for interacting with the Qveris REST API.
|
|
5
|
+
* Handles authentication, request formatting, and error handling.
|
|
6
|
+
*
|
|
7
|
+
* @module api/client
|
|
8
|
+
*/
|
|
9
|
+
import type { SearchRequest, SearchResponse, ExecuteRequest, ExecuteResponse, QverisClientConfig } from '../types.js';
|
|
10
|
+
/**
|
|
11
|
+
* Qveris API Client
|
|
12
|
+
*
|
|
13
|
+
* A lightweight HTTP client for the Qveris API using native fetch.
|
|
14
|
+
* Requires Node.js 18+ for native fetch support.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* const client = new QverisClient({ apiKey: 'your-api-key' });
|
|
19
|
+
*
|
|
20
|
+
* // Search for tools
|
|
21
|
+
* const searchResult = await client.searchTools({
|
|
22
|
+
* query: 'weather API',
|
|
23
|
+
* limit: 5
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Execute a tool
|
|
27
|
+
* const execResult = await client.executeTool('tool-id', {
|
|
28
|
+
* search_id: searchResult.search_id,
|
|
29
|
+
* parameters: { city: 'London' }
|
|
30
|
+
* });
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
export declare class QverisClient {
|
|
34
|
+
private readonly apiKey;
|
|
35
|
+
private readonly baseUrl;
|
|
36
|
+
/**
|
|
37
|
+
* Creates a new Qveris API client.
|
|
38
|
+
*
|
|
39
|
+
* @param config - Client configuration
|
|
40
|
+
* @throws {Error} If apiKey is not provided
|
|
41
|
+
*/
|
|
42
|
+
constructor(config: QverisClientConfig);
|
|
43
|
+
/**
|
|
44
|
+
* Makes an authenticated HTTP request to the Qveris API.
|
|
45
|
+
*
|
|
46
|
+
* @param method - HTTP method
|
|
47
|
+
* @param endpoint - API endpoint (relative to base URL)
|
|
48
|
+
* @param body - Request body (will be JSON serialized)
|
|
49
|
+
* @returns Parsed JSON response
|
|
50
|
+
* @throws {ApiError} If the request fails
|
|
51
|
+
*/
|
|
52
|
+
private request;
|
|
53
|
+
/**
|
|
54
|
+
* Search for tools based on a natural language query.
|
|
55
|
+
*
|
|
56
|
+
* Finds tools that match the described capability. Results include
|
|
57
|
+
* tool metadata, parameter schemas, and usage examples.
|
|
58
|
+
*
|
|
59
|
+
* @param request - Search parameters
|
|
60
|
+
* @returns Search results with matching tools
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const result = await client.searchTools({
|
|
65
|
+
* query: 'send SMS message',
|
|
66
|
+
* limit: 10,
|
|
67
|
+
* session_id: 'user-123'
|
|
68
|
+
* });
|
|
69
|
+
*
|
|
70
|
+
* console.log(`Found ${result.total} tools`);
|
|
71
|
+
* for (const tool of result.results) {
|
|
72
|
+
* console.log(`- ${tool.name}: ${tool.description}`);
|
|
73
|
+
* }
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
searchTools(request: SearchRequest): Promise<SearchResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Execute a tool with the specified parameters.
|
|
79
|
+
*
|
|
80
|
+
* The tool_id must come from a previous searchTools call.
|
|
81
|
+
* The search_id links this execution to that search for analytics.
|
|
82
|
+
*
|
|
83
|
+
* @param toolId - The tool identifier from search results
|
|
84
|
+
* @param request - Execution parameters
|
|
85
|
+
* @returns Execution result
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```typescript
|
|
89
|
+
* const result = await client.executeTool('openweathermap_current', {
|
|
90
|
+
* search_id: 'search-abc123',
|
|
91
|
+
* session_id: 'user-123',
|
|
92
|
+
* parameters: {
|
|
93
|
+
* city: 'Tokyo',
|
|
94
|
+
* units: 'metric'
|
|
95
|
+
* }
|
|
96
|
+
* });
|
|
97
|
+
*
|
|
98
|
+
* if (result.success) {
|
|
99
|
+
* console.log('Result:', result.result);
|
|
100
|
+
* } else {
|
|
101
|
+
* console.error('Failed:', result.error_message);
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
executeTool(toolId: string, request: ExecuteRequest): Promise<ExecuteResponse>;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Creates a Qveris client from environment variables.
|
|
109
|
+
*
|
|
110
|
+
* Reads the API key from the QVERIS_API_KEY environment variable.
|
|
111
|
+
*
|
|
112
|
+
* @returns Configured Qveris client
|
|
113
|
+
* @throws {Error} If QVERIS_API_KEY is not set
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```typescript
|
|
117
|
+
* // Ensure QVERIS_API_KEY is set in your environment
|
|
118
|
+
* const client = createClientFromEnv();
|
|
119
|
+
* ```
|
|
120
|
+
*/
|
|
121
|
+
export declare function createClientFromEnv(): QverisClient;
|
|
122
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,aAAa,EACb,cAAc,EACd,cAAc,EACd,eAAe,EACf,kBAAkB,EAEnB,MAAM,aAAa,CAAC;AAKrB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,YAAY;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IAEjC;;;;;OAKG;gBACS,MAAM,EAAE,kBAAkB;IAQtC;;;;;;;;OAQG;YACW,OAAO;IA2CrB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACG,WAAW,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAIlE;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACG,WAAW,CACf,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,eAAe,CAAC;CAI5B;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,IAAI,YAAY,CAYlD"}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Qveris API HTTP Client
|
|
3
|
+
*
|
|
4
|
+
* Provides a type-safe HTTP client for interacting with the Qveris REST API.
|
|
5
|
+
* Handles authentication, request formatting, and error handling.
|
|
6
|
+
*
|
|
7
|
+
* @module api/client
|
|
8
|
+
*/
|
|
9
|
+
/** Production API base URL */
|
|
10
|
+
const DEFAULT_BASE_URL = 'https://qveris.ai/api/v1';
|
|
11
|
+
/**
|
|
12
|
+
* Qveris API Client
|
|
13
|
+
*
|
|
14
|
+
* A lightweight HTTP client for the Qveris API using native fetch.
|
|
15
|
+
* Requires Node.js 18+ for native fetch support.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```typescript
|
|
19
|
+
* const client = new QverisClient({ apiKey: 'your-api-key' });
|
|
20
|
+
*
|
|
21
|
+
* // Search for tools
|
|
22
|
+
* const searchResult = await client.searchTools({
|
|
23
|
+
* query: 'weather API',
|
|
24
|
+
* limit: 5
|
|
25
|
+
* });
|
|
26
|
+
*
|
|
27
|
+
* // Execute a tool
|
|
28
|
+
* const execResult = await client.executeTool('tool-id', {
|
|
29
|
+
* search_id: searchResult.search_id,
|
|
30
|
+
* parameters: { city: 'London' }
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
export class QverisClient {
|
|
35
|
+
apiKey;
|
|
36
|
+
baseUrl;
|
|
37
|
+
/**
|
|
38
|
+
* Creates a new Qveris API client.
|
|
39
|
+
*
|
|
40
|
+
* @param config - Client configuration
|
|
41
|
+
* @throws {Error} If apiKey is not provided
|
|
42
|
+
*/
|
|
43
|
+
constructor(config) {
|
|
44
|
+
if (!config.apiKey) {
|
|
45
|
+
throw new Error('Qveris API key is required');
|
|
46
|
+
}
|
|
47
|
+
this.apiKey = config.apiKey;
|
|
48
|
+
this.baseUrl = config.baseUrl ?? DEFAULT_BASE_URL;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Makes an authenticated HTTP request to the Qveris API.
|
|
52
|
+
*
|
|
53
|
+
* @param method - HTTP method
|
|
54
|
+
* @param endpoint - API endpoint (relative to base URL)
|
|
55
|
+
* @param body - Request body (will be JSON serialized)
|
|
56
|
+
* @returns Parsed JSON response
|
|
57
|
+
* @throws {ApiError} If the request fails
|
|
58
|
+
*/
|
|
59
|
+
async request(method, endpoint, body) {
|
|
60
|
+
const url = `${this.baseUrl}${endpoint}`;
|
|
61
|
+
const response = await fetch(url, {
|
|
62
|
+
method,
|
|
63
|
+
headers: {
|
|
64
|
+
'Authorization': `Bearer ${this.apiKey}`,
|
|
65
|
+
'Content-Type': 'application/json',
|
|
66
|
+
},
|
|
67
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
68
|
+
});
|
|
69
|
+
if (!response.ok) {
|
|
70
|
+
let errorMessage;
|
|
71
|
+
let errorDetails;
|
|
72
|
+
try {
|
|
73
|
+
const errorBody = (await response.json());
|
|
74
|
+
errorMessage =
|
|
75
|
+
errorBody.message ||
|
|
76
|
+
errorBody.error ||
|
|
77
|
+
response.statusText;
|
|
78
|
+
errorDetails = errorBody;
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
errorMessage = response.statusText || `HTTP ${response.status}`;
|
|
82
|
+
}
|
|
83
|
+
const error = {
|
|
84
|
+
status: response.status,
|
|
85
|
+
message: errorMessage,
|
|
86
|
+
details: errorDetails,
|
|
87
|
+
};
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
return response.json();
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Search for tools based on a natural language query.
|
|
94
|
+
*
|
|
95
|
+
* Finds tools that match the described capability. Results include
|
|
96
|
+
* tool metadata, parameter schemas, and usage examples.
|
|
97
|
+
*
|
|
98
|
+
* @param request - Search parameters
|
|
99
|
+
* @returns Search results with matching tools
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```typescript
|
|
103
|
+
* const result = await client.searchTools({
|
|
104
|
+
* query: 'send SMS message',
|
|
105
|
+
* limit: 10,
|
|
106
|
+
* session_id: 'user-123'
|
|
107
|
+
* });
|
|
108
|
+
*
|
|
109
|
+
* console.log(`Found ${result.total} tools`);
|
|
110
|
+
* for (const tool of result.results) {
|
|
111
|
+
* console.log(`- ${tool.name}: ${tool.description}`);
|
|
112
|
+
* }
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
async searchTools(request) {
|
|
116
|
+
return this.request('POST', '/search', request);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Execute a tool with the specified parameters.
|
|
120
|
+
*
|
|
121
|
+
* The tool_id must come from a previous searchTools call.
|
|
122
|
+
* The search_id links this execution to that search for analytics.
|
|
123
|
+
*
|
|
124
|
+
* @param toolId - The tool identifier from search results
|
|
125
|
+
* @param request - Execution parameters
|
|
126
|
+
* @returns Execution result
|
|
127
|
+
*
|
|
128
|
+
* @example
|
|
129
|
+
* ```typescript
|
|
130
|
+
* const result = await client.executeTool('openweathermap_current', {
|
|
131
|
+
* search_id: 'search-abc123',
|
|
132
|
+
* session_id: 'user-123',
|
|
133
|
+
* parameters: {
|
|
134
|
+
* city: 'Tokyo',
|
|
135
|
+
* units: 'metric'
|
|
136
|
+
* }
|
|
137
|
+
* });
|
|
138
|
+
*
|
|
139
|
+
* if (result.success) {
|
|
140
|
+
* console.log('Result:', result.result);
|
|
141
|
+
* } else {
|
|
142
|
+
* console.error('Failed:', result.error_message);
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
*/
|
|
146
|
+
async executeTool(toolId, request) {
|
|
147
|
+
const endpoint = `/tools/execute?tool_id=${encodeURIComponent(toolId)}`;
|
|
148
|
+
return this.request('POST', endpoint, request);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Creates a Qveris client from environment variables.
|
|
153
|
+
*
|
|
154
|
+
* Reads the API key from the QVERIS_API_KEY environment variable.
|
|
155
|
+
*
|
|
156
|
+
* @returns Configured Qveris client
|
|
157
|
+
* @throws {Error} If QVERIS_API_KEY is not set
|
|
158
|
+
*
|
|
159
|
+
* @example
|
|
160
|
+
* ```typescript
|
|
161
|
+
* // Ensure QVERIS_API_KEY is set in your environment
|
|
162
|
+
* const client = createClientFromEnv();
|
|
163
|
+
* ```
|
|
164
|
+
*/
|
|
165
|
+
export function createClientFromEnv() {
|
|
166
|
+
const apiKey = process.env.QVERIS_API_KEY;
|
|
167
|
+
if (!apiKey) {
|
|
168
|
+
throw new Error('QVERIS_API_KEY environment variable is required.\n' +
|
|
169
|
+
'Please set it to your Qveris API token.\n' +
|
|
170
|
+
'Contact Qveris to obtain an API token.');
|
|
171
|
+
}
|
|
172
|
+
return new QverisClient({ apiKey });
|
|
173
|
+
}
|
|
174
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAWH,8BAA8B;AAC9B,MAAM,gBAAgB,GAAG,0BAA0B,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,YAAY;IACN,MAAM,CAAS;IACf,OAAO,CAAS;IAEjC;;;;;OAKG;IACH,YAAY,MAA0B;QACpC,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;QAChD,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,IAAI,gBAAgB,CAAC;IACpD,CAAC;IAED;;;;;;;;OAQG;IACK,KAAK,CAAC,OAAO,CACnB,MAAsB,EACtB,QAAgB,EAChB,IAAc;QAEd,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,OAAO,GAAG,QAAQ,EAAE,CAAC;QAEzC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM;YACN,OAAO,EAAE;gBACP,eAAe,EAAE,UAAU,IAAI,CAAC,MAAM,EAAE;gBACxC,cAAc,EAAE,kBAAkB;aACnC;YACD,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS;SAC9C,CAAC,CAAC;QAEH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,IAAI,YAAoB,CAAC;YACzB,IAAI,YAAqB,CAAC;YAE1B,IAAI,CAAC;gBACH,MAAM,SAAS,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA4B,CAAC;gBACrE,YAAY;oBACT,SAAS,CAAC,OAAkB;wBAC5B,SAAS,CAAC,KAAgB;wBAC3B,QAAQ,CAAC,UAAU,CAAC;gBACtB,YAAY,GAAG,SAAS,CAAC;YAC3B,CAAC;YAAC,MAAM,CAAC;gBACP,YAAY,GAAG,QAAQ,CAAC,UAAU,IAAI,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC;YAClE,CAAC;YAED,MAAM,KAAK,GAAa;gBACtB,MAAM,EAAE,QAAQ,CAAC,MAAM;gBACvB,OAAO,EAAE,YAAY;gBACrB,OAAO,EAAE,YAAY;aACtB,CAAC;YAEF,MAAM,KAAK,CAAC;QACd,CAAC;QAED,OAAO,QAAQ,CAAC,IAAI,EAAgB,CAAC;IACvC,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,KAAK,CAAC,WAAW,CAAC,OAAsB;QACtC,OAAO,IAAI,CAAC,OAAO,CAAiB,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;OA2BG;IACH,KAAK,CAAC,WAAW,CACf,MAAc,EACd,OAAuB;QAEvB,MAAM,QAAQ,GAAG,0BAA0B,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC,OAAO,CAAkB,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CACF;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,mBAAmB;IACjC,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAE1C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CACb,oDAAoD;YACpD,2CAA2C;YAC3C,wCAAwC,CACzC,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC,CAAC;AACtC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Qveris MCP Server
|
|
4
|
+
*
|
|
5
|
+
* A Model Context Protocol (MCP) server that provides access to the Qveris
|
|
6
|
+
* tool discovery and execution API. Enables LLMs to dynamically search for
|
|
7
|
+
* and execute third-party tools via natural language.
|
|
8
|
+
*
|
|
9
|
+
* @module @qverisai/sdk
|
|
10
|
+
* @version 0.1.0
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* Configure in Claude Desktop or Cursor:
|
|
14
|
+
* ```json
|
|
15
|
+
* {
|
|
16
|
+
* "mcpServers": {
|
|
17
|
+
* "qveris": {
|
|
18
|
+
* "command": "npx",
|
|
19
|
+
* "args": ["@qverisai/sdk"],
|
|
20
|
+
* "env": { "QVERIS_API_KEY": "your-api-key" }
|
|
21
|
+
* }
|
|
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":";AACA;;;;;;;;;;;;;;;;;;;;;;;GAuBG"}
|