MCP Server Template πŸ› οΈ

by jatinsandilya

14 stars
332 downloads
Not rated
GitHub Website

About

Minimal typescript template to build an mcp server

Details

Author
jatinsandilya
GitHub stars
14
Downloads
332
Categories
Developer Tools

- Basic MCP server setup written in TypeScript
- Sample tool implementation included for reference
- Ready-to-use project structure with predefined files
- Built on the official @modelcontextprotocol/sdk
- Compiled JavaScript output in the build/ directory

Clone the repository, install dependencies with pnpm install, and build the project with pnpm run build. For Cursor, configure it in Settings β†’ MCP with command node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js. For Claude Desktop, add a JSON entry to its MCP config with the same command and arguments.

MCP Server Template πŸ› οΈ

A starter template for building your own Model Context Protocol (MCP) server. This template provides the basic structure and setup needed to create custom MCPs that can be used with Cursor or Claude Desktop.

<a href="https://glama.ai/mcp/servers/vnt96edg3a">
Server Template MCP server
</a>

Features

- Basic MCP server setup with TypeScript
- Sample tool implementation
- Ready-to-use project structure
- Built with @modelcontextprotocol/sdk

Project Structure

mcp-server-template/
β”œβ”€β”€ index.ts        # Main server implementation
β”œβ”€β”€ package.json    # Project dependencies
β”œβ”€β”€ tsconfig.json   # TypeScript configuration
└── build/         # Compiled JavaScript output

Getting Started

1. Clone this template:

git clone [your-repo-url] my-mcp-server
cd my-mcp-server

2. Install dependencies:

pnpm install

3. Build the project:

pnpm run build

This will generate the /build/index.js file - your compiled MCP server script.

Using with Cursor

1. Go to Cursor Settings -> MCP -> Add new MCP server
2. Configure your MCP:
- Name: [choose your own name]
- Type: command
- Command: node ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js

Using with Claude Desktop

Add the following MCP config to your Claude Desktop configuration:

{
  "mcpServers": {
    "your-mcp-name": {
      "command": "node",
      "args": ["ABSOLUTE_PATH_TO_MCP_SERVER/build/index.js"]
    }
  }
}

Development

The template includes a sample tool implementation in index.ts. To create your own MCP:

1. Modify the server configuration in index.ts:

const server = new McpServer({
name: "your-mcp-name",
version: "0.0.1",
});

2. Define your custom tools using the server.tool() method:

server.tool(
"your-tool-name",
"Your tool description",
{
// Define your tool's parameters using Zod schema
parameter: z.string().describe("Parameter description"),
},
async ({ parameter }) => {
// Implement your tool's logic here
return {
content: [
{
type: "text",
text: "Your tool's response",
},
],
};
}
);

3. Build and test your implementation:

npm run build

Contributing

Feel free to submit issues and enhancement requests!

License

MIT

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.