@sena-ai/tools 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=mcpServer.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpServer.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/mcpServer.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,39 @@
1
+ import { describe, it, expect } from 'vitest';
2
+ import { mcpServer } from '../mcpServer.js';
3
+ describe('mcpServer', () => {
4
+ it('creates HTTP MCP tool port', () => {
5
+ const tool = mcpServer({
6
+ name: 'posthog',
7
+ url: 'https://mcp.posthog.com/mcp',
8
+ headers: { Authorization: 'Bearer test' },
9
+ });
10
+ expect(tool.name).toBe('posthog');
11
+ expect(tool.type).toBe('mcp-http');
12
+ const config = tool.toMcpConfig({ name: 'claude' });
13
+ expect(config).toEqual({
14
+ url: 'https://mcp.posthog.com/mcp',
15
+ headers: { Authorization: 'Bearer test' },
16
+ });
17
+ });
18
+ it('creates stdio MCP tool port', () => {
19
+ const tool = mcpServer({
20
+ name: 'my-tool',
21
+ command: 'node',
22
+ args: ['./server.js'],
23
+ });
24
+ expect(tool.name).toBe('my-tool');
25
+ expect(tool.type).toBe('mcp-stdio');
26
+ const config = tool.toMcpConfig({ name: 'codex' });
27
+ expect(config).toEqual({
28
+ command: 'node',
29
+ args: ['./server.js'],
30
+ });
31
+ });
32
+ it('omits headers when not provided for HTTP', () => {
33
+ const tool = mcpServer({ name: 'simple', url: 'https://example.com/mcp' });
34
+ const config = tool.toMcpConfig({ name: 'claude' });
35
+ expect(config).toEqual({ url: 'https://example.com/mcp' });
36
+ expect(config).not.toHaveProperty('headers');
37
+ });
38
+ });
39
+ //# sourceMappingURL=mcpServer.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpServer.test.js","sourceRoot":"","sources":["../../src/__tests__/mcpServer.test.ts"],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AM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC;YACrB,OAAO,EAAE,MAAM;YACf,IAAI,EAAE,CAAC,aAAa,CAAC;SACtB,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IAEF,EAAE,CAAC,0CAA0C,EAAE,GAAG,EAAE;QAClD,MAAM,IAAI,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,EAAE,yBAAyB,EAAE,CAAC,CAAA;QAC1E,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAA;QACnD,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,EAAE,GAAG,EAAE,yBAAyB,EAAE,CAAC,CAAA;QAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;IAC9C,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
@@ -0,0 +1,3 @@
1
+ export { mcpServer } from './mcpServer.js';
2
+ export type { McpServerOptions, McpHttpOptions, McpStdioOptions } from './mcpServer.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAC1C,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,2 @@
1
+ export { mcpServer } from './mcpServer.js';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA"}
@@ -0,0 +1,15 @@
1
+ import type { ToolPort } from '@sena-ai/core';
2
+ export type McpHttpOptions = {
3
+ name: string;
4
+ url: string;
5
+ headers?: Record<string, string>;
6
+ };
7
+ export type McpStdioOptions = {
8
+ name: string;
9
+ command: string;
10
+ args?: string[];
11
+ env?: Record<string, string>;
12
+ };
13
+ export type McpServerOptions = McpHttpOptions | McpStdioOptions;
14
+ export declare function mcpServer(options: McpServerOptions): ToolPort;
15
+ //# sourceMappingURL=mcpServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpServer.d.ts","sourceRoot":"","sources":["../src/mcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAA0B,MAAM,eAAe,CAAA;AAErE,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACjC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;IACf,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CAC7B,CAAA;AAED,MAAM,MAAM,gBAAgB,GAAG,cAAc,GAAG,eAAe,CAAA;AAM/D,wBAAgB,SAAS,CAAC,OAAO,EAAE,gBAAgB,GAAG,QAAQ,CAyB7D"}
@@ -0,0 +1,29 @@
1
+ function isHttpOptions(opts) {
2
+ return 'url' in opts;
3
+ }
4
+ export function mcpServer(options) {
5
+ if (isHttpOptions(options)) {
6
+ return {
7
+ name: options.name,
8
+ type: 'mcp-http',
9
+ toMcpConfig(_runtime) {
10
+ return {
11
+ url: options.url,
12
+ ...(options.headers ? { headers: options.headers } : {}),
13
+ };
14
+ },
15
+ };
16
+ }
17
+ return {
18
+ name: options.name,
19
+ type: 'mcp-stdio',
20
+ toMcpConfig(_runtime) {
21
+ return {
22
+ command: options.command,
23
+ args: options.args ?? [],
24
+ ...(options.env ? { env: options.env } : {}),
25
+ };
26
+ },
27
+ };
28
+ }
29
+ //# sourceMappingURL=mcpServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcpServer.js","sourceRoot":"","sources":["../src/mcpServer.ts"],"names":[],"mappings":"AAiBA,SAAS,aAAa,CAAC,IAAsB;IAC3C,OAAO,KAAK,IAAI,IAAI,CAAA;AACtB,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,OAAyB;IACjD,IAAI,aAAa,CAAC,OAAO,CAAC,EAAE,CAAC;QAC3B,OAAO;YACL,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,IAAI,EAAE,UAAU;YAChB,WAAW,CAAC,QAAqB;gBAC/B,OAAO;oBACL,GAAG,EAAE,OAAO,CAAC,GAAG;oBAChB,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;iBACzD,CAAA;YACH,CAAC;SACF,CAAA;IACH,CAAC;IAED,OAAO;QACL,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,IAAI,EAAE,WAAW;QACjB,WAAW,CAAC,QAAqB;YAC/B,OAAO;gBACL,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,EAAE;gBACxB,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aAC7C,CAAA;QACH,CAAC;KACF,CAAA;AACH,CAAC"}
package/package.json ADDED
@@ -0,0 +1,22 @@
1
+ {
2
+ "name": "@sena-ai/tools",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "exports": {
6
+ ".": {
7
+ "types": "./dist/index.d.ts",
8
+ "import": "./dist/index.js"
9
+ }
10
+ },
11
+ "files": ["dist"],
12
+ "scripts": {
13
+ "build": "tsc -b",
14
+ "dev": "tsc -b --watch"
15
+ },
16
+ "dependencies": {
17
+ "@sena-ai/core": "workspace:*"
18
+ },
19
+ "devDependencies": {
20
+ "typescript": "^5.8.0"
21
+ }
22
+ }