Quick start
How to create yout own MCP server with the MCPlug SDK
Quick start
To get started just run the following command:
This will create a new directory called my_mcp_server
with the following files:
src/index.ts
: The entry point of your MCP server.package.json
: The package.json file for your MCP server.tsconfig.json
: The tsconfig.json file for your MCP server..env
: The environment variables for your MCP server.README.md
: The README file for your MCP server.changelog directory
: The changelog directory for your MCP server..cursor/mcp.json
: The cursor configuration file for your MCP server in order to test it locally. (generated when running the dev command)
Install the dependencies and run the dev server. This will launch a vite server that will bundle your MCP server that will also generate a global declaration file for the context and env objects.
Your MCP server code
You can then start developing your MCP server by adding tools to the src/index.ts
file.
The MCP is a simple export default object that contains a record of tools, prompts and resources of your MCP server.
In this example we have a tool called get-weather
that takes a city name as input and returns the weather in that city.
Tools
Learn more about tools
You can see that the index.ts file exports a createCtx function. This function is used to create the context object that will be available in all your tools, prompts and resources.
Context and Env
Learn more about context and env
That’s it! You have now created your own MCP server.