feat(mcp): finalize scaffolding and factory entry
Adds packages/mcp/.gitignore, src/index.ts (public API barrel), src/server.ts (createPascalMcpServer factory), and a smoke test for the public API. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
2ae932f384
commit
eebbef502d
@@ -0,0 +1,2 @@
|
|||||||
|
dist/
|
||||||
|
*.tsbuildinfo
|
||||||
@@ -13,8 +13,8 @@ if (typeof (globalThis as any).requestAnimationFrame === 'undefined') {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
import useScene from '@pascal-app/core/store'
|
|
||||||
import { WallNode } from '@pascal-app/core/schema'
|
import { WallNode } from '@pascal-app/core/schema'
|
||||||
|
import useScene from '@pascal-app/core/store'
|
||||||
|
|
||||||
function assert(cond: unknown, msg: string): asserts cond {
|
function assert(cond: unknown, msg: string): asserts cond {
|
||||||
if (!cond) throw new Error(`ASSERT FAILED: ${msg}`)
|
if (!cond) throw new Error(`ASSERT FAILED: ${msg}`)
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
import { expect, test } from 'bun:test'
|
||||||
|
|
||||||
|
test('version module loads', async () => {
|
||||||
|
const mod = await import('./index')
|
||||||
|
expect(mod.version).toBe('0.1.0')
|
||||||
|
})
|
||||||
|
|
||||||
|
test('createPascalMcpServer is a function', async () => {
|
||||||
|
const mod = await import('./index')
|
||||||
|
expect(typeof mod.createPascalMcpServer).toBe('function')
|
||||||
|
})
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
export { SceneBridge } from './bridge/scene-bridge'
|
||||||
|
export { type CreatePascalMcpServerOptions, createPascalMcpServer } from './server'
|
||||||
|
|
||||||
|
export const version = '0.1.0'
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
||||||
|
import type { SceneBridge } from './bridge/scene-bridge'
|
||||||
|
import { registerPrompts } from './prompts'
|
||||||
|
import { registerResources } from './resources'
|
||||||
|
import { registerTools } from './tools'
|
||||||
|
import { registerVisionTools } from './tools/vision'
|
||||||
|
|
||||||
|
export type CreatePascalMcpServerOptions = {
|
||||||
|
bridge: SceneBridge
|
||||||
|
name?: string
|
||||||
|
version?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function createPascalMcpServer(opts: CreatePascalMcpServerOptions): McpServer {
|
||||||
|
const server = new McpServer({
|
||||||
|
name: opts.name ?? 'pascal-mcp',
|
||||||
|
version: opts.version ?? '0.1.0',
|
||||||
|
})
|
||||||
|
registerTools(server, opts.bridge)
|
||||||
|
registerVisionTools(server, opts.bridge)
|
||||||
|
registerResources(server, opts.bridge)
|
||||||
|
registerPrompts(server, opts.bridge)
|
||||||
|
return server
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user