A Model Context Protocol (MCP) server that connects to any OSLC 3.0 server, discovers its capabilities, and exposes them as MCP tools and resources for LLM-driven CRUD operations.
AI assistants can't interact with OSLC servers directly. This module bridges that gap by dynamically discovering an OSLC server's service providers, creation factories, query capabilities, and resource shapes at startup, then exposing them as typed MCP tools that any MCP-compatible AI assistant can call.
- Node.js v22 or later
- An OSLC 3.0 server running (e.g., oslc-server or mrm-server from this workspace)
cd oslc-mcp-server
npm install
npm run buildThe server accepts configuration via CLI arguments or environment variables (CLI overrides env):
| CLI Argument | Environment Variable | Description |
|---|---|---|
--server <url> |
OSLC_SERVER_URL |
Required. Base URL of the OSLC server |
--catalog <url> |
OSLC_CATALOG_URL |
Catalog URL (defaults to {server}/oslc/catalog) |
--username <user> |
OSLC_USERNAME |
Username for authenticated servers |
--password <pass> |
OSLC_PASSWORD |
Password for authenticated servers |
Start your OSLC server first, then:
node dist/index.js --server http://localhost:3002 --catalog http://localhost:3002/oslcThe server communicates via stdio using the MCP protocol. To use it with Claude Code, add it to your MCP server configuration:
{
"mcpServers": {
"oslc": {
"command": "node",
"args": ["path/to/oslc-mcp-server/dist/index.js", "--server", "http://localhost:3002", "--catalog", "http://localhost:3002/oslc"]
}
}
}At startup, the server:
- Connects to the OSLC server's service provider catalog
- Walks all service providers, collecting creation factories, query capabilities, and resource shapes
- Generates per-type MCP tools from each creation factory and query capability (e.g.,
create_programs,query_services) - Registers generic CRUD tools (
get_resource,update_resource,delete_resource,list_resource_types,query_resources) - Exposes catalog, vocabulary, and resource shapes as MCP resources for LLM context
Per-type tools (dynamically generated from discovery):
create_<type>-- Creates a resource of that type. Input schema is derived from the OSLC resource shape, with proper types, descriptions, required fields, and allowed values.query_<type>-- Queries resources of that type usingoslc.where,oslc.select, andoslc.orderByparameters.
Generic tools (always available):
get_resource-- Fetch any OSLC resource by URIupdate_resource-- Update properties on an existing resource (uses ETag for concurrency)delete_resource-- Delete a resource by URIlist_resource_types-- List all discovered resource types with their factories and propertiesquery_resources-- Query any resource type using a query capability URL
oslc://catalog-- Service provider catalog summary (providers, factories, query capabilities)oslc://vocabulary-- Resource types and their relationshipsoslc://shapes-- Property definitions for each resource type (names, types, cardinalities)
oslc-mcp-server/src/
├── index.ts CLI entry point, arg parsing, startup orchestration
├── server.ts MCP Server setup, tool/resource registration, stdio transport
├── discovery.ts Walks OSLC catalog, collects shapes/factories/queries
├── schema.ts Converts OSLC resource shapes to JSON Schema
├── resources.ts MCP resource definitions (catalog/vocabulary/shapes)
├── types.ts Shared TypeScript interfaces
├── oslc-client.d.ts Type declarations for oslc-client
└── tools/
├── generic.ts Handlers for generic CRUD tools
└── factory.ts Generates per-type tool definitions from discovery
Dependencies: Uses oslc-client for all OSLC operations (HTTP, RDF parsing via rdflib, authentication) and @modelcontextprotocol/sdk for the MCP server framework.
Licensed under the Apache License, Version 2.0. See the workspace root LICENSE for details.