- Home
- MCP servers
- FastMCP Production-Ready Server
FastMCP Production-Ready Server
- python
0
GitHub Stars
python
Language
4 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You can run a production-ready FastMCP server that exposes an MCP endpoint at /mcp, includes Neo4j connectivity tools, structured JSON logging, and options for local, containerized, and Azure deployments. This guide walks you through how to use the server, install it, and manage configuration, tooling, and deployment considerations.
How to use
You will run the FastMCP server and interact with it through an MCP client. Start the server with environment-driven configuration, then connect an MCP client to the /mcp endpoint to invoke available tools such as greeting responses and Neo4j health checks or queries. The server logs in JSON format to stdout, making it easy to ingest into cloud logging or monitoring systems.
How to install
Prerequisites you need before installing and running the server:
- Python 3.10.19 or compatible
- pip (Python package manager)
- Docker (optional for containerized deployment)
- docker-compose (optional for local multi-service setup)
Step-by-step setup when running locally without containers:
-
- Create a working directory for your project.
-
- Create a virtual environment (optional but recommended).
-
- Install dependencies from the requirements files.
-
- Prepare configuration by creating a .env file from the .env.example template.
-
- Start the server and verify the MCP endpoint is accessible.
-
- Run tests to confirm tooling works as expected.
Concrete commands you can run locally to get started:
# 1) Create project directory
mkdir fastmcp
cd fastmcp
# 2) (Optional) Create a virtual environment and activate it
python -m venv venv
source venv/bin/activate # on Unix/macOS
venv\Scripts\activate.bat # on Windows
# 3) Install dependencies from development requirements
pip install -r requirements/dev.txt
# 4) Copy the example environment configuration
cp .env.example .env
# Edit .env to set APP_NAME, HOST, PORT, LOG_LEVEL, NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD
# 5) Run tests
pytest
# 6) Start the server (compatibility entry point)
python -m app.main
# 7) Open the MCP endpoint in a browser or via HTTP client
# Access at http://127.0.0.1:8000/mcp
Additional sections
Configuration and runtime behavior are designed to be environment-driven. The server reads the following variables from your environment: APP_NAME, HOST, PORT, LOG_LEVEL, NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD. Provide a .env file with sensible defaults and keep secrets out of source control.
Logging is emitted as JSON to stdout with time (UTC ISO), level, logger, message, and exc_info when present. This format supports easy ingestion into cloud logging and monitoring systems.
Neo4j tools available from the server include a health check and a query execution tool. The health check returns ok or an error with an exception string. The query tool executes Cypher queries, returning a list of records or a single error object if execution fails. Ensure the Neo4j credentials are provided to enable these capabilities.
For local development and containerized deployments, you can enable a Docker-based workflow with a docker-compose file that starts the app container and a Neo4j container. The app connects to Neo4j via bolt://neo4j:7687.
Azure deployment options include an Azure Container Apps template and App Service start scripts. You can configure CI pipelines to run tests and optionally deploy to Azure using the provided templates and scripts.
Security considerations emphasize that no secrets should be stored in the repository. Use environment variables or Azure secrets management in production.
Configuration details
Environment variables you should set and their purpose:
-
APP_NAME: The name of your application used for display and logging.
-
HOST: The host IP or name to bind the HTTP MCP endpoint.
-
PORT: The port to bind the HTTP MCP endpoint.
-
LOG_LEVEL: The logging level (e.g., INFO, DEBUG).
-
NEO4J_URI, NEO4J_USER, NEO4J_PASSWORD: Credentials and connection string for Neo4j access used by the Neo4j tools.
A .env.example template is provided to help you configure these values.
Troubleshooting
If the MCP endpoint is not responding, check that the server is running on the expected host and port, verify environment variables are loaded, and review the JSON logs for errors. Ensure Neo4j is reachable if you intend to use the Neo4j tools. Restart the server after updating configuration.
Notes
The example setup demonstrates both HTTP and local stdio methods to interact with the MCP server. The HTTP approach uses a standard MCP URL, while the stdio approach starts the server as a local process that can be driven by tooling.
Tooling and endpoints overview
The server exposes a set of tools accessible via the MCP interface. These include a greet function that returns personalized greetings, a Neo4j health check, and a Neo4j query executor. Each tool is designed to be simple to integrate into your existing MCP workflows.
Available tools
greet
Returns a greeting string for the provided name in the format 'Hello, {name}!'.
neo4j_health
Performs a lightweight health check against the connected Neo4j database and returns 'ok' or an error with details.
neo4j_query
Executes a Neo4j Cypher query with optional parameters and a result limit, returning a list of record dictionaries or an error object.