mcpio
v0.1.7
Published
MCPIO - CLI tool for MCP (for both local and remote MCPs)
Downloads
6
Maintainers
Readme
MCPIO
MCPIO is a CLI tool for MCP (Model Control Protocol), supporting both local and remote MCPs.
Installation
# Install globally
npm install -g mcpio
# Or install locally in a project
npm install mcpioCLI Usage
# View help
mcpio --help
# Install a package
mcpio install package-name
mcpio i package-name
# Install a specific version as dev dependency
mcpio install package-name -v 1.0.0 -d
# Uninstall a package
mcpio uninstall package-name
mcpio un package-name
# List installed packages
mcpio list
mcpio ls
# Run a local MCP
mcpio local run ./path/to/mcp -p 3000 -d -e NODE_ENV=development
# Stop a local MCP
mcpio local stop ./path/to/mcp
# Connect to a remote MCP
mcpio remote connect https://example.com/mcp -k your-api-key -t 5000
# Disconnect from a remote MCP
mcpio remote disconnect https://example.com/mcp
# Send a request to a remote MCP
mcpio remote request https://example.com/mcp /api/models -m POST -b '{"name":"model-name"}'Programmatic Usage
import { MCPIO } from 'mcpio';
// Initialize MCPIO
const mcpio = new MCPIO();
// Example: Install a package
mcpio.install('package-name')
.then(() => console.log('Package installed successfully!'))
.catch(err => console.error('Error installing package:', err));
// Example: Use a local MCP
const localMcp = mcpio.local('path/to/local/mcp');
await localMcp.run();
// Example: Connect to a remote MCP
const remoteMcp = mcpio.remote('https://example.com/mcp-endpoint');
await remoteMcp.connect();Features
- CLI interface for easy management of MCPs
- Manage MCP packages easily
- Support for both local and remote MCPs
- TypeScript support
- Simple, intuitive API
Developer Guide
Publishing to npm
This package includes a custom publish script that helps with versioning and publishing to npm.
# Run the npm publish script
npm run publish:npmThe script will:
- Validate your package.json
- Check git status and branch
- Prompt you to bump the version (patch, minor, major, etc.)
- Build the package
- Run tests
- Publish to npm with your chosen settings
Requirements for publishing
- You must be logged in to npm (
npm login) - Make sure all package.json fields are properly filled out
- Ensure the bin field correctly points to the CLI entry point
API Reference
MCPIO Class
The main class for interacting with MCPIO.
Methods
install(packageName: string, options?: InstallOptions): Promise<void>uninstall(packageName: string): Promise<void>list(): Promise<Package[]>local(path: string): LocalMCPremote(url: string): RemoteMCP
LocalMCP Class
For working with local MCPs.
Methods
run(options?: RunOptions): Promise<void>stop(): Promise<void>
RemoteMCP Class
For working with remote MCPs.
Methods
connect(options?: ConnectOptions): Promise<void>disconnect(): Promise<void>request<T>(endpoint: string, method?: string, body?: any): Promise<T>
License
MIT
