Skip to content

Commit 977328b

Browse files
Add optional RPC URLS and improve build reliability (#284)
* Add optional RPC URLS and update node-fetch versions - Add ability to override RPC url for each chain - Increment node-fetch versions to get correct typescript types - Add documentation around these changes * Removed need for node-fetch & updated docs to explain common errors with node - Removed all uses of node-fetch - Updated docs to explain how to force version 18 * Update install state * Add valid example RPC URLs - Added valid urls as examples in docs - Added node@18 prompt to claude cli docs - Added variables to .env.example * Add docs and improve build reliability - Added new docs page for support - Changed module resolution to node - Added dependency for noble hashes to resolve conflicts - * remove .nvmrc * Update packages/mcp-server/tsconfig.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update tools.mdx --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 848c236 commit 977328b

15 files changed

Lines changed: 2145 additions & 1858 deletions

File tree

.changeset/eighty-carpets-end.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@sei-js/mcp-server": patch
3+
---
4+
5+
Added ability to add custom RPC urls to each chain, removed the need for node-fetch, & updated docs for troubleshooting clarification

.yarn/install-state.gz

101 KB
Binary file not shown.

docs/docs.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@
6363
{
6464
"group": "Implementation",
6565
"pages": ["mcp-server/tools", "mcp-server/prompts", "mcp-server/context"]
66+
},
67+
{
68+
"group": "Support",
69+
"pages": ["mcp-server/troubleshooting"]
6670
}
6771
]
6872
},

docs/mcp-server/introduction.mdx

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,11 @@ Start with read-only blockchain data access:
4040
}
4141
```
4242

43-
### Full Setup (With Wallet)
43+
### Full Setup (With Wallet and RPC Configuration)
4444

45-
To enable transactions and wallet tools, add the wallet mode flag and private key:
45+
<Note>
46+
**Advanced Configuration**: For wallet setup and custom RPC endpoints, see the [Environment Variables](/mcp-server/setup#environment-variables) section in the setup guide.
47+
</Note>
4648

4749
```json
4850
{
@@ -52,7 +54,10 @@ To enable transactions and wallet tools, add the wallet mode flag and private ke
5254
"args": ["-y", "@sei-js/mcp-server"],
5355
"env": {
5456
"WALLET_MODE": "private-key",
55-
"PRIVATE_KEY": "0x123..."
57+
"PRIVATE_KEY": "YOUR_PRIVATE_KEY",
58+
"MAINNET_RPC_URL": "https://evm-rpc.sei-apis.com",
59+
"TESTNET_RPC_URL": "https://evm-rpc-testnet.sei-apis.com",
60+
"DEVNET_RPC_URL": "https://evm-rpc-arctic-1.sei-apis.com"
5661
}
5762
}
5863
}
@@ -63,6 +68,10 @@ To enable transactions and wallet tools, add the wallet mode flag and private ke
6368
Follow our step-by-step installation guide for Claude Desktop, Cursor, Windsurf, and custom integrations.
6469
</Card>
6570

71+
<Note>
72+
**Running into issues?** If you encounter "'fetch' is not defined" errors or Node.js version conflicts, check out our [troubleshooting guide](/mcp-server/troubleshooting) for solutions to common setup problems.
73+
</Note>
74+
6675
## What is MCP?
6776

6877
The Model Context Protocol is an open standard that connects AI systems with custom prompts, tools and data sources (context). It enables:

docs/mcp-server/setup.mdx

