relay-protocol-mcp-server
Copilot instructions1 starsChanged 14 months agoMITView on GitHub
You are working on a Model Context Protocol (MCP) server for the Relay Protocol API. This document outlines the project specifications and coding standards. The project implements 9 MCP tools covering all major Relay Protocol operations:
The file
Show its rules and text
We split this copilot-instructions.md into the rules it gives an agent
16 rules. About 0 are common, 11 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈11
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 16
Keep API client logic separate from MCP tool handlers
- Distinctive: line 17
Use comprehensive TypeScript types for validation
- Distinctive: line 21
Always wrap tool handlers in try-catch blocks
- Distinctive: line 26
Use TypeScript strict mode
- Distinctive: line 28
Use Zod for runtime validation matching TypeScript types
- Very specific: line 32
All tools prefixed with relay_ to avoid conflicts
- Distinctive: line 69
Default pagination with page/limit
- Distinctive: line 75
Use ES modules with .js extensions
- Distinctive: line 76
Use type imports where applicable
- Very specific: line 118
Run pnpm dev for development
- Very specific: line 119
Use pnpm typecheck before committing
- Very specific: line 120
Run pnpm test for test suite
- Very specific: line 121
Use pnpm build for production build
- Distinctive: line 125
Check console output for API request logs
- Distinctive: line 127
Use fetchAll sparingly to avoid large responses
- Distinctive: line 128
Test with small datasets first
≈ “Common” is an estimate: at least 1 in 5 of the 1,644 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Relay Protocol MCP Project Guidelines
You are working on a Model Context Protocol (MCP) server for the Relay Protocol API. This document outlines the project specifications and coding standards.
Project Overview
- Purpose: MCP server providing access to Relay Protocol REST API
- Language: TypeScript with Node.js
- Framework: Official MCP SDK (@modelcontextprotocol/sdk)
- API Client: Axios for HTTP requests
- Validation: Zod for schema validation
Architecture Principles
1. Separation of Concerns
- Keep API client logic separate from MCP tool handlers
- Use comprehensive TypeScript types for validation
- Separate types from implementation
2. Error Handling
- Always wrap tool handlers in try-catch blocks
- Return structured error responses with debugging details
- Distinguish between API errors, connection errors, and validation errors
3. Type Safety
- Use TypeScript strict mode
- Define all API types explicitly
- Use Zod for runtime validation matching TypeScript types
4. Tool Design
- Tools are grouped by resource (chains, prices, quotes, requests, transactions, currencies, swaps)
- All tools prefixed with
relay_to avoid conflicts - Tool descriptions include examples
- Direct data return (no success/data wrapping)
Code Standards
File Organization
src/
├── client/ # HTTP client and error handling
├── tools/ # MCP tool implementations
├── types/ # TypeScript type definitions
├── config.ts # Configuration settings
└── index.ts # MCP server entry pointNaming Conventions
- Files: kebab-case (e.g.,
relay-client.ts) - Classes: PascalCase (e.g.,
RelayClient) - Functions: camelCase (e.g.,
swapMultiInput) - Constants: UPPER_SNAKE_CASE (e.g.,
MAX_RETRIES) - MCP tools: snake_case with prefix (e.g.,
relay_get_chains)
Error Response Format
{
error: string, // Simple message for LLM
details: { // Full details for debugging
message: string,
statusCode?: number,
response?: any,
request?: any
}
}Pagination Pattern
- Default pagination with page/limit
- Optional
fetchAllflag for auto-pagination - Return pagination metadata with results
- Safety limit of 10,000 items for fetchAll
Import Style
- Use ES modules with .js extensions
- Use type imports where applicable
- Group imports: external, internal, types
Testing Guidelines
- Test error scenarios
- Mock HTTP requests
- Validate schema parsing
- Test pagination logic
Key Decisions
- No Authentication: Relay API is free, no API keys needed
- Hard-coded Configuration: Fixed API URL and settings in config.ts
- No Caching: Adds complexity without clear benefit
- Hybrid Pagination: Manual control with auto-fetch option
- Direct Returns: MCP SDK handles success/error states
Common Patterns
Tool Handler Template
async function handleToolName(args: unknown) {
const validated = toolSchema.parse(args);
return await client.apiMethod(validated);
}Error Handling in Tools
try {
const result = await operation();
return result;
} catch (error) {
if (error instanceof SpecificError) {
// Handle specific error type
}
throw error; // Let MCP SDK handle
}Development Workflow
- Run
pnpm devfor development - Use
pnpm typecheckbefore committing - Run
pnpm testfor test suite - Use
pnpm buildfor production build
Debugging Tips
- Check console output for API request logs
- Error details include full request/response data
- Use fetchAll sparingly to avoid large responses
- Test with small datasets first
Implemented Tools
The project implements 9 MCP tools covering all major Relay Protocol operations:
relay_get_chains- List supported blockchain networksrelay_get_token_price- Get real-time token pricesrelay_get_currencies- Discover tokens with advanced filteringrelay_get_quote- Generate bridging/swap quotesrelay_swap_multi_input- Execute multi-chain swapsrelay_get_execution_status- Track request progressrelay_get_requests- Monitor request historyrelay_transactions_index- Index transactions for trackingrelay_transactions_single- Index specific transfers/wraps
Project Status
- ✅ All 9 tools implemented and documented
- ✅ Comprehensive TypeScript types for all API responses
- ✅ Full error handling with detailed debugging information
- ✅ Zod validation schemas integrated into tool handlers
- ✅ Complete documentation with JSDoc comments
- ✅ Node.js v20+ requirement for modern features
- ✅ Production-ready with proper build pipeline
Remember: The goal is to provide a clean, type-safe interface to Relay Protocol through MCP tools while maintaining excellent developer experience.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

