OBDiag MCP Server - Model Context Protocol server for OceanBase Diagnostic Tool
Project description
OBDiag MCP Server
A Model Context Protocol (MCP) server that enables secure interaction with OBDiag (OceanBase Diagnostic Tool).
English | 简体中文
Overview
The OBDiag MCP Server provides a standardized interface for AI assistants to interact with OceanBase diagnostic tools through the Model Context Protocol. It allows you to perform cluster diagnostics, log analysis, and system health checks programmatically.
Features
- Cluster Inspection: Perform comprehensive cluster health checks and generate inspection reports
- Log Analysis: Analyze cluster logs to identify error messages and performance issues
- Scene-based Diagnostics: Execute specific diagnostic scenarios with customizable parameters
- Multiple Transport Protocols: Support for stdio, SSE, and streamable-http transport modes
- Easy Integration: Simple setup and configuration for MCP-compatible clients
Prerequisites
Before using the OBDiag MCP Server, ensure that:
- Python 3.10+: The server requires Python 3.10 or higher
- OBDiag is installed: The server requires OBDiag to be installed and accessible via the
obdiagcommand - Configuration file exists: The OBDiag configuration file should be present at
~/.obdiag/config.yml
Installation
From Source
- Clone the repository:
git clone https://github.com/oceanbase/mcp-oceanbase.git
cd mcp-oceanbase
- Navigate to the obdiag MCP server directory:
cd src/obdiag_mcp_server
- Install the package:
pip install -e .
Using pip
pip install obdiag-mcp
Usage
Command Line
The server can be started with different transport protocols:
# stdio mode (for direct integration)
obdiag-mcp stdio
# SSE mode (default port 8000)
obdiag-mcp sse
# SSE mode with custom port
obdiag-mcp sse 8001
# streamable-http mode (default port 8000)
obdiag-mcp streamable-http
# streamable-http mode with custom port
obdiag-mcp streamable-http 8001
MCP Client Configuration
To use with an MCP client (like Claude Desktop), configure your client:
{
"mcpServers": {
"obdiag": {
"url": "http://localhost:8000/mcp"
}
}
}
Available Tools
The OBDiag MCP Server provides the following diagnostic tools:
obdiag_check_run
Performs cluster inspection and returns inspection reports.
Usage: No parameters required Returns: Cluster inspection report
obdiag_analyze_log
Analyzes cluster logs to identify error messages and performance issues.
Usage: No parameters required Returns: Log analysis results
obdiag_display_list
Queries available diagnostic commands and returns the list of supported commands.
Usage: No parameters required Returns: List of available diagnostic scenes
obdiag_display_run
Executes specific diagnostic commands with optional environment variables.
Parameters:
scene(string): The diagnostic scene name from obdiag_display_list resultsenv_dict(dict, optional): Environment variables for the diagnostic command
Returns: Diagnostic results for the specified scene
Development
Project Structure
obdiag_mcp_server/
├── __init__.py
├── server.py # Main server implementation
├── tools/
│ ├── __init__.py
│ └── obdiag_tools.py # OBDiag tool implementations
├── pyproject.toml # Project configuration
├── LICENSE # Apache 2.0 License
└── README.md # This file
Running Tests
# Install development dependencies
pip install -e ".[dev]"
# Run tests
pytest
Building
# Build the package
python -m build
# Install from built package
pip install dist/obdiag_mcp-*.whl
Configuration
The server automatically checks for OBDiag configuration at ~/.obdiag/config.yml. Ensure this file exists and contains valid OBDiag configuration.
Example configuration structure:
# ~/.obdiag/config.yml
obdiag:
basic:
config_path: ~/.obdiag/config.yml
log_path: ~/.obdiag/log
cluster:
# Your cluster configuration here
Troubleshooting
Common Issues
-
"obdiag is not installed"
- Ensure OBDiag is installed and accessible via the
obdiagcommand - Check your PATH environment variable
- Ensure OBDiag is installed and accessible via the
-
"obdiag config is not exist"
- Create the configuration file at
~/.obdiag/config.yml - Ensure the file contains valid YAML configuration
- Create the configuration file at
-
Connection refused errors
- Check if the specified port is available
- Ensure firewall settings allow the connection
Logs
The server outputs diagnostic information to stdout. For detailed OBDiag logs, check the ~/.obdiag/log directory.
Contributing
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
Community
Don't hesitate to ask for help!
- Community Forum: https://ask.oceanbase.com
- GitHub Issues: https://github.com/oceanbase/mcp-oceanbase/issues
- Documentation: https://www.oceanbase.com/docs
License
This project is licensed under the Apache License, Version 2.0. See the LICENSE file for details.
Related Projects
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file obdiag_mcp-0.0.3.tar.gz.
File metadata
- Download URL: obdiag_mcp-0.0.3.tar.gz
- Upload date:
- Size: 11.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1fe0838c1be06599f0fff2ef84efa5c4640512f6c9a6bd025a091bd4fe8e0829
|
|
| MD5 |
3575686e7101d14276b10607f159ed39
|
|
| BLAKE2b-256 |
d06db63bf5b8791d5c3c70232297bc3f6a537d1101c410a1b092067e5000a3a7
|
Provenance
The following attestation bundles were made for obdiag_mcp-0.0.3.tar.gz:
Publisher:
publish.yaml on oceanbase/mcp-oceanbase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obdiag_mcp-0.0.3.tar.gz -
Subject digest:
1fe0838c1be06599f0fff2ef84efa5c4640512f6c9a6bd025a091bd4fe8e0829 - Sigstore transparency entry: 493122552
- Sigstore integration time:
-
Permalink:
oceanbase/mcp-oceanbase@b14035670009dbcd56442acb657b85d4958489e8 -
Branch / Tag:
refs/tags/obdiag-mcp-v0.0.3 - Owner: https://github.com/oceanbase
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@b14035670009dbcd56442acb657b85d4958489e8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file obdiag_mcp-0.0.3-py3-none-any.whl.
File metadata
- Download URL: obdiag_mcp-0.0.3-py3-none-any.whl
- Upload date:
- Size: 11.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1445d5fb44a2118410295ff95db19a011d317650a1626e74414dfe961a12943
|
|
| MD5 |
0979b12dcce1731a6711078e9ed6cd35
|
|
| BLAKE2b-256 |
065b16cfaef9d0dbeb747af61f799dfdba04325acb4dbac67f478401ea103f4d
|
Provenance
The following attestation bundles were made for obdiag_mcp-0.0.3-py3-none-any.whl:
Publisher:
publish.yaml on oceanbase/mcp-oceanbase
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
obdiag_mcp-0.0.3-py3-none-any.whl -
Subject digest:
a1445d5fb44a2118410295ff95db19a011d317650a1626e74414dfe961a12943 - Sigstore transparency entry: 493122588
- Sigstore integration time:
-
Permalink:
oceanbase/mcp-oceanbase@b14035670009dbcd56442acb657b85d4958489e8 -
Branch / Tag:
refs/tags/obdiag-mcp-v0.0.3 - Owner: https://github.com/oceanbase
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yaml@b14035670009dbcd56442acb657b85d4958489e8 -
Trigger Event:
release
-
Statement type: