MCP Server TypeScript

MCP Server TypeScript

A production-ready TypeScript MCP server providing basic tools (add, echo, timestamp), resources (server info, greetings, data access), and prompt templates (analyze, code-review, summarize). Serves as a foundation for building custom MCP servers with extensible architecture.

Category
Visit Server

README

MCP Server - TypeScript

A production-ready Model Context Protocol (MCP) server built with TypeScript.

Features

  • Tools: Execute actions (add, echo, timestamp)
  • Resources: Access data (server info, greetings, data by ID)
  • Prompts: Reusable prompt templates (analyze, code-review, summarize)

Project Structure

mcp-server/
├── src/
│   ├── index.ts              # Main server entry point
│   ├── tools/                # Tool implementations
│   │   └── index.ts
│   ├── resources/            # Resource handlers
│   │   └── index.ts
│   ├── prompts/              # Prompt templates
│   │   └── index.ts
│   └── utils/                # Helper functions
│       └── helpers.ts
├── build/                    # Compiled output (generated)
├── .env.example              # Environment template
├── .gitignore
├── package.json
├── tsconfig.json
└── README.md

Installation

cd mcp-server
npm install

Configuration

  1. Copy .env.example to .env:

    cp .env.example .env
    
  2. Edit .env with your configuration:

    SERVER_NAME=mcp-server
    SERVER_VERSION=1.0.0
    

Development

Build and run the server:

npm run build
npm run dev

Testing with Claude Desktop

Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "mcp-server": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-server/build/index.js"]
    }
  }
}

Available Capabilities

Tools

  • add - Add two numbers
  • echo - Echo text back
  • timestamp - Get current timestamp

Resources

  • info://server - Server information
  • greeting://{name} - Personalized greeting
  • data://{id} - Data by ID

Prompts

  • analyze - Analysis prompt template
  • code-review - Code review prompt template
  • summarize - Summarization prompt template

Production Deployment

  1. Build the project:

    npm run build
    
  2. The compiled server is in build/index.js

  3. Run with:

    node build/index.js
    

Adding New Capabilities

New Tool

Edit src/tools/index.ts and add:

server.registerTool(
  'tool-name',
  {
    title: 'Tool Title',
    description: 'Tool description',
    inputSchema: {
      param: z.string().describe('Parameter description'),
    },
  },
  async ({ param }) => {
    // Implementation
    return {
      content: [{ type: 'text', text: 'result' }],
    };
  }
);

New Resource

Edit src/resources/index.ts and add:

server.registerResource(
  'resource-name',
  new ResourceTemplate('scheme://{param}', { list: undefined }),
  {
    title: 'Resource Title',
    description: 'Resource description',
  },
  async (uri, { param }) => {
    return {
      contents: [{ uri: uri.href, text: 'data' }],
    };
  }
);

New Prompt

Edit src/prompts/index.ts and add:

server.registerPrompt(
  'prompt-name',
  {
    title: 'Prompt Title',
    description: 'Prompt description',
  },
  async () => {
    return {
      messages: [
        {
          role: 'user',
          content: { type: 'text', text: 'prompt text' },
        },
      ],
    };
  }
);

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured