A streamable HTTP MCP (Model Context Protocol) server built with TypeScript, Express, and the official MCP SDK.
Warning
This is an experimental project in development. This project is not supported and offered under an MIT license.
This server demonstrates how to build a remote MCP server using the Streamable HTTP transport. It exposes tools and resources that can be accessed by MCP clients like Claude Desktop.
This remote MCP server is hosted at https://pii-mcp.dev/mcp. You can connect using your own Skyflow credentials - see the configuration section below for details.
To use this MCP server with Claude Desktop, add the following configuration to your claude_desktop_config.json:
{
"mcpServers": {
"sky": {
"command": "npx",
"args": ["mcp-remote", "https://pii-mcp.dev/mcp"],
"headers": {
"Authorization": "Bearer {mcp token here}"
}
}
}
}- Tools:
dehydrate: Skyflow dehydration tool for detecting and redacting sensitive information (PII, PHI, etc.) in textrehydrate: Reverses dehydration by restoring original sensitive data from tokensdehydrate_file: Processes files (images, PDFs, audio, documents) to detect and redact sensitive information
- Authentication: Supports both JWT bearer tokens and API keys via
Authorizationheader (auto-detected) - Multi-tenant: Each request can specify different vault configurations via query parameters
- Transport: Streamable HTTP with JSON response support
- Port: Configurable via
PORTenvironment variable (defaults to 3000)
Note: Make sure the server is running before starting Claude Desktop.
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
After updating the config:
- Save the file
- Restart Claude Desktop completely (quit and reopen)
- The
addanddehydratetools should now be available in Claude Desktop
- Express Server: Handles HTTP requests on the
/mcpendpoint - MCP Server: Registers tools and resources using the official SDK
- Streamable HTTP Transport: Creates a new transport per request to prevent ID collisions
- Session Management: Each request gets its own isolated transport instance
npm install
# or
pnpm installThe easiest way to start developing is to use the dev script, which automatically starts both the MCP server and inspector with the correct configuration:
pnpm devThis will:
- Start the MCP Inspector on port 6274 (UI) and 6277 (proxy)
- Automatically open your browser with the inspector pre-configured to connect to
http://localhost:3000/mcp - Start your MCP server on port 3000
- Display interleaved logs from both processes in your terminal
pnpm dev- Recommended for development. Starts both inspector and server with automatic browser configurationpnpm server- Starts only the MCP server on port 3000pnpm inspector- Starts only the MCP Inspector (useful if you want to run them in separate terminals)
If you prefer to run the inspector and server in separate terminals:
- Copy your Vault Details into
.env.local - In terminal 1, start the inspector:
pnpm inspector
- In terminal 2, start the server:
pnpm server
- Open your browser to
http://localhost:6274/ - Choose 'Streamable HTTP' and set the address to
http://localhost:3000/mcp - Click 'Connect'
- Port 3000: Your MCP server (configurable via
PORTenv var) - Port 6274: MCP Inspector UI (where you interact with the inspector)
- Port 6277: MCP Inspector Proxy (internal proxy used by the inspector)
Authentication Model: This server supports multiple authentication methods:
- JWT bearer token: Pass via
Authorization: Bearer <jwt>header - auto-detected by JWT format - API key via header: Pass via
Authorization: Bearer <api-key>header - non-JWT values are treated as API keys - API key via query param: Pass via
?apiKey=<api-key>query parameter (fallback)
Create a .env.local file with optional fallback values:
VAULT_ID: Your Skyflow vault ID (optional - can be provided via query parameter)VAULT_URL: Your Skyflow vault URL (optional - can be provided via query parameter, e.g.,https://ebfc9bee4242.vault.skyflowapis.com)WORKSPACE_ID: Your Skyflow workspace ID (optional - can be provided via query parameter)ACCOUNT_ID: Your Skyflow account ID (optional - can be provided via query parameter)PORT: Server port (default: 3000)
Note: SKYFLOW_API_KEY and REQUIRED_BEARER_TOKEN are no longer used. The bearer token is now passed through from the client to Skyflow.
Note: All requests require authentication and configuration. Replace placeholders with your actual values:
{your_bearer_token}: Your Skyflow JWT bearer token OR API key (auto-detected based on format){vault_id}: Your Skyflow vault ID{vault_url}: Your Skyflow vault URL (e.g.,https://ebfc9bee4242.vault.skyflowapis.com)
Test the MCP server by listing available tools:
curl -X POST "http://localhost:3000/mcp?vaultId={vault_id}&vaultUrl={vault_url}" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer {your_bearer_token}" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'Test calling the dehydrate tool to redact sensitive information:
curl -X POST "http://localhost:3000/mcp?vaultId={vault_id}&vaultUrl={vault_url}" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer {your_bearer_token}" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"dehydrate","arguments":{"inputString":"My email is john.doe@example.com and my SSN is 123-45-6789"}},"id":2}'This will return the dehydrated text with sensitive data redacted, along with word and character counts.
Test calling the rehydrate tool to restore original sensitive data:
curl -X POST "http://localhost:3000/mcp?vaultId={vault_id}&vaultUrl={vault_url}" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer {your_bearer_token}" \
-d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"rehydrate","arguments":{"inputString":"[REDACTED_TEXT_WITH_TOKENS]"}},"id":3}'To use this MCP server with Claude Desktop, add the following configuration to your claude_desktop_config.json:
For local testing with environment variable fallbacks:
{
"mcpServers": {
"skyflow-pii": {
"command": "npx",
"args": ["mcp-remote", "http://localhost:3000/mcp"],
"headers": {
"Authorization": "Bearer {your_skyflow_bearer_token}"
}
}
}
}For connecting to the hosted server or any remote instance with dynamic configuration:
{
"mcpServers": {
"skyflow-pii": {
"command": "npx",
"args": ["mcp-remote", "https://pii-mcp.dev/mcp?accountId={account_id}&vaultId={vault_id}&vaultUrl={vault_url}&workspaceId={workspace_id}"],
"headers": {
"Authorization": "Bearer {your_skyflow_bearer_token}"
}
}
}
}Important Notes:
- Replace
{your_skyflow_bearer_token}with your actual Skyflow bearer token - Replace
{account_id},{vault_id},{vault_url}, and{workspace_id}with your Skyflow configuration values - The
vaultUrlshould be URL-encoded (e.g.,https%3A%2F%2Febfc9bee4242.vault.skyflowapis.com) - Make sure the server is running before starting Claude Desktop (for local development)
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
After updating the config:
- Save the file
- Restart Claude Desktop completely (quit and reopen)
- The
dehydrate,rehydrate, anddehydrate_filetools should now be available in Claude Desktop
- Express Server: Handles HTTP requests on the
/mcpendpoint with query parameter support - Bearer Token Pass-Through: Client's Skyflow bearer token is forwarded directly to Skyflow API
- Per-Request Skyflow Instances: Each request creates its own Skyflow client with unique credentials
- AsyncLocalStorage Context: Tools access the current request's Skyflow instance via context
- Streamable HTTP Transport: Creates a new transport per request to prevent ID collisions
- Multi-Tenant Support: Different users can use different vaults/workspaces via query parameters
@modelcontextprotocol/sdk: Official MCP TypeScript SDKexpress: Web server frameworkzod: Schema validation for tool inputs/outputsskyflow-node: Skyflow SDK for data privacy and deidentificationdotenv: Environment variable management