@comunica/mcp-sparql-link-traversal-solid 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright © 2026-now Ruben Taelman
4
+ Ghent University – imec, Belgium
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ of this software and associated documentation files (the "Software"), to deal
8
+ in the Software without restriction, including without limitation the rights
9
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ copies of the Software, and to permit persons to whom the Software is
11
+ furnished to do so, subject to the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be included in
14
+ all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,214 @@
1
+ # Comunica MCP SPARQL Link Traversal Solid
2
+
3
+ [![npm version](https://badge.fury.io/js/%40comunica%2Fmcp-sparql-link-traversal-solid.svg)](https://www.npmjs.com/package/@comunica/mcp-sparql-link-traversal-solid)
4
+
5
+ Comunica MCP SPARQL Link Traversal Solid is an [MCP server](https://modelcontextprotocol.io/) for allowing AI agents to execute SPARQL queries with link traversal capabilities over [Solid](https://solidproject.org/) data pods with authentication support.
6
+
7
+ This combines the power of link traversal (dynamically discovering data by following links) with Solid authentication, enabling queries over both public and private interconnected Solid resources.
8
+
9
+ It's main distinguishing features are the following:
10
+
11
+ * Improves the accuracy of your AI agent's answers by leveraging the power of SPARQL and Knowledge Graphs.
12
+ * Execute [SPARQL 1.2](https://www.w3.org/TR/sparql12-query/) queries with automatic link traversal over Solid pods.
13
+ * Interactive authentication with Solid identity providers.
14
+ * Access both public and private Solid resources while following links.
15
+ * Dynamically discover and query linked data across multiple Solid pods.
16
+ * Query over distributed Solid knowledge graphs without prior knowledge of all sources.
17
+
18
+ **[Learn more about Comunica on our website](https://comunica.dev/).**
19
+
20
+ _Internally, this is a [Comunica module](https://comunica.dev/) that is configured with modules to execute SPARQL queries with link traversal over Solid pods through MCP._
21
+
22
+ ## Supported by
23
+
24
+ Comunica is a community-driven project, sustained by the [Comunica Association](https://comunica.dev/association/).
25
+ If you are using Comunica, [becoming a sponsor or member](https://opencollective.com/comunica-association) is a way to make Comunica sustainable in the long-term.
26
+
27
+ Our top sponsors are shown below!
28
+
29
+ <a href="https://opencollective.com/comunica-association/sponsor/0/website" target="_blank"><img src="https://opencollective.com/comunica-association/sponsor/0/avatar.svg"></a>
30
+ <a href="https://opencollective.com/comunica-association/sponsor/1/website" target="_blank"><img src="https://opencollective.com/comunica-association/sponsor/1/avatar.svg"></a>
31
+ <a href="https://opencollective.com/comunica-association/sponsor/2/website" target="_blank"><img src="https://opencollective.com/comunica-association/sponsor/2/avatar.svg"></a>
32
+ <a href="https://opencollective.com/comunica-association/sponsor/3/website" target="_blank"><img src="https://opencollective.com/comunica-association/sponsor/3/avatar.svg"></a>
33
+
34
+ ## Usage examples
35
+
36
+ After connecting this MCP server to your AI agent (see some examples on how to do this below),
37
+ your agent can SPARQL query Solid data pods with link traversal, including private resources.
38
+
39
+ For example, use it to ask:
40
+
41
+ > Use Comunica SPARQL Link Traversal Solid to query my personal Solid pod and follow links to find all my contacts and their information.
42
+
43
+ The query engine will automatically follow links across different Solid pods while maintaining authentication.
44
+
45
+ ### Prompt suggestions
46
+
47
+ If you want your agent to always use SPARQL for higher accuracy in answers, you can tell it the following:
48
+
49
+ > When looking up data from Solid pods, always prefer using SPARQL queries with link traversal as this enables dynamic discovery of interconnected data.
50
+ > Link traversal allows queries to follow links between resources across multiple Solid pods while maintaining authentication.
51
+ > Since SPARQL queries with link traversal can take a while to execute, start producing an approximate answer yourself and show it to me if the SPARQL query takes more than 1 second, but then make the answer more concrete based on the SPARQL query once it finalized, as it will be more accurate.
52
+
53
+ ## Installation
54
+
55
+ Comunica requires [Node.JS](http://nodejs.org/) 14.0 or higher and is tested on OSX and Linux.
56
+
57
+ The easiest way to install the client is by installing it from NPM as follows:
58
+
59
+ ```bash
60
+ $ [sudo] npm install -g @comunica/mcp-sparql-link-traversal-solid
61
+ ```
62
+
63
+ Alternatively, you can install from the latest GitHub sources.
64
+ For this, please refer to the README of the [Comunica monorepo](https://github.com/comunica/comunica).
65
+ If you do so, the following examples require replacing `comunica-mcp-sparql-link-traversal-solid` with `node engines/mcp-sparql-link-traversal-solid/bin/mcp.js`.
66
+
67
+ ## Important: HTTP Mode Only
68
+
69
+ **Note:** Due to the interactive nature of Solid authentication, this MCP server only supports HTTP mode. Stdio mode is not available as it cannot handle the interactive login flow required for Solid authentication.
70
+
71
+ ## Connect this MCP server to your agent
72
+
73
+ Below, a non-exhaustive list of examples is given to connect this MCP server to your agent.
74
+
75
+ ### Claude Desktop
76
+
77
+ After installing, you need to run the MCP server in HTTP mode:
78
+
79
+ #### HTTP Mode with Authentication
80
+
81
+ First, start the server manually:
82
+
83
+ ```bash
84
+ $ comunica-mcp-sparql-link-traversal-solid --mode http --port 3123
85
+ ```
86
+
87
+ This will prompt you to authenticate with your Solid identity provider. Follow the interactive login instructions in your terminal.
88
+
89
+ Then, add the following entry to your `claude_desktop_config.json`:
90
+
91
+ ```json
92
+ {
93
+ "mcpServers": {
94
+ "comunica-sparql-link-traversal-solid": {
95
+ "command": "npx",
96
+ "args": [
97
+ "-y",
98
+ "mcp-remote",
99
+ "http://localhost:3123/mcp",
100
+ "--allow-http"
101
+ ]
102
+ }
103
+ }
104
+ }
105
+ ```
106
+
107
+ Then, you can ask Claude something like the following:
108
+
109
+ > Using Comunica SPARQL Solid, can you show me information about myself and my friends?
110
+
111
+ #### Custom Identity Provider
112
+
113
+ You can specify a custom Solid identity provider using the `--idp` flag:
114
+
115
+ ```bash
116
+ $ comunica-mcp-sparql-link-traversal-solid --mode http --port 3123 --idp https://login.inrupt.com/
117
+ ```
118
+
119
+ #### Disable Authentication
120
+
121
+ If you only need to query public Solid resources, you can disable authentication:
122
+
123
+ ```bash
124
+ $ comunica-mcp-sparql-link-traversal-solid --mode http --port 3123 --idp void
125
+ ```
126
+
127
+ #### Default Sources
128
+
129
+ You can optionally configure default starting points for link traversal when starting the MCP server:
130
+
131
+ ```bash
132
+ $ comunica-mcp-sparql-link-traversal-solid --mode http --port 3123 https://example.solidcommunity.net/profile/card
133
+ ```
134
+
135
+ ### Claude Code
136
+
137
+ #### HTTP Mode
138
+
139
+ Run the MCP server in HTTP mode, which requires starting the server manually first:
140
+
141
+ ```bash
142
+ $ comunica-mcp-sparql-link-traversal-solid --mode http --port 3123
143
+ ```
144
+
145
+ Then add it to Claude Code:
146
+
147
+ ```bash
148
+ claude mcp add --transport http sparql-link-traversal-solid http://localhost:3123/mcp
149
+ ```
150
+
151
+ Learn more in the [Claude Code MCP docs](https://code.claude.com/docs/en/mcp).
152
+
153
+ ### ChatGPT
154
+
155
+ At the time of writing, ChatGPT only supports HTTP-based MCP servers.
156
+ So you'll need to run this tool under HTTP mode and expose it to the public Web,
157
+ possibly combined with a reverse proxy and/or OAuth layer.
158
+
159
+ ```bash
160
+ $ comunica-mcp-sparql-link-traversal-solid --mode http --port 3123
161
+ ```
162
+
163
+ ## Available Tools
164
+
165
+ This MCP server provides the following tools:
166
+
167
+ ### query_sparql
168
+
169
+ Execute SPARQL queries with link traversal over one or more Solid pods as starting points, which also includes update queries.
170
+
171
+ **Parameters:**
172
+ - `query` (required): SPARQL query string
173
+ - `sources` (required, unless default sources are configured): List of starting point URLs for link traversal (Solid pod URLs)
174
+ - `queryFormatLanguage` (optional): Query language (e.g., `sparql`, `graphql`). Allows you to specify alternative query languages supported by Comunica
175
+ - `queryFormatVersion` (optional): Query language version (e.g., `1.0`, `1.1`, `1.2`). Specifies the version of the query language to use
176
+ - `baseIRI` (optional): Base IRI for resolving relative IRIs in the query
177
+ - `httpProxy` (optional): HTTP proxy URL (e.g., `http://proxy.example.com:8080`)
178
+ - `httpAuth` (optional): HTTP basic authentication in the format `username:password`
179
+ - `httpTimeout` (optional): HTTP request timeout in milliseconds
180
+ - `httpRetryCount` (optional): Number of HTTP request retries on failure
181
+
182
+ **Note:** When the MCP server is started with default sources, the `sources` parameter is not available, and all queries automatically use the configured default sources.
183
+
184
+ ### query_sparql_rdf
185
+
186
+ Execute SPARQL queries over a serialized RDF dataset provided as a string (useful for querying Turtle, N-Triples, or other RDF formats directly).
187
+
188
+ **Parameters:**
189
+ - `query` (required): SPARQL query string
190
+ - `value` (required): Serialized RDF dataset as a string
191
+ - `mediaType` (required): Media type of the serialized RDF dataset (e.g., `text/turtle`, `application/n-triples`, `application/ld+json`)
192
+ - `fileBaseIRI` (optional): Base IRI for resolving relative IRIs in the RDF dataset
193
+ - `baseIRI` (optional): Base IRI for resolving relative IRIs in the query
194
+ - `queryFormatLanguage` (optional): Query language (e.g., `sparql`, `graphql`). Allows you to specify alternative query languages supported by Comunica
195
+ - `queryFormatVersion` (optional): Query language version (e.g., `1.0`, `1.1`, `1.2`). Specifies the version of the query language to use
196
+
197
+ ## Authentication Flow
198
+
199
+ When you start the MCP server with authentication enabled (default), you will be prompted to:
200
+
201
+ 1. Visit a URL in your web browser
202
+ 2. Log in to your Solid identity provider
203
+ 3. Authorize the application
204
+ 4. The server will automatically receive the authentication token
205
+
206
+ Once authenticated, all queries will be executed with your Solid credentials, allowing access to private resources while traversing links across Solid pods.
207
+
208
+ ## Learn more
209
+
210
+ This README just shows the tip of the iceberg!
211
+ Learn more about Comunica's functionalities in the following guides:
212
+
213
+ * _[*Full documentation*](https://comunica.dev/docs/)_
214
+ * _[*Solid documentation*](https://solidproject.org/)_
package/bin/mcp.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/bin/mcp.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const mcp_sparql_solid_1 = require("@comunica/mcp-sparql-solid");
5
+ const query_sparql_link_traversal_solid_1 = require("@comunica/query-sparql-link-traversal-solid");
6
+ // eslint-disable-next-line ts/no-require-imports,ts/no-var-requires,import/extensions
7
+ (0, mcp_sparql_solid_1.runCliSolid)(new query_sparql_link_traversal_solid_1.QueryEngine(), require('../package.json').version);
8
+ //# sourceMappingURL=mcp.js.map
package/bin/mcp.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp.js","sourceRoot":"","sources":["mcp.ts"],"names":[],"mappings":";;;AACA,iEAAyD;AACzD,mGAA0E;AAE1E,sFAAsF;AACtF,IAAA,8BAAW,EAAC,IAAI,+CAAW,EAAE,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC,OAAO,CAAC,CAAC","sourcesContent":["#!/usr/bin/env node\nimport { runCliSolid } from '@comunica/mcp-sparql-solid';\nimport { QueryEngine } from '@comunica/query-sparql-link-traversal-solid';\n\n// eslint-disable-next-line ts/no-require-imports,ts/no-var-requires,import/extensions\nrunCliSolid(new QueryEngine(), require('../package.json').version);\n"]}
package/package.json ADDED
@@ -0,0 +1,57 @@
1
+ {
2
+ "name": "@comunica/mcp-sparql-link-traversal-solid",
3
+ "version": "1.0.0",
4
+ "description": "An MCP server for executing SPARQL queries with link traversal over Solid data pods with authentication support",
5
+ "license": "MIT",
6
+ "funding": {
7
+ "type": "opencollective",
8
+ "url": "https://opencollective.com/comunica-association"
9
+ },
10
+ "homepage": "https://comunica.dev/",
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "https://github.com/comunica/comunica-feature-mcp.git",
14
+ "directory": "engines/mcp-sparql-link-traversal-solid"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/comunica/comunica-feature-mcp/issues"
18
+ },
19
+ "keywords": [
20
+ "mcp",
21
+ "agentic",
22
+ "comunica",
23
+ "sparql",
24
+ "solid",
25
+ "link-traversal",
26
+ "authentication",
27
+ "engine",
28
+ "query",
29
+ "update",
30
+ "sparql engine",
31
+ "sparql query",
32
+ "sparql update",
33
+ "sparql 1.1",
34
+ "sparql 1.2"
35
+ ],
36
+ "sideEffects": false,
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "bin": {
41
+ "comunica-mcp-sparql-link-traversal-solid": "bin/mcp.js"
42
+ },
43
+ "files": [
44
+ "bin/**/*.d.ts",
45
+ "bin/**/*.js",
46
+ "bin/**/*.js.map"
47
+ ],
48
+ "scripts": {
49
+ "build": "yarn run build:ts",
50
+ "build:ts": "node \"../../node_modules/typescript/bin/tsc\""
51
+ },
52
+ "dependencies": {
53
+ "@comunica/mcp-sparql-solid": "^1.0.0",
54
+ "@comunica/query-sparql-link-traversal-solid": "^0.8.0"
55
+ },
56
+ "gitHead": "8a35a73d61cf1066bb1181761884d84d3b932932"
57
+ }