Skip to content

Commit 777e011

Browse files
committed
Update Sophia MCP endpoint to use context-based URLs
1 parent 759004f commit 777e011

2 files changed

Lines changed: 27 additions & 55 deletions

File tree

docs/cloud/sophia/administrator-guide.adoc

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ image::../../../images/sophia/context-list.png[Context list]
3030

3131
=== Creating a Context
3232

33-
Click *New Context* and provide a unique ID (e.g. `restheart`, `cloud`). The ID is used in the web URL path (`/contexts/restheart`) and in the `X-Sophia-Context` MCP header.
33+
Click *New Context* and provide a unique ID (e.g. `restheart`, `cloud`). The ID is used in the web URL path (`/contexts/restheart`) and in the MCP endpoint URL (`/mcp/restheart/`).
3434

3535
image::../../../images/sophia/context-edit.png[Context editor]
3636

@@ -125,7 +125,7 @@ Use these URLs when embedding Sophia in an iframe:
125125
<iframe src="https://sophia.restheart.com/contexts/restheart" ...></iframe>
126126
----
127127

128-
For MCP clients, the context is selected via the `X-Sophia-Context` request header (see link:/docs/cloud/sophia/mcp[Sophia MCP Server]).
128+
For MCP clients, the context is selected via the URL path (see link:/docs/cloud/sophia/mcp[Sophia MCP Server]).
129129

130130
=== Managing Contexts via API
131131

@@ -297,7 +297,7 @@ The JWT token value is displayed *only once* after creation — copy it immediat
297297

298298
For each token, the admin panel can generate ready-to-paste MCP configuration snippets for:
299299

300-
- *Claude Desktop* — uses `npx mcp-remote` with `Authorization` and `X-Sophia-Context` headers
300+
- *Claude Desktop* — uses `npx mcp-remote` with `Authorization: Bearer` header
301301
- *Cursor / VS Code* — uses SSE format with headers object
302302

303303
image::../../../images/sophia/token-mcp-config.png[MCP config]
@@ -312,9 +312,8 @@ Example generated configuration for Claude Desktop:
312312
"command": "npx",
313313
"args": [
314314
"mcp-remote",
315-
"https://sophia-api.restheart.com/mcp",
316-
"--header", "Authorization: Bearer <token>",
317-
"--header", "X-Sophia-Context: restheart"
315+
"https://sophia-api.restheart.com/mcp/restheart/",
316+
"--header", "Authorization: Bearer <token>"
318317
]
319318
}
320319
}

docs/cloud/sophia/mcp.adoc

Lines changed: 22 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -10,49 +10,41 @@ applies_to: both
1010

1111
Connect any link:https://modelcontextprotocol.io[MCP-compatible] AI client to your RESTHeart knowledge base in minutes.
1212

13-
*Endpoint:* `https://sophia-api.restheart.com/mcp`
14-
1513
=== Public vs Authenticated Access
1614

1715
Sophia MCP supports two access modes:
1816

1917
[cols="1,2,2", options="header"]
2018
|===
2119
| Mode | When to use | Headers required
22-
| *Public* | Knowledge bases with `public` tag | `X-Sophia-Context` only
23-
| *Authenticated* | Private knowledge bases | `Authorization: Bearer <token>` + `X-Sophia-Context`
20+
| *Public* | Knowledge bases with `public` tag | _(none)_
21+
| *Authenticated* | Private knowledge bases | `Authorization: Bearer <token>`
2422
|===
2523

