pretherford/mcp-server-simple
If you are the rightful owner of mcp-server-simple and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
Claude desktop compatible MCP server
MCP Server Simple
A simple Model Context Protocol (MCP) server that demonstrates basic MCP functionality with example tools. This server is designed to work seamlessly with Claude Desktop and provides a foundation for building your own MCP servers.
Features
- š Hello Tool: Returns friendly greeting messages
- ā° Time Tool: Provides current date and time in various formats
- š§® Calculator Tool: Performs basic mathematical operations
- š Easy Configuration: Ready-to-use Claude Desktop configuration files
- š§ TypeScript: Fully typed implementation with modern JavaScript features
- š Extensible: Clean, well-documented code structure for easy customization
Quick Start
Prerequisites
- Node.js 18 or higher
- npm or yarn package manager
- Claude Desktop application
Installation
-
Clone the repository:
git clone https://github.com/pretherford/mcp-server-simple.git cd mcp-server-simple
-
Quick setup (recommended):
./dev-setup.sh
This script will install dependencies, build the project, run tests, and provide next steps.
-
Manual setup:
npm install npm run build
Claude Desktop Configuration
-
Locate your Claude Desktop config file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%\Claude\claude_desktop_config.json
- Linux:
~/.config/Claude/claude_desktop_config.json
- macOS:
-
Add the MCP server configuration:
{ "mcpServers": { "simple-mcp-server": { "command": "node", "args": ["/absolute/path/to/mcp-server-simple/dist/index.js"] } } }
-
Update the path to match your installation directory
-
Restart Claude Desktop completely
Available Tools
Hello Tool
Returns a personalized greeting message.
Parameters:
name
(optional): Name to include in the greeting
Example usage:
- "Use the hello tool to greet me"
- "Say hello to Alice using the hello tool"
Time Tool
Provides the current date and time in various formats.
Parameters:
format
(optional): Output format - "iso", "locale", or "unix" (default: "locale")timezone
(optional): Timezone specification (e.g., "UTC", "America/New_York")
Example usage:
- "What's the current time?"
- "Get the current time in ISO format"
- "What time is it in Tokyo?"
Calculator Tool
Performs basic mathematical calculations.
Parameters:
operation
(required): "add", "subtract", "multiply", "divide", "power", "sqrt"a
(required): First numberb
(optional): Second number (not required for square root)
Example usage:
- "Calculate 15 + 27"
- "What's 144 divided by 12?"
- "Calculate the square root of 64"
- "Compute 2 to the power of 8"
Development
Project Structure
mcp-server-simple/
āāā src/
ā āāā index.ts # Main server implementation
āāā dist/ # Compiled JavaScript output
āāā examples/
ā āāā claude-desktop/ # Claude Desktop configuration examples
āāā package.json # Project dependencies and scripts
āāā tsconfig.json # TypeScript configuration
Available Scripts
npm run build
- Compile TypeScript to JavaScriptnpm run dev
- Watch mode for developmentnpm start
- Run the compiled servernpm run lint
- Check code style with ESLintnpm run lint:fix
- Auto-fix linting issuesnpm run clean
- Remove compiled files
Development Workflow
- Make changes to
src/index.ts
- Build the project:
npm run build
- Restart Claude Desktop to pick up changes
- Test your changes in Claude Desktop
Testing the Server
You can test the MCP server independently using the MCP client tools:
# Install MCP CLI tools (if available)
npm install -g @modelcontextprotocol/cli
# Test the server
echo '{"jsonrpc": "2.0", "id": 1, "method": "tools/list"}' | npm start
Extending the Server
Adding New Tools
-
Add the tool definition in
setupTools()
:{ name: 'my-new-tool', description: 'Description of what the tool does', inputSchema: { type: 'object', properties: { // Define your parameters here } } }
-
Add the handler in the
CallToolRequestSchema
handler:case 'my-new-tool': return await this.handleMyNewTool(args);
-
Implement the handler method:
private async handleMyNewTool(args: any) { // Your tool implementation return { content: [ { type: 'text', text: 'Tool result', }, ], }; }
Error Handling
The server includes comprehensive error handling:
- Input validation for all tools
- Graceful error messages returned to Claude
- Process cleanup on shutdown signals
- Structured error responses with clear descriptions
Troubleshooting
Common Issues
-
Server not appearing in Claude Desktop:
- Verify the path in
claude_desktop_config.json
is correct - Ensure Claude Desktop has been completely restarted
- Check that the server builds without errors (
npm run build
)
- Verify the path in
-
Tools not working:
- Check the Claude Desktop logs for error messages
- Verify Node.js version is 18 or higher
- Ensure all dependencies are installed (
npm install
)
-
Permission errors:
- Make sure the server file is executable
- Check file permissions on the installation directory
- On macOS/Linux, you may need to run
chmod +x dist/index.js
Debug Mode
Enable debug logging by setting the environment variable:
NODE_ENV=development npm start
Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
License
This project is licensed under the MIT License - see the file for details.
Acknowledgments
- Built with the Model Context Protocol SDK
- Designed for Claude Desktop
- Inspired by the MCP community and examples
Support
If you encounter issues or have questions:
- Check the troubleshooting section
- Review the MCP documentation
- Open an issue on GitHub
Happy building with MCP! š