HTTP Server API Referenceο
Complete reference for RMCP HTTP server endpoints and statistical tools.
π Live Server: https://rmcp-server-394229601724.us-central1.run.app
π Interactive Docs: https://rmcp-server-394229601724.us-central1.run.app/docs
Core Endpointsο
Root Endpointο
MCP Protocol Endpointο
Server-Sent Eventsο
Health Checkο
Session Managementο
All MCP communication requires session initialization and proper header management.
Initialize Sessionο
Request:
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": {
"name": "my-client",
"version": "1.0"
}
}
}
Response:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"protocolVersion": "2025-06-18",
"capabilities": {
"tools": {"listChanged": false},
"resources": {"subscribe": true, "listChanged": true},
"prompts": {"listChanged": false},
"logging": {},
"completion": {}
},
"serverInfo": {
"name": "RMCP MCP Server",
"version": "0.7.0"
}
}
}
Response Headers:
- Mcp-Session-Id: <generated-session-id> - Use in subsequent requests
Statistical Analysis Toolsο
List Toolsο
Request:
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list",
"params": {}
}
Response: List of 53 statistical analysis tools across 11 categories.
Call Toolsο
Request:
{
"jsonrpc": "2.0",
"id": 3,
"method": "tools/call",
"params": {
"name": "<tool_name>",
"arguments": { ... }
}
}
Response:
{
"jsonrpc": "2.0",
"id": 3,
"result": {
"content": [
{
"type": "text",
"text": "Statistical analysis results..."
},
{
"type": "image",
"data": "base64-encoded-image",
"mimeType": "image/png"
}
]
}
}
Regression Analysis Toolsο
linear_modelο
Linear and logistic regression analysis with comprehensive diagnostics.
Arguments:
Parameter |
Type |
Description |
|---|---|---|
|
string |
R formula (e.g., βy ~ x1 + x2β) |
|
string |
Data in CSV format or array |
|
string |
Data format: βcsvβ, βjsonβ, or βarrayβ |
|
string |
βgaussianβ (linear) or βbinomialβ (logistic) |
|
boolean |
Generate diagnostic plots (default: true) |
Example:
{
"name": "linear_model",
"arguments": {
"formula": "sales ~ marketing + season",
"data": "sales,marketing,season\n100,5,1\n120,8,2\n115,6,1\n140,10,2",
"format": "csv",
"family": "gaussian"
}
}
Returns: Model summary, coefficients, RΒ², diagnostics, and residual plots.
correlation_analysisο
Correlation matrices with significance testing and confidence intervals.
Arguments:
Example:
{
"name": "correlation_analysis",
"arguments": {
"data": {
"sales": [100, 120, 115, 140],
"marketing": [5, 8, 6, 10],
"satisfaction": [7.5, 8.2, 7.8, 8.9]
},
"format": "json",
"method": "pearson"
}
}
Returns: Correlation matrix, p-values, confidence intervals, and heatmap.
Time Series Analysis Toolsο
time_series_arimaο
ARIMA modeling with automatic order selection and forecasting.
Arguments:
Example:
{
"name": "time_series_arima",
"arguments": {
"data": [100, 105, 110, 108, 115, 120, 125, 130, 128, 135],
"variable_name": "monthly_sales",
"forecast_periods": 3,
"auto_arima": true
}
}
Returns: ARIMA model summary, forecasts with confidence intervals, and diagnostic plots.
Statistical Testing Toolsο
t_testο
One-sample, two-sample, and paired t-tests with effect sizes.
Arguments:
Example:
{
"name": "t_test",
"arguments": {
"data1": [23, 25, 27, 24, 26, 28, 25, 24],
"data2": [20, 22, 24, 21, 23, 25, 22, 21],
"test_type": "two_sample",
"alternative": "two_sided"
}
}
Returns: T-statistic, p-value, confidence interval, and effect size.
Machine Learning Toolsο
kmeans_clusteringο
K-means clustering with optimal cluster selection and visualization.
Arguments:
Parameter |
Type |
Description |
|---|---|---|
|
mixed |
Data matrix in CSV format or arrays |
|
string |
Data format: βcsvβ, βjsonβ, or βarrayβ |
|
number |
Number of clusters (optional - auto-selects) |
|
number |
Maximum clusters to test (default: 10) |
|
boolean |
Generate cluster visualization (default: true) |
Example:
{
"name": "kmeans_clustering",
"arguments": {
"data": "x,y\n1,2\n2,3\n8,9\n9,8\n1,1\n9,9",
"format": "csv",
"k": 2
}
}
Returns: Cluster assignments, centroids, within-cluster sum of squares, and visualization.
Data Analysis Toolsο
descriptive_statsο
Comprehensive descriptive statistics with distribution analysis.
Arguments:
Example:
{
"name": "descriptive_stats",
"arguments": {
"data": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
"variable_name": "test_scores",
"include_plots": true
}
}
Returns: Mean, median, standard deviation, quartiles, skewness, kurtosis, and plots.
Visualization Toolsο
scatter_plotο
Professional scatter plots with trend lines and statistical annotations.
Arguments:
Parameter |
Type |
Description |
|---|---|---|
|
array |
X-axis values |
|
array |
Y-axis values |
|
string |
X-axis label |
|
string |
Y-axis label |
|
boolean |
Add linear trend line (default: true) |
|
boolean |
Add confidence bands (default: true) |
|
array |
Optional grouping variable |
Example:
{
"name": "scatter_plot",
"arguments": {
"x": [1, 2, 3, 4, 5],
"y": [2, 4, 6, 8, 10],
"x_name": "Marketing Spend",
"y_name": "Sales Revenue",
"add_trend_line": true
}
}
Returns: Professional scatter plot with correlation statistics.
Error Handlingο
JSON-RPC 2.0 Error Codesο
Standard JSON-RPC error responses:
Code |
Description |
|---|---|
|
Parse error - Invalid JSON |
|
Invalid Request - JSON-RPC format error |
|
Method not found - Unknown method |
|
Invalid params - Parameter validation error |
|
Internal error - Server processing error |
HTTP Error Codesο
HTTP-specific errors:
Code |
Description |
|---|---|
|
Bad Request - Missing headers/invalid format |
|
Method Not Allowed - Wrong HTTP method |
|
Internal Server Error - Unexpected error |
Example Error Responseο
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32603,
"message": "400: Session not initialized. Send initialize request first.",
"data": {"type": "HTTPException"}
}
}
Rate Limitingο
The server implements reasonable rate limiting for stability:
Concurrent Sessions: 100 active sessions
Request Rate: 60 requests per minute per session
Tool Execution: 10 concurrent tool executions per session
Exceeding limits returns HTTP 429 (Too Many Requests).
Securityο
Protocol Security: - MCP protocol version validation - Session-based access control - Request origin validation
Data Security: - R code execution in sandboxed environment - File system access restrictions - Package installation approval system
Transport Security: - HTTPS encryption for data in transit - CORS policy for browser access - Standard HTTP security headers
Best Practicesο
Client Implementationο
Session Management: Always initialize sessions and handle session IDs properly
Error Handling: Implement robust error handling for network and protocol errors
Timeout Handling: Set appropriate timeouts for long-running statistical operations
Connection Pooling: Reuse HTTP connections for better performance
Data Formatsο
CSV Format: Best for tabular data with headers
JSON Format: Best for structured data with mixed types
Array Format: Best for simple numeric vectors
Performance Tipsο
Batch Operations: Group related analysis calls when possible
Data Size: Keep datasets reasonable (<10MB) for optimal performance
Visualization: Disable plots for large batch operations if not needed
SSE Monitoring: Use Server-Sent Events for long-running operations
Integration Examplesο
See HTTP Server Getting Started Guide for complete client implementation examples in:
Python with
requestslibraryJavaScript with
fetchAPIcurl command-line examples
π Additional Resources:
Interactive API Explorer: https://rmcp-server-394229601724.us-central1.run.app/docs
ReDoc Documentation: https://rmcp-server-394229601724.us-central1.run.app/redoc
GitHub Repository: https://github.com/finite-sample/rmcp
Python Package Docs: Quick Start Guide