rcrewai 0.2.1 → 0.4.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.
- checksums.yaml +4 -4
- data/.rubocop.yml +21 -0
- data/.rubocop_todo.yml +99 -0
- data/CHANGELOG.md +64 -1
- data/README.md +170 -2
- data/ROADMAP.md +84 -0
- data/Rakefile +53 -53
- data/bin/rcrewai +3 -3
- data/docs/mcp.md +109 -0
- data/docs/superpowers/plans/2026-05-11-llm-modernization.md +2753 -0
- data/docs/superpowers/specs/2026-05-11-llm-modernization-design.md +479 -0
- data/docs/upgrading-to-0.3.md +163 -0
- data/examples/async_execution_example.rb +82 -81
- data/examples/hierarchical_crew_example.rb +68 -72
- data/examples/human_in_the_loop_example.rb +73 -74
- data/examples/mcp_example.rb +48 -0
- data/examples/native_tools_example.rb +64 -0
- data/examples/streaming_example.rb +56 -0
- data/lib/rcrewai/agent.rb +181 -286
- data/lib/rcrewai/async_executor.rb +43 -43
- data/lib/rcrewai/cli.rb +11 -11
- data/lib/rcrewai/configuration.rb +34 -9
- data/lib/rcrewai/crew.rb +134 -39
- data/lib/rcrewai/events.rb +30 -0
- data/lib/rcrewai/flow/state.rb +47 -0
- data/lib/rcrewai/flow/state_store.rb +50 -0
- data/lib/rcrewai/flow.rb +243 -0
- data/lib/rcrewai/human_input.rb +104 -114
- data/lib/rcrewai/knowledge/base.rb +52 -0
- data/lib/rcrewai/knowledge/chunker.rb +31 -0
- data/lib/rcrewai/knowledge/embedder.rb +48 -0
- data/lib/rcrewai/knowledge/sources.rb +83 -0
- data/lib/rcrewai/knowledge/store.rb +58 -0
- data/lib/rcrewai/knowledge.rb +13 -0
- data/lib/rcrewai/legacy_react_runner.rb +172 -0
- data/lib/rcrewai/llm_client.rb +24 -1
- data/lib/rcrewai/llm_clients/anthropic.rb +174 -54
- data/lib/rcrewai/llm_clients/azure.rb +23 -128
- data/lib/rcrewai/llm_clients/base.rb +11 -7
- data/lib/rcrewai/llm_clients/google.rb +159 -95
- data/lib/rcrewai/llm_clients/ollama.rb +150 -106
- data/lib/rcrewai/llm_clients/openai.rb +140 -63
- data/lib/rcrewai/mcp/client.rb +101 -0
- data/lib/rcrewai/mcp/tool_adapter.rb +59 -0
- data/lib/rcrewai/mcp/transport/http.rb +53 -0
- data/lib/rcrewai/mcp/transport/stdio.rb +55 -0
- data/lib/rcrewai/mcp.rb +8 -0
- data/lib/rcrewai/memory.rb +45 -37
- data/lib/rcrewai/output_schema.rb +79 -0
- data/lib/rcrewai/planning.rb +65 -0
- data/lib/rcrewai/pricing.rb +34 -0
- data/lib/rcrewai/process.rb +86 -95
- data/lib/rcrewai/provider_schema.rb +38 -0
- data/lib/rcrewai/sse_parser.rb +55 -0
- data/lib/rcrewai/task.rb +145 -66
- data/lib/rcrewai/tool_runner.rb +132 -0
- data/lib/rcrewai/tool_schema.rb +97 -0
- data/lib/rcrewai/tools/base.rb +98 -37
- data/lib/rcrewai/tools/code_executor.rb +71 -74
- data/lib/rcrewai/tools/email_sender.rb +70 -78
- data/lib/rcrewai/tools/file_reader.rb +38 -30
- data/lib/rcrewai/tools/file_writer.rb +40 -38
- data/lib/rcrewai/tools/pdf_processor.rb +115 -130
- data/lib/rcrewai/tools/sql_database.rb +58 -55
- data/lib/rcrewai/tools/web_search.rb +26 -25
- data/lib/rcrewai/version.rb +2 -2
- data/lib/rcrewai.rb +20 -10
- data/rcrewai.gemspec +39 -39
- metadata +77 -47
data/bin/rcrewai
CHANGED
data/docs/mcp.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
# MCP (Model Context Protocol) Support
|
|
2
|
+
|
|
3
|
+
RCrewAI 0.3 ships a minimal MCP client that lets your agents call tools
|
|
4
|
+
hosted by any MCP server — local processes (stdio) or remote services
|
|
5
|
+
(streamable HTTP) — without any custom adapter code.
|
|
6
|
+
|
|
7
|
+
## What is MCP?
|
|
8
|
+
|
|
9
|
+
[MCP](https://modelcontextprotocol.io) is an open protocol for connecting
|
|
10
|
+
language models to tools and data sources. Servers expose tools via a
|
|
11
|
+
JSON-RPC schema; clients (like RCrewAI) connect, discover the tools, and
|
|
12
|
+
invoke them on the model's behalf.
|
|
13
|
+
|
|
14
|
+
The big win: any of the dozens of off-the-shelf MCP servers — filesystem,
|
|
15
|
+
git, Slack, Postgres, browser automation, custom internal tools — works
|
|
16
|
+
with RCrewAI without writing a single line of glue.
|
|
17
|
+
|
|
18
|
+
## Connecting
|
|
19
|
+
|
|
20
|
+
### Stdio (local subprocess)
|
|
21
|
+
|
|
22
|
+
```ruby
|
|
23
|
+
require 'rcrewai'
|
|
24
|
+
|
|
25
|
+
RCrewAI::MCP::Client.with_connection(
|
|
26
|
+
command: "npx",
|
|
27
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"]
|
|
28
|
+
) do |client|
|
|
29
|
+
puts "connected to #{client.server_name}"
|
|
30
|
+
client.tools.each { |t| puts " - #{t.name}: #{t.description}" }
|
|
31
|
+
end
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Streamable HTTP (remote)
|
|
35
|
+
|
|
36
|
+
```ruby
|
|
37
|
+
RCrewAI::MCP::Client.with_connection(
|
|
38
|
+
url: "https://mcp.example.com/v1",
|
|
39
|
+
headers: { "Authorization" => "Bearer #{ENV['MCP_TOKEN']}" }
|
|
40
|
+
) do |client|
|
|
41
|
+
# ...
|
|
42
|
+
end
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Manual lifecycle
|
|
46
|
+
|
|
47
|
+
`with_connection` is the recommended form (auto-closes on block exit), but
|
|
48
|
+
you can also drive the lifecycle manually:
|
|
49
|
+
|
|
50
|
+
```ruby
|
|
51
|
+
client = RCrewAI::MCP::Client.connect(command: "ruby", args: ["my_server.rb"])
|
|
52
|
+
# ... use client.tools ...
|
|
53
|
+
client.close
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Tool name prefix
|
|
57
|
+
|
|
58
|
+
To prevent collisions when an agent uses tools from multiple MCP servers,
|
|
59
|
+
tool names are prefixed with the server name:
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
echo-server__echo
|
|
63
|
+
filesystem__read_file
|
|
64
|
+
filesystem__write_file
|
|
65
|
+
git__commit
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
The prefix is `#{server_name}__#{tool_name}`, where `server_name` comes
|
|
69
|
+
from the server's own `serverInfo.name`.
|
|
70
|
+
|
|
71
|
+
## Using MCP tools with an agent
|
|
72
|
+
|
|
73
|
+
MCP tools are ordinary `RCrewAI::Tools::Base` instances — pass them to
|
|
74
|
+
`Agent.new(tools: ...)` like any other tool:
|
|
75
|
+
|
|
76
|
+
```ruby
|
|
77
|
+
RCrewAI::MCP::Client.with_connection(command: "npx", args: [...]) do |client|
|
|
78
|
+
agent = RCrewAI::Agent.new(
|
|
79
|
+
name: "fs_agent",
|
|
80
|
+
role: "Filesystem operator",
|
|
81
|
+
goal: "Read and summarize files",
|
|
82
|
+
tools: client.tools
|
|
83
|
+
)
|
|
84
|
+
|
|
85
|
+
task = RCrewAI::Task.new(name: "summarize",
|
|
86
|
+
description: "Read /tmp/notes.md and summarize",
|
|
87
|
+
agent: agent)
|
|
88
|
+
result = agent.execute_task(task)
|
|
89
|
+
puts result[:content]
|
|
90
|
+
end
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
When `ToolRunner` (the new native-function-calling loop) is selected, the
|
|
94
|
+
LLM picks an MCP tool by name, RCrewAI dispatches the call to the MCP
|
|
95
|
+
server, threads the result back into the conversation, and continues.
|
|
96
|
+
|
|
97
|
+
## What's not (yet) supported in 0.3
|
|
98
|
+
|
|
99
|
+
The 0.3 client is intentionally minimal — it covers `initialize`,
|
|
100
|
+
`tools/list`, `tools/call`, and the `notifications/initialized` handshake.
|
|
101
|
+
The following are not implemented:
|
|
102
|
+
|
|
103
|
+
- **Resources** (`resources/list`, `resources/read`)
|
|
104
|
+
- **Prompts** (`prompts/list`, `prompts/get`)
|
|
105
|
+
- **Server mode** — RCrewAI can be an MCP client, not yet an MCP server
|
|
106
|
+
- **OAuth** authentication for HTTP transports
|
|
107
|
+
- **Notifications other than `initialized`** (e.g., progress, log)
|
|
108
|
+
|
|
109
|
+
These will land in follow-up releases as the MCP spec stabilizes.
|