Development Guide
April 26, 2025 · View on GitHub
This guide provides information for developers who want to extend or modify the MCP servers in this repository.
Project Structure
The repository is organized as follows:
mcp-security/
├── docs/ # Documentation
│ ├── servers/ # Server-specific documentation
│ └── img/ # Images for documentation
├── server/ # Server implementations
│ ├── gti/ # Google Threat Intelligence server
│ ├── scc/ # Security Command Center server
│ ├── secops/ # Security Operations server
│ └── secops-soar/ # SOAR server
└── README.md # Repository README
MCP Server Architecture
Each MCP server follows a similar structure:
- Server Entry Point: The main server script that handles MCP protocol interactions
- Tools Module: Contains the functions exposed as MCP tools
- Utilities: Helper functions and API clients
Example: GTI Server Structure
server/gti/
├── gti_mcp/ # Main package
│ ├── server.py # MCP server implementation
│ ├── utils.py # Utility functions
│ └── tools/ # Tool implementations
│ ├── __init__.py
│ ├── collections.py
│ ├── files.py
│ └── ...
├── pyproject.toml # Project metadata
├── setup.py # Installation script
└── README.md # Server-specific README
Adding a New Tool
To add a new tool to an existing server:
- Identify the appropriate server and tools module
- Add your tool function with proper type annotations
- Register the tool in the server's tool registry
- Update the documentation in the corresponding
docs/servers/*.mdfile
Example: Adding a Tool to GTI
# In server/gti/gti_mcp/tools/files.py
def new_file_tool(file_hash: str) -> dict:
"""
Description of what the new tool does.
Args:
file_hash: Description of the parameter
Returns:
A dictionary containing the relevant information
"""
# Implementation goes here
...
return result
Then register it in __init__.py:
from .files import get_file_report, get_entities_related_to_a_file, new_file_tool
__all__ = [
"get_file_report",
"get_entities_related_to_a_file",
"new_file_tool"
]
Creating a New MCP Server
To create a new MCP server:
- Create a new directory under
server/ - Implement the server following the MCP specification
- Create appropriate documentation in
docs/servers/ - Update the table of contents in
docs/toc.md
Testing
For each server, you should test:
- Tool Functionality: Ensure each tool works as expected
- MCP Protocol Compliance: Test compatibility with MCP clients
- Error Handling: Verify graceful error handling
Documentation Standards
When documenting tools:
- Include clear descriptions of what each tool does
- Document all parameters with types and descriptions
- Explain the return values and any side effects
- Provide examples of how to use the tool
Building Documentation
The documentation uses Sphinx with MyST Markdown. To build the docs:
-
Install dependencies:
cd docs pip install -r requirements.txt -
Build the documentation:
make html -
The built documentation will be in
docs/_build/html/
Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Update documentation
- Submit a pull request
Best Practices
- Follow Python PEP 8 style guidelines
- Add type annotations to all functions
- Write clear docstrings
- Handle errors gracefully
- Keep MCP tools focused on a single responsibility