MCP (Model Context Protocol) serves as a framework for AI models, enabling them to store data, execute tools, and utilize prompts for specific tasks. This repository provides several server implementation examples that allow you to connect AI models with your terminal or other environments.
You can set up an MCP server in multiple ways, depending on your needs and environment. Each option provides different transport methods and deployment environments.
This option lets you run the MCP server locally using Python without Docker.
Clone the repository:
git clone https://github.com/user/mcp-server-examples.git
cd mcp-server-examples
Install the required dependencies:
pip install -r requirements.txt
Run the STDIO server:
python stdio_server.py
This containerized approach runs the MCP server using Docker.
Clone the repository:
git clone https://github.com/user/mcp-server-examples.git
cd mcp-server-examples
Build the Docker image:
docker build -t mcp-stdio-server -f Dockerfile.stdio .
Run the Docker container:
docker run -it mcp-stdio-server
This option uses Server-Sent Events (SSE) as the transport method, containerized with Docker.
Clone the repository:
git clone https://github.com/user/mcp-server-examples.git
cd mcp-server-examples
Build the Docker image:
docker build -t mcp-sse-server -f Dockerfile.sse .
Run the Docker container:
docker run -p 8000:8000 mcp-sse-server
The server will be available at http://localhost:8000
For deploying the MCP server to the cloud, you can use Google Cloud Platform.
Set up a Google Cloud account and install the Google Cloud SDK
Authenticate with Google Cloud:
gcloud auth login
Configure your project:
gcloud config set project YOUR_PROJECT_ID
Build and push the Docker image:
docker build -t gcr.io/YOUR_PROJECT_ID/mcp-sse-server -f Dockerfile.sse .
docker push gcr.io/YOUR_PROJECT_ID/mcp-sse-server
Deploy to Google Cloud Run:
gcloud run deploy mcp-server \
--image gcr.io/YOUR_PROJECT_ID/mcp-sse-server \
--platform managed \
--region us-central1 \
--allow-unauthenticated
Google Cloud Run will provide a URL where your server is accessible
Once your server is running, you can test it by using prompts in Claude:
To run a directory listing:
Run the command ls in my workspace.
To execute a simple echo command:
Execute echo Hello from Claude.
The output from these commands will be displayed directly in your terminal or in the Claude interface, depending on your setup.
For production use, consider implementing:
You can extend your MCP server to:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.