@agenium/mcp-server 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/README.md +164 -0
- package/dist/bridge.d.ts +66 -0
- package/dist/bridge.d.ts.map +1 -0
- package/dist/bridge.js +380 -0
- package/dist/bridge.js.map +1 -0
- package/dist/cli.d.ts +12 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +122 -0
- package/dist/cli.js.map +1 -0
- package/dist/discovery.d.ts +82 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +154 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +34 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp-transport.d.ts +63 -0
- package/dist/mcp-transport.d.ts.map +1 -0
- package/dist/mcp-transport.js +180 -0
- package/dist/mcp-transport.js.map +1 -0
- package/dist/types.d.ts +132 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +18 -0
- package/dist/types.js.map +1 -0
- package/package.json +52 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenium/mcp-server — MCP Transport Manager
|
|
3
|
+
*
|
|
4
|
+
* Manages the connection to an MCP server (stdio, SSE, or streamable HTTP).
|
|
5
|
+
* Provides a unified interface for listing tools, calling tools, etc.
|
|
6
|
+
*/
|
|
7
|
+
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
8
|
+
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
9
|
+
import { SSEClientTransport } from '@modelcontextprotocol/sdk/client/sse.js';
|
|
10
|
+
// ============================================================================
|
|
11
|
+
// MCP Transport Manager
|
|
12
|
+
// ============================================================================
|
|
13
|
+
export class MCPTransportManager {
|
|
14
|
+
client;
|
|
15
|
+
transport = null;
|
|
16
|
+
config;
|
|
17
|
+
connected = false;
|
|
18
|
+
constructor(config) {
|
|
19
|
+
this.config = config;
|
|
20
|
+
this.client = new Client({ name: 'agenium-mcp-bridge', version: '0.1.0' }, { capabilities: {} });
|
|
21
|
+
}
|
|
22
|
+
/** Connect to the MCP server */
|
|
23
|
+
async connect() {
|
|
24
|
+
if (this.connected)
|
|
25
|
+
return;
|
|
26
|
+
switch (this.config.transport) {
|
|
27
|
+
case 'stdio': {
|
|
28
|
+
this.transport = new StdioClientTransport({
|
|
29
|
+
command: this.config.command,
|
|
30
|
+
args: this.config.args,
|
|
31
|
+
cwd: this.config.cwd,
|
|
32
|
+
env: this.config.env
|
|
33
|
+
? { ...process.env, ...this.config.env }
|
|
34
|
+
: undefined,
|
|
35
|
+
});
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case 'sse': {
|
|
39
|
+
this.transport = new SSEClientTransport(new URL(this.config.url), {
|
|
40
|
+
requestInit: this.config.headers
|
|
41
|
+
? { headers: this.config.headers }
|
|
42
|
+
: undefined,
|
|
43
|
+
});
|
|
44
|
+
break;
|
|
45
|
+
}
|
|
46
|
+
case 'streamable-http': {
|
|
47
|
+
// Streamable HTTP uses the same SSE transport in v1 SDK
|
|
48
|
+
// In v2 it would use StreamableHTTPClientTransport
|
|
49
|
+
this.transport = new SSEClientTransport(new URL(this.config.url), {
|
|
50
|
+
requestInit: this.config.headers
|
|
51
|
+
? { headers: this.config.headers }
|
|
52
|
+
: undefined,
|
|
53
|
+
});
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
default:
|
|
57
|
+
throw new Error(`Unsupported MCP transport: ${this.config.transport}`);
|
|
58
|
+
}
|
|
59
|
+
await this.client.connect(this.transport);
|
|
60
|
+
this.connected = true;
|
|
61
|
+
}
|
|
62
|
+
/** Disconnect from the MCP server */
|
|
63
|
+
async disconnect() {
|
|
64
|
+
if (!this.connected)
|
|
65
|
+
return;
|
|
66
|
+
try {
|
|
67
|
+
await this.client.close();
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
// Ignore close errors
|
|
71
|
+
}
|
|
72
|
+
this.transport = null;
|
|
73
|
+
this.connected = false;
|
|
74
|
+
}
|
|
75
|
+
/** Check if connected */
|
|
76
|
+
isConnected() {
|
|
77
|
+
return this.connected;
|
|
78
|
+
}
|
|
79
|
+
// ============================================================================
|
|
80
|
+
// Tool Operations
|
|
81
|
+
// ============================================================================
|
|
82
|
+
/** List all tools exposed by the MCP server */
|
|
83
|
+
async listTools() {
|
|
84
|
+
this.ensureConnected();
|
|
85
|
+
const result = await this.client.listTools();
|
|
86
|
+
return (result.tools ?? []).map((t) => ({
|
|
87
|
+
name: t.name,
|
|
88
|
+
description: t.description,
|
|
89
|
+
inputSchema: t.inputSchema,
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
/** Call a tool on the MCP server */
|
|
93
|
+
async callTool(name, args) {
|
|
94
|
+
this.ensureConnected();
|
|
95
|
+
const result = await this.client.callTool({ name, arguments: args });
|
|
96
|
+
return {
|
|
97
|
+
content: result.content ?? [],
|
|
98
|
+
isError: result.isError,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
// ============================================================================
|
|
102
|
+
// Resource Operations
|
|
103
|
+
// ============================================================================
|
|
104
|
+
/** List all resources */
|
|
105
|
+
async listResources() {
|
|
106
|
+
this.ensureConnected();
|
|
107
|
+
try {
|
|
108
|
+
const result = await this.client.listResources();
|
|
109
|
+
return (result.resources ?? []).map((r) => ({
|
|
110
|
+
uri: r.uri,
|
|
111
|
+
name: r.name,
|
|
112
|
+
description: r.description,
|
|
113
|
+
mimeType: r.mimeType,
|
|
114
|
+
}));
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
// Server may not support resources
|
|
118
|
+
return [];
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
/** Read a resource */
|
|
122
|
+
async readResource(uri) {
|
|
123
|
+
this.ensureConnected();
|
|
124
|
+
const result = await this.client.readResource({ uri });
|
|
125
|
+
return {
|
|
126
|
+
contents: result.contents ?? [],
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
// ============================================================================
|
|
130
|
+
// Prompt Operations
|
|
131
|
+
// ============================================================================
|
|
132
|
+
/** List all prompts */
|
|
133
|
+
async listPrompts() {
|
|
134
|
+
this.ensureConnected();
|
|
135
|
+
try {
|
|
136
|
+
const result = await this.client.listPrompts();
|
|
137
|
+
return (result.prompts ?? []).map((p) => ({
|
|
138
|
+
name: p.name,
|
|
139
|
+
description: p.description,
|
|
140
|
+
arguments: p.arguments?.map((a) => ({
|
|
141
|
+
name: a.name,
|
|
142
|
+
description: a.description,
|
|
143
|
+
required: a.required,
|
|
144
|
+
})),
|
|
145
|
+
}));
|
|
146
|
+
}
|
|
147
|
+
catch {
|
|
148
|
+
// Server may not support prompts
|
|
149
|
+
return [];
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/** Get a prompt */
|
|
153
|
+
async getPrompt(name, args) {
|
|
154
|
+
this.ensureConnected();
|
|
155
|
+
const result = await this.client.getPrompt({ name, arguments: args });
|
|
156
|
+
return {
|
|
157
|
+
description: result.description,
|
|
158
|
+
messages: result.messages ?? [],
|
|
159
|
+
};
|
|
160
|
+
}
|
|
161
|
+
// ============================================================================
|
|
162
|
+
// Server Info
|
|
163
|
+
// ============================================================================
|
|
164
|
+
/** Get MCP server info (if available after connect) */
|
|
165
|
+
getServerInfo() {
|
|
166
|
+
if (!this.connected)
|
|
167
|
+
return null;
|
|
168
|
+
const info = this.client.getServerVersion?.() ?? null;
|
|
169
|
+
return info;
|
|
170
|
+
}
|
|
171
|
+
// ============================================================================
|
|
172
|
+
// Internal
|
|
173
|
+
// ============================================================================
|
|
174
|
+
ensureConnected() {
|
|
175
|
+
if (!this.connected) {
|
|
176
|
+
throw new Error('MCP transport not connected. Call connect() first.');
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=mcp-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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,KAAK,CAAC,SAAS,CACb,IAAY,EACZ,IAA6B;QAK7B,IAAI,CAAC,eAAe,EAAE,CAAC;QACvB,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACtE,OAAO;YACL,WAAW,EAAE,MAAM,CAAC,WAAW;YAC/B,QAAQ,EAAG,MAAM,CAAC,QAAkB,IAAI,EAAE;SAC3C,CAAC;IACJ,CAAC;IAED,+EAA+E;IAC/E,cAAc;IACd,+EAA+E;IAE/E,uDAAuD;IACvD,aAAa;QACX,IAAI,CAAC,IAAI,CAAC,SAAS;YAAE,OAAO,IAAI,CAAC;QACjC,MAAM,IAAI,GAAI,IAAI,CAAC,MAAc,CAAC,gBAAgB,EAAE,EAAE,IAAI,IAAI,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,+EAA+E;IAC/E,WAAW;IACX,+EAA+E;IAEvE,eAAe;QACrB,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;QACxE,CAAC;IACH,CAAC;CACF"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @agenium/mcp-server — Types
|
|
3
|
+
*
|
|
4
|
+
* Shared type definitions for the MCP ↔ AGENIUM bridge.
|
|
5
|
+
*/
|
|
6
|
+
/** Stdio-based MCP server (spawns a child process) */
|
|
7
|
+
export interface MCPStdioConfig {
|
|
8
|
+
transport: 'stdio';
|
|
9
|
+
/** Command to run (e.g. 'npx', 'python3', 'node') */
|
|
10
|
+
command: string;
|
|
11
|
+
/** Arguments to the command */
|
|
12
|
+
args?: string[];
|
|
13
|
+
/** Working directory */
|
|
14
|
+
cwd?: string;
|
|
15
|
+
/** Environment variables (merged with process.env) */
|
|
16
|
+
env?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
/** HTTP/SSE-based MCP server (connects to running server) */
|
|
19
|
+
export interface MCPHttpConfig {
|
|
20
|
+
transport: 'sse';
|
|
21
|
+
/** URL of the running MCP server's SSE endpoint */
|
|
22
|
+
url: string;
|
|
23
|
+
/** Optional headers for authentication */
|
|
24
|
+
headers?: Record<string, string>;
|
|
25
|
+
}
|
|
26
|
+
/** Streamable HTTP transport (MCP v2-style) */
|
|
27
|
+
export interface MCPStreamableHttpConfig {
|
|
28
|
+
transport: 'streamable-http';
|
|
29
|
+
/** URL of the MCP server endpoint */
|
|
30
|
+
url: string;
|
|
31
|
+
/** Optional headers for authentication */
|
|
32
|
+
headers?: Record<string, string>;
|
|
33
|
+
}
|
|
34
|
+
export type MCPServerConfig = MCPStdioConfig | MCPHttpConfig | MCPStreamableHttpConfig;
|
|
35
|
+
export interface MCPBridgeConfig {
|
|
36
|
+
/** Agent name on the AGENIUM network (e.g. 'weather-tools') */
|
|
37
|
+
name: string;
|
|
38
|
+
/** MCP server configuration */
|
|
39
|
+
mcp: MCPServerConfig;
|
|
40
|
+
/** AGENIUM agent options */
|
|
41
|
+
agent?: {
|
|
42
|
+
/** Port to listen on (default: auto) */
|
|
43
|
+
port?: number;
|
|
44
|
+
/** DNS server address (default: 185.204.169.26) */
|
|
45
|
+
dnsServer?: string;
|
|
46
|
+
/** DNS server port (default: 3000) */
|
|
47
|
+
dnsPort?: number;
|
|
48
|
+
/** Whether to auto-register on DNS (default: true) */
|
|
49
|
+
autoRegister?: boolean;
|
|
50
|
+
/** Public host/IP for DNS registration endpoint */
|
|
51
|
+
publicHost?: string;
|
|
52
|
+
/** Data directory for agent state */
|
|
53
|
+
dataDir?: string;
|
|
54
|
+
};
|
|
55
|
+
/** Bridge behavior */
|
|
56
|
+
bridge?: {
|
|
57
|
+
/** Timeout for MCP tool calls in ms (default: 30000) */
|
|
58
|
+
toolCallTimeoutMs?: number;
|
|
59
|
+
/** Whether to expose resources as capabilities (default: true) */
|
|
60
|
+
exposeResources?: boolean;
|
|
61
|
+
/** Whether to expose prompts as capabilities (default: true) */
|
|
62
|
+
exposePrompts?: boolean;
|
|
63
|
+
/** Log level */
|
|
64
|
+
logLevel?: 'debug' | 'info' | 'warn' | 'error' | 'silent';
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export interface MCPToolInfo {
|
|
68
|
+
/** Tool name */
|
|
69
|
+
name: string;
|
|
70
|
+
/** Tool description */
|
|
71
|
+
description?: string;
|
|
72
|
+
/** JSON Schema for the tool's input */
|
|
73
|
+
inputSchema: Record<string, unknown>;
|
|
74
|
+
}
|
|
75
|
+
export interface MCPResourceInfo {
|
|
76
|
+
/** Resource URI */
|
|
77
|
+
uri: string;
|
|
78
|
+
/** Resource name */
|
|
79
|
+
name: string;
|
|
80
|
+
/** Description */
|
|
81
|
+
description?: string;
|
|
82
|
+
/** MIME type */
|
|
83
|
+
mimeType?: string;
|
|
84
|
+
}
|
|
85
|
+
export interface MCPPromptInfo {
|
|
86
|
+
/** Prompt name */
|
|
87
|
+
name: string;
|
|
88
|
+
/** Description */
|
|
89
|
+
description?: string;
|
|
90
|
+
/** Arguments the prompt accepts */
|
|
91
|
+
arguments?: Array<{
|
|
92
|
+
name: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
required?: boolean;
|
|
95
|
+
}>;
|
|
96
|
+
}
|
|
97
|
+
export declare enum BridgeState {
|
|
98
|
+
IDLE = "IDLE",
|
|
99
|
+
CONNECTING = "CONNECTING",
|
|
100
|
+
READY = "READY",
|
|
101
|
+
REGISTERED = "REGISTERED",
|
|
102
|
+
ERROR = "ERROR",
|
|
103
|
+
STOPPED = "STOPPED"
|
|
104
|
+
}
|
|
105
|
+
export interface BridgeEvents {
|
|
106
|
+
ready: {
|
|
107
|
+
tools: MCPToolInfo[];
|
|
108
|
+
resources: MCPResourceInfo[];
|
|
109
|
+
prompts: MCPPromptInfo[];
|
|
110
|
+
};
|
|
111
|
+
registered: {
|
|
112
|
+
name: string;
|
|
113
|
+
endpoint: string;
|
|
114
|
+
};
|
|
115
|
+
'tool:call': {
|
|
116
|
+
tool: string;
|
|
117
|
+
sessionId: string;
|
|
118
|
+
};
|
|
119
|
+
'tool:result': {
|
|
120
|
+
tool: string;
|
|
121
|
+
sessionId: string;
|
|
122
|
+
durationMs: number;
|
|
123
|
+
};
|
|
124
|
+
'tool:error': {
|
|
125
|
+
tool: string;
|
|
126
|
+
sessionId: string;
|
|
127
|
+
error: string;
|
|
128
|
+
};
|
|
129
|
+
error: Error;
|
|
130
|
+
stopped: void;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,OAAO,CAAC;IACnB,qDAAqD;IACrD,OAAO,EAAE,MAAM,CAAC;IAChB,+BAA+B;IAC/B,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,wBAAwB;IACxB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC9B;AAED,6DAA6D;AAC7D,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,KAAK,CAAC;IACjB,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,+CAA+C;AAC/C,MAAM,WAAW,uBAAuB;IACtC,SAAS,EAAE,iBAAiB,CAAC;IAC7B,qCAAqC;IACrC,GAAG,EAAE,MAAM,CAAC;IACZ,0CAA0C;IAC1C,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM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for the MCP ↔ AGENIUM bridge.
|
|
5
|
+
*/
|
|
6
|
+
// ============================================================================
|
|
7
|
+
// Bridge State
|
|
8
|
+
// ============================================================================
|
|
9
|
+
export var BridgeState;
|
|
10
|
+
(function (BridgeState) {
|
|
11
|
+
BridgeState["IDLE"] = "IDLE";
|
|
12
|
+
BridgeState["CONNECTING"] = "CONNECTING";
|
|
13
|
+
BridgeState["READY"] = "READY";
|
|
14
|
+
BridgeState["REGISTERED"] = "REGISTERED";
|
|
15
|
+
BridgeState["ERROR"] = "ERROR";
|
|
16
|
+
BridgeState["STOPPED"] = "STOPPED";
|
|
17
|
+
})(BridgeState || (BridgeState = {}));
|
|
18
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAoHH,+EAA+E;AAC/E,eAAe;AACf,+EAA+E;AAE/E,MAAM,CAAN,IAAY,WAOX;AAPD,WAAY,WAAW;IACrB,4BAAa,CAAA;IACb,wCAAyB,CAAA;IACzB,8BAAe,CAAA;IACf,wCAAyB,CAAA;IACzB,8BAAe,CAAA;IACf,kCAAmB,CAAA;AACrB,CAAC,EAPW,WAAW,KAAX,WAAW,QAOtB"}
|
package/package.json
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agenium/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Bridge MCP (Model Context Protocol) servers to the AGENIUM agent:// network",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"agenium-mcp": "dist/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"clean": "rm -rf dist",
|
|
19
|
+
"test": "node --experimental-vm-modules node_modules/.bin/jest --forceExit",
|
|
20
|
+
"prepublishOnly": "npm run build"
|
|
21
|
+
},
|
|
22
|
+
"keywords": [
|
|
23
|
+
"agenium",
|
|
24
|
+
"mcp",
|
|
25
|
+
"model-context-protocol",
|
|
26
|
+
"agent",
|
|
27
|
+
"bridge",
|
|
28
|
+
"ai",
|
|
29
|
+
"tools"
|
|
30
|
+
],
|
|
31
|
+
"author": "AGENIUM",
|
|
32
|
+
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/agenium-org/agenium"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
39
|
+
"agenium": "^0.1.0",
|
|
40
|
+
"zod": "^3.25.0"
|
|
41
|
+
},
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/node": "^22.0.0",
|
|
44
|
+
"typescript": "^5.7.0",
|
|
45
|
+
"jest": "^29.7.0",
|
|
46
|
+
"@jest/globals": "^29.7.0",
|
|
47
|
+
"ts-jest": "^29.2.0"
|
|
48
|
+
},
|
|
49
|
+
"engines": {
|
|
50
|
+
"node": ">=20.0.0"
|
|
51
|
+
}
|
|
52
|
+
}
|