
This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

A configurable Model Context Protocol server built on FastMCP that connects to SPARQL endpoints, executes queries, formats results, and caches responses for AI assistants querying semantic data.
MCP server for querying SPARQL endpoints is cataloged as an MCP server attributed to yet-market. A configurable Model Context Protocol server built on FastMCP that connects to SPARQL endpoints, executes queries, formats results, and caches responses for AI assistants querying semantic data. It is categorized under databases storage. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: Not specified. Check the source repository's current license and terms before using, modifying or distributing this software.
Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for MCP server for querying SPARQL endpoints are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
It supports standard JSON, simplified JSON, and tabular formats.
No; the server does not implement authentication or authorization and relies on the security of the underlying SPARQL endpoint.
README.md · 7f8bd0b4bddf · Fetched 2026-11-13 12:50:03 UTC
Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.
Showing the last retrieved documentation snapshot; check the source for current changes.
MCP SPARQL Server is a high-performance, configurable server that connects to any SPARQL endpoint and provides enhanced functionality including result formatting and caching. It's built on top of the FastMCP framework implementing the Model Context Protocol (MCP) to provide a seamless interface for AI assistants to query semantic data.
SPARQLWrapper libraryfastmcp frameworkpydantic for configurationpython-daemon for background execution# Clone the repository
git clone https://github.com/yet-market/yet-sparql-mcp-server.git
cd yet-sparql-mcp-server
# Install dependencies
pip install -r requirements.txt
# Install the package
pip install -e .
pip install mcp-server-sparql
For a full installation with systemd service setup:
# Download the repository
git clone https://github.com/yet-market/yet-sparql-mcp-server.git
cd yet-sparql-mcp-server
# Run the installation script (as root for systemd service)
sudo ./install.sh
The installer automatically:
After installation, use the provided scripts:
# Check status
./status.sh
# Start/stop services
./start.sh [stdio|http] # Start service (http is default)
./stop.sh [stdio|http] # Stop service
./logs.sh [stdio|http] # View logs
# Examples
./start.sh http # Start HTTP service for nginx
./logs.sh http # View HTTP service logs
./test.sh # Test server functionality
./stop.sh # Stop all services
Test your server with the built-in test suite:
# Run comprehensive tests
./test.sh
# Run specific tests
./test.sh endpoint # Test HTTP connectivity
./test.sh service # Test service status
./test.sh config # Test configuration
./test.sh mcp # Test MCP protocol
./test.sh client # Test with FastMCP client
./test.sh info # Show connection info
The test script validates:
Start the server by specifying a SPARQL endpoint:
python server.py --endpoint https://dbpedia.org/sparql
Run the server as an HTTP server:
# Basic HTTP server
python server.py --transport http --endpoint https://dbpedia.org/sparql
# Custom host and port
python server.py --transport http --host 0.0.0.0 --port 8080 --endpoint https://dbpedia.org/sparql
# Using environment variables
export MCP_TRANSPORT=http
export MCP_HOST=0.0.0.0
export MCP_PORT=8000
export SPARQL_ENDPOINT=https://dbpedia.org/sparql
python server.py
To run the server as a background process (stdio transport):
python server.py --endpoint https://dbpedia.org/sparql --daemon \
--log-file /var/log/mcp-sparql.log \
--pid-file /var/run/mcp-sparql.pid
To run the HTTP server as a daemon:
python server.py --transport http --host 0.0.0.0 --port 8000 \
--endpoint https://dbpedia.org/sparql --daemon \
--log-file /var/log/mcp-sparql.log \
--pid-file /var/run/mcp-sparql.pid
If installed with systemd support:
Configure your endpoint in the environment file:
sudo nano /etc/mcp-sparql/env
Start the service:
sudo systemctl start sparql-server
Enable on boot:
sudo systemctl enable sparql-server
After starting the server, you can use it with any MCP-compatible client or through the FastMCP client:
import asyncio
from fastmcp.client import Client, PythonStdioTransport
async def query_server():
# Connect to the server
transport = PythonStdioTransport(
script_path="server.py",
args=["--endpoint", "https://dbpedia.org/sparql"]
)
async with Client(transport) as client:
# Execute a SPARQL query
result = await client.call_tool("query", {
"query_string": "SELECT * WHERE { ?s ?p ?o } LIMIT 5",
"format": "simplified"
})
print(result[0].text)
asyncio.run(query_server())
import asyncio
from fastmcp.client import Client, HttpTransport
async def query_server():
# Connect to HTTP server
transport = HttpTransport("http://localhost:8000")
async with Client(transport) as client:
# Execute a SPARQL query
result = await client.call_tool("query", {
"query_string": "SELECT * WHERE { ?s ?p ?o } LIMIT 5",
"format": "simplified"
})
print(result[0].text)
asyncio.run(query_server())
# JSON format (default)
result = await client.call_tool("query", {
"query_string": "SELECT * WHERE { ?s ?p ?o } LIMIT 5",
"format": "json"
})
# Tabular format
result = await client.call_tool("query", {
"query_string": "SELECT * WHERE { ?s ?p ?o } LIMIT 5",
"format": "tabular"
})
# Get cache statistics
cache_stats = await client.call_tool("cache", {"action": "stats"})
# Clear the cache
cache_clear = await client.call_tool("cache", {"action": "clear"})
| Argument | Description | Default |
|---|---|---|
--endpoint URL | SPARQL endpoint URL | Required |
--timeout SECONDS | Request timeout in seconds | 30 |
--format FORMAT | Result format (json, simplified, tabular) | json |
--cache-enabled BOOL | Enable result caching | true |
--cache-ttl SECONDS | Cache time-to-live in seconds | 300 |
--cache-max-size SIZE | Maximum cache size | 100 |
--cache-strategy STRATEGY | Cache replacement strategy (lru, lfu, fifo) | lru |
--pretty-print | Pretty print JSON output | false |
--include-metadata BOOL | Include query metadata in results | true |
--daemon | Run as a background daemon | false |
--log-file FILE | Log file location when running as a daemon | /var/log/mcp-sparql-server.log |
--pid-file FILE | PID file location when running as a daemon | /var/run/mcp-sparql-server.pid |
--transport TRANSPORT | Transport type (stdio or http) | stdio |
--host HOST | Host to bind HTTP server to | localhost |
--port PORT | Port to bind HTTP server to | 8000 |
| Variable | Description | Default |
|---|---|---|
SPARQL_ENDPOINT | SPARQL endpoint URL | None (required) |
SPARQL_TIMEOUT | Request timeout in seconds | 30 |
SPARQL_FORMAT | Default result format | json |
SPARQL_CACHE_ENABLED | Enable caching | true |
SPARQL_CACHE_TTL | Cache time-to-live in seconds | 300 |
SPARQL_CACHE_MAX_SIZE | Maximum cache size | 100 |
SPARQL_CACHE_STRATEGY | Cache replacement strategy | lru |
SPARQL_PRETTY_PRINT | Pretty print JSON output | false |
SPARQL_INCLUDE_METADATA | Include query metadata in results | true |
MCP_TRANSPORT | Transport type (stdio or http) | stdio |
MCP_HOST | Host to bind HTTP server to | localhost |
MCP_PORT | Port to bind HTTP server to | 8000 |
When using HTTP transport, you can integrate the server with nginx as a reverse proxy:
python server.py --transport http --host localhost --port 8000 --endpoint https://your-sparql-endpoint.com/sparql
Add this configuration to your nginx server block:
upstream mcp_sparql {
server localhost:8000;
# Add more servers for load balancing if needed
# server localhost:8001;
# server localhost:8002;
}
server {
listen 80;
server_name your-domain.com;
location /api/sparql {
proxy_pass http://mcp_sparql;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# Optional: Add CORS headers
add_header Access-Control-Allow-Origin *;
add_header Access-Control-Allow-Methods "GET, POST, OPTIONS";
add_header Access-Control-Allow-Headers "Content-Type, Authorization";
}
}
Create a systemd service for HTTP mode:
# /etc/systemd/system/mcp-sparql-http.service
[Unit]
Description=MCP SPARQL Server (HTTP)
After=network.target
[Service]
Type=simple
User=mcp-sparql
Group=mcp-sparql
WorkingDirectory=/opt/mcp-sparql
Environment=MCP_TRANSPORT=http
Environment=MCP_HOST=localhost
Environment=MCP_PORT=8000
Environment=SPARQL_ENDPOINT=https://your-sparql-endpoint.com/sparql
ExecStart=/opt/mcp-sparql/venv/bin/python server.py
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
Enable and start the service:
sudo systemctl enable mcp-sparql-http
sudo systemctl start mcp-sparql-http
The server supports three different output formats:
Returns the standard SPARQL JSON results format with optional metadata.
{
"head": {
"vars": ["s", "p", "o"]
},
"results": {
"bindings": [
{
"s": { "type": "uri", "value": "http://example.org/resource" },
"p": { "type": "uri", "value": "http://example.org/property" },
"o": { "type": "literal", "value": "Example Value" }
}
]
},
"metadata": {
"variables": ["s", "p", "o"],
"count": 1,
"query": "SELECT * WHERE { ?s ?p ?o } LIMIT 1"
}
}
Returns a simplified JSON structure that's easier to work with, converting variable bindings into simple key-value objects.
{
"type": "SELECT",
"results": [
{
"s": "http://example.org/resource",
"p": "http://example.org/property",
"o": "Example Value"
}
],
"metadata": {
"variables": ["s", "p", "o"],
"count": 1,
"query": "SELECT * WHERE { ?s ?p ?o } LIMIT 1"
}
}
Returns results in a tabular format with columns and rows, suitable for table display.
{
"type": "SELECT",
"columns": [
{ "name": "s", "label": "s" },
{ "name": "p", "label": "p" },
{ "name": "o", "label": "o" }
],
"rows": [
[
"http://example.org/resource",
"http://example.org/property",
"Example Value"
]
],
"metadata": {
"variables": ["s", "p", "o"],
"count": 1,
"query": "SELECT * WHERE { ?s ?p ?o } LIMIT 1"
}
}
The server supports three cache replacement strategies:
Evicts the least recently accessed items first. This is the default strategy and works well for most scenarios, as it prioritizes keeping recently accessed items in the cache.
Evicts the least frequently accessed items first. This strategy is good for scenarios where some queries are much more common than others, as it prioritizes keeping frequently accessed items in the cache.
Evicts the oldest items first, regardless of access patterns. This strategy is simpler and can be useful when you want a purely time-based caching approach.
The server supports all SPARQL features. Here are some example queries you can try:
SELECT * WHERE { ?s ?p ?o } LIMIT 10
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?subject ?label
WHERE {
?subject rdf:type rdfs:Class ;
rdfs:label ?label .
}
LIMIT 10
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?person ?name
WHERE {
?person foaf:name ?name .
FILTER(REGEX(?name, "Smith", "i"))
}
LIMIT 10
PREFIX dbo: <http://dbpedia.org/ontology/>
PREFIX dbp: <http://dbpedia.org/property/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT ?city ?name ?population ?country ?countryName
WHERE {
?city a dbo:City ;
rdfs:label ?name ;
dbo:population ?population ;
dbo:country ?country .
?country rdfs:label ?countryName .
FILTER(?population > 1000000)
FILTER(LANG(?name) = 'en')
FILTER(LANG(?countryName) = 'en')
}
ORDER BY DESC(?population)
LIMIT 10
--timeout optionWhen running in foreground mode, logs are output to the console. When running as a daemon, logs are written to the specified log file (default: /var/log/mcp-sparql-server.log).
To increase verbosity, you can set the Python logging level in the source code.
mcp-server-sparql/
├── sparql_server/ # Main package
│ ├── core/ # Core functionality
│ │ ├── __init__.py # Package exports
│ │ ├── config.py # Configuration management
│ │ └── server.py # Main SPARQL server
│ ├── formatters/ # Result formatters
│ │ ├── __init__.py # Package exports
│ │ ├── formatter.py # Base formatter class
│ │ ├── json_formatter.py # JSON formatter
│ │ ├── simplified_formatter.py # Simplified JSON formatter
│ │ └── tabular_formatter.py # Tabular formatter
│ ├── cache/ # Caching implementation
│ │ ├── __init__.py # Package exports
│ │ ├── query_cache.py # Base cache interface
│ │ ├── lru_cache.py # LRU cache implementation
│ │ ├── lfu_cache.py # LFU cache implementation
│ │ └── fifo_cache.py # FIFO cache implementation
│ └── __init__.py # Package exports
├── server.py # Main entry point
├── setup.py # Package setup
├── install.sh # Installation script
├── requirements.txt # Python dependencies
├── sparql-server.service # Systemd service file
├── README.md # This file
└── LICENSE # License file
# Test stdio transport
python test_sparql_server.py
# Test HTTP transport (start server first)
# Terminal 1:
python server.py --transport http --endpoint https://dbpedia.org/sparql
# Terminal 2:
# Run HTTP-specific tests (if available)
This project is licensed under a dual-license model:
See the LICENSE file for complete details.
This software was imagined and developed by Temkit Sid-Ali for Yet.lu with AI assistance from Claude (Anthropic), GitHub Copilot/Codex (OpenAI), and GPT-o3 (OpenAI).
We have exciting plans for the future! Check out our detailed roadmap to see what's coming next, including:
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)See our Contributing Guide for detailed development setup and guidelines.
This project is built on top of several excellent open source projects:
Special thanks to:
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for MCP server for querying SPARQL endpoints from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/yet-sparql-mcp-server)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.
No reviewed package or image identity; download statistics are not listed yet.
Alternative and complementary servers in the same category

This is a Model Context Protocol (MCP) server for interacting with AIStor object stores.

A Model Context Protocol server that lets AI assistants run SQL queries against AWS Athena databases and retrieve results.

A Model Context Protocol (MCP) server that exposes access to an InfluxDB v2 instance using the InfluxDB OSS API v2.