C64 MCP Server
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
🚀 C64 Model Context Protocol (MCP)
MCP resource server that:
Authenticates against Keycloak
Discovers available views, functions, and agent systems
Registers selected items as MCP tools
Serves them over FastMCP (
streamable-httporsse)
📋 Requirements
Python
>=3.12.9Network access to:
Auth server (
AUTH_HOST/ realm)Linked Data API
Graph Builder Services API
M4AI API
Related MCP server: basesmcp
🔧 Installation
uv sync⚙️ Configuration
Configuration is loaded from environment variables (and .env in the repo root).
Variable | Default | Description |
|
| MCP server bind host |
|
| MCP server bind port |
|
| If |
|
| MCP transport ( |
|
| Keycloak base host used to construct OIDC endpoints for server-side auth metadata/introspection |
|
| Keycloak realm used with |
|
| OAuth client id used by MCP resource-server auth settings/introspection verifier |
|
| OAuth client secret paired with |
|
| OAuth strict mode flag |
|
| Token endpoint used by the CLI login flow (password + refresh grants) |
|
| Client id sent by the CLI login/token client |
|
| Scope requested by the CLI login/token client |
|
| Grant type used for username/password login |
| none | Default username for startup authentication when |
| none | Default password for startup authentication when |
| none | Comma-separated view ids for non-interactive selection |
| none | Comma-separated function ids for non-interactive selection |
| none | Comma-separated agent-system ids for non-interactive selection |
|
| Base URL for Graph Builder Services API |
|
| Base URL for Linked Data API |
|
| Base URL for M4AI API |
💡 AUTH_* vs KEYCLOAK_*
AUTH_*controls how the MCP server exposes and validates OAuth/OIDC integration (issuer/introspection/authorization metadata). It is server-facing auth configuration.KEYCLOAK_*controls how this script logs in a user and refreshes tokens during startup tool discovery (KeycloakAuthClient). It is client-facing token acquisition configuration.In many setups these point to the same Keycloak realm, but they can use different client IDs/secrets depending on your security model.
Example .env:
MCP_HOST=localhost
MCP_PORT=8001
MCP_SSL_ENABLED=false
TRANSPORT=streamable-http
AUTH_HOST=https://auth.example.com/auth
AUTH_REALM=your-realm
OAUTH_CLIENT_ID=your-client-id
OAUTH_CLIENT_SECRET=your-secret
OAUTH_STRICT=false
KEYCLOAK_TOKEN_URL=https://auth.example.com/auth/realms/your-realm/protocol/openid-connect/token
KEYCLOAK_CLIENT_ID=your-keycloak-client-id
KEYCLOAK_SCOPE="email profile offline_access"
KEYCLOAK_GRANT_TYPE=password
DCH_USERNAME=your.username
DCH_PASSWORD=your-password
DCH_VIEWS=view-id-123,view-id-456
DCH_FUNCTIONS=77,81
DCH_AGENT_SYSTEMS=14,21
GRAPH_BUILDER_SERVICES_BASE_URL=https://api.example.com/gbs
LINKED_DATA_API_BASE_URL=https://api.example.com/linked-data-api
M4AI_BASE_URL=https://api.example.com/m4ai🗝️ Configure Keycloak Client (for MCP Authentication)
Minimum setup to get credentials needed by this MCP server:
Ensure you have admin access to Keycloak.
Select the target realm.
Go to
Clientsand clickCreate client.Set:
Client type:
OpenID ConnectClient ID: your client id
Client name: your client name
Description: optional
Click
Next.Enable
Client authentication(toggle ON).In authentication flow, enable
Standard flow.Click
Next.Set
Valid redirect URIsto where the client is available, usuallyhttp://localhost:*.Create/save the client.
Open the created client, go to
Credentials, and copy/create the client secret.
At this point you have the minimum required values:
Client ID
Client secret
Realm
Auth host
Use those values in .env:
AUTH_HOST=https://<your-keycloak-host>/auth
AUTH_REALM=<your-realm>
OAUTH_CLIENT_ID=<client-id>
OAUTH_CLIENT_SECRET=<client-secret>
KEYCLOAK_CLIENT_ID=<client-id>
KEYCLOAK_TOKEN_URL=https://<your-keycloak-host>/auth/realms/<your-realm>/protocol/openid-connect/token▶️ Running
Basic run:
uv run python main.pyWith explicit credentials:
uv run python main.py --username my.user --password '***'With credentials from environment:
export DCH_USERNAME=my.user
export DCH_PASSWORD='***'
uv run python main.pyWith credential caching enabled:
uv run python main.py --cache-credentialsWith direct selection from CLI:
uv run python main.py \
--views view-id-123,view-id-456 \
--functions 77,81 \
--agent-systems 14,21With paging/limits:
uv run python main.py \
--views-limit 50 \
--functions-page-size 50 \
--agent-systems-page-size 50These values control interactive selection page sizes. Additional pages are fetched lazily when you move between pages in the selector UI.
💻 Development
Run Ruff lint checks:
uv run ruff check .Auto-format the codebase with Ruff:
uv run ruff format .🤖 Claude Desktop Integration
Add this MCP server entry to your claude_desktop_config.json under mcpServers.
Use your own local values for binary path, MCP URL, OAuth client id, and client secret.
{
"mcpServers": {
"c64-mcp": {
"command": "/path/to/npx",
"args": [
"mcp-remote",
"<mcp_server_url>",
"--static-oauth-client-info",
"{\"client_id\":\"your-client-id\",\"client_secret\":\"your-client-secret\"}"
]
}
},
...
}📝 CLI Options
--username
--password
--views
--functions
--agent-systems
--cache-credentials
--views-limit
--functions-page-size
--agent-systems-page-size
--selection-config
--output-selection-as-config--selection-config is optional. If omitted, the script uses interactive selection.
--cache-credentials is optional. If omitted, .credentials_cache is not read or written.
Environment credentials are also supported via DCH_USERNAME and DCH_PASSWORD.
Selection can also be provided directly through --views, --functions, --agent-systems or DCH_VIEWS, DCH_FUNCTIONS, DCH_AGENT_SYSTEMS.
🔐 Authentication and Token Cache
Refresh token cache file: .credentials_cache (next to main.py).
Startup auth flow with --cache-credentials:
Try cached refresh token.
If invalid/missing, authenticate using
--username/--password, thenDCH_USERNAME/DCH_PASSWORD, then prompt if still needed.Save new refresh token when available.
Continue with view/function/agent-system discovery.
Startup auth flow without --cache-credentials:
Skip reading
.credentials_cache.Authenticate using
--username/--password, thenDCH_USERNAME/DCH_PASSWORD, then prompt if still needed.Do not write
.credentials_cache.Continue with view/function/agent-system discovery.
During API calls, if access token expires (401), the script refreshes and retries.
Important behavior:
If credential caching is enabled and no cached token exists, login is prompted before reading
--selection-config.CLI flags take precedence over
DCH_USERNAMEandDCH_PASSWORD.For direct selection, CLI args take precedence over
DCH_VIEWS,DCH_FUNCTIONS, andDCH_AGENT_SYSTEMS.
🧰 Tool Selection Modes
1) Interactive mode (default)
When no selection config, direct selection CLI args, or direct selection env vars are provided:
Script fetches selection pages from APIs on demand
Shows checkbox-style selectors for:
Views
Functions
Agent systems
Left/right arrow keys or
a/dmove between pages in TTY modenandpmove between pages in prompt modeItem numbers are global across pages, so the displayed number stays stable as you page through results
Selected items are registered as MCP tools
2) Direct id selection (--views, --functions, --agent-systems)
Provide comma-separated ids directly on the command line:
uv run python main.py \
--views view-id-123,view-id-456 \
--functions 77,81 \
--agent-systems 14,21Or through environment variables:
export DCH_VIEWS=view-id-123,view-id-456
export DCH_FUNCTIONS=77,81
export DCH_AGENT_SYSTEMS=14,21
uv run python main.pyThese use the same id-only resolution rules as JSON config mode. Missing categories default to an empty selection.
3) JSON config mode (--selection-config)
Provide a JSON file that defines what to select.
Example:
{
"views": [
"view-id-123",
"view-id-456"
],
"functions": [
77,
81
],
"agent_systems": [
14,
21
]
}Also accepted:
agentSystems(camelCase) instead ofagent_systems
📋 Config rules
Each entry in:
viewsmust be a view idfunctionsmust be a function idagent_systemsmust be an agent-system id
When --selection-config is used, the server fetches each selected entity directly by id and uses the fetched details to build the MCP tools in the same order as the config file.
If any id cannot be resolved, startup fails with a clear CLI error.
Run with selection file:
uv run python main.py --selection-config ./selection.json📤 Export terminal selection to config
When running in interactive mode, you can export your selected items:
uv run python main.py --output-selection-as-config ./selection.jsonThis writes a JSON file with views, functions, and agent_systems based on your terminal selection.
The exported config contains only ids.
Constraint:
--selection-configand--output-selection-as-configare mutually exclusive.--selection-configcannot be combined with--views,--functions, or--agent-systems.--output-selection-as-configonly works in interactive mode.
💡 What Gets Registered
For each selected entity, the script fetches details and registers a tool:
Views: executes via
execute_viewFunctions: executes via
execute_functionAgent systems: executes over a stream, reconstructs chunked output, and returns the final last-layer result
Parameter names are normalized to valid Python identifiers for tool signatures.
🧩 Example Workflows
Interactive:
uv run python main.pyNon-interactive with predefined selections:
uv run python main.py \
--selection-config ./selection.json \
--views-limit 100 \
--functions-page-size 100 \
--agent-systems-page-size 100🧯 Troubleshooting
Configuration error: Invalid transport ...Set
TRANSPORTtostreamable-httporsse.
Authentication failed ...Check username/password and Keycloak client settings.
Failed fetching views/functions/agent systems ...Verify API connectivity and token scope/permissions.
Selection config contains unknown ...Ensure the ids in JSON exist and are accessible by the detail endpoints.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Host any HTTP API as MCP tools with a tamper-evident cross-agent settlement ledger.
MCP server for your apps' tools and custom tools, plus hosted AI agents and approval-gated workflows
Remote MCP server exposing SMI Aware tools, resources, and skills over Streamable HTTP.
Search and inspect source-pinned agent skills, plugins and tools through a free public MCP.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to discover and execute tools via a secure MCP server with JWT authentication, RBAC, rate limiting, and audit logging.1MIT
- AlicenseNot gradedqualityCmaintenanceEnables turning any Python function into an auto-registered MCP tool and serving them over a FastMCP server with auto-discovery, optional auth, and request context.MIT
- AlicenseNot gradedqualityCmaintenanceEnables developers to register sync or async MCP tools that are automatically protected by context-budget guards, including DataFrame blockades, payload truncation, and log-line capping. Each invocation is wrapped with correlated trace IDs and fail-closed error envelopes, and the server can be mounted as an SSE endpoint inside a FastAPI application.MIT
- FlicenseNot gradedqualityAmaintenanceEnables LLMs to dynamically search for, add, configure, enable/disable, and aggregate tools from multiple MCP servers at runtime, with persistent configuration and proxying.-