@i18n-agent/mcp-client 1.0.0 โ 1.0.2
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/CONTRIBUTING.md +218 -0
- package/LICENSE +21 -0
- package/README.md +264 -0
- package/install.js +218 -0
- package/mcp-client.js +808 -0
- package/package.json +35 -12
- package/index.js +0 -8
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
# Contributing to i18n-agent MCP Client
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to the i18n-agent MCP client! We welcome contributions from the community.
|
|
4
|
+
|
|
5
|
+
## ๐ Quick Start
|
|
6
|
+
|
|
7
|
+
1. **Fork the repository** on GitHub
|
|
8
|
+
2. **Clone your fork** locally:
|
|
9
|
+
```bash
|
|
10
|
+
git clone https://github.com/YOUR_USERNAME/mcp-client.git
|
|
11
|
+
cd mcp-client
|
|
12
|
+
```
|
|
13
|
+
3. **Create a feature branch**:
|
|
14
|
+
```bash
|
|
15
|
+
git checkout -b feature/your-feature-name
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## ๐ Development Setup
|
|
19
|
+
|
|
20
|
+
### Prerequisites
|
|
21
|
+
- Node.js 16+
|
|
22
|
+
- npm or yarn
|
|
23
|
+
- Git
|
|
24
|
+
|
|
25
|
+
### Local Development
|
|
26
|
+
```bash
|
|
27
|
+
# Install dependencies (if any are added)
|
|
28
|
+
npm install
|
|
29
|
+
|
|
30
|
+
# Run tests
|
|
31
|
+
npm test
|
|
32
|
+
|
|
33
|
+
# Test the installer locally
|
|
34
|
+
node install.js
|
|
35
|
+
|
|
36
|
+
# Test MCP client syntax
|
|
37
|
+
node -c mcp-client.js
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## ๐ Types of Contributions
|
|
41
|
+
|
|
42
|
+
### ๐ Bug Reports
|
|
43
|
+
- Use the [GitHub Issues](https://github.com/i18n-agent/mcp-client/issues) page
|
|
44
|
+
- Include steps to reproduce
|
|
45
|
+
- Mention your OS, IDE, and Node.js version
|
|
46
|
+
- Include error messages and logs
|
|
47
|
+
|
|
48
|
+
### ๐ก Feature Requests
|
|
49
|
+
- Check existing issues first
|
|
50
|
+
- Describe the use case and expected behavior
|
|
51
|
+
- Consider backward compatibility
|
|
52
|
+
|
|
53
|
+
### ๐ง Code Contributions
|
|
54
|
+
|
|
55
|
+
#### Areas for Contribution:
|
|
56
|
+
- **IDE Support**: Add support for new AI IDEs
|
|
57
|
+
- **Installation**: Improve cross-platform compatibility
|
|
58
|
+
- **Error Handling**: Better error messages and recovery
|
|
59
|
+
- **Documentation**: Improve README, add examples
|
|
60
|
+
- **Testing**: Add more test cases
|
|
61
|
+
- **Localization**: Translate installation messages
|
|
62
|
+
|
|
63
|
+
## ๐งช Testing
|
|
64
|
+
|
|
65
|
+
Before submitting a PR, ensure:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
# Run the test suite
|
|
69
|
+
npm test
|
|
70
|
+
|
|
71
|
+
# Test installation process
|
|
72
|
+
node install.js
|
|
73
|
+
|
|
74
|
+
# Check for syntax errors
|
|
75
|
+
node -c mcp-client.js
|
|
76
|
+
node -c install.js
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Test Coverage Areas:
|
|
80
|
+
- โ
Configuration generation
|
|
81
|
+
- โ
IDE detection
|
|
82
|
+
- โ
File validation
|
|
83
|
+
- โ
Package.json validation
|
|
84
|
+
- โ
MCP client syntax
|
|
85
|
+
- ๐ง Cross-platform testing needed
|
|
86
|
+
- ๐ง Error condition testing needed
|
|
87
|
+
|
|
88
|
+
## ๐ Coding Standards
|
|
89
|
+
|
|
90
|
+
### JavaScript Style
|
|
91
|
+
- Use ES6+ modules (`import`/`export`)
|
|
92
|
+
- Use modern JavaScript features
|
|
93
|
+
- Add JSDoc comments for functions
|
|
94
|
+
- Use descriptive variable names
|
|
95
|
+
|
|
96
|
+
### Security
|
|
97
|
+
- **Never commit API keys** or secrets
|
|
98
|
+
- Use environment variables for configuration
|
|
99
|
+
- Validate user input
|
|
100
|
+
- Handle errors gracefully
|
|
101
|
+
|
|
102
|
+
### Example Code Style:
|
|
103
|
+
```javascript
|
|
104
|
+
/**
|
|
105
|
+
* Detect available AI IDEs on the system
|
|
106
|
+
* @returns {Promise<Array>} List of available IDEs with config paths
|
|
107
|
+
*/
|
|
108
|
+
async function detectAvailableIDEs() {
|
|
109
|
+
const available = [];
|
|
110
|
+
|
|
111
|
+
for (const [key, config] of Object.entries(IDE_CONFIGS)) {
|
|
112
|
+
const configDir = path.dirname(config.configPath);
|
|
113
|
+
if (fs.existsSync(configDir)) {
|
|
114
|
+
available.push({ key, ...config });
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return available;
|
|
119
|
+
}
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## ๐ฆ Pull Request Process
|
|
123
|
+
|
|
124
|
+
1. **Create a feature branch** from `main`
|
|
125
|
+
2. **Make your changes** with clear, focused commits
|
|
126
|
+
3. **Add tests** if applicable
|
|
127
|
+
4. **Update documentation** if needed
|
|
128
|
+
5. **Run tests** and ensure they pass
|
|
129
|
+
6. **Create a Pull Request** with:
|
|
130
|
+
- Clear title and description
|
|
131
|
+
- Reference any related issues
|
|
132
|
+
- Include testing steps
|
|
133
|
+
|
|
134
|
+
### PR Title Format:
|
|
135
|
+
- `feat: add support for WebStorm IDE`
|
|
136
|
+
- `fix: handle Windows path separators correctly`
|
|
137
|
+
- `docs: improve installation instructions`
|
|
138
|
+
- `test: add cross-platform installation tests`
|
|
139
|
+
|
|
140
|
+
## ๐ Adding IDE Support
|
|
141
|
+
|
|
142
|
+
To add support for a new AI IDE:
|
|
143
|
+
|
|
144
|
+
1. **Add IDE config** to `IDE_CONFIGS` in `install.js`:
|
|
145
|
+
```javascript
|
|
146
|
+
newIDE: {
|
|
147
|
+
name: 'New IDE Name',
|
|
148
|
+
configPath: path.join(os.homedir(), '.newIDE/mcp_config.json'),
|
|
149
|
+
displayPath: '~/.newIDE/mcp_config.json'
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
2. **Add configuration logic** if the IDE uses a different config format
|
|
154
|
+
|
|
155
|
+
3. **Test on the target platform**
|
|
156
|
+
|
|
157
|
+
4. **Update README** with IDE support information
|
|
158
|
+
|
|
159
|
+
## ๐ Debugging
|
|
160
|
+
|
|
161
|
+
### Common Issues:
|
|
162
|
+
- **Permission errors**: Check file permissions for config directories
|
|
163
|
+
- **Path issues**: Ensure paths work on Windows/macOS/Linux
|
|
164
|
+
- **JSON parsing**: Validate config file structure
|
|
165
|
+
- **Node.js version**: Ensure compatibility with Node 16+
|
|
166
|
+
|
|
167
|
+
### Debug Environment Variables:
|
|
168
|
+
```bash
|
|
169
|
+
# Enable verbose logging (if implemented)
|
|
170
|
+
DEBUG=i18n-agent:* node install.js
|
|
171
|
+
|
|
172
|
+
# Test with different home directories
|
|
173
|
+
HOME=/tmp/test-home node install.js
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## ๐ Documentation
|
|
177
|
+
|
|
178
|
+
### README Updates
|
|
179
|
+
- Keep installation instructions current
|
|
180
|
+
- Add new IDE support to the table
|
|
181
|
+
- Update feature lists
|
|
182
|
+
- Include troubleshooting for new scenarios
|
|
183
|
+
|
|
184
|
+
### Code Comments
|
|
185
|
+
- Document complex logic
|
|
186
|
+
- Explain IDE-specific quirks
|
|
187
|
+
- Add TODO comments for future improvements
|
|
188
|
+
|
|
189
|
+
## ๐ Internationalization
|
|
190
|
+
|
|
191
|
+
We welcome contributions to translate the installer messages:
|
|
192
|
+
|
|
193
|
+
1. **Add language files** in `locales/` directory
|
|
194
|
+
2. **Use i18n library** for message formatting
|
|
195
|
+
3. **Test with different system locales**
|
|
196
|
+
|
|
197
|
+
## โ๏ธ License
|
|
198
|
+
|
|
199
|
+
By contributing, you agree that your contributions will be licensed under the MIT License.
|
|
200
|
+
|
|
201
|
+
## ๐ Getting Help
|
|
202
|
+
|
|
203
|
+
- **GitHub Issues**: https://github.com/i18n-agent/mcp-client/issues
|
|
204
|
+
- **Discord**: [Join our community](https://discord.gg/i18nagent)
|
|
205
|
+
- **Email**: support@i18nagent.ai
|
|
206
|
+
|
|
207
|
+
## ๐ Recognition
|
|
208
|
+
|
|
209
|
+
Contributors will be:
|
|
210
|
+
- Listed in the README
|
|
211
|
+
- Mentioned in release notes
|
|
212
|
+
- Invited to our contributors Discord channel
|
|
213
|
+
|
|
214
|
+
Thank you for helping make i18n-agent better for everyone! ๐
|
|
215
|
+
|
|
216
|
+
---
|
|
217
|
+
|
|
218
|
+
Made with โค๏ธ by the i18n-agent community
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 FatCouple Oร
|
|
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,264 @@
|
|
|
1
|
+
# ๐ i18n-agent MCP Client
|
|
2
|
+
|
|
3
|
+
Professional translation service client for Claude, Cursor, VS Code, and other AI IDEs using the Model Context Protocol (MCP).
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@i18n-agent/mcp-client)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
## โจ Features
|
|
9
|
+
|
|
10
|
+
- **๐ฏ Smart Translation**: Context-aware translations with cultural adaptation
|
|
11
|
+
- **๐ File Translation**: Support for JSON, YAML, CSV, XML, Markdown, and more
|
|
12
|
+
- **๐ฐ Credit Tracking**: Real-time credit balance and word count estimates
|
|
13
|
+
- **๐ 30+ Languages**: Multi-tier language support with quality ratings
|
|
14
|
+
- **๐ง Easy Setup**: One-command installation for major AI IDEs
|
|
15
|
+
|
|
16
|
+
## ๐ Quick Installation
|
|
17
|
+
|
|
18
|
+
Install via npx (recommended):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npx @i18n-agent/mcp-client install
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Or install globally:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npm install -g @i18n-agent/mcp-client
|
|
28
|
+
i18n-agent-install
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## ๐ Setup API Key
|
|
32
|
+
|
|
33
|
+
1. **Get your API key** from [app.i18nagent.ai](https://app.i18nagent.ai)
|
|
34
|
+
|
|
35
|
+
2. **Set environment variable**:
|
|
36
|
+
```bash
|
|
37
|
+
export API_KEY=your-api-key-here
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
3. **Make it permanent** (add to ~/.bashrc or ~/.zshrc):
|
|
41
|
+
```bash
|
|
42
|
+
echo 'export API_KEY=your-api-key-here' >> ~/.zshrc
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
4. **Restart your AI IDE** to load the new configuration
|
|
46
|
+
|
|
47
|
+
## ๐ฎ Usage Examples
|
|
48
|
+
|
|
49
|
+
### Text Translation
|
|
50
|
+
```
|
|
51
|
+
Translate "Hello, how are you?" to Spanish for a casual audience
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### File Translation
|
|
55
|
+
```
|
|
56
|
+
Translate this JSON file to French, preserving the structure
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Credit Check
|
|
60
|
+
```
|
|
61
|
+
Check my translation credits
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Language Support
|
|
65
|
+
```
|
|
66
|
+
List supported languages with quality ratings
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## ๐ Supported AI IDEs
|
|
70
|
+
|
|
71
|
+
| IDE | Status | Config Location |
|
|
72
|
+
|-----|--------|----------------|
|
|
73
|
+
| **Claude Desktop** | โ
Auto-configured | `~/Library/Application Support/Claude/claude_desktop_config.json` |
|
|
74
|
+
| **Cursor** | โ
Auto-configured | `~/.cursor/mcp_settings.json` |
|
|
75
|
+
| **VS Code** | โ
Auto-configured | `~/.vscode/mcp_settings.json` |
|
|
76
|
+
| **Other MCP IDEs** | ๐ง Manual setup | Varies |
|
|
77
|
+
|
|
78
|
+
## ๐ Language Support
|
|
79
|
+
|
|
80
|
+
### Tier 1 - Production Ready (80-90% Quality)
|
|
81
|
+
- **en**: English
|
|
82
|
+
- **es**: Spanish
|
|
83
|
+
- **fr**: French
|
|
84
|
+
- **de**: German
|
|
85
|
+
- **it**: Italian
|
|
86
|
+
- **pt**: Portuguese
|
|
87
|
+
- **nl**: Dutch
|
|
88
|
+
|
|
89
|
+
### Tier 2 - Production Viable (50-75% Quality)
|
|
90
|
+
- **ru**: Russian
|
|
91
|
+
- **zh-CN**: Chinese (Simplified)
|
|
92
|
+
- **ja**: Japanese
|
|
93
|
+
- **ko**: Korean
|
|
94
|
+
- **ar**: Arabic
|
|
95
|
+
- **he**: Hebrew
|
|
96
|
+
- **hi**: Hindi
|
|
97
|
+
- **pl**: Polish
|
|
98
|
+
- **cs**: Czech
|
|
99
|
+
|
|
100
|
+
### Tier 3 - Basic Support (20-50% Quality)
|
|
101
|
+
- **zh-TW**: Chinese (Traditional)
|
|
102
|
+
- **th**: Thai
|
|
103
|
+
- **vi**: Vietnamese
|
|
104
|
+
- **sv**: Swedish
|
|
105
|
+
- **da**: Danish
|
|
106
|
+
- **no**: Norwegian
|
|
107
|
+
- **fi**: Finnish
|
|
108
|
+
- **tr**: Turkish
|
|
109
|
+
- **hu**: Hungarian
|
|
110
|
+
|
|
111
|
+
## ๐ Supported File Formats
|
|
112
|
+
|
|
113
|
+
| Format | Extension | Features |
|
|
114
|
+
|--------|-----------|----------|
|
|
115
|
+
| JSON | `.json` | Preserves structure, nested objects |
|
|
116
|
+
| YAML | `.yaml`, `.yml` | Maintains formatting, comments |
|
|
117
|
+
| CSV | `.csv` | Handles quoted fields, commas |
|
|
118
|
+
| XML/HTML | `.xml`, `.html` | Extracts text content |
|
|
119
|
+
| Markdown | `.md` | Preserves formatting, skips code |
|
|
120
|
+
| Properties | `.properties` | Key-value pairs |
|
|
121
|
+
| Plain Text | `.txt` | Direct translation |
|
|
122
|
+
|
|
123
|
+
## ๐ง Manual Setup
|
|
124
|
+
|
|
125
|
+
If auto-installation fails, you can manually configure your IDE:
|
|
126
|
+
|
|
127
|
+
### Claude Desktop
|
|
128
|
+
Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"mcpServers": {
|
|
133
|
+
"i18n-agent": {
|
|
134
|
+
"command": "node",
|
|
135
|
+
"args": ["/path/to/mcp-client.js"],
|
|
136
|
+
"env": {
|
|
137
|
+
"MCP_SERVER_URL": "https://mcp.i18nagent.ai",
|
|
138
|
+
"API_KEY": "your-api-key-here"
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
### Cursor / VS Code
|
|
146
|
+
Create `.cursor/mcp_settings.json` or `.vscode/mcp_settings.json`:
|
|
147
|
+
|
|
148
|
+
```json
|
|
149
|
+
{
|
|
150
|
+
"mcpServers": {
|
|
151
|
+
"i18n-agent": {
|
|
152
|
+
"command": "node",
|
|
153
|
+
"args": ["/path/to/mcp-client.js"],
|
|
154
|
+
"env": {
|
|
155
|
+
"MCP_SERVER_URL": "https://mcp.i18nagent.ai",
|
|
156
|
+
"API_KEY": "your-api-key-here"
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## ๐ก Usage Tips
|
|
164
|
+
|
|
165
|
+
### Translation Context
|
|
166
|
+
- **Target Audience**: Specify "technical", "casual", "formal", or "general"
|
|
167
|
+
- **Industry Context**: Use "technology", "healthcare", "finance", "education"
|
|
168
|
+
- **Regional Variations**: Add regions like "Spain", "Mexico", "Brazil"
|
|
169
|
+
|
|
170
|
+
### File Translation
|
|
171
|
+
- **Preserve Structure**: Keeps original file format and structure
|
|
172
|
+
- **Output Format**: Convert between formats (JSON โ YAML โ CSV)
|
|
173
|
+
- **Large Files**: Automatically chunks large files for processing
|
|
174
|
+
|
|
175
|
+
### Credit Management
|
|
176
|
+
- **Cost**: 0.001 credits per word
|
|
177
|
+
- **Monitoring**: Check balance before large translations
|
|
178
|
+
- **Estimates**: Get word count estimates before translation
|
|
179
|
+
|
|
180
|
+
## ๐จ Troubleshooting
|
|
181
|
+
|
|
182
|
+
### Installation Issues
|
|
183
|
+
|
|
184
|
+
**Permission denied:**
|
|
185
|
+
```bash
|
|
186
|
+
sudo npm install -g @i18n-agent/mcp-client
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
**IDE not detected:**
|
|
190
|
+
```bash
|
|
191
|
+
# Check if IDE directory exists
|
|
192
|
+
ls ~/Library/Application\ Support/Claude/
|
|
193
|
+
ls ~/.cursor/
|
|
194
|
+
ls ~/.vscode/
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Runtime Issues
|
|
198
|
+
|
|
199
|
+
**API Key not found:**
|
|
200
|
+
```bash
|
|
201
|
+
echo $API_KEY # Should show your key
|
|
202
|
+
export API_KEY=your-key-here
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
**Connection errors:**
|
|
206
|
+
- Check your internet connection
|
|
207
|
+
- Verify API key is valid
|
|
208
|
+
- Try again after a few seconds
|
|
209
|
+
|
|
210
|
+
**Translation quality:**
|
|
211
|
+
- Use Tier 1 languages for production
|
|
212
|
+
- Add context with industry/audience parameters
|
|
213
|
+
- Review Tier 2/3 translations manually
|
|
214
|
+
|
|
215
|
+
## ๐ Pricing
|
|
216
|
+
|
|
217
|
+
- **Pay-per-use**: 0.001 credits per word
|
|
218
|
+
- **No subscriptions**: Only pay for what you translate
|
|
219
|
+
- **Bulk discounts**: Available for enterprise usage
|
|
220
|
+
- **Free tier**: New accounts get starter credits
|
|
221
|
+
|
|
222
|
+
## ๐ Privacy & Security
|
|
223
|
+
|
|
224
|
+
- **No data storage**: Translations are processed in real-time
|
|
225
|
+
- **Encrypted transport**: All data sent over HTTPS
|
|
226
|
+
- **API key security**: Keys are stored locally, never transmitted in logs
|
|
227
|
+
- **GDPR compliant**: EU privacy standards
|
|
228
|
+
|
|
229
|
+
## ๐ค Contributing
|
|
230
|
+
|
|
231
|
+
We welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md).
|
|
232
|
+
|
|
233
|
+
### Development Setup
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
git clone https://github.com/i18n-agent/mcp-client.git
|
|
237
|
+
cd mcp-client
|
|
238
|
+
npm install
|
|
239
|
+
npm test
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
## ๐ License
|
|
243
|
+
|
|
244
|
+
MIT License - see [LICENSE](LICENSE) file for details.
|
|
245
|
+
|
|
246
|
+
Copyright (c) 2025 FatCouple Oร
|
|
247
|
+
|
|
248
|
+
## ๐ Links
|
|
249
|
+
|
|
250
|
+
- **Website**: [i18nagent.ai](https://i18nagent.ai)
|
|
251
|
+
- **Dashboard**: [app.i18nagent.ai](https://app.i18nagent.ai)
|
|
252
|
+
- **Documentation**: [docs.i18nagent.ai](https://docs.i18nagent.ai)
|
|
253
|
+
- **GitHub**: [github.com/i18n-agent/mcp-client](https://github.com/i18n-agent/mcp-client)
|
|
254
|
+
- **Issues**: [github.com/i18n-agent/mcp-client/issues](https://github.com/i18n-agent/mcp-client/issues)
|
|
255
|
+
|
|
256
|
+
## ๐ Support
|
|
257
|
+
|
|
258
|
+
- **Discord**: [Join our community](https://discord.gg/i18nagent)
|
|
259
|
+
- **Email**: support@i18nagent.ai
|
|
260
|
+
- **Documentation**: [docs.i18nagent.ai](https://docs.i18nagent.ai)
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
Made with โค๏ธ by [FatCouple Oร](https://fireinbelly.com)
|
package/install.js
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* i18n-agent MCP Client Installer
|
|
5
|
+
* Installs the MCP client to work with Claude, Cursor, VS Code and other AI IDEs
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import fs from 'fs';
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import os from 'os';
|
|
11
|
+
import { fileURLToPath } from 'url';
|
|
12
|
+
|
|
13
|
+
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
14
|
+
|
|
15
|
+
// Supported IDE configurations
|
|
16
|
+
const IDE_CONFIGS = {
|
|
17
|
+
claude: {
|
|
18
|
+
name: 'Claude Desktop',
|
|
19
|
+
configPath: path.join(os.homedir(), 'Library/Application Support/Claude/claude_desktop_config.json'),
|
|
20
|
+
displayPath: '~/Library/Application Support/Claude/claude_desktop_config.json'
|
|
21
|
+
},
|
|
22
|
+
cursor: {
|
|
23
|
+
name: 'Cursor',
|
|
24
|
+
configPath: path.join(os.homedir(), '.cursor/mcp_settings.json'),
|
|
25
|
+
displayPath: '~/.cursor/mcp_settings.json'
|
|
26
|
+
},
|
|
27
|
+
vscode: {
|
|
28
|
+
name: 'VS Code (with MCP extension)',
|
|
29
|
+
configPath: path.join(os.homedir(), '.vscode/mcp_settings.json'),
|
|
30
|
+
displayPath: '~/.vscode/mcp_settings.json'
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
console.log(`
|
|
35
|
+
๐ i18n-agent MCP Client Installer
|
|
36
|
+
===================================
|
|
37
|
+
|
|
38
|
+
This installer will set up the i18n-agent MCP client for your AI IDE.
|
|
39
|
+
|
|
40
|
+
Features:
|
|
41
|
+
โจ Text translation with cultural context
|
|
42
|
+
๐ File translation (JSON, YAML, CSV, MD, etc.)
|
|
43
|
+
๐ฐ Credit balance checking
|
|
44
|
+
๐ 30+ language support with quality tiers
|
|
45
|
+
`);
|
|
46
|
+
|
|
47
|
+
async function detectAvailableIDEs() {
|
|
48
|
+
const available = [];
|
|
49
|
+
|
|
50
|
+
for (const [key, config] of Object.entries(IDE_CONFIGS)) {
|
|
51
|
+
const configDir = path.dirname(config.configPath);
|
|
52
|
+
if (fs.existsSync(configDir)) {
|
|
53
|
+
available.push({ key, ...config });
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return available;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function createMCPConfig() {
|
|
61
|
+
const mcpClientPath = path.resolve(__dirname, 'mcp-client.js');
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
mcpServers: {
|
|
65
|
+
"i18n-agent": {
|
|
66
|
+
command: "node",
|
|
67
|
+
args: [mcpClientPath],
|
|
68
|
+
env: {
|
|
69
|
+
MCP_SERVER_URL: "https://mcp.i18nagent.ai",
|
|
70
|
+
API_KEY: ""
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function updateClaudeConfig(configPath) {
|
|
78
|
+
let config = {};
|
|
79
|
+
|
|
80
|
+
// Read existing config if it exists
|
|
81
|
+
if (fs.existsSync(configPath)) {
|
|
82
|
+
try {
|
|
83
|
+
const content = fs.readFileSync(configPath, 'utf8');
|
|
84
|
+
config = JSON.parse(content);
|
|
85
|
+
} catch (error) {
|
|
86
|
+
console.warn(`Warning: Could not parse existing config at ${configPath}`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Ensure mcpServers exists
|
|
91
|
+
if (!config.mcpServers) {
|
|
92
|
+
config.mcpServers = {};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Add i18n-agent configuration
|
|
96
|
+
const mcpClientPath = path.resolve(__dirname, 'mcp-client.js');
|
|
97
|
+
config.mcpServers["i18n-agent"] = {
|
|
98
|
+
command: "node",
|
|
99
|
+
args: [mcpClientPath],
|
|
100
|
+
env: {
|
|
101
|
+
MCP_SERVER_URL: "https://mcp.i18nagent.ai",
|
|
102
|
+
API_KEY: ""
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
// Write updated config
|
|
107
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
108
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
109
|
+
|
|
110
|
+
return config;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function updateGenericMCPConfig(configPath) {
|
|
114
|
+
const config = createMCPConfig();
|
|
115
|
+
|
|
116
|
+
// Write config
|
|
117
|
+
fs.mkdirSync(path.dirname(configPath), { recursive: true });
|
|
118
|
+
fs.writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
119
|
+
|
|
120
|
+
return config;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
async function main() {
|
|
124
|
+
try {
|
|
125
|
+
console.log('๐ Detecting available AI IDEs...\n');
|
|
126
|
+
|
|
127
|
+
const availableIDEs = await detectAvailableIDEs();
|
|
128
|
+
|
|
129
|
+
if (availableIDEs.length === 0) {
|
|
130
|
+
console.log(`โ No supported AI IDEs detected.
|
|
131
|
+
|
|
132
|
+
Supported IDEs:
|
|
133
|
+
- Claude Desktop (macOS)
|
|
134
|
+
- Cursor
|
|
135
|
+
- VS Code (with MCP extension)
|
|
136
|
+
|
|
137
|
+
Manual setup:
|
|
138
|
+
1. Create the configuration file for your IDE
|
|
139
|
+
2. Add the i18n-agent MCP server configuration
|
|
140
|
+
3. Set your API_KEY environment variable
|
|
141
|
+
|
|
142
|
+
For manual setup instructions, visit: https://docs.i18nagent.ai/setup
|
|
143
|
+
`);
|
|
144
|
+
process.exit(1);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
console.log('โ
Available AI IDEs:');
|
|
148
|
+
availableIDEs.forEach((ide, index) => {
|
|
149
|
+
console.log(`${index + 1}. ${ide.name}`);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
console.log('\n๐ Installing for all available IDEs...\n');
|
|
153
|
+
|
|
154
|
+
let installCount = 0;
|
|
155
|
+
|
|
156
|
+
for (const ide of availableIDEs) {
|
|
157
|
+
try {
|
|
158
|
+
console.log(`โ๏ธ Configuring ${ide.name}...`);
|
|
159
|
+
|
|
160
|
+
if (ide.key === 'claude') {
|
|
161
|
+
updateClaudeConfig(ide.configPath);
|
|
162
|
+
} else {
|
|
163
|
+
updateGenericMCPConfig(ide.configPath);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
console.log(`โ
${ide.name} configured successfully!`);
|
|
167
|
+
console.log(` Config: ${ide.displayPath}\n`);
|
|
168
|
+
installCount++;
|
|
169
|
+
|
|
170
|
+
} catch (error) {
|
|
171
|
+
console.error(`โ Failed to configure ${ide.name}: ${error.message}\n`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
if (installCount > 0) {
|
|
176
|
+
console.log(`๐ Installation complete! Configured ${installCount} IDE(s).
|
|
177
|
+
|
|
178
|
+
๐ Important: Set your API key
|
|
179
|
+
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
180
|
+
You need to set your API key to use the translation service:
|
|
181
|
+
|
|
182
|
+
1. Get your API key from: https://app.i18nagent.ai
|
|
183
|
+
2. Set it as an environment variable:
|
|
184
|
+
|
|
185
|
+
export API_KEY=your-api-key-here
|
|
186
|
+
|
|
187
|
+
Or add it to your shell profile (~/.bashrc, ~/.zshrc):
|
|
188
|
+
echo 'export API_KEY=your-api-key-here' >> ~/.zshrc
|
|
189
|
+
|
|
190
|
+
๐ Restart your IDE
|
|
191
|
+
After setting the API key, restart your AI IDE to load the new configuration.
|
|
192
|
+
|
|
193
|
+
๐งช Test the installation
|
|
194
|
+
Try these commands in your AI IDE:
|
|
195
|
+
- "Translate 'Hello world' to Spanish"
|
|
196
|
+
- "Check my translation credits"
|
|
197
|
+
- "List supported languages"
|
|
198
|
+
|
|
199
|
+
๐ Documentation: https://docs.i18nagent.ai
|
|
200
|
+
๐ Issues: https://github.com/i18n-agent/mcp-client/issues
|
|
201
|
+
`);
|
|
202
|
+
} else {
|
|
203
|
+
console.error('โ Installation failed for all IDEs. Please check the error messages above.');
|
|
204
|
+
process.exit(1);
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
} catch (error) {
|
|
208
|
+
console.error(`โ Installation failed: ${error.message}`);
|
|
209
|
+
process.exit(1);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// Handle command line execution
|
|
214
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
215
|
+
main();
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export { main, IDE_CONFIGS, createMCPConfig };
|