-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Rewrite the developer mcp using the rmcp sdk #4297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Nice! I hadn't thought of implementing it as a "new" extension, but this does make it easy to run side-by-side. One thing we could do here is add some cases to the mcp integration tests for the old and new implementation and compare the recorded interaction. One risk that we'll need to watch out for is someone else making changes to developer that don't get flagged as conflicts and instead end up silently dropped though. |
4f4b29f
to
f26cdb3
Compare
added integration tests! yeah agreed that is a risk. But I thought it'd be easier to re-write it instead of modifying this 4000 line file in place... Hopefully there won't be too many changes til I swap the clients. |
FWIW I have a small change pending on how we do the prompt for windows vs non windows - extracting the communalities and also pointing out to the agent to use / even in windows since C:\new\table will mostly be converted to something with a newline and a tab in it. Let's keep that in mind |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice.
Yeah given what Douwe is saying and that there might be PRs referencing the existing developer extension, it is probably better to just delete the old implementation along with adding this one.
vec![ | ||
ToolCall::new("text_editor", json!({ | ||
"command": "view", | ||
"path": "/Users/aning/goose/crates/goose/tests/tmp/goose.txt" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably don't want to use these paths -- you could have the tool first create a file and operate on that
ServerInfo { | ||
capabilities: ServerCapabilities::builder().enable_tools().build(), | ||
instructions: Some(instructions), | ||
..Default::default() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: currently it's returning "rmcp" as the server name, so this should probably also have a
server_info: Implementation {
name: "goose-developer",
version: env!("CARGO_PKG_VERSION").to_owned()
}
let stdout = SplitStream::new(stdout.split(b'\n')).map(|v| ("stdout", v)); | ||
let stderr = SplitStream::new(stderr.split(b'\n')).map(|v| ("stderr", v)); | ||
let mut merged = stdout.merge(stderr); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this seems to have lost the output streaming we did using notifications that the prior tool had:
goose/crates/goose-mcp/src/developer/mod.rs
Lines 645 to 661 in 9b9e6d9
notifier | |
.try_send(JsonRpcMessage::Notification(JsonRpcNotification { | |
jsonrpc: JsonRpcVersion2_0, | |
notification: Notification { | |
method: "notifications/message".to_string(), | |
params: object!({ | |
"level": "info", | |
"data": { | |
"type": "shell", | |
"stream": key, | |
"output": line, | |
} | |
}), | |
extensions: Default::default(), | |
}, | |
})) | |
.ok(); |
for this you'd need a reference to the Peer (client). I'm not sure if the #[tool]
annotated functions provide that, but it should be possible using call_tool
#4125
This is part 1 of moving the developer extension to using the official rmcp sdk instead of our custom sdk. All the functionalities of the og developer tools have been reimplemented (thanks AI) along with all the existing tests.
Tested the new server with the mcp inspector and the tools are working
npx --registry https://registry.npmjs.org @modelcontextprotocol/inspector cargo run -p goose-server --bin goosed -- mcp rmcp_developer
This is not used by anything yet. Second PR incoming, where I actually swap the client.
The rmcp developer is missing the prompts and streaming feature, but i will add them before swapping the clients.