my-mcp-server

aynul-abedin/my-mcp-server

3.2

If you are the rightful owner of my-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

This document provides a comprehensive overview of a Model Context Protocol (MCP) server designed for deployment to Smithery, highlighting its features, tools, resources, and usage instructions.

Tools
1
Resources
0
Prompts
0

My MCP Server

A Model Context Protocol (MCP) server ready for deployment to Smithery.

Features

This MCP server provides:

🔧 Tools

  • calculate: Perform basic arithmetic operations (add, subtract, multiply, divide)

📦 Resources

  • greeting://{name}: Get a personalized greeting message

💡 Prompts

  • help: Get help using the MCP server (optional topic parameter)

Local Development

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Installation

npm install

Build

npm run build

Run Locally

# Development mode with auto-reload
npm run dev

# Production mode
npm start

The server will start on http://localhost:3000 by default.

Testing

You can test the server using the MCP Inspector:

npx @modelcontextprotocol/inspector http://localhost:3000/mcp

Or connect it to any MCP client that supports HTTP transport:

VS Code:

code --add-mcp '{"name":"my-server","type":"http","url":"http://localhost:3000/mcp"}'

Claude Desktop: Add to your claude_desktop_config.json:

{
  "mcpServers": {
    "my-mcp-server": {
      "url": "http://localhost:3000/mcp",
      "type": "http"
    }
  }
}

Deployment to Smithery

Prerequisites

  1. Create an account on Smithery
  2. Install the Smithery CLI (if available) or use the web interface

Deployment Steps

  1. Prepare your repository:

    • Push your code to GitHub
    • Ensure smithery.json is in the root directory
    • Make sure your repository is public or accessible to Smithery
  2. Configure Smithery:

    • Log in to Smithery
    • Create a new MCP server project
    • Connect your GitHub repository
    • Smithery will automatically detect the smithery.json configuration
  3. Deploy:

    • Smithery will:
      • Install dependencies (npm install)
      • Build the project (npm run build)
      • Start the server (node build/index.js)
      • Expose it via their infrastructure
  4. Test your deployment:

    • Use the provided Smithery URL to connect from any MCP client
    • Example: https://your-server.smithery.ai/mcp

Project Structure

my-mcp-server/
├── src/
│   └── index.ts          # Main server implementation
├── build/                 # Compiled JavaScript (generated)
├── package.json          # Node.js dependencies and scripts
├── tsconfig.json         # TypeScript configuration
├── smithery.json         # Smithery deployment configuration
├── .gitignore
└── README.md

Customizing Your Server

Adding a New Tool

server.registerTool(
  'myTool',
  {
    title: 'My Tool',
    description: 'Description of what the tool does',
    inputSchema: {
      param1: z.string(),
      param2: z.number(),
    },
    outputSchema: {
      result: z.string(),
    },
  },
  async ({ param1, param2 }) => {
    // Your tool logic here
    const output = { result: `Processed: ${param1}, ${param2}` };
    return {
      content: [{ type: 'text', text: JSON.stringify(output) }],
      structuredContent: output,
    };
  }
);

Adding a New Resource

server.registerResource(
  'myResource',
  new ResourceTemplate('myResource://{id}', { list: undefined }),
  {
    title: 'My Resource',
    description: 'Description of the resource',
  },
  async (uri, { id }) => ({
    contents: [
      {
        uri: uri.href,
        text: `Resource data for ID: ${id}`,
      },
    ],
  })
);

Adding a New Prompt

server.registerPrompt(
  'myPrompt',
  {
    title: 'My Prompt',
    description: 'Description of the prompt',
    argsSchema: {
      context: z.string(),
    },
  },
  ({ context }) => ({
    messages: [
      {
        role: 'user',
        content: {
          type: 'text',
          text: `Please help with: ${context}`,
        },
      },
    ],
  })
);

Environment Variables

  • PORT: Server port (default: 3000)

Documentation

License

MIT

Support

For issues and questions: