Desmos MCP Server
Enables mathematical formula visualization and analysis through interactive plotting, formula validation, and symbolic computation. Supports both Desmos API integration and local matplotlib rendering for creating 2D mathematical graphs.
README
Desmos-MCP Server
English | 中文
This is a standard Model Context Protocol (MCP) server designed to provide powerful mathematical formula visualization and analysis capabilities for Large Language Models (LLMs). It utilizes sympy for local rendering and computation, and can optionally integrate with the Desmos API.
✨ Features
- Interactive Formula Validation: Use the
validate_formulatool to check the syntax of mathematical formulas. If a formula is invalid, it uses the LLM sampling feature to provide an easy-to-understand explanation of the error. - Single Function Plotting: Use the
plot_math_functiontool to generate a 2D plot from a formula. It supports using the Desmos API (configurable viaconfig.json) or falling back to localmatplotlibrendering, and provides progress reports during execution. - Multiple Function Plotting: Use the
plot_multiple_functionstool to plot multiple functions on the same graph. - Symbolic Analysis: Use the
analyze_formulatool to calculate mathematical properties of a formula, such as its domain, range, and critical points. - Save Plot to File: Automatically saves the generated plot as a PNG file to a
Desmos-MCPfolder on your desktop.
⚙️ Tech Stack
- Python 3.10+
- FastMCP
- Sympy
- Matplotlib
- HTTPX
🚀 Installation & Setup
- Clone the project (if you haven't already)
- Install
uvIf you don't haveuvinstalled, run the following command in your terminal:powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" - Create a virtual environment
In the project root directory, run:
uv venv - Install dependencies
This command will install all the necessary dependencies based on theuv syncpyproject.tomlfile.
🔧 Configuration
The server's behavior is controlled by the config.json file in the project root.
{
"desmos": {
"use_api": true,
"api_key_env_var": "DESMOS_API_KEY",
"fallback_to_local": true
},
"rendering": {
"default_width": 600,
"default_height": 400
}
}
desmos.use_api: Iftrue, the server will first attempt to use the Desmos API for plotting.desmos.api_key_env_var: Specifies the name of the environment variable used to get the Desmos API key.desmos.fallback_to_local: Ifuse_apiistruebut the API call fails, this determines if the server should automatically fall back to local rendering.
Set Desmos API Key (Optional)
To use the Desmos API feature, you need to set an environment variable. For example, in PowerShell:
$env:DESMOS_API_KEY="your_actual_api_key_here"
▶️ Running the Server
To run the server independently for testing, execute the following command in the project root:
uv run src/main.py
The server will start via standard input/output (stdio) and will be ready to be connected by an MCP client (like the Gemini CLI).
📝 To-Do
- [ ] Add 3D plotting support.
- [ ] Implement real-time formula analysis and interactive plotting, similar to Desmos.
📄 License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.