ModelScope MCP Server
Project description
ModelScope MCP Server
A Model Context Protocol (MCP) server that integrates with ModelScope's ecosystem, providing seamless access to AI models, datasets, apps, papers, and generation capabilities through popular MCP clients.
✨ Features
- 🔐 User Authentication - Retrieve information about the currently authenticated ModelScope user
- 🎨 AI Image Generation - Generate images from text prompts using any AIGC model available on ModelScope
- 📚 Research Paper Search - Search for arXiv papers indexed in ModelScope with comprehensive metadata
- 🔍 Resource Discovery (Coming Soon) - Search for models, datasets, studios and other resources on ModelScope
- 📖 Documentation Search (Coming Soon) - Semantic search for ModelScope documentation and articles
- 🚀 Gradio API Integration (Coming Soon) - Invoke Gradio APIs exposed by any pre-configured ModelScope studio
🚀 Quick Start
1. Get Your API Token
- Visit ModelScope and sign in to your account
- Navigate to [Home] → [Access Tokens] to retrieve your default API token or create a new one
📖 For detailed instructions, refer to the ModelScope Token Documentation
2. Integration with MCP Clients
Add the following JSON configuration to your MCP client's configuration file:
{
"mcpServers": {
"modelscope-mcp-server": {
"command": "uvx",
"args": ["modelscope-mcp-server"],
"env": {
"MODELSCOPE_API_TOKEN": "your-api-token"
}
}
}
}
Or, you can use the pre-built Docker image:
{
"mcpServers": {
"modelscope-mcp-server": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"-e", "MODELSCOPE_API_TOKEN",
"spadrian/modelscope-mcp-server:latest"
],
"env": {
"MODELSCOPE_API_TOKEN": "your-api-token"
}
}
}
}
Refer to the MCP JSON Configuration Standard for more details.
This format is widely adopted across the MCP ecosystem:
- Cherry Studio: See Cherry Studio MCP Configuration
- Claude Desktop: Uses
~/.claude/claude_desktop_config.json - Cursor: Uses
~/.cursor/mcp.json - VS Code: Uses workspace
.vscode/mcp.json - Other clients: Many MCP-compatible applications follow this standard
🛠️ Development
Environment Setup
-
Clone and Setup:
git clone https://github.com/modelscope/modelscope-mcp-server.git cd modelscope-mcp-server uv sync
-
Activate Environment:
source .venv/bin/activate # Linux/macOS # or via your IDE
-
Set Your API Token Environment Variable:
export MODELSCOPE_API_TOKEN="your-api-token"
Or, you can set the API token in the
.envfile (under the project root) for convenience:MODELSCOPE_API_TOKEN="your-api-token"
Running the Demo Script
Run a quick demo to explore the server's capabilities:
uv run python demo.py
Use the --full flag to demonstrate all available features:
uv run python demo.py --full
Running the Server Locally
# Standard stdio transport (default)
uv run modelscope-mcp-server
# Streamable HTTP transport for web integration
uv run modelscope-mcp-server --transport http
# HTTP/SSE transport with custom port (default: 8000)
uv run modelscope-mcp-server --transport [http/sse] --port 8080
For HTTP/SSE mode, connect using a local URL in your MCP client configuration:
{
"mcpServers": {
"modelscope-mcp-server": {
"url": "http://127.0.0.1:8000/mcp/"
}
}
}
You can also debug the server using the MCP Inspector tool:
npx @modelcontextprotocol/inspector uv run modelscope-mcp-server
The above command uses stdio transport by default; you can switch to HTTP or SSE in the Web UI as needed.
Testing
Run the complete test suite:
# Basic test run
uv run pytest
# Run tests for a specific file
uv run pytest tests/test_search_papers.py
# With coverage report
uv run pytest --cov=src --cov=examples --cov-report=html
Code Quality
This project uses pre-commit hooks for automated code formatting, linting, and type checking:
# Install hooks
uv run pre-commit install
# Run all checks manually
uv run pre-commit run --all-files
All PRs must pass these checks and include appropriate tests.
📦 Release Management
TODO: trigger release from GitHub Actions
Release to PyPI
python scripts/pypi_release.py
Release to Docker Hub
docker login
# Release to Docker Hub (will auto-detect buildx or use traditional build)
python scripts/docker_release.py
# Release to Docker Hub (use traditional multi-arch build with manifest)
python scripts/docker_release.py --traditional-multiarch
🤝 Contributing
We welcome contributions! Please ensure that:
- All PRs include relevant tests and pass the full test suite
- Code follows our style guidelines (enforced by pre-commit hooks)
- Documentation is updated for new features
- Commit messages follow conventional commit format
📚 References
- Model Context Protocol - Official MCP documentation
- FastMCP v2 - High-performance MCP framework
- MCP Example Servers - Community server examples
📜 License
This project is licensed under the Apache License (Version 2.0).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modelscope_mcp_server-0.1.3.tar.gz.
File metadata
- Download URL: modelscope_mcp_server-0.1.3.tar.gz
- Upload date:
- Size: 71.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4519e1361632515ac1a7bd89142ec3bc0dcd4238a341b8634b6c2534a9eff301
|
|
| MD5 |
765bde07138567169c2105a00f9ab45f
|
|
| BLAKE2b-256 |
43fc07b3dfca9a4c37926b1f8a63bbd7c36b4003f32cf82f420a6f2b5e9df281
|
File details
Details for the file modelscope_mcp_server-0.1.3-py3-none-any.whl.
File metadata
- Download URL: modelscope_mcp_server-0.1.3-py3-none-any.whl
- Upload date:
- Size: 23.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4b5353d1334510ae53783941fe51aef35afdf01782c59c4a770324e7bab586c1
|
|
| MD5 |
792290ef45a5e2a0ed4b3a9e5a5a0bb8
|
|
| BLAKE2b-256 |
fae93e3c64df533becf66854f3fc02d32c9cb361bd890be5d0f8f5d29d2311fe
|