WASImancer Resource API Guide
π§ work in progress
This guide explains how to use WASImancer's REST API to dynamically add, update, and remove resources without restarting the server.
Overview
WASImancer provides REST API endpoints that enable:
- Adding new resources - Upload static or dynamic resource definitions
- Updating existing resources - Modify a resource's properties and contents
- Removing resources - Delete resources that are no longer needed
These operations allow you to manage your MCP server's resources at runtime without service interruption.
Administration authentication
All Administration API endpoints require authentication using a Bearer token. This token is configured when starting the WASImancer server using the WASIMANCER_ADMIN_TOKEN
environment variable:
In all API requests, include this header:
API Endpoints
1. Add a New Resource
Add a new static or dynamic resource to the server.
Endpoint: POST /add-resource
Headers:
- Authorization: Bearer <token>
- Authentication token
- Content-Type: application/json
- Content type
Request Body (Static Resource):
Request Body (Dynamic Resource):
Success Response: - Status Code: 200 - Body:
Error Responses: - Status Code: 400 - Missing or invalid resource data - Status Code: 403 - Invalid authentication token - Status Code: 500 - Server error
cURL Example (Static Resource):
cURL Example (Dynamic Resource):
2. Update an Existing Resource
Update the properties or contents of an existing resource.
Endpoint: PUT /update-resource/:name
URL Parameters:
- :name
- The name of the resource to update
Headers:
- Authorization: Bearer <token>
- Authentication token
- Content-Type: application/json
- Content type
Request Body: Same format as for adding a resource, but must include the same name as in the URL
Success Response: - Status Code: 200 - Body:
Error Responses: - Status Code: 400 - Missing or invalid resource data - Status Code: 403 - Invalid authentication token - Status Code: 404 - Resource not found - Status Code: 500 - Server error
cURL Example:
3. Remove a Resource
Remove a resource from the server.
Endpoint: DELETE /remove-resource/:name
URL Parameters:
- :name
- The name of the resource to remove
Headers:
- Authorization: Bearer <token>
- Authentication token
Success Response: - Status Code: 200 - Body:
Error Responses: - Status Code: 400 - Missing resource name - Status Code: 403 - Invalid authentication token - Status Code: 404 - Resource not found - Status Code: 500 - Server error
cURL Example:
Working with Resources
Static vs. Dynamic Resources
WASImancer automatically determines whether a resource is static or dynamic based on:
- Static Resource: URI with no parameters (doesn't contain curly braces
{}
), or doesn't have anarguments
field - Dynamic Resource: URI with parameters (contains one or more
{paramName}
segments) and has anarguments
field
Resource Field Descriptions
Common Fields
name
: A unique identifier for the resourceuri
: URI for static resources or URI template for dynamic resourcescontents
: Array of content objects, each with at least atext
field
Dynamic Resource Fields
arguments
: Array of argument definitions for dynamic resourcesname
: Argument name (must match parameters in the URI template)type
: Argument type (for documentation purposes)
Best Practices
Naming Conventions
Use consistent, descriptive names for resources:
- Use kebab-case for multi-word resource names (e.g., server-config
, user-profile
)
- Use appropriate URI schemes (e.g., config://
, info://
, data://
)
Resource Organization
Organize resources by purpose and keep them focused: - Group related information in a single resource - Prefer multiple content items over deeply nested JSON - Use clear, consistent structure across resources