Skip to content

Commit 59b8ea7

Browse files
committed
new: improved mcp server prompts to be more clear about plugins and tooling
1 parent 835023a commit 59b8ea7

File tree

3 files changed

+63
-24
lines changed

3 files changed

+63
-24
lines changed

src/mcp/plugins.prompt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Available Plugins Identifiers
2+
3+
##PLUGIN_LIST##
4+
5+
Use the `plugin_info` tool with the plugin identifier, as it is in this list, as it is to get information about a plugin, its options and how to use it.
6+
Some plugin identifiers (like HTTP) actually group multiple plugins, make sure to use the right one by using the examples as a reference.

src/mcp/service.rs

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,24 @@ impl Service {
7979
format!("Waited for {} seconds.", seconds)
8080
}
8181

82+
#[tool(description = "List all available plugins.")]
83+
async fn list_plugins(&self) -> String {
84+
// Populate the prompt with the list of plugins.
85+
let mut plugins = Vec::new();
86+
for plugin in PLUGINS_DOCS_DIR.files() {
87+
plugins.push(format!(
88+
"* {}",
89+
plugin
90+
.path()
91+
.to_str()
92+
.unwrap()
93+
.to_string()
94+
.replace(".md", "")
95+
));
96+
}
97+
include_str!("plugins.prompt").replace("##PLUGIN_LIST##", &plugins.join("\n"))
98+
}
99+
82100
#[tool(description = "Get information about a plugin.")]
83101
async fn plugin_info(
84102
&self,
@@ -231,24 +249,8 @@ impl Service {
231249
#[tool_handler]
232250
impl ServerHandler for Service {
233251
fn get_info(&self) -> ServerInfo {
234-
// Populate the prompt with the list of plugins.
235-
let mut plugins = Vec::new();
236-
for plugin in PLUGINS_DOCS_DIR.files() {
237-
plugins.push(format!(
238-
"* {}",
239-
plugin
240-
.path()
241-
.to_str()
242-
.unwrap()
243-
.to_string()
244-
.replace(".md", "")
245-
));
246-
}
247-
let prompt =
248-
include_str!("service_info.prompt").replace("##PLUGIN_LIST##", &plugins.join("\n"));
249-
250252
ServerInfo {
251-
instructions: Some(prompt),
253+
instructions: Some(include_str!("service_info.prompt").to_owned()),
252254
// TODO: add loot to resources?
253255
capabilities: ServerCapabilities::builder().enable_tools().build(),
254256
..Default::default()

src/mcp/service_info.prompt

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,47 @@
11
Legba is a credentials bruteforcer, password sprayer and enumerator supporting several protocols with a dedicated plugin each.
22

3-
## Supported Protocols Plugin Identifiers
3+
## Supported Protocols and Features
44

5-
##PLUGIN_LIST##
5+
AMQP (ActiveMQ, RabbitMQ, Qpid, JORAM and Solace), Cassandra/ScyllaDB, DNS subdomain enumeration, FTP, HTTP (basic authentication, NTLMv1, NTLMv2, multipart form, custom requests with CSRF support, files/folders enumeration, virtual host enumeration), IMAP, IRC, Kerberos pre-authentication and user enumeration, LDAP, MongoDB, MQTT, Microsoft SQL, MySQL, Oracle, PostgreSQL, POP3, RDP, Redis, Samba, SSH / SFTP, SMTP, Socks5, STOMP (ActiveMQ, RabbitMQ, HornetQ and OpenMQ), TCP and UDP port scanning with banner grabbing, Telnet, VNC.
66

77
## Instructions
88

9-
- Use the `plugin_info` tool with the plugin identifier to get information about a plugin, its options and how to use it.
10-
- Some plugin identifiers (like HTTP) actually group multiple plugins, make sure to use the right one by using the examples as a reference.
11-
- Start a new session with the `start_session` tool.
12-
- Each session you start will use up the amount of workers you specify in `--concurrency` and free them once concluded.
13-
- Use the `get_available_workers` tool to determine how many workers are available for use and wait if none is free.
9+
Use the `list_plugins` tool for a complete list of all the plugins and their options, start a new session with the `start_session` tool, for example:
10+
11+
{
12+
`argv`: [
13+
`http.enum`,
14+
`--target`,
15+
`http://example.com`,
16+
`--payloads`,
17+
`/path/to/SecLists/Discovery/Web-Content/quickhits.txt`,
18+
`--http-success-codes`,
19+
`200,301,302,401,403`,
20+
`--concurrency`,
21+
`10`
22+
]
23+
}
24+
25+
Each session you start will use up the amount of workers you specify in `--concurrency` and free them once concluded.
26+
Use the `get_available_workers` tool to determine how many workers are available for use and wait if none is free.
27+
28+
## Starting a Session
29+
30+
Start a new session with the `start_session` tool, for example:
31+
32+
{
33+
`argv`: [
34+
`http.enum`,
35+
`--target`,
36+
`http://example.com`,
37+
`--payloads`,
38+
`/path/to/SecLists/Discovery/Web-Content/quickhits.txt`,
39+
`--http-success-codes`,
40+
`200,301,302,401,403`,
41+
`--concurrency`,
42+
`10`
43+
]
44+
}
1445

1546
## Arguments
1647

0 commit comments

Comments
 (0)