@attrove/mcp 0.1.3 → 0.1.5
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/README.md +52 -1
- package/cjs/README.md +247 -0
- package/cjs/bin/attrove-mcp.js +69 -0
- package/cjs/package.json +69 -0
- package/cjs/src/__mocks__/version.js +17 -0
- package/cjs/src/__mocks__/version.js.map +1 -0
- package/cjs/src/constants.js +17 -0
- package/cjs/src/constants.js.map +1 -0
- package/cjs/src/index.js +43 -0
- package/cjs/src/index.js.map +1 -0
- package/cjs/src/server.js +247 -0
- package/cjs/src/server.js.map +1 -0
- package/cjs/src/tools/index.js +26 -0
- package/cjs/src/tools/index.js.map +1 -0
- package/cjs/src/tools/integrations.js +50 -0
- package/cjs/src/tools/integrations.js.map +1 -0
- package/cjs/src/tools/query.js +70 -0
- package/cjs/src/tools/query.js.map +1 -0
- package/cjs/src/tools/search.js +147 -0
- package/cjs/src/tools/search.js.map +1 -0
- package/cjs/src/version.js +142 -0
- package/cjs/src/version.js.map +1 -0
- package/esm/README.md +247 -0
- package/esm/bin/attrove-mcp.js +69 -0
- package/esm/package.json +69 -0
- package/esm/src/__mocks__/version.js +12 -0
- package/esm/src/__mocks__/version.js.map +1 -0
- package/esm/src/constants.js +14 -0
- package/esm/src/constants.js.map +1 -0
- package/esm/src/index.js +32 -0
- package/esm/src/index.js.map +1 -0
- package/esm/src/server.js +241 -0
- package/esm/src/server.js.map +1 -0
- package/esm/src/tools/index.js +19 -0
- package/esm/src/tools/index.js.map +1 -0
- package/esm/src/tools/integrations.js +46 -0
- package/esm/src/tools/integrations.js.map +1 -0
- package/esm/src/tools/query.js +66 -0
- package/esm/src/tools/query.js.map +1 -0
- package/esm/src/tools/search.js +143 -0
- package/esm/src/tools/search.js.map +1 -0
- package/esm/src/version.js +137 -0
- package/esm/src/version.js.map +1 -0
- package/package.json +13 -11
- package/types/src/__mocks__/version.d.ts +7 -0
- package/types/src/constants.d.ts +13 -0
- package/types/src/index.d.ts +32 -0
- package/types/src/server.d.ts +38 -0
- package/types/src/tools/index.d.ts +80 -0
- package/types/src/tools/integrations.d.ts +22 -0
- package/types/src/tools/query.d.ts +47 -0
- package/types/src/tools/search.d.ts +57 -0
- package/types/src/version.d.ts +23 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server Version Utilities
|
|
3
|
+
*
|
|
4
|
+
* Reads the version from package.json at runtime to ensure the reported
|
|
5
|
+
* version always matches the published package version.
|
|
6
|
+
*
|
|
7
|
+
* Uses a cross-platform approach that works in both ESM and CJS environments
|
|
8
|
+
* by parsing Error stack traces to determine the current file location.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync, readFileSync } from 'fs';
|
|
11
|
+
import { dirname, join, resolve } from 'path';
|
|
12
|
+
import { fileURLToPath } from 'url';
|
|
13
|
+
/**
|
|
14
|
+
* Fallback version used when package.json cannot be read.
|
|
15
|
+
* This should only happen in unusual development environments.
|
|
16
|
+
*/
|
|
17
|
+
const FALLBACK_VERSION = '0.0.0-unknown';
|
|
18
|
+
/**
|
|
19
|
+
* Cached version string to avoid repeated file reads.
|
|
20
|
+
*/
|
|
21
|
+
let cachedVersion;
|
|
22
|
+
/**
|
|
23
|
+
* Get the directory of the current file using Error stack trace parsing.
|
|
24
|
+
* Works in both ESM and CJS environments without relying on __dirname or import.meta.url.
|
|
25
|
+
*/
|
|
26
|
+
function getCurrentDirectory() {
|
|
27
|
+
const err = new Error();
|
|
28
|
+
const stack = err.stack || '';
|
|
29
|
+
// Stack trace line patterns:
|
|
30
|
+
// Node CJS: " at Function.<anonymous> (/path/to/file.js:10:15)"
|
|
31
|
+
// Node ESM: " at file:///path/to/file.js:10:15"
|
|
32
|
+
// Also handles: " at /path/to/file.js:10:15"
|
|
33
|
+
const lines = stack.split('\n');
|
|
34
|
+
for (const line of lines) {
|
|
35
|
+
// Skip the Error message line and this function's frame
|
|
36
|
+
if (!line.includes('getCurrentDirectory') && !line.startsWith('Error')) {
|
|
37
|
+
// Match file:// URLs (ESM)
|
|
38
|
+
const fileUrlMatch = line.match(/file:\/\/([^:]+):\d+:\d+/);
|
|
39
|
+
if (fileUrlMatch) {
|
|
40
|
+
try {
|
|
41
|
+
const filePath = fileURLToPath(`file://${fileUrlMatch[1]}`);
|
|
42
|
+
return dirname(filePath);
|
|
43
|
+
}
|
|
44
|
+
catch {
|
|
45
|
+
// Continue to next pattern
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
// Match parenthesized paths: "at Something (/path/to/file.js:10:15)"
|
|
49
|
+
const parenMatch = line.match(/\(([^)]+):\d+:\d+\)/);
|
|
50
|
+
if (parenMatch && !parenMatch[1].startsWith('node:')) {
|
|
51
|
+
return dirname(parenMatch[1]);
|
|
52
|
+
}
|
|
53
|
+
// Match bare paths: "at /path/to/file.js:10:15"
|
|
54
|
+
const bareMatch = line.match(/at\s+([^:]+):\d+:\d+/);
|
|
55
|
+
if (bareMatch && !bareMatch[1].startsWith('node:') && !bareMatch[1].includes('(')) {
|
|
56
|
+
return dirname(bareMatch[1].trim());
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Search for package.json with the correct package name starting from a directory.
|
|
64
|
+
*/
|
|
65
|
+
function findPackageJson(startDir, packageName) {
|
|
66
|
+
let dir = startDir;
|
|
67
|
+
const visited = new Set();
|
|
68
|
+
while (dir && !visited.has(dir)) {
|
|
69
|
+
visited.add(dir);
|
|
70
|
+
const pkgPath = join(dir, 'package.json');
|
|
71
|
+
if (existsSync(pkgPath)) {
|
|
72
|
+
try {
|
|
73
|
+
const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
|
|
74
|
+
if (pkg.name === packageName && pkg.version) {
|
|
75
|
+
return pkg.version;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Continue searching
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
const parent = dirname(dir);
|
|
83
|
+
if (parent === dir)
|
|
84
|
+
break;
|
|
85
|
+
dir = parent;
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Get the MCP server version from package.json.
|
|
91
|
+
*
|
|
92
|
+
* This function reads the version at runtime from the package.json file,
|
|
93
|
+
* ensuring the MCP server always reports the correct published version
|
|
94
|
+
* to clients.
|
|
95
|
+
*
|
|
96
|
+
* The version is cached after the first read for performance.
|
|
97
|
+
*/
|
|
98
|
+
export function getVersion() {
|
|
99
|
+
if (cachedVersion !== undefined) {
|
|
100
|
+
return cachedVersion;
|
|
101
|
+
}
|
|
102
|
+
const packageName = '@attrove/mcp';
|
|
103
|
+
// Try to find package.json starting from the current file's directory
|
|
104
|
+
const currentDir = getCurrentDirectory();
|
|
105
|
+
if (currentDir) {
|
|
106
|
+
const version = findPackageJson(currentDir, packageName);
|
|
107
|
+
if (version) {
|
|
108
|
+
cachedVersion = version;
|
|
109
|
+
return version;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Fallback: search from common locations relative to process.cwd()
|
|
113
|
+
const fallbackPaths = [
|
|
114
|
+
resolve(process.cwd(), 'packages/mcp'),
|
|
115
|
+
resolve(process.cwd(), 'node_modules/@attrove/mcp'),
|
|
116
|
+
process.cwd(),
|
|
117
|
+
];
|
|
118
|
+
for (const searchPath of fallbackPaths) {
|
|
119
|
+
if (existsSync(searchPath)) {
|
|
120
|
+
const version = findPackageJson(searchPath, packageName);
|
|
121
|
+
if (version) {
|
|
122
|
+
cachedVersion = version;
|
|
123
|
+
return version;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
// If we can't find package.json, use the fallback
|
|
128
|
+
cachedVersion = FALLBACK_VERSION;
|
|
129
|
+
return FALLBACK_VERSION;
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* Reset the cached version. Primarily for testing purposes.
|
|
133
|
+
*/
|
|
134
|
+
export function resetVersionCache() {
|
|
135
|
+
cachedVersion = undefined;
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../../../../packages/mcp/src/version.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AAEpC;;;GAGG;AACH,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC;;GAEG;AACH,IAAI,aAAiC,CAAC;AAEtC;;;GAGG;AACH,SAAS,mBAAmB;IAC1B,MAAM,GAAG,GAAG,IAAI,KAAK,EAAE,CAAC;IACxB,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,IAAI,EAAE,CAAC;IAE9B,6BAA6B;IAC7B,mEAAmE;IACnE,mDAAmD;IACnD,gDAAgD;IAChD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAEhC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,wDAAwD;QACxD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;YACvE,2BAA2B;YAC3B,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;YAC5D,IAAI,YAAY,EAAE,CAAC;gBACjB,IAAI,CAAC;oBACH,MAAM,QAAQ,GAAG,aAAa,CAAC,UAAU,YAAY,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;oBAC5D,OAAO,OAAO,CAAC,QAAQ,C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C;YACjB,CAAC;QACH,CAAC;IACH,CAAC;IAED,kDAAkD;IAClD,aAAa,GAAG,gBAAgB,CAAC;IACjC,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB;IAC/B,aAAa,GAAG,SAAS,CAAC;AAC5B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@attrove/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "MCP server for Attrove - AI-powered context retrieval for Claude and Cursor",
|
|
5
|
-
"main": "./
|
|
6
|
-
"module": "./
|
|
7
|
-
"types": "./
|
|
5
|
+
"main": "./cjs/src/index.js",
|
|
6
|
+
"module": "./esm/src/index.js",
|
|
7
|
+
"types": "./types/src/index.d.ts",
|
|
8
8
|
"bin": {
|
|
9
9
|
"attrove-mcp": "./bin/attrove-mcp.js"
|
|
10
10
|
},
|
|
11
11
|
"exports": {
|
|
12
12
|
".": {
|
|
13
13
|
"import": {
|
|
14
|
-
"types": "./
|
|
15
|
-
"default": "./
|
|
14
|
+
"types": "./types/src/index.d.ts",
|
|
15
|
+
"default": "./esm/src/index.js"
|
|
16
16
|
},
|
|
17
17
|
"require": {
|
|
18
|
-
"types": "./
|
|
19
|
-
"default": "./
|
|
18
|
+
"types": "./types/src/index.d.ts",
|
|
19
|
+
"default": "./cjs/src/index.js"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"files": [
|
|
24
|
-
"
|
|
24
|
+
"cjs",
|
|
25
|
+
"esm",
|
|
26
|
+
"types",
|
|
25
27
|
"bin",
|
|
26
28
|
"README.md"
|
|
27
29
|
],
|
|
@@ -56,7 +58,7 @@
|
|
|
56
58
|
},
|
|
57
59
|
"dependencies": {
|
|
58
60
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
59
|
-
"@attrove/sdk": "
|
|
61
|
+
"@attrove/sdk": "0.1.5"
|
|
60
62
|
},
|
|
61
63
|
"devDependencies": {
|
|
62
64
|
"@types/node": "^20.0.0",
|
|
@@ -65,4 +67,4 @@
|
|
|
65
67
|
"publishConfig": {
|
|
66
68
|
"access": "public"
|
|
67
69
|
}
|
|
68
|
-
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Constants
|
|
3
|
+
*
|
|
4
|
+
* Centralized constants used across the MCP server. Consolidating these ensures
|
|
5
|
+
* consistency and makes maintenance easier.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Maximum length for message body preview text in search results.
|
|
9
|
+
*
|
|
10
|
+
* When displaying search results, message bodies longer than this value
|
|
11
|
+
* will be truncated with an ellipsis to keep output manageable.
|
|
12
|
+
*/
|
|
13
|
+
export declare const MAX_BODY_PREVIEW_LENGTH = 200;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @attrove/mcp
|
|
3
|
+
*
|
|
4
|
+
* MCP server for Attrove - enables AI assistants like Claude and Cursor
|
|
5
|
+
* to access user context through the Attrove API.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```bash
|
|
9
|
+
* # Run via npx
|
|
10
|
+
* ATTROVE_API_KEY=sk_... ATTROVE_USER_ID=... npx @attrove/mcp
|
|
11
|
+
*
|
|
12
|
+
* # Configure in Claude Desktop
|
|
13
|
+
* {
|
|
14
|
+
* "mcpServers": {
|
|
15
|
+
* "attrove": {
|
|
16
|
+
* "command": "npx",
|
|
17
|
+
* "args": ["@attrove/mcp"],
|
|
18
|
+
* "env": {
|
|
19
|
+
* "ATTROVE_API_KEY": "sk_...",
|
|
20
|
+
* "ATTROVE_USER_ID": "..."
|
|
21
|
+
* }
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* }
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @packageDocumentation
|
|
28
|
+
*/
|
|
29
|
+
export { createServer, startServer, getConfigFromEnv } from './server';
|
|
30
|
+
export type { McpServerConfig } from './server';
|
|
31
|
+
export { allToolDefinitions, queryToolDefinition, searchToolDefinition, integrationsToolDefinition, } from './tools';
|
|
32
|
+
export { getVersion } from './version';
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Attrove MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Model Context Protocol server that enables AI assistants like Claude
|
|
5
|
+
* to access user context through the Attrove API.
|
|
6
|
+
*/
|
|
7
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* Configuration for the MCP server.
|
|
10
|
+
*/
|
|
11
|
+
export interface McpServerConfig {
|
|
12
|
+
/**
|
|
13
|
+
* Attrove API key (sk_ prefixed).
|
|
14
|
+
*/
|
|
15
|
+
apiKey: string;
|
|
16
|
+
/**
|
|
17
|
+
* User ID (UUID) to scope API calls.
|
|
18
|
+
*/
|
|
19
|
+
userId: string;
|
|
20
|
+
/**
|
|
21
|
+
* Optional API base URL.
|
|
22
|
+
*/
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Create and configure the Attrove MCP server.
|
|
27
|
+
*/
|
|
28
|
+
export declare function createServer(config: McpServerConfig): Server;
|
|
29
|
+
/**
|
|
30
|
+
* Start the MCP server with stdio transport.
|
|
31
|
+
*/
|
|
32
|
+
export declare function startServer(config: McpServerConfig): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Get configuration from environment variables.
|
|
35
|
+
*
|
|
36
|
+
* @throws {Error} If required environment variables are missing
|
|
37
|
+
*/
|
|
38
|
+
export declare function getConfigFromEnv(): McpServerConfig;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Tools
|
|
3
|
+
*
|
|
4
|
+
* Tool definitions and executors for the Attrove MCP server.
|
|
5
|
+
*/
|
|
6
|
+
import { queryToolDefinition, executeQueryTool, QueryToolInput } from './query';
|
|
7
|
+
import { searchToolDefinition, executeSearchTool, SearchToolInput } from './search';
|
|
8
|
+
import { integrationsToolDefinition, executeIntegrationsTool } from './integrations';
|
|
9
|
+
export { queryToolDefinition, executeQueryTool, searchToolDefinition, executeSearchTool, integrationsToolDefinition, executeIntegrationsTool, };
|
|
10
|
+
export type { QueryToolInput, SearchToolInput };
|
|
11
|
+
/**
|
|
12
|
+
* All tool definitions for registration with MCP.
|
|
13
|
+
*/
|
|
14
|
+
export declare const allToolDefinitions: readonly [{
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
inputSchema: {
|
|
18
|
+
type: "object";
|
|
19
|
+
properties: {
|
|
20
|
+
query: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
integration_ids: {
|
|
25
|
+
type: string;
|
|
26
|
+
items: {
|
|
27
|
+
type: string;
|
|
28
|
+
};
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
include_sources: {
|
|
32
|
+
type: string;
|
|
33
|
+
description: string;
|
|
34
|
+
default: boolean;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
required: string[];
|
|
38
|
+
};
|
|
39
|
+
}, {
|
|
40
|
+
name: string;
|
|
41
|
+
description: string;
|
|
42
|
+
inputSchema: {
|
|
43
|
+
type: "object";
|
|
44
|
+
properties: {
|
|
45
|
+
query: {
|
|
46
|
+
type: string;
|
|
47
|
+
description: string;
|
|
48
|
+
};
|
|
49
|
+
after_date: {
|
|
50
|
+
type: string;
|
|
51
|
+
description: string;
|
|
52
|
+
};
|
|
53
|
+
before_date: {
|
|
54
|
+
type: string;
|
|
55
|
+
description: string;
|
|
56
|
+
};
|
|
57
|
+
sender_domains: {
|
|
58
|
+
type: string;
|
|
59
|
+
items: {
|
|
60
|
+
type: string;
|
|
61
|
+
};
|
|
62
|
+
description: string;
|
|
63
|
+
};
|
|
64
|
+
include_body_text: {
|
|
65
|
+
type: string;
|
|
66
|
+
description: string;
|
|
67
|
+
default: boolean;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
required: string[];
|
|
71
|
+
};
|
|
72
|
+
}, {
|
|
73
|
+
name: string;
|
|
74
|
+
description: string;
|
|
75
|
+
inputSchema: {
|
|
76
|
+
type: "object";
|
|
77
|
+
properties: {};
|
|
78
|
+
required: never[];
|
|
79
|
+
};
|
|
80
|
+
}];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Integrations Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool for listing and managing connected integrations.
|
|
5
|
+
*/
|
|
6
|
+
import { Attrove } from '@attrove/sdk';
|
|
7
|
+
/**
|
|
8
|
+
* Tool definition for attrove_integrations.
|
|
9
|
+
*/
|
|
10
|
+
export declare const integrationsToolDefinition: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object";
|
|
15
|
+
properties: {};
|
|
16
|
+
required: never[];
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Execute the integrations tool.
|
|
21
|
+
*/
|
|
22
|
+
export declare function executeIntegrationsTool(client: Attrove): Promise<string>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool for RAG queries against user context.
|
|
5
|
+
*/
|
|
6
|
+
import { Attrove } from '@attrove/sdk';
|
|
7
|
+
/**
|
|
8
|
+
* Tool definition for attrove_query.
|
|
9
|
+
*/
|
|
10
|
+
export declare const queryToolDefinition: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object";
|
|
15
|
+
properties: {
|
|
16
|
+
query: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
integration_ids: {
|
|
21
|
+
type: string;
|
|
22
|
+
items: {
|
|
23
|
+
type: string;
|
|
24
|
+
};
|
|
25
|
+
description: string;
|
|
26
|
+
};
|
|
27
|
+
include_sources: {
|
|
28
|
+
type: string;
|
|
29
|
+
description: string;
|
|
30
|
+
default: boolean;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
required: string[];
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Input for the query tool.
|
|
38
|
+
*/
|
|
39
|
+
export interface QueryToolInput {
|
|
40
|
+
query: string;
|
|
41
|
+
integration_ids?: string[];
|
|
42
|
+
include_sources?: boolean;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Execute the query tool.
|
|
46
|
+
*/
|
|
47
|
+
export declare function executeQueryTool(client: Attrove, input: QueryToolInput): Promise<string>;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Search Tool
|
|
3
|
+
*
|
|
4
|
+
* MCP tool for semantic search across user context.
|
|
5
|
+
*/
|
|
6
|
+
import { Attrove } from '@attrove/sdk';
|
|
7
|
+
/**
|
|
8
|
+
* Tool definition for attrove_search.
|
|
9
|
+
*/
|
|
10
|
+
export declare const searchToolDefinition: {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object";
|
|
15
|
+
properties: {
|
|
16
|
+
query: {
|
|
17
|
+
type: string;
|
|
18
|
+
description: string;
|
|
19
|
+
};
|
|
20
|
+
after_date: {
|
|
21
|
+
type: string;
|
|
22
|
+
description: string;
|
|
23
|
+
};
|
|
24
|
+
before_date: {
|
|
25
|
+
type: string;
|
|
26
|
+
description: string;
|
|
27
|
+
};
|
|
28
|
+
sender_domains: {
|
|
29
|
+
type: string;
|
|
30
|
+
items: {
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
description: string;
|
|
34
|
+
};
|
|
35
|
+
include_body_text: {
|
|
36
|
+
type: string;
|
|
37
|
+
description: string;
|
|
38
|
+
default: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
required: string[];
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
/**
|
|
45
|
+
* Input for the search tool.
|
|
46
|
+
*/
|
|
47
|
+
export interface SearchToolInput {
|
|
48
|
+
query: string;
|
|
49
|
+
after_date?: string;
|
|
50
|
+
before_date?: string;
|
|
51
|
+
sender_domains?: string[];
|
|
52
|
+
include_body_text?: boolean;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Execute the search tool.
|
|
56
|
+
*/
|
|
57
|
+
export declare function executeSearchTool(client: Attrove, input: SearchToolInput): Promise<string>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Server Version Utilities
|
|
3
|
+
*
|
|
4
|
+
* Reads the version from package.json at runtime to ensure the reported
|
|
5
|
+
* version always matches the published package version.
|
|
6
|
+
*
|
|
7
|
+
* Uses a cross-platform approach that works in both ESM and CJS environments
|
|
8
|
+
* by parsing Error stack traces to determine the current file location.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* Get the MCP server version from package.json.
|
|
12
|
+
*
|
|
13
|
+
* This function reads the version at runtime from the package.json file,
|
|
14
|
+
* ensuring the MCP server always reports the correct published version
|
|
15
|
+
* to clients.
|
|
16
|
+
*
|
|
17
|
+
* The version is cached after the first read for performance.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getVersion(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Reset the cached version. Primarily for testing purposes.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resetVersionCache(): void;
|