Skip to content

Commit f447eda

Browse files
authored
Merge pull request #8 from openSVM/copilot/implement-mcp-server
feat(mcp): implement foundational Model Context Protocol (MCP) server with universal installer
2 parents b5a2ade + d1ccc9d commit f447eda

File tree

14 files changed

+3789
-0
lines changed

14 files changed

+3789
-0
lines changed

HOSTING.md

Lines changed: 401 additions & 0 deletions
Large diffs are not rendered by default.

INSTALL.md

Lines changed: 251 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,251 @@
1+
# IDLHub MCP Server - Installation Script
2+
3+
This directory contains the universal installation script for the IDLHub MCP Server.
4+
5+
## Quick Install
6+
7+
The easiest way to install the IDLHub MCP Server is using our one-line installer:
8+
9+
```bash
10+
curl -fsSL https://idlhub.com/mcp | sh
11+
```
12+
13+
Or with wget:
14+
15+
```bash
16+
wget -qO- https://idlhub.com/mcp | sh
17+
```
18+
19+
## What the Script Does
20+
21+
The installation script will:
22+
23+
1. **Detect your operating system** (Linux, macOS, Windows/WSL)
24+
2. **Check for dependencies** (Node.js >= v14, npm, git)
25+
3. **Install missing dependencies** automatically
26+
4. **Clone the IDLHub repository** to `~/.idlhub`
27+
5. **Install npm packages** required for the MCP server
28+
6. **Configure your shell** environment
29+
7. **Test the installation** to ensure everything works
30+
8. **Provide integration instructions** for Claude Desktop, Cline, etc.
31+
32+
## Supported Platforms
33+
34+
### macOS
35+
- ✅ macOS 10.15+ (Catalina and later)
36+
- ✅ Apple Silicon (M1/M2/M3) and Intel
37+
- ✅ Automatic dependency installation via Homebrew
38+
39+
### Linux
40+
- ✅ Ubuntu 18.04+
41+
- ✅ Debian 10+
42+
- ✅ Fedora 30+
43+
- ✅ RHEL/CentOS 7+
44+
- ✅ Arch Linux
45+
- ✅ openSUSE
46+
- ✅ Linux Mint
47+
- ✅ Pop!_OS
48+
49+
### Windows
50+
- ✅ Windows 10/11 with WSL2 (recommended)
51+
- ✅ Git Bash
52+
- ⚠️ Manual Node.js installation required
53+
54+
## Dependencies
55+
56+
The script will automatically install these if missing:
57+
58+
- **Node.js** >= v14 (LTS recommended)
59+
- **npm** (included with Node.js)
60+
- **git** (for cloning the repository)
61+
62+
## Installation Directory
63+
64+
By default, the MCP server is installed to:
65+
66+
```
67+
~/.idlhub/
68+
```
69+
70+
This includes:
71+
- The IDLHub repository with all IDL files
72+
- MCP server source code
73+
- Documentation
74+
- Examples and tests
75+
76+
## Manual Installation
77+
78+
If you prefer to install manually or the script doesn't work on your system:
79+
80+
```bash
81+
# Clone the repository
82+
git clone https://github.com/openSVM/idlhub.git ~/.idlhub
83+
cd ~/.idlhub
84+
85+
# Install dependencies
86+
npm install
87+
88+
# Test the installation
89+
npm test
90+
91+
# Start the server
92+
npm run mcp:start
93+
```
94+
95+
## Hosting the Script
96+
97+
To host this script at `https://idlhub.com/mcp`, you have several options:
98+
99+
### Option 1: GitHub Pages (Recommended)
100+
101+
1. The script is already in the repository as `install.sh`
102+
2. Configure GitHub Pages to serve from the root directory
103+
3. Access via: `https://raw.githubusercontent.com/openSVM/idlhub/main/install.sh`
104+
4. Set up a redirect from `idlhub.com/mcp` to the raw GitHub URL
105+
106+
### Option 2: Cloudflare Pages
107+
108+
1. Connect your repository to Cloudflare Pages
109+
2. Set build command: `echo ""`
110+
3. Set output directory: `/`
111+
4. Configure a redirect:
112+
- From: `/mcp`
113+
- To: `/install.sh`
114+
- Status: 200 (not 301/302)
115+
116+
### Option 3: Custom Server
117+
118+
1. Upload `install.sh` to your web server
119+
2. Configure nginx/apache to serve it with proper headers:
120+
121+
```nginx
122+
location /mcp {
123+
alias /path/to/install.sh;
124+
default_type text/plain;
125+
add_header Content-Type "text/x-shellscript; charset=utf-8";
126+
add_header X-Content-Type-Options "nosniff";
127+
}
128+
```
129+
130+
### Option 4: Using a CDN
131+
132+
Point `idlhub.com/mcp` to:
133+
```
134+
https://cdn.jsdelivr.net/gh/openSVM/idlhub@main/install.sh
135+
```
136+
137+
## Security Considerations
138+
139+
The installation script:
140+
141+
- ✅ Uses HTTPS for all downloads
142+
- ✅ Verifies git repository authenticity
143+
- ✅ Does not require sudo except for system package managers
144+
- ✅ Installs to user's home directory by default
145+
- ✅ Shows all commands before executing
146+
- ✅ Has error handling and rollback
147+
148+
Users should always:
149+
- Review the script before running
150+
- Use HTTPS (`-fsSL` flags with curl)
151+
- Run from trusted sources only
152+
153+
## Troubleshooting
154+
155+
### Permission Denied
156+
157+
If you get "permission denied" errors:
158+
159+
```bash
160+
# Make the script executable
161+
chmod +x install.sh
162+
./install.sh
163+
```
164+
165+
### Node.js Version Too Old
166+
167+
```bash
168+
# The script will attempt to upgrade automatically
169+
# Or manually upgrade Node.js from: https://nodejs.org/
170+
```
171+
172+
### Installation Fails
173+
174+
```bash
175+
# Try manual installation
176+
git clone https://github.com/openSVM/idlhub.git ~/.idlhub
177+
cd ~/.idlhub
178+
npm install
179+
npm test
180+
```
181+
182+
### Can't Connect to GitHub
183+
184+
```bash
185+
# Check your internet connection
186+
# Try using a VPN if GitHub is blocked
187+
# Or download the repository manually
188+
```
189+
190+
## Updating
191+
192+
To update an existing installation:
193+
194+
```bash
195+
# Re-run the installation script
196+
curl -fsSL https://idlhub.com/mcp | sh
197+
198+
# Or manually update
199+
cd ~/.idlhub
200+
git pull origin main
201+
npm install
202+
```
203+
204+
## Uninstalling
205+
206+
To remove the MCP server:
207+
208+
```bash
209+
# Remove the installation directory
210+
rm -rf ~/.idlhub
211+
212+
# Remove shell configuration (optional)
213+
# Edit ~/.bashrc or ~/.zshrc and remove IDLHub entries
214+
```
215+
216+
## Environment Variables
217+
218+
The script respects these environment variables:
219+
220+
- `INSTALL_DIR` - Custom installation directory (default: `~/.idlhub`)
221+
- `NODE_MIN_VERSION` - Minimum Node.js version (default: `14`)
222+
223+
Example:
224+
```bash
225+
INSTALL_DIR=~/custom/path curl -fsSL https://idlhub.com/mcp | sh
226+
```
227+
228+
## Testing the Script Locally
229+
230+
Before hosting publicly, test the script:
231+
232+
```bash
233+
# Test locally
234+
bash install.sh
235+
236+
# Test with curl
237+
curl -fsSL http://localhost:8000/install.sh | sh
238+
239+
# Test error handling
240+
bash -x install.sh # Debug mode
241+
```
242+
243+
## Support
244+
245+
- **Issues**: https://github.com/openSVM/idlhub/issues
246+
- **Discussions**: https://github.com/openSVM/idlhub/discussions
247+
- **Documentation**: See `mcp-server/README.md`
248+
249+
## License
250+
251+
This script is part of the IDLHub project and is released into the public domain under the Unlicense.

