risc0-mcp-server 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 +21 -0
- package/README.md +218 -0
- package/dist/config.d.ts +12 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +254 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/get-api-reference.d.ts +12 -0
- package/dist/tools/get-api-reference.d.ts.map +1 -0
- package/dist/tools/get-api-reference.js +31 -0
- package/dist/tools/get-api-reference.js.map +1 -0
- package/dist/tools/get-documentation.d.ts +13 -0
- package/dist/tools/get-documentation.d.ts.map +1 -0
- package/dist/tools/get-documentation.js +26 -0
- package/dist/tools/get-documentation.js.map +1 -0
- package/dist/tools/get-example.d.ts +15 -0
- package/dist/tools/get-example.d.ts.map +1 -0
- package/dist/tools/get-example.js +52 -0
- package/dist/tools/get-example.js.map +1 -0
- package/dist/tools/get-faq.d.ts +10 -0
- package/dist/tools/get-faq.d.ts.map +1 -0
- package/dist/tools/get-faq.js +77 -0
- package/dist/tools/get-faq.js.map +1 -0
- package/dist/tools/get-terminology.d.ts +9 -0
- package/dist/tools/get-terminology.d.ts.map +1 -0
- package/dist/tools/get-terminology.js +81 -0
- package/dist/tools/get-terminology.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +8 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/list-examples.d.ts +8 -0
- package/dist/tools/list-examples.d.ts.map +1 -0
- package/dist/tools/list-examples.js +54 -0
- package/dist/tools/list-examples.js.map +1 -0
- package/dist/tools/search-docs.d.ts +12 -0
- package/dist/tools/search-docs.d.ts.map +1 -0
- package/dist/tools/search-docs.js +14 -0
- package/dist/tools/search-docs.js.map +1 -0
- package/dist/types.d.ts +34 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/doc-indexer.d.ts +20 -0
- package/dist/utils/doc-indexer.d.ts.map +1 -0
- package/dist/utils/doc-indexer.js +161 -0
- package/dist/utils/doc-indexer.js.map +1 -0
- package/dist/utils/file-reader.d.ts +12 -0
- package/dist/utils/file-reader.d.ts.map +1 -0
- package/dist/utils/file-reader.js +30 -0
- package/dist/utils/file-reader.js.map +1 -0
- package/dist/utils/github-fetcher.d.ts +10 -0
- package/dist/utils/github-fetcher.d.ts.map +1 -0
- package/dist/utils/github-fetcher.js +72 -0
- package/dist/utils/github-fetcher.js.map +1 -0
- package/dist/utils/markdown-parser.d.ts +17 -0
- package/dist/utils/markdown-parser.d.ts.map +1 -0
- package/dist/utils/markdown-parser.js +55 -0
- package/dist/utils/markdown-parser.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 RISC Zero Community
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# RISC Zero MCP Documentation Server
|
|
2
|
+
|
|
3
|
+
Model Context Protocol (MCP) server that provides programmatic access to [RISC Zero](https://risczero.com) documentation, enabling AI assistants like Claude to help developers build zkVM applications.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🔍 **Full-text search** across all RISC Zero documentation
|
|
8
|
+
- 📚 **Documentation retrieval** for specific topics and tutorials
|
|
9
|
+
- 💡 **Example browser** with 25+ zkVM example applications
|
|
10
|
+
- 🔧 **API reference** access to Rust crate documentation
|
|
11
|
+
- ❓ **FAQ lookup** for common questions
|
|
12
|
+
- 📖 **Terminology** definitions for zkVM concepts
|
|
13
|
+
- ⚡ **Fast caching** for improved performance
|
|
14
|
+
- 🔒 **No API keys required** for basic usage
|
|
15
|
+
|
|
16
|
+
## Available Tools
|
|
17
|
+
|
|
18
|
+
1. `search_docs` - Search documentation by keyword
|
|
19
|
+
2. `get_documentation` - Get specific doc pages
|
|
20
|
+
3. `list_examples` - Browse all examples
|
|
21
|
+
4. `get_example` - Get detailed example info
|
|
22
|
+
5. `get_api_reference` - Access API docs
|
|
23
|
+
6. `get_faq` - Query FAQs
|
|
24
|
+
7. `get_terminology` - Look up terms
|
|
25
|
+
|
|
26
|
+
## Installation
|
|
27
|
+
|
|
28
|
+
**Using npm:**
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install -g risc0-mcp-server
|
|
32
|
+
# or run directly
|
|
33
|
+
npx risc0-mcp-server
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
**Using Bun (faster):**
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
bun install -g risc0-mcp-server
|
|
40
|
+
# or run directly
|
|
41
|
+
bunx risc0-mcp-server
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Usage
|
|
45
|
+
|
|
46
|
+
### Claude Desktop
|
|
47
|
+
|
|
48
|
+
Add to your Claude Desktop configuration file:
|
|
49
|
+
|
|
50
|
+
**macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
51
|
+
**Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
|
|
52
|
+
|
|
53
|
+
```json
|
|
54
|
+
{
|
|
55
|
+
"mcpServers": {
|
|
56
|
+
"risc0-docs": {
|
|
57
|
+
"command": "npx",
|
|
58
|
+
"args": ["-y", "risc0-mcp-server"]
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Then restart Claude Desktop.
|
|
65
|
+
|
|
66
|
+
### Claude Code
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude mcp add risc0-docs -- npx -y risc0-mcp-server
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### OpenCode
|
|
73
|
+
|
|
74
|
+
Add to your `opencode.json` configuration:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"mcp": {
|
|
79
|
+
"risc0-docs": {
|
|
80
|
+
"type": "stdio",
|
|
81
|
+
"command": "npx",
|
|
82
|
+
"args": ["-y", "risc0-mcp-server"]
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### Cursor
|
|
89
|
+
|
|
90
|
+
Open **Cursor Settings > MCP** and add a new server:
|
|
91
|
+
|
|
92
|
+
```json
|
|
93
|
+
{
|
|
94
|
+
"mcpServers": {
|
|
95
|
+
"risc0-docs": {
|
|
96
|
+
"command": "npx",
|
|
97
|
+
"args": ["-y", "risc0-mcp-server"]
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Windsurf
|
|
104
|
+
|
|
105
|
+
Open **Windsurf Settings > MCP** and add:
|
|
106
|
+
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"risc0-docs": {
|
|
111
|
+
"command": "npx",
|
|
112
|
+
"args": ["-y", "risc0-mcp-server"]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Any MCP-compatible client
|
|
119
|
+
|
|
120
|
+
This server uses **stdio transport**. Run it with any MCP client by executing:
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
npx -y risc0-mcp-server
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
### Example Queries
|
|
127
|
+
|
|
128
|
+
Once connected, ask your AI assistant:
|
|
129
|
+
|
|
130
|
+
- "Search RISC Zero docs for zkVM quickstart guide"
|
|
131
|
+
- "Show me the password checker example"
|
|
132
|
+
- "What is a receipt in RISC Zero?"
|
|
133
|
+
- "List all available zkVM examples"
|
|
134
|
+
- "Get API reference for risc0-zkvm crate"
|
|
135
|
+
|
|
136
|
+
## Development
|
|
137
|
+
|
|
138
|
+
**Using Bun (recommended - faster):**
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
# Clone repository
|
|
142
|
+
git clone https://github.com/ELDEVODE/risc0-mcp-server.git
|
|
143
|
+
cd risc0-mcp-server
|
|
144
|
+
|
|
145
|
+
# Install dependencies
|
|
146
|
+
bun install
|
|
147
|
+
|
|
148
|
+
# Build
|
|
149
|
+
bun run build
|
|
150
|
+
|
|
151
|
+
# Run in development mode (with hot reload)
|
|
152
|
+
bun run dev
|
|
153
|
+
|
|
154
|
+
# Lint and format
|
|
155
|
+
bun run lint
|
|
156
|
+
bun run format
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
**Using npm:**
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
# Clone repository
|
|
163
|
+
git clone https://github.com/ELDEVODE/risc0-mcp-server.git
|
|
164
|
+
cd risc0-mcp-server
|
|
165
|
+
|
|
166
|
+
# Install dependencies
|
|
167
|
+
npm install
|
|
168
|
+
|
|
169
|
+
# Build
|
|
170
|
+
npm run build
|
|
171
|
+
|
|
172
|
+
# Run in development mode
|
|
173
|
+
npm run dev:npm
|
|
174
|
+
|
|
175
|
+
# Lint and format
|
|
176
|
+
npm run lint
|
|
177
|
+
npm run format
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
## Architecture
|
|
181
|
+
|
|
182
|
+
- **Runtime:** Compatible with both Bun and Node.js 18+
|
|
183
|
+
- **Package Manager:** Works with both bun and npm
|
|
184
|
+
- **Server:** MCP protocol implementation with stdio transport
|
|
185
|
+
- **Tools:** 7 specialized documentation tools
|
|
186
|
+
- **Fetcher:** GitHub API integration for fetching docs
|
|
187
|
+
- **Indexer:** In-memory search index
|
|
188
|
+
- **Parser:** Markdown and frontmatter parsing
|
|
189
|
+
- **Cache:** TTL-based caching layer
|
|
190
|
+
|
|
191
|
+
## Environment Variables
|
|
192
|
+
|
|
193
|
+
- `GITHUB_TOKEN` (optional): GitHub personal access token for higher API rate limits (60/hour unauthenticated, 5000/hour authenticated)
|
|
194
|
+
|
|
195
|
+
## Contributing
|
|
196
|
+
|
|
197
|
+
Contributions welcome! Please:
|
|
198
|
+
|
|
199
|
+
1. Fork the repository
|
|
200
|
+
2. Create a feature branch
|
|
201
|
+
3. Make your changes
|
|
202
|
+
4. Add tests if applicable
|
|
203
|
+
5. Submit a pull request
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT License - see LICENSE file
|
|
208
|
+
|
|
209
|
+
## Links
|
|
210
|
+
|
|
211
|
+
- [RISC Zero](https://risczero.com)
|
|
212
|
+
- [RISC Zero Docs](https://dev.risczero.com)
|
|
213
|
+
- [GitHub](https://github.com/risc0/risc0)
|
|
214
|
+
- [Discord](https://discord.gg/risczero)
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
Built with ❤️ by the RISC Zero Community
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const CONFIG: {
|
|
2
|
+
RISC0_REPO: string;
|
|
3
|
+
RISC0_BRANCH: string;
|
|
4
|
+
DOCS_BASE_PATH: string;
|
|
5
|
+
CACHE_TTL: number;
|
|
6
|
+
GITHUB_API_BASE: string;
|
|
7
|
+
GITHUB_RAW_BASE: string;
|
|
8
|
+
MAX_SEARCH_RESULTS: number;
|
|
9
|
+
MAX_EXAMPLE_FILES: number;
|
|
10
|
+
EXAMPLES_PATH: string;
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,MAAM;;;;;;;;;;CAUlB,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const CONFIG = {
|
|
2
|
+
RISC0_REPO: 'risc0/risc0',
|
|
3
|
+
RISC0_BRANCH: 'main',
|
|
4
|
+
DOCS_BASE_PATH: 'website',
|
|
5
|
+
CACHE_TTL: 3600000, // 1 hour in ms
|
|
6
|
+
GITHUB_API_BASE: 'https://api.github.com',
|
|
7
|
+
GITHUB_RAW_BASE: 'https://raw.githubusercontent.com',
|
|
8
|
+
MAX_SEARCH_RESULTS: 20,
|
|
9
|
+
MAX_EXAMPLE_FILES: 10, // Limit files returned to avoid overwhelming responses
|
|
10
|
+
EXAMPLES_PATH: 'examples',
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,UAAU,EAAE,aAAa;IACzB,YAAY,EAAE,MAAM;IACpB,cAAc,EAAE,SAAS;IACzB,SAAS,EAAE,OAAO,EAAE,eAAe;IACnC,eAAe,EAAE,wBAAwB;IACzC,eAAe,EAAE,mCAAmC;IACpD,kBAAkB,EAAE,EAAE;IACtB,iBAAiB,EAAE,EAAE,EAAE,uDAAuD;IAC9E,aAAa,EAAE,UAAU;CAC1B,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
+
import { createRisc0DocsServer } from './server.js';
|
|
4
|
+
async function main() {
|
|
5
|
+
const server = createRisc0DocsServer();
|
|
6
|
+
const transport = new StdioServerTransport();
|
|
7
|
+
await server.connect(transport);
|
|
8
|
+
console.error('RISC Zero MCP Documentation Server running on stdio');
|
|
9
|
+
}
|
|
10
|
+
main().catch((error) => {
|
|
11
|
+
console.error('Fatal error:', error);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAEpD,KAAK,UAAU,IAAI;IACjB,MAAM,MAAM,GAAG,qBAAqB,EAAE,CAAC;IACvC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAE7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,OAAO,CAAC,KAAK,CAAC,qDAAqD,CAAC,CAAC;AACvE,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAkBnE,wBAAgB,qBAAqB,IAAI,MAAM,CA4Q9C"}
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
|
|
3
|
+
import { GitHubFetcher } from './utils/github-fetcher.js';
|
|
4
|
+
import { FileReader } from './utils/file-reader.js';
|
|
5
|
+
import { DocIndexer } from './utils/doc-indexer.js';
|
|
6
|
+
import { searchDocs, getDocumentation, listExamples, getExample, getApiReference, getFaq, getTerminology, } from './tools/index.js';
|
|
7
|
+
export function createRisc0DocsServer() {
|
|
8
|
+
const server = new Server({
|
|
9
|
+
name: 'risc0-docs-server',
|
|
10
|
+
version: '1.0.0',
|
|
11
|
+
}, {
|
|
12
|
+
capabilities: {
|
|
13
|
+
tools: {},
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
// Initialize services
|
|
17
|
+
const fetcher = new GitHubFetcher();
|
|
18
|
+
const fileReader = new FileReader(fetcher);
|
|
19
|
+
const indexer = new DocIndexer(fetcher);
|
|
20
|
+
// Initialize index on first use
|
|
21
|
+
let indexInitialized = false;
|
|
22
|
+
async function ensureIndexInitialized() {
|
|
23
|
+
if (!indexInitialized) {
|
|
24
|
+
console.error('Initializing documentation index...');
|
|
25
|
+
await indexer.buildIndex();
|
|
26
|
+
indexInitialized = true;
|
|
27
|
+
console.error('Documentation index ready');
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
// List available tools
|
|
31
|
+
server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
32
|
+
return {
|
|
33
|
+
tools: [
|
|
34
|
+
{
|
|
35
|
+
name: 'search_docs',
|
|
36
|
+
description: 'Search RISC Zero documentation by keyword. Returns relevant documentation pages with excerpts and relevance scores.',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
query: {
|
|
41
|
+
type: 'string',
|
|
42
|
+
description: 'Search query string',
|
|
43
|
+
},
|
|
44
|
+
section: {
|
|
45
|
+
type: 'string',
|
|
46
|
+
description: 'Filter by section (api, education, faq, terminology, examples)',
|
|
47
|
+
enum: ['api', 'education', 'faq', 'terminology', 'examples'],
|
|
48
|
+
},
|
|
49
|
+
limit: {
|
|
50
|
+
type: 'number',
|
|
51
|
+
description: 'Maximum number of results to return',
|
|
52
|
+
default: 20,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
required: ['query'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: 'get_documentation',
|
|
60
|
+
description: 'Get the full content of a specific documentation page by path. Returns markdown content with metadata.',
|
|
61
|
+
inputSchema: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: {
|
|
64
|
+
path: {
|
|
65
|
+
type: 'string',
|
|
66
|
+
description: 'Path to the documentation file (e.g., "website/docs/quickstart.md")',
|
|
67
|
+
},
|
|
68
|
+
version: {
|
|
69
|
+
type: 'string',
|
|
70
|
+
description: 'Git branch or tag (defaults to "main")',
|
|
71
|
+
default: 'main',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ['path'],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'list_examples',
|
|
79
|
+
description: 'List all available RISC Zero example applications with descriptions and categories.',
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: 'object',
|
|
82
|
+
properties: {},
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'get_example',
|
|
87
|
+
description: 'Get detailed information about a specific RISC Zero example, including README and optionally source files.',
|
|
88
|
+
inputSchema: {
|
|
89
|
+
type: 'object',
|
|
90
|
+
properties: {
|
|
91
|
+
name: {
|
|
92
|
+
type: 'string',
|
|
93
|
+
description: 'Name of the example (e.g., "password-checker")',
|
|
94
|
+
},
|
|
95
|
+
includeFiles: {
|
|
96
|
+
type: 'boolean',
|
|
97
|
+
description: 'Include source code files in the response',
|
|
98
|
+
default: false,
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
required: ['name'],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
name: 'get_api_reference',
|
|
106
|
+
description: 'Get API reference documentation for a RISC Zero Rust crate from docs.rs and crates.io.',
|
|
107
|
+
inputSchema: {
|
|
108
|
+
type: 'object',
|
|
109
|
+
properties: {
|
|
110
|
+
crate: {
|
|
111
|
+
type: 'string',
|
|
112
|
+
description: 'Crate name (e.g., "risc0-zkvm")',
|
|
113
|
+
},
|
|
114
|
+
version: {
|
|
115
|
+
type: 'string',
|
|
116
|
+
description: 'Crate version (defaults to "latest")',
|
|
117
|
+
default: 'latest',
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
required: ['crate'],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: 'get_faq',
|
|
125
|
+
description: 'Get frequently asked questions from RISC Zero documentation. Optionally filter by keyword.',
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: 'object',
|
|
128
|
+
properties: {
|
|
129
|
+
keyword: {
|
|
130
|
+
type: 'string',
|
|
131
|
+
description: 'Optional keyword to filter FAQs',
|
|
132
|
+
},
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'get_terminology',
|
|
138
|
+
description: 'Get RISC Zero terminology and glossary definitions. Optionally search for a specific term.',
|
|
139
|
+
inputSchema: {
|
|
140
|
+
type: 'object',
|
|
141
|
+
properties: {
|
|
142
|
+
term: {
|
|
143
|
+
type: 'string',
|
|
144
|
+
description: 'Optional term to search for (supports fuzzy matching)',
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
],
|
|
150
|
+
};
|
|
151
|
+
});
|
|
152
|
+
// Handle tool calls
|
|
153
|
+
server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
154
|
+
try {
|
|
155
|
+
const { name, arguments: args } = request.params;
|
|
156
|
+
switch (name) {
|
|
157
|
+
case 'search_docs': {
|
|
158
|
+
await ensureIndexInitialized();
|
|
159
|
+
const result = await searchDocs(indexer, args);
|
|
160
|
+
return {
|
|
161
|
+
content: [
|
|
162
|
+
{
|
|
163
|
+
type: 'text',
|
|
164
|
+
text: JSON.stringify(result, null, 2),
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
case 'get_documentation': {
|
|
170
|
+
const result = await getDocumentation(fileReader, args);
|
|
171
|
+
return {
|
|
172
|
+
content: [
|
|
173
|
+
{
|
|
174
|
+
type: 'text',
|
|
175
|
+
text: JSON.stringify(result, null, 2),
|
|
176
|
+
},
|
|
177
|
+
],
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
case 'list_examples': {
|
|
181
|
+
const result = await listExamples(fetcher);
|
|
182
|
+
return {
|
|
183
|
+
content: [
|
|
184
|
+
{
|
|
185
|
+
type: 'text',
|
|
186
|
+
text: JSON.stringify(result, null, 2),
|
|
187
|
+
},
|
|
188
|
+
],
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
case 'get_example': {
|
|
192
|
+
const result = await getExample(fetcher, args);
|
|
193
|
+
return {
|
|
194
|
+
content: [
|
|
195
|
+
{
|
|
196
|
+
type: 'text',
|
|
197
|
+
text: JSON.stringify(result, null, 2),
|
|
198
|
+
},
|
|
199
|
+
],
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
case 'get_api_reference': {
|
|
203
|
+
const result = await getApiReference(args);
|
|
204
|
+
return {
|
|
205
|
+
content: [
|
|
206
|
+
{
|
|
207
|
+
type: 'text',
|
|
208
|
+
text: JSON.stringify(result, null, 2),
|
|
209
|
+
},
|
|
210
|
+
],
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
case 'get_faq': {
|
|
214
|
+
const result = await getFaq(fileReader, args);
|
|
215
|
+
return {
|
|
216
|
+
content: [
|
|
217
|
+
{
|
|
218
|
+
type: 'text',
|
|
219
|
+
text: JSON.stringify(result, null, 2),
|
|
220
|
+
},
|
|
221
|
+
],
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
case 'get_terminology': {
|
|
225
|
+
const result = await getTerminology(fileReader, args);
|
|
226
|
+
return {
|
|
227
|
+
content: [
|
|
228
|
+
{
|
|
229
|
+
type: 'text',
|
|
230
|
+
text: JSON.stringify(result, null, 2),
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
default:
|
|
236
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
catch (error) {
|
|
240
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
241
|
+
return {
|
|
242
|
+
content: [
|
|
243
|
+
{
|
|
244
|
+
type: 'text',
|
|
245
|
+
text: JSON.stringify({ error: errorMessage }, null, 2),
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
isError: true,
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
return server;
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EACL,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,eAAe,EACf,MAAM,EACN,cAAc,GACf,MAAM,kBAAkB,CAAC;AAE1B,MAAM,UAAU,qBAAqB;IACnC,MAAM,MAAM,GAAG,IAAI,MAAM,CACvB;QACE,IAAI,EAAE,mBAAmB;QACzB,OAAO,EAAE,OAAO;KACjB,EACD;QACE,YAAY,EAAE;YACZ,KAAK,EAAE,EAAE;SACV;KACF,CACF,CAAC;IAEF,sBAAsB;IACtB,MAAM,OAAO,GAAG,IAAI,aAAa,EAAE,CAAC;IACpC,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,OAAO,CAAC,CAAC;IAExC,gCAAgC;IAChC,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,KAAK,UAAU,sBAAsB;QACnC,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACtB,OAAO,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACrD,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC;YAC3B,gBAAgB,GAAG,IAAI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;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;qBACvD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare function getApiReference(args: {
|
|
2
|
+
crate: string;
|
|
3
|
+
version?: string;
|
|
4
|
+
}): Promise<{
|
|
5
|
+
crate: string;
|
|
6
|
+
version: string;
|
|
7
|
+
description: string;
|
|
8
|
+
docsUrl: string;
|
|
9
|
+
modules?: string[];
|
|
10
|
+
examples?: string[];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=get-api-reference.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-api-reference.d.ts","sourceRoot":"","sources":["../../src/tools/get-api-reference.ts"],"names":[],"mappings":"AAEA,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,GAAG,OAAO,CAAC;IACV,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC,CA0CD"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fetch from 'node-fetch';
|
|
2
|
+
export async function getApiReference(args) {
|
|
3
|
+
const { crate, version = 'latest' } = args;
|
|
4
|
+
if (!crate || crate.trim().length === 0) {
|
|
5
|
+
throw new Error('Crate parameter is required');
|
|
6
|
+
}
|
|
7
|
+
try {
|
|
8
|
+
// Fetch crate metadata from crates.io
|
|
9
|
+
const cratesUrl = `https://crates.io/api/v1/crates/${crate}`;
|
|
10
|
+
const response = await fetch(cratesUrl);
|
|
11
|
+
if (!response.ok) {
|
|
12
|
+
throw new Error(`Crate ${crate} not found on crates.io`);
|
|
13
|
+
}
|
|
14
|
+
const data = (await response.json());
|
|
15
|
+
const crateData = data.crate;
|
|
16
|
+
const actualVersion = version === 'latest' ? crateData.newest_version : version;
|
|
17
|
+
const docsUrl = crateData.documentation || `https://docs.rs/${crate}/${actualVersion}`;
|
|
18
|
+
return {
|
|
19
|
+
crate: crateData.name,
|
|
20
|
+
version: actualVersion,
|
|
21
|
+
description: crateData.description || 'No description available',
|
|
22
|
+
docsUrl,
|
|
23
|
+
modules: [],
|
|
24
|
+
examples: [],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw new Error(`Failed to get API reference for ${crate}: ${error instanceof Error ? error.message : String(error)}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=get-api-reference.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-api-reference.js","sourceRoot":"","sources":["../../src/tools/get-api-reference.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,YAAY,CAAC;AAE/B,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAGrC;IAQC,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,EAAE,GAAG,IAAI,CAAC;IAE3C,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;IACjD,CAAC;IAED,IAAI,CAAC;QACH,sCAAsC;QACtC,MAAM,SAAS,GAAG,mCAAmC,KAAK,EAAE,CAAC;QAC7D,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;QAExC,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,yBAAyB,CAAC,CAAC;QAC3D,CAAC;QAED,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAOlC,CAAC;QAEF,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC;QAC7B,MAAM,aAAa,GAAG,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC;QAChF,MAAM,OAAO,GAAG,SAAS,CAAC,aAAa,IAAI,mBAAmB,KAAK,IAAI,aAAa,EAAE,CAAC;QAEvF,OAAO;YACL,KAAK,EAAE,SAAS,CAAC,IAAI;YACrB,OAAO,EAAE,aAAa;YACtB,WAAW,EAAE,SAAS,CAAC,WAAW,IAAI,0BAA0B;YAChE,OAAO;YACP,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,EAAE;SACb,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CACb,mCAAmC,KAAK,KAAK,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACtG,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { FileReader } from '../utils/file-reader.js';
|
|
2
|
+
export declare function getDocumentation(fileReader: FileReader, args: {
|
|
3
|
+
path: string;
|
|
4
|
+
version?: string;
|
|
5
|
+
}): Promise<{
|
|
6
|
+
title: string;
|
|
7
|
+
content: string;
|
|
8
|
+
path: string;
|
|
9
|
+
version: string;
|
|
10
|
+
metadata: Record<string, any>;
|
|
11
|
+
lastUpdated?: string;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=get-documentation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-documentation.d.ts","sourceRoot":"","sources":["../../src/tools/get-documentation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD,wBAAsB,gBAAgB,CACpC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,GACvC,OAAO,CAAC;IACT,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC,CA2BD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MarkdownParser } from '../utils/markdown-parser.js';
|
|
2
|
+
import { CONFIG } from '../config.js';
|
|
3
|
+
export async function getDocumentation(fileReader, args) {
|
|
4
|
+
const { path, version = CONFIG.RISC0_BRANCH } = args;
|
|
5
|
+
if (!path || path.trim().length === 0) {
|
|
6
|
+
throw new Error('Path parameter is required');
|
|
7
|
+
}
|
|
8
|
+
try {
|
|
9
|
+
const content = await fileReader.readFile(path);
|
|
10
|
+
const parser = new MarkdownParser();
|
|
11
|
+
const { data, content: markdownContent } = parser.parse(content);
|
|
12
|
+
const title = data.title || path.split('/').pop()?.replace(/\.(md|mdx)$/, '') || 'Untitled';
|
|
13
|
+
return {
|
|
14
|
+
title,
|
|
15
|
+
content: markdownContent,
|
|
16
|
+
path,
|
|
17
|
+
version,
|
|
18
|
+
metadata: data,
|
|
19
|
+
lastUpdated: data.lastUpdated,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
throw new Error(`Failed to get documentation for ${path}: ${error instanceof Error ? error.message : String(error)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=get-documentation.js.map
|