Skip to content

Commit f906938

Browse files
feat: Add display_name support and enhance test suite
## Test Suite Enhancements (test_mcp_providers.go) - Add `display_name` config option for provider aliasing - Implement GetDisplayName() helper method - Add TTFT (Time To First Token) tracking - Add OAuth authentication support - Add concurrent model testing with configurable limits - Improve table formatting for long model names - Simplify error display with clean table format - Remove code preview and file path clutter - Change default config path to ~/.mcp-code-api/config.yaml ## OAuth & Validation - Add OAuth PKCE flow support - Add OAuth defaults and callback handling - Add code validation for Go, Python, JavaScript - Add language detection and validation framework ## Documentation - Add comprehensive test results documentation - Update README with latest features - Update contributing guidelines - Update security and support docs ## Configuration - Remove deprecated remove.go command - Update config examples with new options - Enhance interactive wizard with better prompts 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 67dc21b commit f906938

32 files changed

+3051
-754
lines changed

.github/secret_scanning.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Secret scanning configuration
2+
# These are public OAuth client credentials for desktop/CLI applications
3+
# following the OAuth 2.0 "installed application" pattern.
4+
# See: https://developers.google.com/identity/protocols/oauth2#installed
5+
6+
paths-ignore:
7+
- 'internal/oauth/defaults.go' # Contains public OAuth client credentials for desktop apps

CONTRIBUTING.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# Contributing to Cerebras MCP
1+
# Contributing to MCP Code API
22

3-
Thank you for your interest in contributing to the Cerebras MCP (Model Context Protocol) server! We welcome contributions from the community and are excited to collaborate with you.
3+
Thank you for your interest in contributing to the MCP Code API (Model Context Protocol) server! We welcome contributions from the community and are excited to collaborate with you.
44

55
## Getting Help and Support
66

@@ -12,7 +12,7 @@ If you have questions about the MCP server or need help:
1212

1313
## Reporting Issues
1414

