Skip to content

crabtalk/crabtalk-mcp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

crabtalk-mcp

Starter template for building an MCP service with crabtalk-command.

This example exposes a single time tool that returns the current UTC time.

Structure

src/
  bin/main.rs   CLI entry point (clap App)
  lib.rs        Module declarations
  mcp.rs        MCP server (rmcp #[tool] methods)
  cmd.rs        Service definition (#[command] + McpService impl)

Key concepts

#[command(kind = "mcp")] generates service management subcommands (start, stop, run, logs) and a TimeCommand::start() entry point.

McpService requires a single method — fn router(&self) -> axum::Router — which wires the rmcp StreamableHttpService into an axum router.

Usage

# Run directly
cargo run -- time run

# Install as a launchd/systemd service
cargo run -- time start

# View logs
cargo run -- time logs

# Stop
cargo run -- time stop

The MCP endpoint is available at http://127.0.0.1:<port>/mcp (port written to ~/.crabtalk/run/time.port).

Adding tools

Add methods to the #[tool_router] impl TimeServer block in src/mcp.rs:

#[tool(description = "Add two numbers")]
async fn add(&self, Parameters(p): Parameters<AddParams>) -> String {
    (p.a + p.b).to_string()
}

Define param structs with #[derive(Deserialize, JsonSchema)].

Building your own

  1. Clone this repo
  2. Rename the package in Cargo.toml
  3. Replace TimeServer with your own server implementation
  4. Update the #[command] name and McpService::router()

About

Template mcp of CrabTalk

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages