Initial project setup with MCP SDK skeleton

- TypeScript project with tsup build
- MCP server with status, connect, disconnect tools (stubs)
- Uses zod for schema validation
- Builds and starts successfully

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Simen Svale 2025-12-30 01:47:16 +01:00
commit db47d8ed10
5 changed files with 2738 additions and 0 deletions

4
.gitignore vendored Normal file
View file

@ -0,0 +1,4 @@
node_modules/
dist/
*.log
.DS_Store

2528
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

47
package.json Normal file
View file

@ -0,0 +1,47 @@
{
"name": "vice-mcp",
"version": "0.1.0",
"description": "MCP server for autonomous C64 debugging via VICE emulator",
"type": "module",
"main": "dist/index.js",
"types": "dist/index.d.ts",
"bin": {
"vice-mcp": "dist/index.js"
},
"scripts": {
"build": "tsup src/index.ts --format esm --dts --clean",
"dev": "tsup src/index.ts --format esm --watch",
"start": "node dist/index.js",
"typecheck": "tsc --noEmit"
},
"repository": {
"type": "git",
"url": "git+https://github.com/simen/vice-mcp.git"
},
"keywords": [
"mcp",
"vice",
"c64",
"commodore",
"debugger",
"emulator"
],
"author": "",
"license": "MIT",
"bugs": {
"url": "https://github.com/simen/vice-mcp/issues"
},
"homepage": "https://github.com/simen/vice-mcp#readme",
"dependencies": {
"@modelcontextprotocol/sdk": "^1.0.0",
"zod": "^4.2.1"
},
"devDependencies": {
"@types/node": "^20.10.0",
"tsup": "^8.0.0",
"typescript": "^5.3.0"
},
"engines": {
"node": ">=18"
}
}

134
src/index.ts Normal file
View file

@ -0,0 +1,134 @@
#!/usr/bin/env node
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import { z } from "zod";
const server = new McpServer({
name: "vice-mcp",
version: "0.1.0",
});
// Connection state (will be managed by protocol layer)
let connected = false;
// Tool: status - Get current connection and emulation state
server.registerTool(
"status",
{
description: "Get current connection and emulation state",
},
async () => {
return {
content: [
{
type: "text",
text: JSON.stringify(
{
connected,
running: false,
hint: connected
? "Connected to VICE"
: "Not connected. Use connect() to establish connection to VICE.",
},
null,
2
),
},
],
};
}
);
// Tool: connect - Connect to a running VICE instance
server.registerTool(
"connect",
{
description: "Connect to a running VICE instance with binary monitor enabled",
inputSchema: z.object({
host: z.string().optional().describe("VICE host address (default: 127.0.0.1)"),
port: z.number().optional().describe("VICE binary monitor port (default: 6502)"),
}),
},
async (args) => {
const host = args.host || "127.0.0.1";
const port = args.port || 6502;
// Placeholder - actual connection logic will be in protocol layer
return {
content: [
{
type: "text",
text: JSON.stringify(
{
connected: false,
error: true,
code: "NOT_IMPLEMENTED",
message: `Connection to ${host}:${port} not yet implemented`,
suggestion:
"Protocol layer is under development. Check back soon!",
},
null,
2
),
},
],
};
}
);
// Tool: disconnect - Disconnect from VICE
server.registerTool(
"disconnect",
{
description: "Disconnect from the VICE instance",
},
async () => {
if (!connected) {
return {
content: [
{
type: "text",
text: JSON.stringify(
{
error: true,
code: "NOT_CONNECTED",
message: "Not connected to VICE",
},
null,
2
),
},
],
};
}
connected = false;
return {
content: [
{
type: "text",
text: JSON.stringify(
{
disconnected: true,
message: "Disconnected from VICE",
},
null,
2
),
},
],
};
}
);
async function main() {
const transport = new StdioServerTransport();
await server.connect(transport);
console.error("VICE MCP server started");
}
main().catch((error) => {
console.error("Fatal error:", error);
process.exit(1);
});

25
tsconfig.json Normal file
View file

@ -0,0 +1,25 @@
{
"compilerOptions": {
"target": "ES2022",
"module": "ESNext",
"moduleResolution": "bundler",
"lib": ["ES2022"],
"outDir": "./dist",
"rootDir": "./src",
"strict": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noImplicitReturns": true,
"noFallthroughCasesInSwitch": true
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
}