MCP Server for Apache Jena
A Model Context Protocol (MCP) server that connects AI agents to Apache Jena for SPARQL query capabilities.
Overview
This project implements an MCP server that allows AI agents (such as Cursor, Claude for Cline, or Claude Desktop) to access and query RDF data stored in Apache Jena. The server provides tools for executing SPARQL queries and updates against a Jena Fuseki server.
Features
- Execute SPARQL queries against a Jena Fuseki server
- Execute SPARQL updates to modify RDF data
- List available named graphs in the dataset
- HTTP Basic authentication support for Jena Fuseki
- Compatible with the Model Context Protocol
Prerequisites
- Node.js (v16 or later)
- Apache Jena Fuseki server running with your RDF data loaded
- An AI agent that supports the Model Context Protocol (e.g., Cursor, Claude for Cline)
Installation
Clone this repository:
git clone https://github.com/ramuzes/mcp-jena.git cd mcp-jena
Install dependencies:
npm install
Build the TypeScript code:
npm run build
Usage
Run the server with default settings (localhost:3030 for Jena, ‘ds’ for dataset):
npm start
Or specify custom Jena endpoint, dataset, and authentication credentials:
npm start -- --endpoint http://your-jena-server:3030 --dataset your_dataset --username your_username --password your_password
You can also use short flags:
npm start -- -e http://your-jena-server:3030 -d your_dataset -u your_username -p your_password
For development mode with automatic transpilation:
npm run dev:transpile -- -e http://your-jena-server:3030 -d your_dataset -u your_username -p your_password
Available Tools
This MCP server provides the following tools:
execute_sparql_query
- Execute a SPARQL query against the Jena datasetexecute_sparql_update
- Execute a SPARQL update query to modify the datasetlist_graphs
- List all available named graphs in the dataset
Environment Variables
You can also configure the server using environment variables:
JENA_FUSEKI_URL
: URL of your Jena Fuseki server (default: http://localhost:3030)DEFAULT_DATASET
: Default dataset name (default: ds)JENA_USERNAME
: Username for HTTP Basic authentication to Jena FusekiJENA_PASSWORD
: Password for HTTP Basic authentication to Jena FusekiPORT
: Port for the MCP server (for HTTP transport, default: 8080)API_KEY
: API key for MCP server authentication
Example SPARQL Queries
Basic SELECT query:
SELECT ?subject ?predicate ?object
WHERE {
?subject ?predicate ?object
}
LIMIT 10
Insert data with UPDATE:
PREFIX ex: <http://example.org/>
INSERT DATA {
ex:subject1 ex:predicate1 "object1" .
ex:subject2 ex:predicate2 42 .
}
Query a specific named graph:
SELECT ?subject ?predicate ?object
FROM NAMED <http://example.org/graph1>
WHERE {
GRAPH <http://example.org/graph1> {
?subject ?predicate ?object
}
}
LIMIT 10
Resources
- Apache Jena
- Model Context Protocol
- SPARQL Query Language
MCP Server for Apache Jena
Project Details
- ramuzes/mcp-jena
- Last Updated: 3/24/2025
Recomended MCP Servers
This is a TypeScript-based MCP server, which wraps around a python script. together it helps track expenses and...
海龟汤mcp服务,使你独自一人也可以享受海龟汤游戏的乐趣
Control your Mac with detailed mouse, keyboard, screen, and window management capabilities.
Metabase MCP server provides integration with the Metabase API, enabling LLM with MCP capabilites to directly interact with...
Ein Model Context Protocol (MCP) Server für die Deutsche Bahn Timetable API
MCP aggregator for batching multiple tool calls into a single request. Reduces overhead, saves tokens, and simplifies...
A MCP Server for browsing the official Minecraft Wiki!
A demonstration server implementing the Model Context Protocol (MCP)