The MCP Linear project provides a server implementation for Model Context Protocol (MCP), enabling efficient model inference through a standardized communication interface. It allows clients to interact with AI models in a consistent way regardless of the underlying model implementation.
Install the MCP Linear server using pip:
pip install mcp-linear
For development or the latest features, you can install directly from the repository:
pip install git+https://github.com/username/mcp-linear.git
Create a configuration file named config.yaml
with the following structure:
model:
name: "my-model"
backend: "transformers" # or "llama-cpp", "vllm", etc.
model_path: "/path/to/model/weights"
server:
host: "0.0.0.0"
port: 8000
max_batch_size: 10
max_queue_size: 100
Start the MCP server using the command:
mcp-linear serve --config config.yaml
Additional command line options:
mcp-linear serve --config config.yaml --log-level debug --workers 4
Connect to the MCP server using the Python client:
from mcp_client import MCPClient
# Initialize the client
client = MCPClient("http://localhost:8000")
# Simple text generation
response = client.generate(
prompt="Explain quantum computing in simple terms",
max_tokens=100
)
print(response.text)
# Stream responses
for chunk in client.generate_stream(
prompt="Write a short story about robots",
max_tokens=500
):
print(chunk.text, end="", flush=True)
You can also use the built-in CLI to interact with the server:
mcp-cli generate \
--server http://localhost:8000 \
--prompt "What is machine learning?" \
--max-tokens 150
The server supports hosting multiple models simultaneously:
# config.yaml
models:
- name: "gpt-small"
backend: "transformers"
model_path: "/models/gpt2"
device: "cuda:0"
- name: "llama-7b"
backend: "llama-cpp"
model_path: "/models/llama-7b.gguf"
device: "cuda:1"
server:
host: "0.0.0.0"
port: 8000
When connecting with a client, specify the model:
response = client.generate(
model="gpt-small",
prompt="Explain the theory of relativity",
max_tokens=200
)
Monitor your server's performance using the built-in metrics endpoint:
curl http://localhost:8000/metrics
Key metrics available:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "mcp-linear" '{"command":"npx","args":["-y","mcp-linear"]}'
See the official Claude Code MCP documentation for more details.
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 > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"mcp-linear": {
"command": "npx",
"args": [
"-y",
"mcp-linear"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"mcp-linear": {
"command": "npx",
"args": [
"-y",
"mcp-linear"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect