Skip to content

Commit

Permalink
feat: memory server (#601)
Browse files Browse the repository at this point in the history
Co-authored-by: Salman Mohammed <[email protected]>
  • Loading branch information
wendytang and salman1993 authored Jan 16, 2025
1 parent 4860adb commit 3727574
Show file tree
Hide file tree
Showing 5 changed files with 563 additions and 7 deletions.
6 changes: 4 additions & 2 deletions crates/goose-cli/src/commands/mcp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use anyhow::Result;
use goose_mcp::NonDeveloperRouter;
use goose_mcp::{Developer2Router, DeveloperRouter, JetBrainsRouter};
use goose_mcp::{
Developer2Router, DeveloperRouter, JetBrainsRouter, MemoryRouter, NonDeveloperRouter,
};
use mcp_server::router::RouterService;
use mcp_server::{BoundedService, ByteTransport, Server};
use tokio::io::{stdin, stdout};
Expand All @@ -16,6 +17,7 @@ pub async fn run_server(name: &str) -> Result<()> {
"developer2" => Some(Box::new(RouterService(Developer2Router::new()))),
"nondeveloper" => Some(Box::new(RouterService(NonDeveloperRouter::new()))),
"jetbrains" => Some(Box::new(RouterService(JetBrainsRouter::new()))),
"memory" => Some(Box::new(RouterService(MemoryRouter::new()))),
_ => None,
};

Expand Down
6 changes: 3 additions & 3 deletions crates/goose-mcp/examples/mcp.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// An example script to run an MCP server
use anyhow::Result;
use goose_mcp::DeveloperRouter;
use goose_mcp::{DeveloperRouter, MemoryRouter};
use mcp_server::router::RouterService;
use mcp_server::{ByteTransport, Server};
use tokio::io::{stdin, stdout};
Expand All @@ -10,7 +10,7 @@ use tracing_subscriber::{self, EnvFilter};
#[tokio::main]
async fn main() -> Result<()> {
// Set up file appender for logging
let file_appender = RollingFileAppender::new(Rotation::DAILY, "logs", "mcp-server.log");
let file_appender = RollingFileAppender::new(Rotation::DAILY, "logs", "goose-mcp-example.log");

// Initialize the tracing subscriber with file and stdout logging
tracing_subscriber::fmt()
Expand All @@ -25,7 +25,7 @@ async fn main() -> Result<()> {
tracing::info!("Starting MCP server");

// Create an instance of our counter router
let router = RouterService(DeveloperRouter::new());
let router = RouterService(MemoryRouter::new());

// Create and run the server
let server = Server::new(router);
Expand Down
2 changes: 2 additions & 0 deletions crates/goose-mcp/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
mod developer;
mod developer2;
mod jetbrains;
mod memory;
mod nondeveloper;

pub use developer::DeveloperRouter;
pub use developer2::Developer2Router;
pub use jetbrains::JetBrainsRouter;
pub use memory::MemoryRouter;
pub use nondeveloper::NonDeveloperRouter;
Loading

0 comments on commit 3727574

Please sign in to comment.