Development rules and guidelines for building an MCP server for esa.io with Deno and TypeScript, including logging, code quality, and API integration patterns
Development guidelines for building an MCP (Model Context Protocol) server for esa.io using Deno and TypeScript.
Build an MCP server that performs basic operations with the esa.io API. Environment variables (`ESA_TOKEN`, `ESA_TEAM_NAME`) manage API token and team name. Refer to esa.io API documentation at https://docs.esa.io/posts/102.
1. **NEVER use `console.log()` or `console.error()` in MCP server code**
- Console logging interferes with stdio transport and causes "Client closed" errors
- This applies to `main.ts` and all imported modules (`src/esa_client.ts`, etc.)
2. **ALWAYS use the `log` object within tool `execute` functions**
```typescript
async execute(args, { log }) {
log.info("Information message");
log.warn("Warning message");
log.error("Error message");
log.debug("Debug message");
}
```
3. **For logging outside `execute` functions**
- Standard FastMCP logging unavailable during initialization
- If necessary, use temporary file logging: `Deno.writeTextFile()` with `--allow-write`
- Remove file logging before final deployment
1. **After every code modification, run:**
- Type checking: `deno check`
- Tests: `deno test`
- Formatting: `deno fmt`
- Linting: `deno lint`
- Combined check: `deno task check:all`
2. **Prioritize lint/format errors immediately**
- Fix all linting and formatting errors before proceeding
- Do not commit code with unresolved errors
3. **Unused code handling:**
- DELETE unused imports and variables completely
- DO NOT use underscore prefixes (e.g., `_variable`)
- DO NOT comment out unused code
- Remove any code not immediately needed
4. **Constant definitions:**
```typescript
// CORRECT
export const MY_OPTIONS = {
optionA: 'valueA',
optionB: 123,
} as const;
// INCORRECT
export const MY_OPTIONS = {
optionA: 'valueA',
optionB: 123,
};
```
1. **Follow Test-Driven Development (TDD)**
- Write tests before implementation
- Ensure all tests pass before committing
2. **Git commit after each phase**
- Commit working code at logical checkpoints
- Use descriptive commit messages
3. **MCP Server Reloads**
- After modifying tools or server settings, reload MCP server in Cursor
- If tool shows "not found", try reloading MCP connection
- Multiple reloads may be necessary for changes to register
1. **Avoid top-level module code that:**
- Uses `console` logging
- Calls `Deno.exit()`
- Executes before server initialization
2. **Ensure environment variables are set:**
- Use `.env` file with dotenv
- Required: `ESA_TOKEN`, `ESA_TEAM_NAME`
- Validate before server starts
Leave a review
No reviews yet. Be the first to review this skill!
# Download SKILL.md from killerskills.ai/api/skills/esaio-mcp-server-development-b00kwe/raw