Get the FREE Ultimate OpenClaw Setup Guide →

straw

A Dart implementation of the Model Context Protocol (MCP), enabling seamless integration between Dart/Flutter applications and LLM services.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio szktty-straw-mcp dart run path/to/server.dart \
  --env STRAW_LOG_LEVEL="INFO" \
  --env STRAW_SERVER_PORT="3000"

How to use

StrawMCP is a Dart-based implementation of the Model Context Protocol (MCP). It provides both client capabilities to communicate with MCP servers and server capabilities to implement MCP endpoints within Dart applications. The SDK supports core MCP features such as tool registration and execution, resource and prompt management, and stdio-based communication, with basic HTTP+SSE transport support. You can run a Dart-based MCP server that exposes tools, resources, and prompts, and connect to it as a client to invoke those capabilities. The examples show how to create a server using ProtocolHandler, add tools and resources, register prompts, and then start the server via STDIO streaming. As a client, you can connect over stdio, initialize with capabilities, list available tools/resources/prompts, call tools, read resources, and fetch prompts.

To use the tools, you would define a tool with a name, a set of arguments (with types and descriptions), and a handler that processes the request and returns results (such as text or structured content). Resources are added with a URI, name, description, and MIME type, and can be read to obtain their contents. Prompts are registered with a name and arguments, and return prompt messages that guide the interaction with the user or the LLM. The SDK also includes stdio stream support for local development and testing, as well as a basic HTTP+SSE transport option for remote scenarios.

How to install

Prerequisites:

Installation steps:

  1. Create or open your Dart project.
  2. Add straw_mcp to your dependencies:
dart pub add straw_mcp

Alternatively, specify in pubspec.yaml:

dependencies:
  straw_mcp: ^0.5.0  # Specify the latest version
  1. Run or build your MCP server using an appropriate entrypoint. The Quick Start example demonstrates creating a server with ProtocolHandler, adding tools/resources/prompts, and starting the server with serveStdio. Adapt the example to your project structure and entrypoint file path, such as path/to/server.dart.

  2. If you are developing quickly, you can test the server via STDIO or configure an HTTP+SSE transport as needed.

Additional notes

Tips and common considerations:

  • The straw_mcp package is labeled experimental; APIs are subject to change. Pin versions in pubspec.yaml to control upgrades.
  • When running a server, ensure proper logging configuration to capture runtime information and errors.
  • For stdio-based development, you can connect a client to the server via standard input/output streams as shown in the examples.
  • If you enable HTTP+SSE transport, you may need to implement or configure an HTTP server to broker the streams between clients and the MCP server.
  • Environment variables such as STRAW_LOG_LEVEL or STRAW_SERVER_PORT can help customize logging and networking during development.
  • If you encounter type or argument errors while registering tools or resources, verify the expected shapes of arguments (e.g., required fields, types) in your Tool definitions and handlers.

Related MCP Servers

Sponsor this space

Reach thousands of developers