README.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ idlhub - a comprehensive, searchable registry of Interface Definition Language (
1010
- **Organized Structure**: Clean directory layout with standardized naming
1111
- **Searchable**: Filter by category, search by name or description
1212
- **Extensible**: Easy to contribute new IDLs or update existing ones
13+
- **🆕 MCP Server**: Model Context Protocol server for LLM and editor integration with schema lookup, code generation, and diagnostics
1314

1415
## 📁 Structure
1516

@@ -22,6 +23,10 @@ idl-registry/
2223
│ ├── orcaIDL.json
2324
│ ├── marinadeIDL.json
2425
│ └── ...
26+
├── mcp-server/ # Model Context Protocol server
27+
│ ├── src/ # Server source code
28+
│ ├── config.json # Server configuration
29+
│ └── README.md # MCP server documentation
2530
└── README.md
2631
```
2732

@@ -62,6 +67,53 @@ const idlResponse = await fetch(`https://raw.githubusercontent.com/openSVM/idl-r
6267
const idl = await idlResponse.json();
6368
```
6469

70+
### Model Context Protocol (MCP) Server
71+
72+
IDLHub includes a **Model Context Protocol (MCP) server** that provides structured, high-performance access to IDL schemas, symbol lookup, code generation, and diagnostics. Perfect for LLM integration and editor tooling.
73+
74+
**One-Line Install:**
75+
76+
```bash
77+
curl -fsSL https://idlhub.com/mcp | sh
78+
```
79+
80+
Or if you have the repository already:
81+
82+
```bash
83+
# Install dependencies
84+
npm install
85+
86+
# Start the MCP server (stdio transport)
87+
npm run mcp:start
88+
89+
# Or start with WebSocket transport
90+
npm run mcp:websocket
91+
```
92+
93+
**Features:**
94+
- 📋 Schema listing & retrieval
95+
- 🔍 Symbol lookup (types, instructions, accounts, enums)
96+
- 💻 Code generation (TypeScript, Rust, Python, Anchor TS)
97+
- ✅ IDL validation and diagnostics
98+
- 🚀 High performance (p95 < 100ms)
99+
- 🔌 Multiple transports (stdio, WebSocket)
100+
101+
**Integration Examples:**
102+
103+
```json
104+
// Claude Desktop / Cline
105+
{
106+
"mcpServers": {
107+
"idlhub": {
108+
"command": "node",
109+
"args": ["/path/to/idlhub/mcp-server/src/index.js"]
110+
}
111+
}
112+
}
113+
```
114+
115+
See [mcp-server/README.md](mcp-server/README.md) for complete documentation.
116+
65117
## 📦 Protocol Categories
66118

67119
- **DEX**: Decentralized exchanges (Orca, Raydium, Phoenix, OpenBook)

0 commit comments

Comments
 (0)