2624
For authenticated access, issue an API token from the admin panel (see link:/docs/cloud/sophia/administrator-guide#_api_token_management[API Token Management]). The admin panel can generate ready-to-paste MCP configuration snippets for each token.
2725

26+
The token can be passed either as a standard `Authorization: Bearer <token>` header or as a `?token=<jwt>` query parameter — useful for clients that do not support custom headers:
27+
28+
`https://sophia-api.restheart.com/mcp/restheart/?token=<your-token>`
29+
2830
image::../../../images/sophia/token-mcp-config.png[MCP config generation]
2931

3032
=== Selecting a Context
3133

32-
Sophia supports multiple *Contexts*, each representing a distinct knowledge base with its own prompt template, tag filters, and RAG options. Select the desired context via the `X-Sophia-Context` header.
34+
Sophia supports multiple *Contexts*, each representing a distinct knowledge base with its own prompt template, tag filters, and RAG options. The context is selected via the URL path.
3335

34-
[cols="1,2", options="header"]
36+
[cols="1,2,2", options="header"]
3537
|===
36-
| Context | Knowledge base
37-
| `restheart` | RESTHeart documentation, plugin API, configuration guides
38-
| `cloud` | RESTHeart Cloud managed service docs
39-
| `brewmaster` | Demo context: the BrewMaster Pro 3000 coffee maker (requires authentication)
38+
| Context | URL | Knowledge base
39+
| `restheart` | `https://sophia-api.restheart.com/mcp/restheart/` | RESTHeart documentation, plugin API, configuration guides
40+
| `cloud` | `https://sophia-api.restheart.com/mcp/cloud/` | RESTHeart Cloud managed service docs
4041
|===
4142

4243
NOTE: Available contexts depend on your Sophia instance. Use the admin panel to create and manage contexts.
4344

4445
==== Filtering by Tag
4546

46-
Within a context, documents are organized by *tags*. The optional `X-Sophia-Tags` header narrows retrieval to documents that carry *all* of the specified tags (comma-separated). Use `sophia_list_tags` to discover which tags are available in your context.
47-
48-
[cols="1,3", options="header"]
49-
|===
50-
| Header value | Effect
51-
| _(omitted)_ | All documents in the context are searched
52-
| `restheart` | Only documents tagged `restheart` are searched
53-
| `cloud` | Only documents tagged `cloud` are searched
54-
| `restheart,plugin` | Only documents tagged with both `restheart` and `plugin` are searched
55-
|===
47+
Within a context, documents are organized by *tags*. Pass the optional `tags` parameter to the `sophia_search` tool to narrow retrieval to documents that carry the specified tags. Use `sophia_list_tags` to discover which tags are available in your context.
5648

5749
=== Configuration Examples
5850

@@ -64,14 +56,16 @@ Within a context, documents are organized by *tags*. The optional `X-Sophia-Tags
6456
"mcpServers": {
6557
"sophia-restheart": {
6658
"command": "npx",
67-
"args": ["mcp-remote", "https://sophia-api.restheart.com/mcp", "--header", "X-Sophia-Context: restheart"]
59+
"args": ["mcp-remote", "https://sophia-api.restheart.com/mcp/restheart/"]
6860
}
6961
}
7062
}
7163
----
7264

7365
==== Claude Desktop (authenticated)
7466

67+
When configuring via `claude_desktop_config.json`, pass the token as a header:
68+
7569
[source,json]
7670
----
7771
{
@@ -80,15 +74,16 @@ Within a context, documents are organized by *tags*. The optional `X-Sophia-Tags
8074
"command": "npx",
8175
"args": [
8276
"mcp-remote",
83-
"https://sophia-api.restheart.com/mcp",
84-
"--header", "Authorization: Bearer <your-token>",
85-
"--header", "X-Sophia-Context: restheart"
77+
"https://sophia-api.restheart.com/mcp/restheart/",
78+
"--header", "Authorization: Bearer <your-token>"
8679
]
8780
}
8881
}
8982
}
9083
----
9184

85+
When configuring via the Claude Desktop UI, custom headers are not available — use OAuth client credentials instead, which Sophia supports natively.
86+
9287
Add the snippet under `mcpServers` in `claude_desktop_config.json` (`~/Library/Application Support/Claude/` on macOS, `%APPDATA%\Claude\` on Windows), then restart.
9388

9489
==== Cursor / VS Code (SSE transport)
@@ -100,10 +95,7 @@ Cursor and VS Code support HTTP/SSE natively:
10095
{
10196
"sophia-restheart": {
10297
"type": "sse",
103-
"url": "https://sophia-api.restheart.com/mcp",
104-
"headers": {
105-
"X-Sophia-Context": "restheart"
106-
}
98+
"url": "https://sophia-api.restheart.com/mcp/restheart/"
10799
}
108100
}
109101
----
@@ -115,10 +107,9 @@ With authentication:
115107
{
116108
"sophia-restheart": {
117109
"type": "sse",
118-
"url": "https://sophia-api.restheart.com/mcp",
110+
"url": "https://sophia-api.restheart.com/mcp/restheart/",
119111
"headers": {
120-
"Authorization": "Bearer <your-token>",
121-
"X-Sophia-Context": "restheart"
112+
"Authorization": "Bearer <your-token>"
122113
}
123114
}
124115
}
@@ -128,24 +119,6 @@ With authentication:
128119

129120
Add to your project's `.mcp.json` or global MCP config.
130121

131-
==== With tag filtering
132-
133-
To restrict retrieval within a context, add the `X-Sophia-Tags` header:
134-
135-
[source,json]
136-
----
137-
{
138-
"mcpServers": {
139-
"sophia-restheart": {
140-
"command": "npx",
141-
"args": ["mcp-remote", "https://sophia-api.restheart.com/mcp",
142-
"--header", "X-Sophia-Context: restheart",
143-
"--header", "X-Sophia-Tags: restheart"]
144-
}
145-
}
146-
}
147-
----
148-
149122
The snippets above use link:https://www.npmjs.com/package/mcp-remote[`mcp-remote`], a small Node.js bridge that exposes the HTTP endpoint as a local `stdio` process — the format most clients expect. It requires link:https://nodejs.org[Node.js >= 18] and is downloaded automatically by `npx` on first run.
150123

151124
=== Available Tools

0 commit comments

Comments
 (0)