Lines changed: 53 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,7 @@ icon: "download"
2525
"mcpServers": {
2626
"sei": {
2727
"command": "npx",
28-
"args": ["-y", "@sei-js/mcp-server"],
29-
"env": {
30-
"WALLET_MODE": "private-key",
31-
"PRIVATE_KEY": "0x123..."
32-
}
28+
"args": ["-y", "@sei-js/mcp-server"]
3329
}
3430
}
3531
}
@@ -64,11 +60,7 @@ icon: "download"
6460
"mcpServers": {
6561
"sei": {
6662
"command": "npx",
67-
"args": ["-y", "@sei-js/mcp-server"],
68-
"env": {
69-
"WALLET_MODE": "private-key",
70-
"PRIVATE_KEY": "0x123..."
71-
}
63+
"args": ["-y", "@sei-js/mcp-server"]
7264
}
7365
}
7466
}
@@ -99,11 +91,7 @@ icon: "download"
9991
"mcpServers": {
10092
"sei": {
10193
"command": "npx",
102-
"args": ["-y", "@sei-js/mcp-server"],
103-
"env": {
104-
"WALLET_MODE": "private-key",
105-
"PRIVATE_KEY": "0x123..."
106-
}
94+
"args": ["-y", "@sei-js/mcp-server"]
10795
}
10896
}
10997
}
@@ -195,7 +183,7 @@ Use a dedicated test wallet with minimal funds. Never use your main wallet's pri
195183
"args": ["-y", "@sei-js/mcp-server"],
196184
"env": {
197185
"WALLET_MODE": "private-key",
198-
"PRIVATE_KEY": "0x123...."
186+
"PRIVATE_KEY": "YOUR_PRIVATE_KEY"
199187
}
200188
}
201189
}
@@ -212,7 +200,55 @@ Use a dedicated test wallet with minimal funds. Never use your main wallet's pri
212200
</Step>
213201
</Steps>
214202

215-
### Security Best Practices
203+
204+
205+
## Environment Variables
206+
207+
### `WALLET_MODE`
208+
- **Type**: `string`
209+
- **Default**: `"disabled"`
210+
- **Description**: Controls wallet functionality and transaction capabilities
211+
- **Options**: `"disabled"` | `"private-key"`
212+
213+
### `PRIVATE_KEY`
214+
- **Type**: `string`
215+
- **Default**: `-`
216+
- **Description**: Private key for wallet operations (required when WALLET_MODE="private-key")
217+
- **Format**: 0x-prefixed hex string
218+
219+
<Note>
220+
**Security Warning**: Never commit private keys to version control. Use environment variables or secure configuration management.
221+
</Note>
222+
223+
### `MAINNET_RPC_URL`
224+
- **Type**: `string`
225+
- **Default**: `"https://sei-mainnet.g.alchemy.com/v2/aRCQx4oOIXZBozWxyx6QG4ltOpRiMMMu"`
226+
- **Description**: Custom RPC endpoint for Sei mainnet
227+
- **Options**: Any valid RPC URL
228+
229+
### `TESTNET_RPC_URL`
230+
- **Type**: `string`
231+
- **Default**: `"https://sei-testnet.g.alchemy.com/v2/aRCQx4oOIXZBozWxyx6QG4ltOpRiMMMu"`
232+
- **Description**: Custom RPC endpoint for Sei testnet
233+
- **Options**: Any valid RPC URL
234+
235+
### `DEVNET_RPC_URL`
236+
- **Type**: `string`
237+
- **Default**: `"https://sei-devnet.g.alchemy.com/v2/aRCQx4oOIXZBozWxyx6QG4ltOpRiMMMu"`
238+
- **Description**: Custom RPC endpoint for Sei devnet
239+
- **Options**: Any valid RPC URL
240+
241+
### `PATH`
242+
- **Type**: `string`
243+
- **Default**: System PATH
244+
- **Description**: Override PATH to specify Node.js version (useful for troubleshooting)
245+
- **Options**: Custom PATH string
246+
247+
<Card title="Need Help?" icon="bug" href="/mcp-server/troubleshooting">
248+
Having issues? Check our comprehensive troubleshooting guide for solutions to common problems.
249+
</Card>
250+
251+
## Security Best Practices
216252

217253
<CardGroup cols={2}>
218254
<Card title="Test Wallet Only" icon="shield-check">

