Reference
MCP Server
14 tools and 2 resources for AI agent access to the SourcePress knowledge graph, content pipeline, and eval loop.
MCP Server
The @sourcepress/mcp package exposes SourcePress capabilities to AI agents and MCP-compatible clients. It provides 14 tools and 2 resources covering the knowledge graph, content generation, eval loop, and approval pipeline.
Overview
The MCP server wraps the same pipeline available via the REST API into the Model Context Protocol interface. Agents connect to it and can query the knowledge graph, trigger generation, run evals, and submit content for approval — without direct HTTP calls.
Package: @sourcepress/mcp
Protocol: @modelcontextprotocol/sdk
Tools: 14
Resources: 2
Starting the Server
The MCP server runs as a standalone process. Start it via the CLI or directly:
# Via CLI (recommended)
pnpm sourcepress dev
# Direct invocation
node packages/mcp/dist/index.js
The server communicates over stdio by default, which is the standard transport for MCP clients (e.g., Claude Desktop, Cursor).
Configuration
The MCP server reads from the same sourcepress.config.ts used by the rest of the system. No separate config file is required.
// sourcepress.config.ts
import { defineConfig } from "@sourcepress/core";
export default defineConfig({
knowledge: {
dir: "./knowledge",
},
ai: {
model: "claude-sonnet-4-5",
budget: {
daily: 10_00, // cents
},
},
evals: {
threshold: 0.8,
max_iterations: 3,
},
github: {
owner: "your-org",
repo: "your-repo",
branch: "main",
},
});
| Field | Type | Description |
|---|---|---|
knowledge.dir | string | Directory scanned for knowledge files |
ai.model | string | Anthropic model used for generation and judging |
ai.budget.daily | number | Daily spend cap in cents |
evals.threshold | number | Minimum score (0–1) to pass the eval loop |
evals.max_iterations | number | Maximum generate-judge-improve cycles |
github.owner | string | Repository owner for PR approval |
github.repo | string | Repository name |
github.branch | string | Target branch for approved content |
Tools
The 14 tools are grouped by pipeline stage.
Knowledge Graph
| Tool | Description |
|---|---|
knowledge_ingest | Ingest a file or URL into the knowledge graph |
knowledge_query | Query entities and relations from the graph |
knowledge_gaps | Identify gaps in the knowledge graph |
knowledge_stale | Detect stale knowledge entries |
Content
| Tool | Description |
|---|---|
content_generate | Generate content against the knowledge graph |
content_improve | Improve existing content using the prompt improvement function |
content_list | List content items in a collection |
content_get | Retrieve a single content item by slug |
Eval
| Tool | Description |
|---|---|
eval_run | Run the generate-judge-improve loop for a given intent |
eval_score | Score a piece of content against the knowledge graph |
eval_judge | Run the judge function and return structured feedback |
Approval
| Tool | Description |
|---|---|
approval_submit | Submit content for approval via GitHub PR |
approval_status | Check the status of a pending approval PR |
Schema
| Tool | Description |
|---|---|
schema_get | Return the current collection schema |
Resources
The MCP server exposes 2 resources that agents can read directly.
| Resource URI | Description |
|---|---|
sourcepress://graph | Full serialized knowledge graph (entities, relations, clusters) |
sourcepress://schema | Current collection and field schema |
Resources are read-only. Mutations go through tools.
Tool Examples
knowledge_ingest
Ingests a local file or remote URL. Runs classify and entity extraction.
Input schema:
{
"source": "https://example.com/article",
"type": "url"
}
Response:
{
"status": "ingested",
"source": "https://example.com/article",
"entities_found": 7,
"relations_found": 4,
"clusters": 1
}
knowledge_query
Queries the graph for entities matching a filter.
Input schema:
{
"entity_type": "product",
"limit": 10
}
Response:
{
"entities": [
{
"id": "ent_01",
"type": "product",
"label": "SourcePress MCP Server",
"relations": ["ent_02", "ent_05"]
}
],
"total": 1
}
eval_run
Runs the full generate-judge-improve loop for a given intent slug.
Input schema:
{
"intent": "mcp-server-overview",
"collection": "docs"
}
Response:
{
"status": "passed",
"iterations": 2,
"final_score": 0.87,
"content_slug": "mcp-server-overview",
"threshold": 0.8
}
If the loop exhausts max_iterations without reaching threshold:
{
"status": "failed",
"iterations": 3,
"final_score": 0.71,
"threshold": 0.8,
"reason": "Score did not reach threshold after 3 iterations."
}
approval_submit
Submits a content item for approval by opening a GitHub PR with a provenance block.
Input schema:
{
"slug": "mcp-server-overview",
"collection": "docs"
}
Response:
{
"status": "submitted",
"pr_url": "https://github.com/your-org/your-repo/pull/42",
"pr_number": 42,
"branch": "sourcepress/docs-mcp-server-overview"
}
schema_get
Returns the active collection schema.
Input schema: (no parameters)
Response:
{
"collections": [
{
"name": "docs",
"fields": [
{ "name": "title", "type": "string", "required": true },
{ "name": "description", "type": "string", "required": true },
{ "name": "section", "type": "string", "required": true },
{ "name": "order", "type": "number", "required": true }
]
}
]
}
Connecting a Client
Claude Desktop
Add the server to your claude_desktop_config.json:
{
"mcpServers": {
"sourcepress": {
"command": "node",
"args": ["/path/to/your/project/packages/mcp/dist/index.js"],
"env": {
"SOURCEPRESS_API_KEY": "your-api-key",
"GITHUB_TOKEN": "your-github-token"
}
}
}
}
Cursor
Add to .cursor/mcp.json in your project root:
{
"mcpServers": {
"sourcepress": {
"command": "node",
"args": ["./packages/mcp/dist/index.js"]
}
}
}
Security
- Write tools (
knowledge_ingest,eval_run,approval_submit,content_generate,content_improve) require a validSOURCEPRESS_API_KEYenvironment variable. - Read tools (
knowledge_query,content_get,schema_get) and resources are unauthenticated by default in local development. - The MCP server inherits the CORS and rate-limiting posture of
@sourcepress/serverwhen run behind the REST layer. - AI and ingestion tools are rate-limited. Batch inputs are capped at 50 URLs per call.
Related
- REST API — same capabilities over HTTP
- Knowledge Graph — entity and relation model
- Eval Loop — generate-judge-improve internals
- Approval Pipeline — GitHub PR provenance flow