This guide helps diagnose and resolve common issues with the TelemetryFlow Python MCP Server.
flowchart TB
Start["Issue Detected"] --> Category{"Issue Category?"}
Category -->|"Startup"| Startup["Server Won't Start"]
Category -->|"Connection"| Connection["Connection Issues"]
Category -->|"Tools"| Tools["Tool Execution"]
Category -->|"API"| API["Claude API"]
Category -->|"Config"| Config["Configuration"]
Startup --> S1{"Module Error?"}
S1 -->|"Yes"| S1Fix["pip install -e ."]
S1 -->|"No"| S2{"API Key Error?"}
S2 -->|"Yes"| S2Fix["Set ANTHROPIC_API_KEY"]
S2 -->|"No"| S3["Check Permissions"]
Connection --> C1{"Session Error?"}
C1 -->|"Yes"| C1Fix["Send initialize first"]
C1 -->|"No"| C2["Check Transport"]
Tools --> T1{"Tool Not Found?"}
T1 -->|"Yes"| T1Fix["Check tool name"]
T1 -->|"No"| T2{"Timeout?"}
T2 -->|"Yes"| T2Fix["Increase timeout"]
T2 -->|"No"| T3["Check Permissions"]
API --> A1{"Rate Limited?"}
A1 -->|"Yes"| A1Fix["Wait/Retry"]
A1 -->|"No"| A2{"Invalid Key?"}
A2 -->|"Yes"| A2Fix["Check API Key"]
A2 -->|"No"| A3["Check Model ID"]
Config --> CF1{"File Not Found?"}
CF1 -->|"Yes"| CF1Fix["tfo-mcp init-config"]
CF1 -->|"No"| CF2["Validate YAML"]
Cause: Package not installed properly.
Solution:
pip install -e .Cause: Claude API key not configured.
Solution:
export ANTHROPIC_API_KEY="sk-ant-..."
# or add to config file:
# claude:
# api_key: "sk-ant-..."Cause: File permissions issue.
Solution:
chmod +x $(which tfo-mcp)sequenceDiagram
participant Client
participant Server
Client->>Server: Connect (stdin)
Server--xClient: No Response
Note over Client,Server: Check: Is server running?
Note over Client,Server: Check: Transport matches?
Note over Client,Server: Check: Error in logs?
Cause: Transport mismatch or server not running.
Solution:
- Ensure server is running:
tfo-mcp serve - Check transport matches client expectation (stdio)
- Check logs for errors
sequenceDiagram
participant Client
participant Server
Client->>Server: tools/list
Server-->>Client: Error: Session not initialized
Note over Client,Server: Must send initialize first!
Client->>Server: initialize
Server-->>Client: OK
Client->>Server: tools/list
Server-->>Client: Tools List
Cause: Client didn't send initialize request first.
Solution: Client must send initialize request before other operations:
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2024-11-05",
"clientInfo": { "name": "client", "version": "1.0" }
}
}Cause: Tool not registered or typo in name.
Solution:
- List available tools:
tools/list - Check tool name spelling (lowercase, underscores)
- Verify tool is enabled
sequenceDiagram
participant Client
participant Server
participant Tool
Client->>Server: tools/call (execute_command)
Server->>Tool: Execute
Note over Tool: Long running...
Tool--xServer: Timeout!
Server-->>Client: Error: Timeout
Cause: Tool took longer than configured timeout.
Solution:
- Increase tool timeout in config:
mcp: tool_timeout: 60.0
- Or pass longer timeout in execute_command:
{ "command": "long_command", "timeout": 120 }
Cause: Server doesn't have access to the file/directory.
Solution:
- Check file permissions
- Run server with appropriate user
- Use absolute paths
flowchart LR
Request["Request"] --> API["Claude API"]
API -->|"429"| RateLimit["Rate Limited"]
RateLimit --> Wait["Wait"]
Wait --> Retry["Retry"]
Retry --> API
Cause: Too many API requests.
Solution:
- Reduce request frequency
- Implement client-side rate limiting
- Increase retry settings:
claude: max_retries: 5
Cause: API key is incorrect or expired.
Solution:
- Verify API key at https://console.anthropic.com
- Check for extra spaces or characters
- Ensure key has correct permissions
Cause: Invalid model ID specified.
Solution: Use a valid model ID:
claude-opus-4-20250514claude-sonnet-4-20250514claude-3-5-sonnet-20241022claude-3-5-haiku-20241022
Cause: Config file doesn't exist at expected location.
Solution:
- Generate default config:
tfo-mcp init-config - Or specify path:
tfo-mcp serve -c /path/to/config.yaml
Cause: YAML syntax error or invalid values.
Solution:
- Validate config:
tfo-mcp validate -c config.yaml - Check YAML syntax
- Review error message for specific field
Cause: Log level too high or output misconfigured.
Solution:
- Lower log level:
logging: level: "debug"
- Check output destination:
logging: output: "stderr" # or "stdout" or file path
Cause: Format set to text.
Solution:
logging:
format: "json"flowchart TB
Enable["Enable Debug Mode"] --> Logs["Check Logs"]
Logs --> Messages["View Raw Messages"]
Messages --> Test["Test Individual Components"]
Test --> Identify["Identify Issue"]
Identify --> Fix["Apply Fix"]
# Via CLI
tfo-mcp serve --debug
# Via environment
TELEMETRYFLOW_MCP_SERVER_DEBUG=true tfo-mcp serve
# Via config
server:
debug: true
logging:
level: "debug"Run server with debug logging to see JSON-RPC messages:
TELEMETRYFLOW_MCP_LOG_LEVEL=debug tfo-mcp serve 2>debug.logimport asyncio
from tfo_mcp.presentation.tools.builtin_tools import _read_file_handler
async def test():
result = await _read_file_handler({"path": "/tmp/test.txt"})
print(result)
asyncio.run(test())Send a ping request:
{ "jsonrpc": "2.0", "id": 1, "method": "ping", "params": {} }Expected response:
{ "jsonrpc": "2.0", "id": 1, "result": {} }graph TB
subgraph JSONRPC["JSON-RPC Errors"]
E32700["-32700<br/>Parse Error"]
E32600["-32600<br/>Invalid Request"]
E32601["-32601<br/>Method Not Found"]
E32602["-32602<br/>Invalid Params"]
E32603["-32603<br/>Internal Error"]
end
subgraph MCP["MCP Errors"]
E32001["-32001<br/>Tool Not Found"]
E32002["-32002<br/>Resource Not Found"]
E32003["-32003<br/>Prompt Not Found"]
E32004["-32004<br/>Tool Execution Error"]
E32008["-32008<br/>Session Not Initialized"]
end
| Code | Name | Description |
|---|---|---|
| -32700 | Parse error | Invalid JSON received |
| -32600 | Invalid Request | Not a valid JSON-RPC request |
| -32601 | Method not found | Method does not exist |
| -32602 | Invalid params | Invalid method parameters |
| -32603 | Internal error | Internal server error |
| -32001 | Tool not found | Requested tool not registered |
| -32002 | Resource not found | Requested resource not available |
| -32003 | Prompt not found | Requested prompt not registered |
| -32004 | Tool execution error | Tool failed to execute |
| -32008 | Session not initialized | Session must be initialized first |
When reporting issues, include:
-
Server version:
tfo-mcp --version
-
Python version:
python --version
-
Configuration (remove sensitive data):
tfo-mcp validate 2>&1 -
Debug logs:
tfo-mcp serve --debug 2>debug.log -
Error message (full stack trace if available)
- GitHub Issues: https://github.com/telemetryflow/telemetryflow-python-mcp/issues
- Documentation: https://docs.telemetryflow.io/mcp