Skip to main content
Glama
crimson-crab-mcp-template

crimson-crab-mcp-template

Claude-powered MCP server in Rust (starter template)

crimson-crab-mcp-template MCP server crates.io license

A minimal, production-ready Model Context Protocol (MCP) server, written in Rust, backed by Anthropic's Claude API through the crimson-crab SDK. It exposes five tools: ask_claude (send a prompt, get Claude's reply), chat (multi-turn conversation), count_tokens (price a prompt without running it), list_models (enumerate the models your API key can use), and get_model (limits and metadata for one model).

Use it as the reference starting point for building your own Claude-powered MCP tools in Rust.

Use this template

Click Use this template on GitHub, or generate a fresh project with cargo generate:

cargo generate --git https://github.com/singhpratech/crimson-crab-mcp-template

You can also just clone it:

git clone https://github.com/singhpratech/crimson-crab-mcp-template

Related MCP server: MCP Server Boilerplate

Quickstart

export ANTHROPIC_API_KEY=sk-ant-...
cargo run

The server communicates over stdio, so running it directly just waits for an MCP client to connect. All logging goes to stderr — stdout is reserved for the MCP protocol. Set RUST_LOG=debug for more verbose logs.

To build an optimized binary you can point a client at:

cargo build --release
# -> target/release/crimson-crab-mcp-template

Wire it into Claude Desktop

Add an entry to your Claude Desktop MCP config (claude_desktop_config.json), pointing at the built binary and passing your API key through the environment:

{
  "mcpServers": {
    "claude-via-crimson-crab": {
      "command": "/absolute/path/to/target/release/crimson-crab-mcp-template",
      "env": {
        "ANTHROPIC_API_KEY": "sk-ant-..."
      }
    }
  }
}

Restart Claude Desktop; the ask_claude, chat, count_tokens, list_models, and get_model tools will then be available.

The tools

ask_claude

Parameter

Type

Required

Description

prompt

string

yes

The prompt to send to Claude.

system

string

no

Optional system prompt.

Builds a Claude Messages request (defaulting to the claude-opus-5 model), calls the API, and returns the concatenated text of Claude's reply.

chat

Parameter

Type

Required

Description

messages

array

yes

The conversation so far, oldest first: {role, content} where role is an enum constrained to "user" or "assistant". Must end with a user turn.

system

string

no

Optional system prompt.

model

string

no

Model id (defaults to the ask_claude model).

max_tokens

integer

no

Maximum tokens to generate (default 1024).

Sends the whole message history to Claude and returns the next reply — use it instead of ask_claude when the caller needs to keep context across turns.

count_tokens

Parameter

Type

Required

Description

prompt

string

yes

The prompt whose token count you want.

system

string

no

Optional system prompt to include in the count.

model

string

no

Model id to count against (counts are model-specific).

Returns the number of input tokens the prompt would consume, without running it — useful for estimating cost before an expensive call.

list_models

Parameter

Type

Required

Description

limit

integer

no

Maximum number of models to return.

Returns the id, display name, and release date of each Claude model available to the configured API key.

get_model

Parameter

Type

Required

Description

model

string

yes

The model id to look up, e.g. claude-opus-5.

Returns the model's display name, release date, context window (max_input_tokens), and maximum output tokens.

Errors from all tools are returned as MCP tool errors rather than panicking. The Claude client is built once at startup and reused across calls.

Built with crimson-crab

This template is built with crimson-crab — a production-grade Rust SDK for Anthropic's Claude API. Source: https://github.com/singhpratech/crimson-crab.

License

Licensed under either of

at your option.


crimson-crab is an independent open-source project and is not affiliated with Anthropic.

Available Tools

3 tools
ask_claudeB

Ask Anthropic's Claude a question and return its answer.

Inputs: prompt (required), system.

count_tokensA

Count the input tokens a prompt would consume for a given Claude model, without sending it.

Inputs: prompt (required), model, system.

list_modelsA

List the Claude models available to the configured Anthropic API key.

Inputs: limit.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.7/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a distinct purpose: ask_claude handles queries, count_tokens deals with token counting, and list_models retrieves available models. There is no functional overlap.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case (ask_claude, count_tokens, list_models), making them predictable and easy to use.

    Tool Count5/5

    With 3 tools, the server is lean and focused on core Claude API interactions. This is appropriate for a minimal template without unnecessary bloat.

    Completeness4/5

    The tools cover essential operations: asking questions, counting tokens, and listing models. Minor gaps exist, such as missing streaming or model details beyond listing, but the set is sufficient for basic use.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      D
      maintenance
      A starter template for building custom MCP servers that can integrate with Claude Desktop, Cursor, and other AI assistants. Provides example tools, TypeScript support, and automated publishing workflows to help developers create their own AI assistant integrations.
      7
      -
    • F
      license
      B
      quality
      D
      maintenance
      A starter template for building custom MCP servers that can integrate with Claude Desktop, Cursor, and other AI assistants. Provides example tools, TypeScript support, and automated publishing workflows to help developers quickly create their own MCP integrations.
      1
      -
    • F
      license
      A
      quality
      D
      maintenance
      A starter template for building custom MCP servers that can integrate with Claude Desktop, Cursor, and other AI assistants. Provides example tools, TypeScript support, and automated publishing workflows to help developers quickly create their own MCP servers.
      7
      -