Using the Python SDK
The Shinzo Python SDK provides automatic instrumentation for MCP servers built with Python. Get started with comprehensive telemetry in just a few minutes.Requirements
- Python: Version 3.10 or higher
- MCP SDK: Compatible with both the main MCP SDK and FastMCP implementations.
Package Installation
Install the Shinzo instrumentation SDK using pip:Basic Setup
Once installed, instrument your MCP server with just a few lines of code:FastMCP Example
Traditional MCP SDK Example
SDK Compatibility
Shinzo automatically detects and instruments your MCP server regardless of which Python SDK you use:| SDK | Detection Method | Decorator | Use Case |
|---|---|---|---|
| FastMCP | server.tool attribute | @mcp.tool() | Simpler API, modern Python patterns, recommended for new projects |
| Traditional MCP | server.call_tool attribute | @server.call_tool() | Standard MCP specification, more configuration options |
Environment Variables
For better security and configuration management, consider using environment variables:Verification
1. Test with Console Exporter
For development, use the console exporter to see telemetry locally:2. Execute a Tool
Run your server and execute any tool. You should see telemetry data in:- Console output (if using console exporter)
- Shinzo Platform dashboard (if using HTTP exporter)
Troubleshooting Installation
Import Errors
If you encounter import errors:- Check Python version: Ensure you’re using Python 3.10+.
- Verify installation: Run
pip show shinzoto confirm it’s installed. - Virtual environment: Make sure you’re in the correct virtual environment.
Type Errors
For type checking issues:- Install type checker:
pip install mypy. - Check Python version: Ensure you’re using Python 3.10+ for proper type hints.
Network Issues
If telemetry isn’t reaching the Shinzo Platform:- Check firewall: Ensure outbound HTTPS connections are allowed.
- Verify endpoint: Confirm the endpoint URL is correct.
- Test connectivity: Try
curl https://api.app.shinzo.ai/health.

