Create your MCP server quickly with FastMCP using TypeScript, supporting stdio and HTTP transport options
@mcpdotdirect/template-mcp-server is a CLI tool designed to streamline the creation and configuration of custom MCP (Model Context Protocol) servers using FastMCP. This server serves as a foundation for integrating AI applications with specific data sources and tools through a standardized protocol, enabling seamless interactions between various clients like Claude Desktop, Continue, Cursor, and more.
@mcpdotdirect/template-mcp-server offers several core features that enhance its utility in building robust MCP servers:
dev
, start:http
) simplifies common development tasks like auto-reloading during testing.The architectural design of @mcpdotdirect/template-mcp-server is centered around the Model Context Protocol, a universal adapter for AI applications. The server uses FastMCP to handle communication between different clients and the underlying data sources or tools. A typical workflow involves an AI application using an MCP client to connect to the server via either stdio or HTTP, which then communicates with specific resources or tools based on user requests.
graph TD
A[AI Application] -->|MCP Client| B[MCP Protocol]
B --> C[MCP Server]
C --> D[Data Source/Tool]
style A fill:#e1f5fe
style C fill:#f3e5f5
style D fill:#e8f5e8
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
To get started, you can quickly bootstrap a new MCP server using the provided CLI tools. The following commands allow you to create and initialize your project:
npx
:
npx @mcpdotdirect/create-mcp-server
# Using npm
npm init @mcpdotdirect/mcp-server
# Using yarn
yarn create mcpdotdirect/mcp
# Using pnpm
pnpm add -D @mcpdotdirect/mcp-server
# Using Bun
bun install @mcpdotdirect/mcp-server
Imagine an interactive chatbot that users can engage with to receive personalized assistance. By integrating the chatbot with Cursor via an MCP server, you can ensure seamless interactions where users input queries and receive responses dynamically.
// Adding a custom prompt for greeting users
server.addPrompt({
name: "greeting",
description: "A simple greeting prompt",
arguments: [
{
name: "name",
description: "Name to greet",
required: true,
},
],
load: async ({ name }) => {
return `Hello, ${name}! How can I help you today?`;
}
});
Consider a scenario where data needs to be processed through multiple stages. By setting up an MCP server and connecting it with various tools (like data cleaning scripts or machine learning models), developers can build robust data processing pipelines.
To use @mcpdotdirect/template-mcp-server, you need to set up the correct configurations for different clients like Cursor, Continuation AI, and others. Here is how you would configure my-mcp-stdio
in ~/.cursor/mcp.json
:
{
"mcpServers": {
"my-mcp-stdio": {
"command": "npm",
"args": [
"start"
],
"env": {
"NODE_ENV": "development"
}
},
"my-mcp-sse": {
"url": "http://localhost:3001/sse"
}
}
}
// Adding a custom tool for greeting users
server.addTool({
name: "hello_world",
description: "A simple hello world tool",
parameters: z.object({
name: z.string().describe("Name to greet")
}),
execute: async (params) => {
return `Hello, ${params.name}!`;
}
});
// Template for adding a resource
server.addResourceTemplate({
uriTemplate: "example://{id}",
name: "Example Resource",
mimeType: "text/plain",
arguments: [
{
name: "id",
description: "Resource ID",
required: true,
},
],
async load({ id }) {
return {
text: `This is an example resource with ID: ${id}`
};
}
});
@mcpdotdirect/template-mcp-server has been optimized for performance and compatibility across a range of environments. The following matrix outlines the server's current status when integrated with various clients:
MCP Client | Resources | Tools | Prompts | Status |
---|---|---|---|---|
Claude Desktop | ✅ | ✅ | ✅ | Full Support |
Continue | ✅ | ✅ | ✅ | Full Support |
Cursor | ❌ | ✅ | ❌ | Tools Only |
You can customize the server behavior using environment variables, such as setting a custom HTTP port or host binding:
# Change the HTTP port (default is 3001)
PORT=8080 npm run start:http
# Change the host binding (default is 0.0.0.0)
HOST=127.0.0.1 npm run start:http
Q: How do I integrate @mcpdotdirect/template-mcp-server with Continue?
create-mcp-server
tool to generate a new project, then add continuationai-tools-csharp
for compatibility.Q: Can I use this server with multiple clients simultaneously?
Q: How do I secure the communication between the client and the server?
Q: Can I add custom user authentication mechanisms?
Q: How do I handle unexpected errors in the MCP protocol flow?
This comprehensive documentation positions @mcpdotdirect/template-mcp-server as an essential tool for building custom, extensible MCP servers that can power a wide range of AI applications.
Simplify MySQL queries with Java-based MysqlMcpServer for easy standard input-output communication
RuinedFooocus is a local AI image generator and chatbot image server for seamless creative control
Learn to set up MCP Airflow Database server for efficient database interactions and querying airflow data
Build stunning one-page websites track engagement create QR codes monetize content easily with Acalytica
Explore CoRT MCP server for advanced self-arguing AI with multi-LLM inference and enhanced evaluation methods
Access NASA APIs for space data, images, asteroids, weather, and exoplanets via MCP integration