mcp-rs is a Rust implementation of the Model Context Protocol (MCP), designed to enable AI agents—such as Copilot Studio—to interact with external systems like WordPress via JSON-RPC.
This project aims to provide a type-safe, extensible, and performant MCP server in Rust, with initial support for WordPress REST API integration.
- 🚀 JSON-RPC 2.0 compliant server - Full MCP protocol implementation
- 📝 WordPress integration - Post/comment/media/user operations
- 🤖 Copilot Studio ready - Seamless AI agent integration
- 🔧 Modular architecture - Easy to extend with new protocols
- ⚡ High performance - Built with Rust and Tokio
- 🔒 Type-safe - Comprehensive error handling and validation
- Rust 1.70+
- WordPress site with REST API enabled (optional for testing)
git clone https://github.com/n-takatsu/mcp-rs.git
cd mcp-rs
cargo build --release- Copy the example environment file:
cp .env.example .env- Edit
.envwith your WordPress configuration:
WORDPRESS_URL=https://your-wordpress-site.com
WORDPRESS_USERNAME=your_username
WORDPRESS_PASSWORD=your_passwordMCP_STDIO=1 cargo runcargo runThe server will listen on 127.0.0.1:8080 by default.
cargo run --example wordpress_testThe WordPress handler provides the following tools:
- get_posts - Retrieve WordPress posts
- create_post - Create new WordPress posts
- get_comments - Retrieve WordPress comments
- wordpress://posts - Access to all WordPress posts
- wordpress://comments - Access to all WordPress comments
src/
├── mcp/ # Core MCP protocol implementation
│ ├── types.rs # MCP type definitions
│ ├── server.rs # MCP server implementation
│ └── error.rs # Error handling
├── handlers/ # Protocol handlers
│ └── wordpress.rs # WordPress REST API handler
└── main.rs # Application entry point
- Create a new handler in
src/handlers/:
use async_trait::async_trait;
use crate::mcp::{McpHandler, McpError, Tool, Resource};
pub struct MyHandler {
// Handler fields
}
#[async_trait]
impl McpHandler for MyHandler {
// Implement required methods
}- Register the handler in
main.rs:
let my_handler = MyHandler::new();
server.add_handler("my_handler".to_string(), Box::new(my_handler));Run the test suite:
cargo testRun with logging:
RUST_LOG=debug cargo testTo use this MCP server with Copilot Studio:
- Configure the server to run in stdio mode
- Set up the MCP client configuration in Copilot Studio
- Point to the compiled binary with
MCP_STDIO=1
Example configuration:
{
"mcpServers": {
"wordpress": {
"command": "path/to/mcp-rs",
"env": {
"MCP_STDIO": "1",
"WORDPRESS_URL": "https://your-site.com",
"WORDPRESS_USERNAME": "username",
"WORDPRESS_PASSWORD": "password"
}
}
}
}Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License.
- Additional WordPress operations (media, users, taxonomies)
- Support for other CMS platforms
- WebSocket transport support
- Advanced authentication methods
- Caching layer for improved performance
- Comprehensive test suite
- Documentation improvements