Skip to content

Commit 7f0843e

Browse files
committed
docs: added MCP docs
1 parent 3dcb884 commit 7f0843e

File tree

2 files changed

+92
-18
lines changed

2 files changed

+92
-18
lines changed

docs/index.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Nerve is an ADK ( _Agent Development Kit_ ) with a convenient command line tool
1010
- [Record & Replay](#-record--replay)
1111
- [Adding Tools](#️-adding-tools)
1212
- [Conversation Window](#-conversation-window)
13+
* [Model Context Protocol](mcp.md)
1314
* [Namespaces](namespaces.md)
1415
* [Workflows](workflows.md)
1516

@@ -277,24 +278,7 @@ nerve play agent-trace.jsonl -f # much faster
277278

278279
### 🛠️ Adding Tools
279280

280-
Since version 1.5.0 Nerve is integrated with [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction). Any server from [the multitude of publicly available MPC servers](https://github.com/punkpeye/awesome-mcp-servers) can be used with:
281-
282-
```yaml
283-
agent: You are a helpful assistant.
284-
task: Write something to your knowledge graph, then read it back, save it to output.txt and set your task as complete.
285-
286-
using:
287-
- task
288-
289-
mcp:
290-
memory:
291-
command: npx
292-
args: ["-y", "@modelcontextprotocol/server-memory"]
293-
294-
filesystem:
295-
command: npx
296-
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
297-
```
281+
Since version 1.5.0 Nerve is integrated with [Model Context Protocol (MCP)](https://modelcontextprotocol.io/introduction), you can refer to the [MCP section](mcp.md) of the documentation to use MCP tools.
298282

299283
When a tool can be represented as a shell command, you can conveniently extend the agent capabilites in the YAML:
300284

docs/mcp.md

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
# Model Context Protocol
2+
3+
Nerve supports [MCP](https://modelcontextprotocol.io/introduction) both as a client and as a server:
4+
5+
* [Client](#mcp-client)
6+
* [Server](#mcp-server)
7+
- [Serving an Agent](#serving-an-agent)
8+
- [Serving an Agent and its Tools](#serving-an-agent-and-its-tools)
9+
- [Tools Only](#tools-only)
10+
11+
## MCP Client
12+
13+
An agent can use any server from [the multitude of publicly available MPC servers](https://github.com/punkpeye/awesome-mcp-servers) with:
14+
15+
```yaml
16+
agent: You are a helpful assistant.
17+
task: Write something to your knowledge graph, then read it back, save it to output.txt and set your task as complete.
18+
19+
using:
20+
- task
21+
22+
mcp:
23+
memory:
24+
command: npx
25+
args: ["-y", "@modelcontextprotocol/server-memory"]
26+
27+
filesystem:
28+
command: npx
29+
args: ["-y", "@modelcontextprotocol/server-filesystem", "."]
30+
```
31+
32+
## MCP Server
33+
34+
Nerve can also act as a MCP server via the `nerve serve <agent>` command. In this mode you can turn an agent into a tool for other agents to use.
35+
36+
### Serving an Agent
37+
38+
For instance this command line will serve the [code-audit](https://github.com/evilsocket/code-audit) agent as an MCP server:
39+
40+
```bash
41+
nerve serve code-audit --mcp
42+
```
43+
44+
This means that agents can use other agents as tools, for instance:
45+
46+
```yaml
47+
agent: You are a helpful assistant.
48+
task: Perform a code audit of {{ path }}.
49+
50+
using:
51+
- task
52+
53+
mcp:
54+
code_audit:
55+
command: nerve
56+
args: ["serve", "code-audit", "--mcp"]
57+
```
58+
59+
You can find a full [example here](https://github.com/evilsocket/nerve/tree/main/examples/mcp-recipe).
60+
61+
### Serving an Agent and its Tools
62+
63+
Additionally you can also serve the agent tools:
64+
65+
```bash
66+
nerve serve code-audit --mcp -t
67+
```
68+
69+
This will export both the agent itself and its tools via MCP.
70+
71+
### Tools Only
72+
73+
You can use this mechanism to serve simple tools via MCP as well. For instance if you create a `tools.yml` like this:
74+
75+
```yaml
76+
tools:
77+
- name: get_weather
78+
description: Get the current weather in a given place.
79+
arguments:
80+
- name: place
81+
description: The place to get the weather of.
82+
example: Rome
83+
tool: curl wttr.in/{{ place }}
84+
```
85+
86+
You can serve it via MCP with:
87+
88+
```bash
89+
nerve serve tools.yml --mcp
90+
```

0 commit comments

Comments
 (0)