home / mcp / example mcp server with fastmcp
Provides a Python-based MCP server that exposes tools, resources, and prompts via stdio for educational use.
Configuration
View docs{
"mcpServers": {
"a-ddollar-cs-mcp": {
"command": "python",
"args": [
"mcp_server.py"
],
"env": {
"PYTHONUNBUFFERED": "1"
}
}
}
}You can run a self-contained MCP server in Python using the FastMCP library to expose tools, resources, and prompts to AI clients. This setup is ideal for educational experiments and quick prototyping, letting models connect to a locally hosted MCP endpoint via stdio transport.
Connect an MCP-compatible client to the local server you run on your machine. The server exposes a set of tools and resources that the client can invoke or request context from. Use it to test basic tool calls, access data sources, and experiment with prompts in a controlled environment.
Prerequisites: you need Python installed on your system and a working Python package manager.
pip install fastmcpRun the example MCP server after installation. This starts a local stdio server using the example script mcp_server.py.
python mcp_server.pyThis example focuses on educational usage. Ensure you review any server code and tool definitions before connecting a client to avoid unintended behavior.