GitHubスター
0
ユーザー評価
未評価
フォーク
0
イシュー
0
閲覧数
2
お気に入り
0
🛠️ MCP-Compatible Testing Plan for DITA XML Content
1. Understand MCP Architecture
MCP operates on a client-server model using JSON-RPC 2.0 for communication. The AI model (client) sends requests to the MCP server, which responds with the necessary context or actions. This setup allows seamless integration between AI applications and external data sources.
2. Set Up the MCP Server
a. Choose an MCP Server Implementation:
- Python SDK: Ideal if your team is proficient in Python. The official MCP Python SDK provides tools to build and run MCP servers.
- TypeScript SDK: Suitable for JavaScript/TypeScript environments. Offers similar functionality as the Python SDK.
Repo & SDK: Model Context Protocol GitHub
b. Develop a Custom MCP Server:
- Data Ingestion: Load your DITA XML files into the server.
- Parsing and Indexing: Use XML parsers to extract relevant information and index it for efficient querying.
- Expose Methods: Define methods that allow the AI client to query the data semantically.
3. Integrate with an AI Client
a. Choose an AI Client:
Claude Desktop App: Supports MCP integration and can be configured to communicate with your MCP server.
Custom AI Application: If you have an existing AI app, integrate it with the MCP server using the appropriate SDK.
b. Configure Communication:
- Define JSON-RPC Methods: Ensure the client can send requests and receive responses following the MCP spec.
4. Define Test Use Cases
a. Owner's Manual Content:
- Use Case: Allow users to query procedures, e.g., "How to reset tire pressure on a 2022 Ford Explorer."
- Implementation: The AI client sends a semantic query to the MCP server, which retrieves the relevant DITA XML topic.
b. Ford Warranty Content:
- Use Case: Query warranty-related content, e.g., "What is the powertrain warranty coverage?"
- Implementation: The server locates and returns matching information from a smaller, targeted dataset.
5. Testing and Validation
- Functional Testing: Ensure returned results are accurate, relevant, and well-structured.
- Performance Testing: Evaluate speed and scalability under simulated load.
- Security Testing: Validate that all inputs and outputs are securely handled and access is controlled.
mcp-dita-server/ ├── mcp_server/ │ ├── init.py │ ├── server.py # MCP JSON-RPC server │ ├── dita_loader.py # Parses and indexes DITA XML │ ├── methods.py # MCP methods exposed to clients │ └── config.py # File paths & server settings ├── data/ │ └── owners_manual/ │ ├── procedure1.xml │ └── ... ├── client_examples/ │ ├── sample_queries.json # Example requests from client ├── requirements.txt ├── README.md └── run.py # Entry point for launching server
Core Functionality Goals Serve as a lightweight MCP-compatible endpoint
Ingest and parse DITA XML from disk
Expose AI-queryable methods (e.g., semantic search, content lookup by topic)
Use JSON-RPC 2.0 protocol
- run.py – Launch Entry Point from mcp_server.server import MCPServer
if name == 'main': server = MCPServer() server.run()
- mcp_server/server.py – JSON-RPC Server from jsonrpcserver import method, serve from mcp_server.methods import register_methods
class MCPServer: def init(self): register_methods()
def run(self):
serve()
- mcp_server/dita_loader.py – Load & Index DITA XML import os from lxml import etree
DITA_DIR = 'data/owners_manual'
def load_dita_content(): content = [] for filename in os.listdir(DITA_DIR): if filename.endswith('.xml'): filepath = os.path.join(DITA_DIR, filename) tree = etree.parse(filepath) content.append({ "filename": filename, "tree": tree, }) return content
- mcp_server/methods.py – Expose JSON-RPC MCP Methods from jsonrpcserver import method from mcp_server.dita_loader import load_dita_content
dita_docs = load_dita_content()
@method def search_content(query: str): results = [] for doc in dita_docs: for elem in doc["tree"].xpath("//*"): if query.lower() in ''.join(elem.itertext()).lower(): results.append({ "file": doc["filename"], "element": elem.tag, "text": ''.join(elem.itertext())[:200] }) return results
def register_methods(): pass # Triggers import and method registration
requirements.txt flask lxml jsonrpcserver
Sample client_examples/sample_queries.json [ { "jsonrpc": "2.0", "method": "search_content", "params": {"query": "tire pressure"}, "id": 1 } ]
How to Use: Clone the repo and place DITA XML files in data/owners_manual/
Install requirements: pip install -r requirements.txt
Run the server: python run.py
Test via Postman or CLI with a JSON-RPC payload.