@elizaos/plugin-mcp 1.0.0 → 1.0.2
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 +65 -24
- package/dist/index.js +373 -164
- package/package.json +25 -3
package/README.md
CHANGED
|
@@ -11,7 +11,6 @@ The [Model Context Protocol](https://modelcontextprotocol.io) (MCP) is an open p
|
|
|
11
11
|
This plugin allows your ElizaOS agents to access multiple MCP servers simultaneously, each providing different capabilities:
|
|
12
12
|
|
|
13
13
|
- **Resources**: Context and data for the agent to reference
|
|
14
|
-
- **Prompts**: Templated messages and workflows
|
|
15
14
|
- **Tools**: Functions for the agent to execute
|
|
16
15
|
|
|
17
16
|
## 📦 Installation
|
|
@@ -55,7 +54,6 @@ bun add @elizaos/plugin-mcp
|
|
|
55
54
|
"servers": {
|
|
56
55
|
"github": {
|
|
57
56
|
"type": "stdio",
|
|
58
|
-
"name": "Code Server",
|
|
59
57
|
"command": "npx",
|
|
60
58
|
"args": ["-y", "@modelcontextprotocol/server-github"]
|
|
61
59
|
}
|
|
@@ -67,41 +65,81 @@ bun add @elizaos/plugin-mcp
|
|
|
67
65
|
|
|
68
66
|
## ⚙️ Configuration Options
|
|
69
67
|
|
|
70
|
-
MCP supports
|
|
68
|
+
MCP supports multiple transport types for connecting to servers. Each type has its own configuration options.
|
|
71
69
|
|
|
72
|
-
###
|
|
70
|
+
### Transport Types
|
|
73
71
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
| `name` | string | The display name of the server |
|
|
78
|
-
| `timeout` | number | Timeout in seconds for tool calls (default: 60) |
|
|
79
|
-
| `disabled` | boolean | Whether the server is disabled |
|
|
72
|
+
- **`streamable-http`** or **`http`** - Modern Streamable HTTP transport (recommended)
|
|
73
|
+
- **`sse`** - Legacy Server-Sent Events transport (deprecated, use `streamable-http` instead)
|
|
74
|
+
- **`stdio`** - Process-based transport using standard input/output
|
|
80
75
|
|
|
81
|
-
###
|
|
82
|
-
|
|
83
|
-
| Option | Type | Description |
|
|
84
|
-
| --------- | -------- | ------------------------------------------------- |
|
|
85
|
-
| `command` | string | The command to run the MCP server |
|
|
86
|
-
| `args` | string[] | Command-line arguments for the server |
|
|
87
|
-
| `env` | object | Environment variables to pass to the server |
|
|
88
|
-
| `cwd` | string | _Optional_ Working directory to run the server in |
|
|
89
|
-
|
|
90
|
-
### sse Server Options
|
|
76
|
+
### HTTP Transport Options (streamable-http, http, sse)
|
|
91
77
|
|
|
92
78
|
| Option | Type | Description |
|
|
93
79
|
| --------- | ------ | -------------------------------------- |
|
|
94
|
-
| `
|
|
80
|
+
| `type` | string | Transport type: "streamable-http", "http", or "sse" |
|
|
81
|
+
| `url` | string | The URL of the HTTP/SSE endpoint |
|
|
82
|
+
| `timeout` | number | _Optional_ Timeout for connections |
|
|
83
|
+
|
|
84
|
+
### stdio Transport Options
|
|
85
|
+
|
|
86
|
+
| Option | Type | Description |
|
|
87
|
+
| ---------------- | -------- | ------------------------------------------------- |
|
|
88
|
+
| `type` | string | Must be "stdio" |
|
|
89
|
+
| `command` | string | _Optional_ The command to run the MCP server |
|
|
90
|
+
| `args` | string[] | _Optional_ Command-line arguments for the server |
|
|
91
|
+
| `env` | object | _Optional_ Environment variables to pass to the server |
|
|
92
|
+
| `cwd` | string | _Optional_ Working directory to run the server in |
|
|
93
|
+
| `timeoutInMillis`| number | _Optional_ Timeout in milliseconds for tool calls |
|
|
94
|
+
|
|
95
|
+
### Example Configuration
|
|
96
|
+
|
|
97
|
+
```json
|
|
98
|
+
{
|
|
99
|
+
"mcp": {
|
|
100
|
+
"servers": {
|
|
101
|
+
"my-modern-server": {
|
|
102
|
+
"type": "streamable-http",
|
|
103
|
+
"url": "https://example.com/mcp"
|
|
104
|
+
},
|
|
105
|
+
"my-local-server": {
|
|
106
|
+
"type": "http",
|
|
107
|
+
"url": "http://localhost:3000",
|
|
108
|
+
"timeout": 30
|
|
109
|
+
},
|
|
110
|
+
"my-legacy-server": {
|
|
111
|
+
"type": "sse",
|
|
112
|
+
"url": "http://localhost:8080"
|
|
113
|
+
},
|
|
114
|
+
"my-stdio-server": {
|
|
115
|
+
"type": "stdio",
|
|
116
|
+
"command": "mcp-server",
|
|
117
|
+
"args": ["--config", "config.json"],
|
|
118
|
+
"cwd": "/path/to/server",
|
|
119
|
+
"timeoutInMillis": 60000
|
|
120
|
+
}
|
|
121
|
+
},
|
|
122
|
+
"maxRetries": 3
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
```
|
|
95
126
|
|
|
96
127
|
## 🛠️ Using MCP Capabilities
|
|
97
128
|
|
|
98
129
|
Once configured, the plugin automatically exposes MCP servers' capabilities to your agent:
|
|
99
130
|
|
|
100
|
-
### Context
|
|
131
|
+
### Context Provider
|
|
132
|
+
|
|
133
|
+
The plugin includes one provider that adds MCP capabilities to the agent's context:
|
|
101
134
|
|
|
102
|
-
|
|
135
|
+
1. **`MCP`**: Lists available servers and their tools and resources
|
|
103
136
|
|
|
104
|
-
|
|
137
|
+
### Actions
|
|
138
|
+
|
|
139
|
+
The plugin provides two actions for interacting with MCP servers:
|
|
140
|
+
|
|
141
|
+
1. **`CALL_TOOL`**: Executes tools from connected MCP servers
|
|
142
|
+
2. **`READ_RESOURCE`**: Accesses resources from connected MCP servers
|
|
105
143
|
|
|
106
144
|
## 🔄 Plugin Flow
|
|
107
145
|
|
|
@@ -168,6 +206,7 @@ Here's a complete example configuration with multiple MCP servers of both types:
|
|
|
168
206
|
"mcp": {
|
|
169
207
|
"servers": {
|
|
170
208
|
"github": {
|
|
209
|
+
"type": "stdio",
|
|
171
210
|
"command": "npx",
|
|
172
211
|
"args": ["-y", "@modelcontextprotocol/server-github"],
|
|
173
212
|
"env": {
|
|
@@ -175,10 +214,12 @@ Here's a complete example configuration with multiple MCP servers of both types:
|
|
|
175
214
|
}
|
|
176
215
|
},
|
|
177
216
|
"puppeteer": {
|
|
217
|
+
"type": "stdio",
|
|
178
218
|
"command": "npx",
|
|
179
219
|
"args": ["-y", "@modelcontextprotocol/server-puppeteer"]
|
|
180
220
|
},
|
|
181
221
|
"google-maps": {
|
|
222
|
+
"type": "stdio",
|
|
182
223
|
"command": "npx",
|
|
183
224
|
"args": ["-y", "@modelcontextprotocol/server-google-maps"],
|
|
184
225
|
"env": {
|