sol-mcp 0.2.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,81 @@
1
+ name: Bump Version
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ bump_type:
7
+ description: 'Version bump type'
8
+ required: true
9
+ default: 'patch'
10
+ type: choice
11
+ options:
12
+ - patch
13
+ - minor
14
+ - major
15
+
16
+ permissions:
17
+ contents: write
18
+
19
+ jobs:
20
+ bump:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v4
24
+ with:
25
+ fetch-depth: 0
26
+
27
+ - name: Set up Python
28
+ uses: actions/setup-python@v5
29
+ with:
30
+ python-version: '3.11'
31
+
32
+ - name: Install toml
33
+ run: pip install toml
34
+
35
+ - name: Bump version
36
+ id: bump
37
+ run: |
38
+ python << 'EOF'
39
+ import toml
40
+ import re
41
+ import os
42
+
43
+ # Read current version
44
+ with open('pyproject.toml', 'r') as f:
45
+ data = toml.load(f)
46
+
47
+ current = data['project']['version']
48
+ major, minor, patch = map(int, current.split('.'))
49
+
50
+ bump_type = '${{ inputs.bump_type }}'
51
+ if bump_type == 'major':
52
+ major += 1
53
+ minor = 0
54
+ patch = 0
55
+ elif bump_type == 'minor':
56
+ minor += 1
57
+ patch = 0
58
+ else:
59
+ patch += 1
60
+
61
+ new_version = f'{major}.{minor}.{patch}'
62
+ data['project']['version'] = new_version
63
+
64
+ with open('pyproject.toml', 'w') as f:
65
+ toml.dump(data, f)
66
+
67
+ print(f'Bumped {current} -> {new_version}')
68
+
69
+ with open(os.environ['GITHUB_OUTPUT'], 'a') as f:
70
+ f.write(f'version={new_version}\n')
71
+ f.write(f'tag=v{new_version}\n')
72
+ EOF
73
+
74
+ - name: Commit and tag
75
+ run: |
76
+ git config user.name "github-actions[bot]"
77
+ git config user.email "github-actions[bot]@users.noreply.github.com"
78
+ git add pyproject.toml
79
+ git commit -m "chore: bump version to ${{ steps.bump.outputs.version }}"
80
+ git tag ${{ steps.bump.outputs.tag }}
81
+ git push origin main --tags
@@ -0,0 +1,59 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ['3.11', '3.12']
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e ".[dev]"
28
+
29
+ - name: Run linter
30
+ run: ruff check src/
31
+
32
+ - name: Run tests
33
+ run: pytest tests/ -v --cov=solana_mcp --cov-report=xml
34
+
35
+ - name: Upload coverage
36
+ uses: codecov/codecov-action@v4
37
+ if: matrix.python-version == '3.11'
38
+ with:
39
+ files: coverage.xml
40
+ fail_ci_if_error: false
41
+
42
+ build:
43
+ runs-on: ubuntu-latest
44
+ steps:
45
+ - uses: actions/checkout@v4
46
+
47
+ - name: Set up Python
48
+ uses: actions/setup-python@v5
49
+ with:
50
+ python-version: '3.11'
51
+
52
+ - name: Install build dependencies
53
+ run: pip install build twine
54
+
55
+ - name: Build package
56
+ run: python -m build
57
+
58
+ - name: Check package
59
+ run: twine check dist/*
@@ -0,0 +1,72 @@
1
+ name: Release to PyPI
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+
8
+ permissions:
9
+ contents: read
10
+ id-token: write # Required for OIDC
11
+
12
+ jobs:
13
+ test:
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: '3.11'
22
+
23
+ - name: Install dependencies
24
+ run: |
25
+ python -m pip install --upgrade pip
26
+ pip install -e ".[dev]"
27
+
28
+ - name: Run tests
29
+ run: pytest tests/ -v
30
+
31
+ - name: Run linter
32
+ run: ruff check src/
33
+
34
+ build:
35
+ needs: test
36
+ runs-on: ubuntu-latest
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - name: Set up Python
41
+ uses: actions/setup-python@v5
42
+ with:
43
+ python-version: '3.11'
44
+
45
+ - name: Install build dependencies
46
+ run: pip install build
47
+
48
+ - name: Build package
49
+ run: python -m build
50
+
51
+ - name: Upload artifacts
52
+ uses: actions/upload-artifact@v4
53
+ with:
54
+ name: dist
55
+ path: dist/
56
+
57
+ publish:
58
+ needs: build
59
+ runs-on: ubuntu-latest
60
+ environment:
61
+ name: pypi
62
+ url: https://pypi.org/p/sol-mcp
63
+ steps:
64
+ - name: Download artifacts
65
+ uses: actions/download-artifact@v4
66
+ with:
67
+ name: dist
68
+ path: dist/
69
+
70
+ - name: Publish to PyPI
71
+ uses: pypa/gh-action-pypi-publish@release/v1
72
+ # No password needed - uses OIDC trusted publishing
@@ -0,0 +1,61 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *$py.class
5
+ *.so
6
+ .Python
7
+ build/
8
+ develop-eggs/
9
+ dist/
10
+ downloads/
11
+ eggs/
12
+ .eggs/
13
+ lib/
14
+ lib64/
15
+ parts/
16
+ sdist/
17
+ var/
18
+ wheels/
19
+ *.egg-info/
20
+ .installed.cfg
21
+ *.egg
22
+
23
+ # Virtual environments
24
+ venv/
25
+ ENV/
26
+ env/
27
+ .venv/
28
+
29
+ # IDE
30
+ .idea/
31
+ .vscode/
32
+ *.swp
33
+ *.swo
34
+
35
+ # Testing
36
+ .pytest_cache/
37
+ .coverage
38
+ htmlcov/
39
+
40
+ # Data (downloaded repos and indices - large, user-specific)
41
+ # Users should run `solana-mcp build` to generate these
42
+
43
+ # Misc
44
+ .DS_Store
45
+ *.log
46
+
47
+ # Secrets and sensitive files (defense in depth)
48
+ .env
49
+ .env.*
50
+ *.env
51
+ !.env.example
52
+ .envrc
53
+ *.pem
54
+ *.key
55
+ *.p12
56
+ *.secret
57
+ *.credentials
58
+ credentials.json
59
+ secrets.json
60
+ *_private.*
61
+ *.private.*
@@ -0,0 +1,92 @@
1
+ # solana-mcp
2
+
3
+ RAG-powered MCP server for Solana runtime, SIMDs, and protocol documentation.
4
+
5
+ ## Quick Reference
6
+
7
+ ```bash
8
+ # Full build (download + compile + index)
9
+ solana-mcp build
10
+
11
+ # Individual steps
12
+ solana-mcp download # Clone agave, SIMDs, alpenglow
13
+ solana-mcp compile # Extract Rust functions/types to JSON
14
+ solana-mcp index # Build vector embeddings in LanceDB
15
+
16
+ # Search
17
+ solana-mcp search "stake warmup"
18
+ solana-mcp status # Check index status
19
+ ```
20
+
21
+ ## MCP Tools
22
+
23
+ | Tool | Purpose |
24
+ |------|---------|
25
+ | `sol_search` | Unified search across runtime + SIMDs |
26
+ | `sol_search_runtime` | Runtime code only (no SIMDs) |
27
+ | `sol_search_simd` | SIMDs only |
28
+ | `sol_grep_constant` | Fast constant lookup |
29
+ | `sol_analyze_function` | Get Rust implementation |
30
+ | `sol_expert_guidance` | Curated interpretations |
31
+ | `sol_get_current_version` | Current mainnet version |
32
+
33
+ ## Project Structure
34
+
35
+ ```
36
+ src/solana_mcp/
37
+ ├── server.py # MCP server (FastMCP)
38
+ ├── cli.py # CLI commands
39
+ ├── indexer/
40
+ │ ├── downloader.py # Git clone repos
41
+ │ ├── compiler.py # Extract Rust to JSON
42
+ │ ├── chunker.py # Rust/markdown chunking
43
+ │ └── embedder.py # Embeddings + LanceDB
44
+ └── expert/
45
+ └── guidance.py # Curated interpretations
46
+ ```
47
+
48
+ ## Data Location
49
+
50
+ ```
51
+ ~/.solana-mcp/
52
+ ├── agave/ # Cloned anza-xyz/agave
53
+ ├── solana-improvement-documents/ # Cloned SIMDs
54
+ ├── alpenglow/ # Cloned anza-xyz/alpenglow
55
+ ├── compiled/ # JSON extracts
56
+ └── lancedb/ # Vector index
57
+ ```
58
+
59
+ ## Key Differences from Ethereum MCP
60
+
61
+ 1. **No formal specs** - Rust code IS the spec
62
+ 2. **No slashing** - Solana doesn't slash validators (indirect penalties only)
63
+ 3. **Account model** - Flat accounts vs Ethereum's state trie
64
+ 4. **Alpenglow** - New consensus replacing TowerBFT (Q1 2026)
65
+
66
+ ## Development
67
+
68
+ ```bash
69
+ pip install -e ".[dev]"
70
+ pytest
71
+ ruff check src/
72
+ ```
73
+
74
+ ## Adding Expert Guidance
75
+
76
+ Edit `src/solana_mcp/expert/guidance.py`:
77
+
78
+ ```python
79
+ GUIDANCE_DB["staking"] = GuidanceEntry(
80
+ topic="Stake Delegation",
81
+ summary="Solana uses delegated proof-of-stake with warmup/cooldown periods.",
82
+ key_points=["No minimum stake", "~2 epoch warmup", "~2 epoch cooldown"],
83
+ gotchas=["No slashing - only indirect penalties", "Rewards based on vote credits"],
84
+ references=["programs/stake/src/stake_state.rs"],
85
+ )
86
+ ```
87
+
88
+ ## Source Repos
89
+
90
+ - **agave**: https://github.com/anza-xyz/agave (main runtime)
91
+ - **SIMDs**: https://github.com/solana-foundation/solana-improvement-documents
92
+ - **alpenglow**: https://github.com/anza-xyz/alpenglow (new consensus)
sol_mcp-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,218 @@
1
+ Metadata-Version: 2.4
2
+ Name: sol-mcp
3
+ Version: 0.2.0
4
+ Summary: RAG-powered MCP server for Solana runtime and SIMDs
5
+ Project-URL: Homepage, https://github.com/be-nvy/solana-mcp
6
+ Project-URL: Documentation, https://github.com/be-nvy/solana-mcp#readme
7
+ Project-URL: Repository, https://github.com/be-nvy/solana-mcp.git
8
+ Project-URL: Issues, https://github.com/be-nvy/solana-mcp/issues
9
+ Author: be.nvy
10
+ License-Expression: MIT
11
+ Keywords: blockchain,mcp,rag,runtime,search,simd,solana
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
19
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
20
+ Requires-Python: >=3.11
21
+ Requires-Dist: click>=8.0.0
22
+ Requires-Dist: gitpython>=3.1.0
23
+ Requires-Dist: lancedb>=0.4.0
24
+ Requires-Dist: mcp>=1.0.0
25
+ Requires-Dist: pyyaml>=6.0.0
26
+ Requires-Dist: rich>=13.0.0
27
+ Requires-Dist: sentence-transformers>=2.2.0
28
+ Requires-Dist: tree-sitter-c>=0.20.0
29
+ Requires-Dist: tree-sitter-rust>=0.20.0
30
+ Requires-Dist: tree-sitter>=0.20.0
31
+ Provides-Extra: dev
32
+ Requires-Dist: mypy>=1.0.0; extra == 'dev'
33
+ Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
34
+ Requires-Dist: pytest>=7.0.0; extra == 'dev'
35
+ Requires-Dist: ruff>=0.1.0; extra == 'dev'
36
+ Provides-Extra: voyage
37
+ Requires-Dist: voyageai>=0.2.0; extra == 'voyage'
38
+ Description-Content-Type: text/markdown
39
+
40
+ # solana-mcp
41
+
42
+ RAG-powered MCP server for Solana runtime, SIMDs, and validator client source code.
43
+
44
+ ## What It Does
45
+
46
+ Indexes and searches across:
47
+ - **Agave** - Reference Rust validator (Anza)
48
+ - **Jito-Agave** - MEV-enabled fork (~70% of mainnet stake)
49
+ - **Jito Programs** - On-chain tip distribution and MEV programs
50
+ - **Firedancer** - Jump's C implementation (~22% with Frankendancer)
51
+ - **SIMDs** - Solana Improvement Documents
52
+ - **Alpenglow** - Future consensus protocol (not yet live)
53
+
54
+ ## Quick Start
55
+
56
+ ```bash
57
+ # Install
58
+ pip install -e .
59
+
60
+ # Full build (download repos + compile + index)
61
+ solana-mcp build
62
+
63
+ # Or step by step
64
+ solana-mcp download # Clone repositories
65
+ solana-mcp compile # Extract code to JSON
66
+ solana-mcp index # Build vector embeddings
67
+ ```
68
+
69
+ ## CLI Commands
70
+
71
+ ```bash
72
+ # Build pipeline
73
+ solana-mcp build # Full pipeline
74
+ solana-mcp download # Clone repos (agave, jito-solana, firedancer, SIMDs, alpenglow)
75
+ solana-mcp compile # Parse Rust/C code into JSON
76
+ solana-mcp index # Build LanceDB vector index
77
+
78
+ # Search
79
+ solana-mcp search "stake delegation"
80
+ solana-mcp search "tower bft" --type rust
81
+ solana-mcp search "leader schedule" --limit 10
82
+
83
+ # Lookup
84
+ solana-mcp constant LAMPORTS_PER_SOL
85
+ solana-mcp function process_vote
86
+
87
+ # Status
88
+ solana-mcp status # Show what's downloaded/compiled/indexed
89
+ ```
90
+
91
+ ## MCP Tools
92
+
93
+ When running as an MCP server, these tools are available:
94
+
95
+ | Tool | Purpose |
96
+ |------|---------|
97
+ | `sol_search` | Semantic search across all indexed content |
98
+ | `sol_search_simd` | Search SIMDs specifically |
99
+ | `sol_grep_constant` | Fast constant lookup |
100
+ | `sol_analyze_function` | Get function source code |
101
+ | `sol_get_current_version` | Current mainnet version (v2.1) |
102
+ | `sol_list_versions` | Version history with features |
103
+ | `sol_get_consensus_status` | TowerBFT (current) vs Alpenglow (future) |
104
+ | `sol_list_feature_gates` | Feature gate activations |
105
+ | `sol_list_clients` | Validator client implementations |
106
+ | `sol_get_client` | Details on specific client |
107
+ | `sol_get_client_diversity` | Stake distribution across clients |
108
+ | `sol_expert_guidance` | Curated guidance on topics |
109
+
110
+ ## Validator Clients
111
+
112
+ Solana validator clients indexed:
113
+
114
+ | Client | Language | Notes |
115
+ |--------|----------|-------|
116
+ | Jito-Agave | Rust | MEV-enabled fork |
117
+ | Frankendancer | C+Rust | Firedancer networking + Agave runtime |
118
+ | Agave | Rust | Reference implementation (Anza) |
119
+ | Firedancer | C | Full independent implementation (Jump) |
120
+
121
+ For current client diversity statistics, see [validators.app](https://www.validators.app/cluster-stats).
122
+
123
+ ## Project Structure
124
+
125
+ ```
126
+ src/solana_mcp/
127
+ ├── server.py # MCP server with all tools
128
+ ├── cli.py # CLI commands
129
+ ├── versions.py # Version/client/consensus tracking
130
+ ├── indexer/
131
+ │ ├── downloader.py # Git clone with sparse checkout
132
+ │ ├── compiler.py # Rust + C parsing (tree-sitter)
133
+ │ ├── chunker.py # Code/markdown chunking
134
+ │ └── embedder.py # Embeddings + LanceDB
135
+ └── expert/
136
+ └── guidance.py # Curated expert knowledge
137
+ ```
138
+
139
+ ## Data Location
140
+
141
+ ```
142
+ ~/.solana-mcp/
143
+ ├── agave/ # Reference client source
144
+ ├── jito-solana/ # MEV fork source
145
+ ├── jito-programs/ # On-chain MEV programs
146
+ ├── firedancer/ # Jump's C implementation
147
+ ├── solana-improvement-documents/
148
+ ├── alpenglow/ # Future consensus
149
+ ├── compiled/ # Extracted JSON
150
+ │ ├── agave/
151
+ │ ├── jito-solana/
152
+ │ ├── jito-programs/
153
+ │ └── firedancer/
154
+ └── lancedb/ # Vector index
155
+ ```
156
+
157
+ ## Expert Guidance Topics
158
+
159
+ The `sol_expert_guidance` tool provides curated knowledge on:
160
+
161
+ **Staking & Consensus:**
162
+ - `staking` - Delegation, warmup/cooldown, rewards
163
+ - `voting` - Vote accounts, TowerBFT voting
164
+ - `slashing` - Current lack of slashing, future plans
165
+ - `towerbft` - Current consensus mechanism
166
+ - `consensus` - PoH + TowerBFT relationship
167
+ - `alpenglow` - Future consensus (~150ms finality)
168
+ - `poh` - Proof of History (ordering, not consensus)
169
+
170
+ **Runtime & Architecture:**
171
+ - `accounts` - Account model, rent, ownership
172
+ - `svm` - Solana Virtual Machine
173
+ - `turbine` - Block propagation
174
+ - `leader_schedule` - Slot assignment
175
+ - `epochs` - 432,000 slots, ~2-3 days
176
+
177
+ **MEV (Jito):**
178
+ - `mev` - MEV on Solana overview
179
+ - `jito` - Jito infrastructure and architecture
180
+ - `bundles` - Atomic transaction bundles
181
+ - `tips` - Tip distribution to validators/stakers
182
+
183
+ ## Solana vs Ethereum
184
+
185
+ | Aspect | Ethereum | Solana |
186
+ |--------|----------|--------|
187
+ | Spec format | Markdown + Python | Rust implementation |
188
+ | Slashing | Yes (3 penalties) | No (indirect penalties only) |
189
+ | Finality | ~13 min | ~12.8s → 150ms (Alpenglow) |
190
+ | Consensus | Casper FFG | TowerBFT → Alpenglow |
191
+
192
+ ## Development
193
+
194
+ ```bash
195
+ # Install with dev dependencies
196
+ pip install -e ".[dev]"
197
+
198
+ # Run tests
199
+ pytest
200
+
201
+ # Lint
202
+ ruff check src/
203
+ ```
204
+
205
+ ## Differences from Official Solana MCP
206
+
207
+ The official [mcp.solana.com](https://mcp.solana.com) is documentation-focused.
208
+
209
+ This implementation:
210
+ - Indexes actual **source code** from multiple clients
211
+ - Parses **Rust and C** with tree-sitter
212
+ - Tracks **client diversity** and stake distribution
213
+ - Includes **expert guidance** from protocol research
214
+ - Provides **constant/function lookup** with full source
215
+
216
+ ## License
217
+
218
+ MIT