What You’ll Build
A simple MCP server with one tool that you can deploy and register on the Context Marketplace. No external API keys required.Already have an API you want to unbundle? Skip to the AI-Assisted Builder section in the Build & List guide for a faster workflow using Cursor or Claude.
When you move from this toy example to real third-party APIs, add
_meta.rateLimit hints to your tools. See Tool Metadata.Prerequisites
Before starting, ensure you have:- Node.js 18+: check with
node --version - pnpm (recommended): install with
npm install -g pnpm - A code editor: VS Code, Cursor, etc.
Step 1: Create Your Project
Open your terminal and run these commands:tsconfig.json:
package.json to add the start script:
Step 2: Write Your MCP Server (Without Security)
We’ll build the server without the security middleware first so you can test everything locally. You’ll add security before deploying. Createserver.ts:
Step 3: Test Locally
Start your server:sessionId from the response.
Test tools/call (execute your tool):
Step 4: Add Security Middleware
Before deploying, you must add the Context security middleware. This ensures only paid requests from the Context Platform can execute your tools. Update yourserver.ts:
Step 5: Deploy to Railway
1
Push to GitHub
Create a new repository and push your code:
2
Deploy on Railway
- Go to railway.app and sign in with GitHub
- Click “New Project” → “Deploy from GitHub repo”
- Select your
my-first-mcprepository - Railway auto-detects Node.js and deploys
3
Configure Start Command
In Railway dashboard:
- Go to your service Settings
- Set Start Command to:
pnpm start - Railway will redeploy automatically
4
Get Your Public URL
- Go to Settings → Networking
- Click “Generate Domain”
- Copy your URL (e.g.,
https://my-first-mcp-production.up.railway.app)
Step 6: Register on Context Marketplace
1
Go to Contribute Page
Navigate to ctxprotocol.com/contribute
2
Fill in the Form
3
Auto-Discovery
Click submit. Context will call your
/mcp endpoint to discover your tools via listTools().4
Stake USDC
All tools require a minimum $10 USDC stake. This is fully refundable with a 7-day withdrawal delay.
Step 7: Verify It Works
- Go to ctxprotocol.com
- In the chat, ask: “Get me an inspirational quote”
- The agent should discover and use your tool!
Updating Your Tool
When you add new endpoints or modify your MCP server, you need to refresh the tool listing on Context.1
Deploy Your Changes
Push your updated code to your deployment (Railway, VPS, etc.)
2
Refresh Skills
- Go to ctxprotocol.com/developer/tools
- Find your tool and click “Refresh Skills”
- Context will re-call
listTools()to discover your new/updated tools
3
Update Description (Optional)
If you’ve added significant new functionality:
- Use the MCP Server Analysis Prompt to generate an updated description
- Edit your tool’s description in the Developer Tools page
What’s Next?
Add Real Data
Connect to external APIs and build valuable tools
AI-Assisted Builder
Use Cursor or Claude to build complex MCP servers from API docs
Context Injection
Access user portfolio data in your tools
Handshake Architecture
Enable signatures, transactions, and OAuth
Troubleshooting
For a complete list of common errors and solutions, see the Troubleshooting Guide.
Server won't start
Server won't start
- Check Node.js version:
node --version(must be 18+) - Ensure all dependencies installed:
pnpm install - Check for TypeScript errors:
pnpm exec tsc --noEmit
Railway deployment fails
Railway deployment fails
- Ensure
package.jsonhas"type": "module" - Check Railway logs for specific errors
- Verify start command is
pnpm start
Tool not discovered on Context
Tool not discovered on Context
- Verify your
/healthendpoint returns 200 - Test
initializeandtools/listwith curl (these don’t require auth) - Ensure HTTPS URL: HTTP endpoints will not work

