Building Your First Tool Quickstart
Strawberry tools are enhanced MCP servers that have additional features to work with the Strawberry Protocol like token gating.
You can create and deploy your first tool server in minutes. First, we’ll show you how to use the commandline tools and then give you a prompt to generate a server to wrap any API.
Create the Tool with Commandline Tools
Generate the boilerplate
# in one tab
npx create-strawberry-toolserver my-project
cd my-project
npm install
npm run dev
Test it out (in another tab)
npx @strawberryprotocol/mcp-cli --sse http://localhost:3000/sse
# ✔ Connected, server capabilities: tools
# ? Pick a primitive ›
# ❯ tool(echo) - Echoes back whatever message you send
#
# ✔ Pick a primitive › tool(echo)
# ✔ * message … hi strawberry
# ✔ Using tool echo...
# { content: [ { type: 'text', text: 'hi strawberry' } ] }
Prompt a New Tool Server
The PROMPT.md
file contains LLM-compatible instructions on how to convert an existing API to a Strawberry-compatible tool server.
You can use claude
, Cursor, or your favorite code editor to do this.
For example, we can use claude
and ask:
Read PROMPT.md and make a toolserver for a Pokemon information server using pokeapi.co. I want you to come up with the list of tools and then change src/index.ts to support these feature
> Read PROMPT.md and make a toolserver for the pokeapi from pokeapi.co. I want you to come up with the list of tools and then change src/index.ts to support these features.
⏺ Read(file_path: "PROMPT.md")…
⎿ Strawberry.fun is a crypto-powered marketplace specifically designed for AI agents, allowing them to autonomously discover, purchase, and utilize specialized tools and services through a seamless, tokenized ecosystem. Each
available AI tool is associated with a unique crypto token, creating a frictionless machine-to-machine commerce environment where payments and tool access occur automatically without human intervention.
This document outlines how to build a _tool server_ using the Strawberry SDK.
... (+745 lines)
⏺ Read(file_path: "src/index.ts")…
⎿ #!/usr/bin/env node
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
... (+59 lines)
⏺ Update(file_path: src/index.ts)…
⎿ Updated src/index.ts with 531 additions and 16 removals
3 import { Server } from "@modelcontextprotocol/sdk/server/index.js";
4 import {
5 CallToolRequestSchema,
6 ListToolsRequestSchema
6 ListToolsRequestSchema,
7 ServerResult
… and after we wait a while:
⏺ Great! The build succeeded. I've created a Pokémon API toolserver with the following tools:
1. get-pokemon - Get detailed info about a Pokémon by name or ID
2. get-pokemon-by-type - Get a list of Pokémon of a specific type
3. get-pokemon-by-ability - Get a list of Pokémon with a specific ability
4. get-move-details - Get detailed information about a Pokémon move
5. compare-pokemon - Compare the stats and abilities of two Pokémon
You can start the server with:
⏺ Bash(npm run start)…
And we can try it out:
Run the Server
npm run dev
> @strawberryprotocol/toolserver-starter@1.0.0 dev
> tsx ./src/index.ts
Server running on port 3000
Pokémon API server running on http://localhost:3000
In a New Tab
npx @strawberryprotocol/mcp-cli --sse http://localhost:3000/sse
✔ Connected, server capabilities: tools
? Pick a primitive ›
❯ tool(get-pokemon) - Get detailed information about a Pokémon by name or ID
tool(get-pokemon-by-type) - Get a list of Pokémon of a specific type
tool(get-pokemon-by-ability) - Get a list of Pokémon with a specific ability
tool(get-move-details) - Get detailed information about a Pokémon move
tool(compare-pokemon) - Compare the stats and abilities of two Pokémon
✔ Pick a primitive › tool(get-pokemon)
✔ * name … Charmander
✔ Using tool get-pokemon...
{
content: [
{
type: 'text',
text: 'Pokémon: Charmander\n' +
'ID: 4\n' +
'Height: 0.6 m\n' +
'Weight: 8.5 kg\n' +
'Types: fire\n' +
'Abilities: blaze, solar-power (hidden)\n' +
'\n' +
'Base Stats:\n' +
'hp: 39\n' +
'attack: 52\n' +
'defense: 43\n' +
'special-attack: 60\n' +
'special-defense: 50\n' +
'speed: 65\n' +
'\n' +
'Sample Moves:\n' +
'mega-punch, fire-punch, thunder-punch, scratch, swords-dance\n' +
'...and 100 more'
}
]
}
Deployment
You can deploy this app using the included Dockerfile
. An easy way is with Railway.
What’s Next?
Be sure to sign up for our Hackathon to win $STRAI before the token launches