My MCP Server
Click on "Deploy 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., "@My MCP Server What's 15 plus 27?"
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.
My MCP Server
A custom Model Context Protocol (MCP) server with an extensible tool architecture for Claude Code. This server makes it easy to add custom tools that Claude can use during conversations.
Features
Extensible Architecture: Easy-to-use pattern for adding new tools
TypeScript: Full type safety with TypeScript
Example Tools Included: Calculator and Echo tools to demonstrate the pattern
Production-Ready: Proper error handling and validation with Zod
Well-Documented: Clear examples and documentation for adding new tools
Related MCP server: TypeScript MCP Server Boilerplate
Available Tools
1. Calculate
Perform basic arithmetic operations (add, subtract, multiply, divide).
Example usage:
"Calculate 15 + 27"
"What's 100 divided by 4?"
"Multiply 8 by 9"
2. Echo
Echo a message back, with optional text transformation (uppercase/lowercase).
Example usage:
"Echo 'Hello World'"
"Echo 'test message' in uppercase"
"Echo 'LOUD TEXT' in lowercase"
Installation
1. Install Dependencies
npm install2. Build the Project
npm run buildThis will compile the TypeScript code to JavaScript in the build/ directory.
3. Configure Claude Code
Add the following configuration to your ~/.claude.json file:
{
"mcpServers": {
"my-mcp": {
"type": "stdio",
"command": "node",
"args": ["/Users/martin/src/my-mcp/build/index.js"]
}
}
}Important: Make sure to use the absolute path to your build/index.js file.
4. Restart Claude Code
After updating the configuration, restart Claude Code to load the MCP server.
Adding New Tools
Adding a new tool is simple and follows a consistent pattern:
Step 1: Create a New Tool File
Create a new file in src/tools/ with the naming convention your-tool.tool.ts:
import { z } from "zod";
import type { ToolDefinition } from "../types/index.js";
export const yourTool: ToolDefinition = {
name: "your_tool_name",
description: "Description of what your tool does",
inputSchema: z.object({
param1: z.string().describe("Description of parameter 1"),
param2: z.number().optional().describe("Optional parameter 2"),
}),
handler: async (args) => {
// Your tool logic here
const result = `Processed: ${args.param1}`;
return {
content: [{
type: "text",
text: result
}]
};
}
};Step 2: Register the Tool
Add your tool to the registry in src/tools/index.ts:
import { yourTool } from "./your-tool.tool.js";
export const tools: ToolDefinition[] = [
echoTool,
calculatorTool,
yourTool, // Add your tool here
];Step 3: Rebuild
npm run buildStep 4: Restart Claude Code
Restart Claude Code to load the new tool.
Step 5: Test
Try using your new tool in a conversation with Claude!
Tool Examples
Simple Text Processing Tool
import { z } from "zod";
import type { ToolDefinition } from "../types/index.js";
export const reverseTool: ToolDefinition = {
name: "reverse",
description: "Reverse a string",
inputSchema: z.object({
text: z.string().describe("The text to reverse"),
}),
handler: async (args) => {
const reversed = args.text.split("").reverse().join("");
return {
content: [{
type: "text",
text: reversed
}]
};
}
};API Call Tool
import { z } from "zod";
import type { ToolDefinition } from "../types/index.js";
export const weatherTool: ToolDefinition = {
name: "get_weather",
description: "Get current weather for a location",
inputSchema: z.object({
location: z.string().describe("City name or zip code"),
}),
handler: async (args) => {
try {
// Make API call (example)
const response = await fetch(
`https://api.weather.example.com/current?location=${args.location}`
);
const data = await response.json();
return {
content: [{
type: "text",
text: `Weather in ${args.location}: ${data.temperature}°F, ${data.conditions}`
}]
};
} catch (error) {
return {
isError: true,
content: [{
type: "text",
text: `Failed to fetch weather: ${error instanceof Error ? error.message : 'Unknown error'}`
}]
};
}
}
};Project Structure
my-mcp/
├── src/
│ ├── index.ts # Main entry point
│ ├── server.ts # Server initialization and request handlers
│ ├── tools/
│ │ ├── index.ts # Tool registry (add new tools here)
│ │ ├── calculator.tool.ts # Calculator tool implementation
│ │ └── echo.tool.ts # Echo tool implementation
│ └── types/
│ └── index.ts # TypeScript type definitions
├── build/ # Compiled JavaScript (generated)
├── package.json # Project dependencies and scripts
├── tsconfig.json # TypeScript configuration
├── .gitignore # Git ignore rules
├── .env.example # Environment variable template
└── README.md # This fileDevelopment
Build the Project
npm run buildRun in Development Mode
npm run devThis will build and run the server, showing any startup logs.
Error Handling
All tools should handle errors gracefully and return structured error responses:
// Success response
return {
content: [{
type: "text",
text: "Operation successful"
}]
};
// Error response
return {
isError: true,
content: [{
type: "text",
text: "Error: Something went wrong"
}]
};Important Notes
Logging: Always use
console.error()for logging, neverconsole.log(). The latter corrupts JSON-RPC messages over stdio.Input Validation: All inputs are automatically validated using Zod schemas
Error Messages: Provide clear, helpful error messages for debugging
Async Handlers: All tool handlers are async functions
Troubleshooting
Server Not Appearing in Claude Code
Check that the path in
~/.claude.jsonis absolute and correctVerify the build succeeded:
npm run buildRestart Claude Code completely
Check for errors:
node build/index.js(should start without errors)
Tool Not Working
Verify the tool is added to the registry in
src/tools/index.tsRebuild the project:
npm run buildRestart Claude Code
Check the Zod schema matches your expected input format
TypeScript Errors
Make sure all imports use
.jsextensions (required for ES modules)Run
npm run buildto see detailed error messagesCheck that types are correctly imported from
../types/index.js
License
MIT
Contributing
Feel free to add more tools and share them! The modular architecture makes it easy to create and share tool implementations.
Available Tools
3 toolsnon_code_web_searchA
Search the web and extract structured data (titles, URLs, snippets) from multiple search results. Use this for discovering sources, researching topics, finding documentation, or exploring options. Ideal for data extraction when you need to identify relevant URLs or gather information from across multiple web sources.
Inputs: num (required), query (required).
supabase_bulkA
Perform bulk database operations on Supabase. Supports two commands:
"insert" - Bulk insert records into a table Required: command="insert", table (string), records (array of objects)
"insert_join" - Insert join table records by looking up IDs from related tables Required: command="insert_join", join (table config), src (lookup config), dst (lookup config), pairs (array of {src, dst} values)
Inputs: no named parameters.
tight_web_fetchA
Extract complete content from a specific URL by fetching and converting HTML to clean markdown. Use this for deep data extraction from a single source - perfect for pulling full text from documentation pages, articles, blog posts, or any web page. Returns structured markdown suitable for parsing, analysis, or reading the entire page content.
Inputs: url (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool targets a clearly distinct operation: multi-source web search, single-URL content extraction, and bulk Supabase writes. An agent can easily choose between discovering sources, fetching a specific page, and persisting records.
All names use snake_case, but the prefixes are inconsistent and somewhat arbitrary ('non_code_', 'supabase_', 'tight_'), and only two names embed a clear verb. It is readable but not a predictable verb_noun pattern throughout.
Three tools is minimal but reasonable for a focused 'research web content and store results' server. The set is compact, though it leaves little room for database reading/query workflows.
Web search and fetch cover content discovery/extraction, but the Supabase surface only supports inserts and join inserts. Agents cannot query, update, delete, or inspect existing data, creating significant dead ends for a database-capable server.
Related MCP Connectors
A simple Typescript MCP server built using the official MCP Typescript SDK and smithery/cli. This…
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
A TypeScript MCP server for Home Assistant, enabling programmatic management of entities, automati…
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA lightweight TypeScript-based MCP server that demonstrates how to build custom MCP tools by implementing a simple addition calculator. Serves as a starting point for building MCP-compatible tools.MIT
- AlicenseNot gradedqualityDmaintenanceA boilerplate project for quickly developing MCP servers using TypeScript, featuring example implementations of tools (calculator, greetings) and resources (server info) with Zod schema validation.ISC
- AlicenseNot gradedqualityDmaintenanceA boilerplate project for quickly developing Model Context Protocol (MCP) servers using TypeScript SDK, with example implementations of tools (calculator, greetings) and resources (server info) using Zod schema validation.ISC
- AlicenseAqualityDmaintenanceA foundational project for quickly developing Model Context Protocol servers using the TypeScript SDK and Zod for schema validation. It features pre-implemented examples for tools like a calculator and greeting service, along with templates for managing dynamic resources.6ISC