A Model Context Protocol (MCP) server that provides access to the SysMLv2 API.
- Streamable HTTP Protocol: Uses FastMCP's streamable HTTP transport for efficient bidirectional communication
- Authorization Forwarding: Forwards Bearer tokens from MCP clients to the SysMLv2 API
- Read-Only Mode: Optional read-only mode that only exposes GET endpoints
- Install dependencies:
pip install -r requirements.txtThe server is configured via environment variables:
SYSMLV2_URL: The base URL of the SysMLv2 API (default:http://localhost:8080)READ_ONLY: Enable read-only mode, only exposing GET endpoints (default:true)- Accepted values:
true,1,yes(case-insensitive)
- Accepted values:
MCPPATH: MCP endpoint path (default:/mcp)
# Default configuration
python server.py
# With custom SysMLv2 API URL
SYSMLV2_URL=https://api.example.com python server.py
# In read-only mode
READ_ONLY=true python server.py
# Combined configuration
SYSMLV2_URL=https://api.example.com READ_ONLY=true python server.pyThe server will start on http://0.0.0.0:8000 and the MCP endpoint will be available at http://0.0.0.0:8000/mcp.
Clients can connect to the MCP server using the streamable HTTP transport. Example using FastMCP client:
from fastmcp.client import Client
# Without authentication
client = Client("http://localhost:8000/mcp")
# With Bearer token authentication
client = Client(
"http://localhost:8000/mcp",
headers={"Authorization": "Bearer your-token-here"}
)docker build -t flexo-mms-sysmlv2-mcp .Run with custom MMS URL:
docker run -d \
-p 8000:8000 \
-e MMS_URL=https://your-flexo-mms-server \
flexo-mms-sysmlv2-mcpRun in read-write mode (enables create/update/delete operations):
docker run -d \
-p 8000:8000 \
-e MMS_URL=https://your-mms-server \
-e READ_ONLY=false \
flexo-mms-sysmlv2-mcpThe server exposes all operations from the OpenAPI specification as MCP tools. Each tool corresponds to a REST API endpoint:
getProjects- Get projectspostProject- Create projectgetProjectById- Get project by IDputProjectById- Update project by IDdeleteProjectById- Delete project by ID
getBranchesByProject- Get branches by projectpostBranchByProject- Create branch by projectgetBranchesByProjectAndId- Get branch by project and IDdeleteBranchByProjectAndId- Delete branch by project and IDmerge- Merge source commit(s) into a target branch
getCommitsByProject- Get commits by projectpostCommitByProject- Create commit by projectgetCommitByProjectAndId- Get commit by project and ID
getElementsByProjectCommit- Get elements by project and commitgetElementByProjectCommitId- Get element by project, commit and IDgetProjectUsageByProjectCommitElement- Get ProjectUsage for an elementgetRelationshipsByProjectCommitRelatedElement- Get relationships for an elementgetRootsByProjectCommit- Get root elements
getQueriesByProject- Get queries by projectpostQueryByProject- Create query by projectgetQueryByProjectAndId- Get query by project and IDputQueryByProjectAndId- Update query by project and IDdeleteQueryByProjectAndId- Delete query by project and IDgetQueryResultsByProjectIdQueryId- Get query resultsgetQueryResultsByProjectIdQuery- Get query results
getTagsByProject- Get tags by projectpostTagByProject- Create tag by projectgetTagByProjectAndId- Get tag by project and IDdeleteTagByProjectAndId- Delete tag by project and ID
When READ_ONLY=true, only GET operations are exposed as tools. This is useful for:
- Providing safe, read-only access to the API
- Preventing accidental modifications
- Compliance with security policies
The server forwards Bearer tokens from MCP clients to the SysMLv2 API. To authenticate:
- Client sends request with
Authorization: Bearer <token>header - Server extracts the token from the MCP request context
- Server forwards the token in the
Authorizationheader to the SysMLv2 API
This allows the SysMLv2 API to handle authentication and authorization independently.
MCP Client → [Streamable HTTP] → MCP Server → [REST API] → SysMLv2 API
(with Bearer token) (with Bearer token)
The server:
- Defines 35 explicit MCP tools corresponding to SysMLv2 API operations
- Extracts Bearer tokens from MCP request context
- Forwards requests to the SysMLv2 API with proper authentication
- Returns responses back to the MCP client
- Conditionally registers write operations based on READ_ONLY mode
The server includes comprehensive error handling:
- HTTP errors are caught and returned with status code and message
- Connection errors are caught and returned with error details
- Invalid requests are handled gracefully
The server uses:
- FastMCP 2.x: For MCP server implementation with streamable HTTP support
- httpx: For async HTTP client functionality
- Python 3.7+: Required for async/await support
See the project license for details.