Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Pistachio MCP Servercalculate 256 times 12"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Pistachio MCP Server
A remote MCP (Model Context Protocol) server built with Node.js and TypeScript. This server demonstrates how to implement tool calls and prompt templates using the official @modelcontextprotocol/sdk with HTTP transport for remote access.
Features
Tool Calls: Register and handle tools that can be invoked by AI models
Prompt Templates: Create reusable prompt templates with argument support
TypeScript: Full type safety with Zod schema validation
Remote HTTP Transport: Streamable HTTP transport for remote MCP server access
CORS Support: Built-in CORS handling for web-based clients
Installation
Install dependencies:
Build the project (optional, for production):
Usage
Development Mode
Run the server in development mode with hot reload:
The server will start on port 3000 by default (or the port specified by the PORT environment variable).
Production Mode
Build and run the compiled server:
Direct Execution
Run TypeScript directly without building:
Environment Variables
PORT: Port number for the HTTP server (default: 3000)
Example:
Remote Access
The server exposes an MCP endpoint at /message that accepts:
GET: Establish SSE stream for receiving messages
POST: Send MCP requests
OPTIONS: CORS preflight requests
The server listens on 0.0.0.0 by default, making it accessible from remote clients.
Example endpoint: http://localhost:3000/message
Project Structure
Adding New Tools
Create a new file in
src/tools/(e.g.,src/tools/my-tool.ts):
Import and register the tool in
src/index.ts:
Adding New Prompt Templates
Create a new file in
src/prompts/(e.g.,src/prompts/my-prompt.ts):
Import and register the prompt in
src/index.ts:
Example Tools
Calculator Tool
The example calculator tool (example_calculator) performs basic arithmetic operations:
Operations: add, subtract, multiply, divide
Input: Two numbers and an operation
Output: Calculation result
Example Prompts
Greeting Prompt
The example greeting prompt (greeting) generates personalized greetings:
Arguments: name (required), language (optional: en, es, fr, de)
Output: Localized greeting message
Remote MCP Server
This server uses the Streamable HTTP transport protocol, which allows MCP clients to connect remotely over HTTP. The transport supports:
Server-Sent Events (SSE) for streaming responses
Standard HTTP POST requests for sending messages
Session management for stateful connections
CORS support for web-based clients
Connecting from MCP Clients
To connect to this remote server from an MCP client, configure it with:
URL:
http://your-server:3000/messageTransport: Streamable HTTP
Dependencies
@modelcontextprotocol/sdk: Official MCP SDK for Node.jszod: Schema validation library (required peer dependency)typescript: TypeScript compilertsx: TypeScript execution runtime
License
MIT