docs/mcp-server/tools.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,4 @@ To use wallet-required tools (🔐), you must configure a wallet connection:
155155
- Only used with funds you can afford to lose
156156
- Properly backed up before use
157157
- From a dedicated wallet, not your main holdings
158-
</Warning>
158+
</Warning>
Lines changed: 231 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,231 @@
1+
---
2+
title: "Troubleshooting"
3+
description: "Resolve common issues and get help with Sei MCP Server setup and configuration"
4+
icon: "bug"
5+
---
6+
7+
## Quick Diagnosis
8+
9+
Most issues are caused by an incorrect Node.js version being used. Start here:
10+
11+
<Steps>
12+
<Step title="Check Node.js Version">
13+
Verify your Node.js version is 18 or higher:
14+
15+
```bash
16+
node --version
17+
```
18+
19+
If you see a version below 18, you'll need to upgrade.
20+
</Step>
21+
22+
<Step title="Check Your PATH">
23+
If your Node.js version looks correct but you're still getting errors, check your PATH:
24+
25+
```bash
26+
echo $PATH
27+
```
28+
29+
Look for Node.js paths in the output. If you see multiple Node.js versions, the first one in the PATH will be used. You can set the PATH [environment variable](/mcp-server/setup#environment-variables) in your mcp config to override what node version is being used.
30+
</Step>
31+
32+
<Step title="Verify Environment Variables">
33+
Check that your environment variables are set correctly. See the [environment variables](/mcp-server/setup#environment-variables) section for reference.
34+
</Step>
35+
</Steps>
36+
37+
## Common Issues
38+
39+
### 'fetch' is not defined errors
40+
41+
This is the most common error and typically indicates a Node.js version issue. If the quick diagnosis above didn't solve your problem, try forcing a specific Node.js version:
42+
43+
<Steps>
44+
<Step title="Force Node.js Version">
45+
You can force the MCP server to use a specific Node.js version by setting the PATH environment variable:
46+
47+
```json
48+
{
49+
"mcpServers": {
50+
"sei": {
51+
"command": "npx",
52+
"args": ["-y", "@sei-js/mcp-server"],
53+
"env": {
54+
"PATH": "/path/to/your/node/bin"
55+
}
56+
}
57+
}
58+
}
59+
```
60+
61+
Replace `/path/to/your/node/bin` with the actual path to your preferred Node.js version.
62+
63+
<Note>
64+
**Quick Path Finder**: Run `dirname $(which npx)` to get the correct path to use.
65+
</Note>
66+
</Step>
67+
</Steps>
68+
69+
### NVM Version Conflicts
70+
71+
If you're using NVM (Node Version Manager), you might have multiple Node.js versions installed.
72+
73+
<Steps>
74+
<Step title="Check NVM Versions">
75+
Check your installed versions:
76+
77+
```bash
78+
nvm list
79+
```
80+
81+
Look for versions below 18 that might be taking precedence.
82+
</Step>
83+
84+
<Step title="Option 1: Remove Problematic Versions">
85+
Uninstall Node.js versions below 18:
86+
87+
```bash
88+
nvm uninstall 16.15.0
89+
nvm uninstall 14.21.3
90+
# ... uninstall other versions below 18
91+
```
92+
93+
This will prevent conflicts with older versions.
94+
</Step>
95+
96+
<Step title="Option 2: Force Specific Version">
97+
Alternatively, you can force the MCP server to use a specific Node.js version by setting the PATH environment variable:
98+
99+
```json
100+
{
101+
"mcpServers": {
102+
"sei": {
103+
"command": "npx",
104+
"args": ["-y", "@sei-js/mcp-server"],
105+
"env": {
106+
"PATH": "/Users/yourname/.nvm/versions/node/v18.18.0/bin:/usr/local/bin:/usr/bin:/bin"
107+
}
108+
}
109+
}
110+
}
111+
```
112+
</Step>
113+
</Steps>
114+
115+
### Environment Variable Issues
116+
117+
Many issues stem from incorrect environment variable configuration.
118+
119+
<Steps>
120+
<Step title="Check Your Configuration">
121+
Verify your environment variables are set correctly. Common issues include:
122+
123+
- **WALLET_MODE**: Should be `"disabled"` or `"private-key"`
124+
- **PRIVATE_KEY**: Must be 0x-prefixed hex string when using private-key mode
125+
- **RPC URLs**: Should be valid URLs if you're overriding defaults
126+
</Step>
127+
128+
<Step title="Test Configuration">
129+
Try running with minimal configuration first:
130+
131+
```json
132+
{
133+
"mcpServers": {
134+
"sei": {
135+
"command": "npx",
136+
"args": ["-y", "@sei-js/mcp-server"]
137+
}
138+
}
139+
}
140+
```
141+
142+
If this works, gradually add your environment variables back.
143+
</Step>
144+
145+
<Step title="Reference Documentation">
146+
See the [Environment Variables](/mcp-server/setup#environment-variables) section for complete documentation of all available options.
147+
</Step>
148+
</Steps>
149+
150+
151+
152+
## Error Reference
153+
154+
<CardGroup cols={1}>
155+
<Card title="'fetch' is not defined" icon="bug">
156+
**Cause**: Node.js version below 18 or PATH pointing to wrong Node.js version
157+
**Solution**: Upgrade Node.js or fix PATH as shown above
158+
</Card>
159+
<Card title="'Cannot find module'" icon="package">
160+
**Cause**: Package not installed or network issues
161+
**Solution**: Check internet connection and try reinstalling the package
162+
</Card>
163+
<Card title="'Permission denied'" icon="lock">
164+
**Cause**: Insufficient permissions to execute npx
165+
**Solution**: Ensure npx is executable or use full path to Node.js binary
166+
</Card>
167+
<Card title="'RPC connection failed'" icon="wifi">
168+
**Cause**: Invalid RPC URL or network connectivity issues
169+
**Solution**: Check your RPC URLs and internet connection
170+
</Card>
171+
</CardGroup>
172+
173+
## Getting Help
174+
175+
### Before Reporting an Issue
176+
177+
1. **Check this troubleshooting guide** - Your issue might already be covered
178+
2. **Verify your environment** - Ensure Node.js 18+ and correct PATH
179+
3. **Test with minimal config** - Try the basic setup first
180+
4. **Check environment variables** - Verify all settings are correct
181+
182+
### Reporting Issues
183+
184+
If you're still experiencing problems, please [create an issue on GitHub](https://github.com/sei-protocol/sei-js/issues) with the following information:
185+
186+
<Steps>
187+
<Step title="Environment Details">
188+
Include:
189+
- Operating system and version
190+
- Node.js version (`node --version`)
191+
- MCP client (Cursor, Claude Desktop, etc.)
192+
- Your PATH (`echo $PATH`)
193+
</Step>
194+
195+
<Step title="Configuration">
196+
Share your MCP configuration (remove private keys):
197+
198+
```json
199+
{
200+
"mcpServers": {
201+
"sei": {
202+
"command": "npx",
203+
"args": ["-y", "@sei-js/mcp-server"],
204+
"env": {
205+
"WALLET_MODE": "disabled"
206+
// ... other env vars (no private keys)
207+
}
208+
}
209+
}
210+
}
211+
```
212+
</Step>
213+
214+
<Step title="Error Messages">
215+
Include the complete error message and any relevant logs.
216+
</Step>
217+
218+
<Step title="Steps to Reproduce">
219+
Describe exactly what you did to encounter the issue.
220+
</Step>
221+
</Steps>
222+
223+
<Note>
224+
**Security**: Never include private keys or sensitive information when reporting issues. Use placeholder values instead.
225+
</Note>
226+
227+
### Community Support
228+
229+
- **GitHub Issues**: [Create an issue](https://github.com/sei-protocol/sei-js/issues)
230+
- **Discord**: Join the [Sei Discord](https://discord.gg/sei) for community help
231+
- **Documentation**: Check the [main Sei docs](https://docs.sei.io/) for additional resources

0 commit comments

Comments
 (0)