silvanexum-mcp 0.1.0__tar.gz

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.
@@ -0,0 +1,20 @@
1
+ node_modules/
2
+ dist/
3
+ *.tsbuildinfo
4
+ .turbo/
5
+
6
+ # Python
7
+ __pycache__/
8
+ *.py[cod]
9
+ .venv/
10
+ venv/
11
+ build/
12
+ *.egg-info/
13
+ dist-py/
14
+ .pytest_cache/
15
+ .ruff_cache/
16
+
17
+ # Editor / OS
18
+ .DS_Store
19
+ .idea/
20
+ .vscode/
@@ -0,0 +1,63 @@
1
+ Metadata-Version: 2.4
2
+ Name: silvanexum-mcp
3
+ Version: 0.1.0
4
+ Summary: Model Context Protocol server for Silvanexum — proof-ranked agent discovery, signed runs, and credit-metered execution as MCP tools. Run with `uvx silvanexum-mcp`.
5
+ Project-URL: Homepage, https://docs.silvanexum.com
6
+ Project-URL: Repository, https://github.com/silvanexum/Silvanexum-sdk
7
+ Author: Silvanexum
8
+ License-Expression: Apache-2.0
9
+ Keywords: agents,ai,claude,mcp,model-context-protocol,silvanexum
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Requires-Python: >=3.10
14
+ Requires-Dist: mcp<2,>=1.2
15
+ Requires-Dist: silvanexum<1,>=0.1
16
+ Description-Content-Type: text/markdown
17
+
18
+ # silvanexum-mcp
19
+
20
+ <!-- mcp-name: io.github.silvanexum/silvanexum -->
21
+
22
+ The official [Model Context Protocol](https://modelcontextprotocol.io) server for
23
+ [Silvanexum](https://silvanexum.com), for Python hosts — proof-ranked agent
24
+ discovery, signed runs, reputation, and credit-metered execution as MCP tools.
25
+
26
+ > The Node build is [`@silvanexum/mcp`](https://www.npmjs.com/package/@silvanexum/mcp)
27
+ > (`npx -y @silvanexum/mcp`). This is the `uvx` equivalent.
28
+
29
+ ## Run it
30
+
31
+ ```bash
32
+ export SILVANEXUM_API_KEY="sx_live_..." # read+run scopes; never pay
33
+ uvx silvanexum-mcp
34
+ ```
35
+
36
+ ### Claude Desktop / Claude Code
37
+
38
+ ```jsonc
39
+ {
40
+ "mcpServers": {
41
+ "silvanexum": {
42
+ "command": "uvx",
43
+ "args": ["silvanexum-mcp"],
44
+ "env": { "SILVANEXUM_API_KEY": "sx_live_..." }
45
+ }
46
+ }
47
+ }
48
+ ```
49
+
50
+ ## Tools
51
+
52
+ `search_agents` · `get_agent` · `get_reputation` · `run_agent` (→ answer + signed
53
+ replay URL) · `get_run` · `deploy_template` · `wallet_balance`.
54
+
55
+ ## Configuration
56
+
57
+ | Env var | Purpose |
58
+ | --- | --- |
59
+ | `SILVANEXUM_API_KEY` | **Required.** Scoped key (`read`+`run` recommended). |
60
+ | `SILVANEXUM_BASE_URL` | API base (default `https://api.silvanexum.com`). |
61
+ | `SILVANEXUM_WEB_URL` | Web base for replay URLs (default `https://silvanexum.com`). |
62
+
63
+ Licensed Apache-2.0.
@@ -0,0 +1,46 @@
1
+ # silvanexum-mcp
2
+
3
+ <!-- mcp-name: io.github.silvanexum/silvanexum -->
4
+
5
+ The official [Model Context Protocol](https://modelcontextprotocol.io) server for
6
+ [Silvanexum](https://silvanexum.com), for Python hosts — proof-ranked agent
7
+ discovery, signed runs, reputation, and credit-metered execution as MCP tools.
8
+
9
+ > The Node build is [`@silvanexum/mcp`](https://www.npmjs.com/package/@silvanexum/mcp)
10
+ > (`npx -y @silvanexum/mcp`). This is the `uvx` equivalent.
11
+
12
+ ## Run it
13
+
14
+ ```bash
15
+ export SILVANEXUM_API_KEY="sx_live_..." # read+run scopes; never pay
16
+ uvx silvanexum-mcp
17
+ ```
18
+
19
+ ### Claude Desktop / Claude Code
20
+
21
+ ```jsonc
22
+ {
23
+ "mcpServers": {
24
+ "silvanexum": {
25
+ "command": "uvx",
26
+ "args": ["silvanexum-mcp"],
27
+ "env": { "SILVANEXUM_API_KEY": "sx_live_..." }
28
+ }
29
+ }
30
+ }
31
+ ```
32
+
33
+ ## Tools
34
+
35
+ `search_agents` · `get_agent` · `get_reputation` · `run_agent` (→ answer + signed
36
+ replay URL) · `get_run` · `deploy_template` · `wallet_balance`.
37
+
38
+ ## Configuration
39
+
40
+ | Env var | Purpose |
41
+ | --- | --- |
42
+ | `SILVANEXUM_API_KEY` | **Required.** Scoped key (`read`+`run` recommended). |
43
+ | `SILVANEXUM_BASE_URL` | API base (default `https://api.silvanexum.com`). |
44
+ | `SILVANEXUM_WEB_URL` | Web base for replay URLs (default `https://silvanexum.com`). |
45
+
46
+ Licensed Apache-2.0.
@@ -0,0 +1,32 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "silvanexum-mcp"
7
+ version = "0.1.0"
8
+ description = "Model Context Protocol server for Silvanexum — proof-ranked agent discovery, signed runs, and credit-metered execution as MCP tools. Run with `uvx silvanexum-mcp`."
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = "Apache-2.0"
12
+ authors = [{ name = "Silvanexum" }]
13
+ keywords = ["silvanexum", "mcp", "model-context-protocol", "agents", "ai", "claude"]
14
+ classifiers = [
15
+ "Programming Language :: Python :: 3",
16
+ "License :: OSI Approved :: Apache Software License",
17
+ "Intended Audience :: Developers",
18
+ ]
19
+ dependencies = [
20
+ "mcp>=1.2,<2",
21
+ "silvanexum>=0.1,<1",
22
+ ]
23
+
24
+ [project.scripts]
25
+ silvanexum-mcp = "silvanexum_mcp.server:main"
26
+
27
+ [project.urls]
28
+ Homepage = "https://docs.silvanexum.com"
29
+ Repository = "https://github.com/silvanexum/Silvanexum-sdk"
30
+
31
+ [tool.hatch.build.targets.wheel]
32
+ packages = ["silvanexum_mcp"]
@@ -0,0 +1,5 @@
1
+ """Silvanexum MCP server (Python). Run with `uvx silvanexum-mcp`."""
2
+ from .server import mcp, main
3
+
4
+ __all__ = ["mcp", "main"]
5
+ __version__ = "0.1.0"
@@ -0,0 +1,146 @@
1
+ """
2
+ Silvanexum MCP server.
3
+
4
+ Exposes proof-ranked agent discovery, signed runs, reputation, and
5
+ credit-metered execution as Model Context Protocol tools, so any MCP host
6
+ (Claude Desktop, Claude Code, Cursor, Windsurf, …) can use Silvanexum natively.
7
+
8
+ uvx silvanexum-mcp (with SILVANEXUM_API_KEY in the environment)
9
+
10
+ Auth: a scoped API key via SILVANEXUM_API_KEY. Grant ``read``+``run`` — never
11
+ ``pay`` by default. Every run_agent result links a signed, replayable trace.
12
+ """
13
+ from __future__ import annotations
14
+
15
+ import os
16
+ import sys
17
+ from typing import Any, Optional
18
+
19
+ from mcp.server.fastmcp import FastMCP
20
+
21
+ from silvanexum import Silvanexum
22
+
23
+ mcp = FastMCP("silvanexum")
24
+
25
+ _client: Optional[Silvanexum] = None
26
+ _WEB = os.environ.get("SILVANEXUM_WEB_URL", "https://silvanexum.com")
27
+
28
+
29
+ def _sx() -> Silvanexum:
30
+ """Lazily build the client so tools register even without a key set."""
31
+ global _client
32
+ if _client is None:
33
+ _client = Silvanexum(
34
+ api_key=os.environ.get("SILVANEXUM_API_KEY"),
35
+ base_url=os.environ.get("SILVANEXUM_BASE_URL"),
36
+ )
37
+ return _client
38
+
39
+
40
+ @mcp.tool()
41
+ def search_agents(
42
+ q: Optional[str] = None,
43
+ sort: Optional[str] = None,
44
+ category: Optional[str] = None,
45
+ ) -> list[dict[str, Any]]:
46
+ """Search the marketplace for agents, ranked by PROVEN OUTCOMES (real run
47
+ corpus + reputation), not stars. `sort` is one of proof|recent|price."""
48
+ results = _sx().marketplace.search(q=q, sort=sort or "proof", category=category)
49
+ return [
50
+ {
51
+ "listingId": r.id,
52
+ "agentId": r.agentId,
53
+ "title": r.title,
54
+ "category": r.category,
55
+ "proofScore": r.proofScore,
56
+ "trustScore": r.proof.trustScore if r.proof else None,
57
+ "totalRuns": r.proof.totalRuns if r.proof else 0,
58
+ "confidence": r.proof.confidence if r.proof else "none",
59
+ "pricing": r.pricing.model if r.pricing else "free",
60
+ }
61
+ for r in results
62
+ ]
63
+
64
+
65
+ @mcp.tool()
66
+ def get_agent(agent_id: str) -> dict[str, Any]:
67
+ """Fetch an agent's configuration and earned reputation by id."""
68
+ return _sx().agents.get(agent_id).model_dump()
69
+
70
+
71
+ @mcp.tool()
72
+ def get_reputation(agent_id: str) -> dict[str, Any]:
73
+ """Get an agent's earned reputation — volume-aware trust score, success
74
+ rate, and confidence, derived from signed runs."""
75
+ agent = _sx().agents.get(agent_id)
76
+ rep = agent.reputation
77
+ if rep is None:
78
+ return {"note": "No reputation yet — the agent has no signed runs."}
79
+ return rep.model_dump()
80
+
81
+
82
+ @mcp.tool()
83
+ def run_agent(agent_id: str, prompt: str) -> dict[str, Any]:
84
+ """Run an agent on a prompt. The run is captured, secret-scrubbed, and
85
+ cryptographically signed. Returns the answer plus a replayable, signed trace
86
+ URL. Requires the `run` scope."""
87
+ run = _sx().runs.create(agent_id=agent_id, prompt=prompt)
88
+ return {
89
+ "runId": run.id,
90
+ "status": run.status,
91
+ "output": run.output,
92
+ "latencyMs": run.latencyMs,
93
+ "signed": bool(run.signature),
94
+ "contentHash": run.contentHash,
95
+ "replayUrl": _sx().runs.share_url(run.id, _WEB),
96
+ }
97
+
98
+
99
+ @mcp.tool()
100
+ def get_run(run_id: str) -> dict[str, Any]:
101
+ """Fetch a run's full signed trace (the step-by-step model/tool/agent
102
+ timeline) by id."""
103
+ run = _sx().runs.get(run_id)
104
+ return {
105
+ "runId": run.id,
106
+ "status": run.status,
107
+ "output": run.output,
108
+ "signed": bool(run.signature),
109
+ "contentHash": run.contentHash,
110
+ "trace": [s.model_dump() for s in run.trace],
111
+ "replayUrl": _sx().runs.share_url(run.id, _WEB),
112
+ }
113
+
114
+
115
+ @mcp.tool()
116
+ def deploy_template(template_id: str, params: Optional[dict[str, Any]] = None) -> dict[str, Any]:
117
+ """Deploy a 1-click vertical agent template into a ready, signed agent (M11).
118
+ Note: template endpoints may be 'planned' / not yet live on a deployment."""
119
+ agent = _sx().templates.deploy(template_id, params=params or {})
120
+ return agent.model_dump()
121
+
122
+
123
+ @mcp.tool()
124
+ def wallet_balance() -> dict[str, Any]:
125
+ """Get the org's credit balance."""
126
+ w = _sx().wallet.get()
127
+ return {
128
+ "balanceCredits": w.balanceCredits,
129
+ "pendingEarningsCredits": w.pendingEarningsCredits,
130
+ "creditValueUsd": w.creditValueUsd,
131
+ }
132
+
133
+
134
+ def main() -> None:
135
+ if not os.environ.get("SILVANEXUM_API_KEY"):
136
+ print(
137
+ "silvanexum-mcp: Missing SILVANEXUM_API_KEY. Create a key (read+run scopes) "
138
+ "in the dashboard and set it in the environment.",
139
+ file=sys.stderr,
140
+ )
141
+ sys.exit(1)
142
+ mcp.run() # stdio transport by default
143
+
144
+
145
+ if __name__ == "__main__":
146
+ main()