15-
If you encounter any bugs or have feature requests, please file them in our [GitHub issues](https://github.com/cerebras/cerebras-code-mcp/issues) with as much detail as possible.
15+
If you encounter any bugs or have feature requests, please file them in our [GitHub issues](https://github.com/cecil-the-coder/mcp-code-api/issues) with as much detail as possible.
1616

1717
When reporting a bug, please include:
1818
- A clear description of the issue
@@ -34,8 +34,8 @@ When reporting a bug, please include:
3434

3535
1. Clone the repository:
3636
```bash
37-
git clone https://github.com/cerebras/cerebras-code-mcp.git
38-
cd cerebras-code-mcp
37+
git clone https://github.com/cecil-the-coder/mcp-code-api.git
38+
cd mcp-code-api
3939
```
4040

4141
2. Install dependencies:
@@ -65,12 +65,7 @@ When reporting a bug, please include:
6565
node src/index.js --config
6666
```
6767

68-
3. **Test the removal wizard:**
69-
```bash
70-
node src/index.js --remove
71-
```
72-
73-
4. **Test with different IDEs:**
68+
3. **Test with different IDEs:**
7469
```bash
7570
CEREBRAS_MCP_IDE=cursor CEREBRAS_API_KEY=your_key node src/index.js
7671
```
@@ -125,7 +120,7 @@ The project follows these standards:
125120
- `src/index.js`: Main entry point and CLI handler
126121
- `src/server/mcp-server.js`: Core MCP server implementation
127122
- `src/server/tool-handlers.js`: Tool implementation (write tool)
128-
- `src/config/interactive-config.js`: Setup and removal wizards
123+
- `src/config/interactive-config.js`: Setup wizard
129124
- `src/config/constants.js`: Configuration constants and paths
130125
- `src/formatting/`: Response formatting for different IDEs
131126
- `src/api/`: API clients for Cerebras and OpenRouter

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Go parameters
44
GOCMD=go
5-
GOBUILD=$(GOCMD) build
5+
GOBUILD=GOAMD64=v1 $(GOCMD) build
66
GOCLEAN=$(GOCMD) clean
77
GOTEST=$(GOCMD) test
88
GOGET=$(GOCMD) get
@@ -47,7 +47,7 @@ run:
4747

4848
# Cross-compilation
4949
linux:
50-
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_UNIX) -v .
50+
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 GOAMD64=v1 $(GOCMD) build -o $(BINARY_UNIX) -v .
5151

5252
# Code quality
5353
lint:

README.md

Lines changed: 146 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ The Go implementation offers significant advantages over the Node.js version:
2727
- 📁 **Context-Aware Processing** with multiple file support
2828
- 💻 **Multi-IDE Support** - Claude Code, Cursor, Cline, VS Code
2929
- ⚙️ **Interactive Configuration Wizard** for easy setup
30-
- 🧹 **Cleanup Wizard** for complete removal
3130
- 📝 **Comprehensive Logging** with debug support
3231

3332
## 📋 System Requirements
@@ -89,7 +88,7 @@ export CEREBRAS_API_KEY="your_cerebras_api_key"
8988
export OPENROUTER_API_KEY="your_openrouter_api_key"
9089

9190
# Set model preferences (optional)
92-
export CEREBRAS_MODEL="qwen-3-coder-480b"
91+
export CEREBRAS_MODEL="zai-glm-4.6"
9392
export OPENROUTER_MODEL="qwen/qwen3-coder"
9493
```
9594

@@ -181,20 +180,6 @@ The Go implementation includes an enhanced auto-instruction system that:
181180
- Provides clear instructions to AI models
182181
- Ensures consistent behavior across all IDEs
183182

184-
## 🧹 Cleanup
185-
186-
To remove all configurations:
187-
188-
```bash
189-
mcp-code-api remove
190-
```
191-
192-
The cleanup wizard will:
193-
- Scan for existing configurations
194-
- Remove IDE-specific files
195-
- Clean up MCP server settings
196-
- Verify completion
197-
198183
## 🏗️ Development
199184

200185
### Building
@@ -249,8 +234,7 @@ mcp-code-api/
249234
├── 📁 cmd/ # CLI commands
250235
│ ├── 📜 root.go # Root command
251236
│ ├── 📜 server.go # Server command
252-
│ ├── 📜 config.go # Configuration command
253-
│ └── 📜 remove.go # Removal command
237+
│ └── 📜 config.go # Configuration command
254238
├── 📁 internal/ # Internal packages
255239
│ ├── 📁 api/ # API integrations
256240
│ │ ├── 📜 router.go # API router
@@ -282,8 +266,8 @@ mcp-code-api/
282266
```bash
283267
# Cerebras Configuration
284268
CEREBRAS_API_KEY=your_key
285-
CEREBRAS_MODEL=qwen-3-coder-480b
286-
CEREBRAS_TEMPERATURE=0.1
269+
CEREBRAS_MODEL=zai-glm-4.6
270+
CEREBRAS_TEMPERATURE=0.6
287271
CEREBRAS_MAX_TOKENS=4096
288272

289273
# OpenRouter Configuration
@@ -301,13 +285,13 @@ CEREBRAS_MCP_VERBOSE=false
301285

302286
### Configuration File
303287

304-
You can also use a YAML configuration file at `~/.cerebras-mcp.yaml`:
288+
You can also use a YAML configuration file at `~/.mcp-code-api/config.yaml`:
305289

306290
```yaml
307291
cerebras:
308292
api_key: "your_key"
309-
model: "qwen-3-coder-480b"
310-
temperature: 0.1
293+
model: "zai-glm-4.6"
294+
temperature: 0.6
311295
max_tokens: 4096
312296

313297
openrouter:
@@ -337,7 +321,7 @@ providers:
337321
- "${CEREBRAS_API_KEY_1}"
338322
- "${CEREBRAS_API_KEY_2}"
339323
- "${CEREBRAS_API_KEY_3}"
340-
model: "qwen-3-coder-480b"
324+
model: "zai-glm-4.6"
341325

342326
openrouter:
343327
# Single key - backward compatible
@@ -380,6 +364,144 @@ mcp-code-api server
380364

381365
For a complete example configuration, see [config.example.yaml](config.example.yaml).
382366

367+
## 🔌 Using API-Compatible Providers
368+
369+
The server supports **API-compatible providers** - third-party services that implement the same API format as the major providers. This includes:
370+
371+
- **Anthropic-compatible** (e.g., z.ai with GLM-4.6, local proxies)
372+
- **OpenAI-compatible** (e.g., LM Studio, Ollama, LocalAI)
373+
- **Custom self-hosted endpoints**
374+
375+
### Anthropic-Compatible Providers (z.ai)
376+
377+
The MCP Code API supports any provider that implements the Anthropic Messages API format.
378+
379+
#### Configuration File Method
380+
381+
Add to your `~/.mcp-code-api/config.yaml`:
382+
383+
```yaml
384+
providers:
385+
anthropic:
386+
# z.ai's authentication token
387+
api_key: "your-zai-api-key"
388+
# z.ai's Anthropic-compatible endpoint
389+
base_url: "https://api.z.ai/api/anthropic"
390+
# Use Z.ai's GLM-4.6 model (200K context, optimized for coding)
391+
model: "glm-4.6"
392+
393+
enabled:
394+
- anthropic
395+
396+
preferred_order:
397+
- anthropic
398+
```
399+
400+
**Available Z.ai Models:**
401+
- `glm-4.6` - Latest flagship model (200K context, best for coding/reasoning)
402+
- `glm-4.5-air` - Lighter/faster variant for quick tasks
403+
404+
#### Environment Variables Method
405+
406+
```bash
407+
# z.ai example
408+
export ANTHROPIC_AUTH_TOKEN="your-zai-api-key"
409+
export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
410+
411+
# Start the server
412+
./mcp-code-api server
413+
```
414+
415+
**Note**: Both `ANTHROPIC_API_KEY` and `ANTHROPIC_AUTH_TOKEN` environment variables are supported.
416+
417+
#### Multiple Anthropic Providers (Advanced)
418+
419+
If you want to use both standard Anthropic AND a compatible provider:
420+
421+
```yaml
422+
providers:
423+
# Standard Anthropic
424+
anthropic:
425+
api_key: "sk-ant-..."
426+
base_url: "https://api.anthropic.com"
427+
model: "claude-3-5-sonnet-20241022"
428+
429+
# Custom provider: z.ai
430+
custom:
431+
zai:
432+
type: "anthropic"
433+
name: "Z.ai"
434+
api_key: "your-zai-api-key"
435+
base_url: "https://api.z.ai/api/anthropic"
436+
default_model: "glm-4.6"
437+
supports_streaming: true
438+
supports_tool_calling: true
439+
tool_format: "anthropic"
440+
441+
enabled:
442+
- anthropic
443+
- zai
444+
445+
preferred_order:
446+
- zai # Try z.ai first
447+
- anthropic # Fall back to official Anthropic
448+
```
449+
450+
### OpenAI-Compatible Providers (LM Studio, Ollama)
451+
452+
```yaml
453+
providers:
454+
openai:
455+
api_key: "lm-studio" # Can be any value for LM Studio
456+
base_url: "http://localhost:1234/v1"
457+
model: "local-model"
458+
```
459+
460+
Or using environment variables:
461+
462+
```bash
463+
export OPENAI_API_KEY="lm-studio"
464+
export OPENAI_BASE_URL="http://localhost:1234/v1"
465+
```
466+
467+
### Supported Environment Variables
468+
469+
All providers now support custom base URLs via environment variables:
470+
471+
| Provider | API Key Env Var(s) | Base URL Env Var |
472+
|-----------|---------------------------------------|------------------------|
473+
| Anthropic | `ANTHROPIC_API_KEY`, `ANTHROPIC_AUTH_TOKEN` | `ANTHROPIC_BASE_URL` |
474+
| OpenAI | `OPENAI_API_KEY` | `OPENAI_BASE_URL` |
475+
| Gemini | `GEMINI_API_KEY` | `GEMINI_BASE_URL` |
476+
| Qwen | `QWEN_API_KEY` | `QWEN_BASE_URL` |
477+
| Cerebras | `CEREBRAS_API_KEY` | `CEREBRAS_BASE_URL` |
478+
| OpenRouter| `OPENROUTER_API_KEY` | `OPENROUTER_BASE_URL` |
479+
480+
**Examples:**
481+
482+
```bash
483+
# Use an OpenAI-compatible endpoint (like LM Studio)
484+
export OPENAI_API_KEY="lm-studio-key"
485+
export OPENAI_BASE_URL="http://localhost:1234/v1"
486+
487+
# Use a custom Anthropic-compatible endpoint (z.ai)
488+
export ANTHROPIC_AUTH_TOKEN="your-token"
489+
export ANTHROPIC_BASE_URL="https://api.z.ai/api/anthropic"
490+
```
491+
492+
### Troubleshooting
493+
494+
**Authentication fails:**
495+
- Verify your token/API key is correct
496+
- Check if the base URL includes the correct API version path
497+
- Some providers require specific headers - check their documentation
498+
499+
**Different API format:**
500+
If the provider uses a slightly different format, you may need to create a custom provider adapter.
501+
502+
**Rate limiting:**
503+
Some compatible providers have different rate limits than the official APIs. Adjust your usage accordingly.
504+
383505
## 🤝 Contributing
384506

385507
Contributions are welcome! Please see our [Contributing Guide](CONTRIBUTING.md) for details.

SECURITY.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## Reporting Security Issues
44

5-
The Cerebras MCP project takes security seriously. If you discover a security vulnerability in the `cerebras-code-mcp` package, please report it responsibly.
5+
The MCP Code API project takes security seriously. If you discover a security vulnerability in the `mcp-code-api` package, please report it responsibly.
66

77
### How to Report
88

@@ -53,5 +53,5 @@ Security updates are provided for:
5353

5454
Please keep your installation up to date by running:
5555
```bash
56-
npm update -g cerebras-code-mcp
56+
npm update -g mcp-code-api
5757
```

0 commit comments

Comments
 (0)