Skip to content

Add MCP server for TypeSpec docs and API signatures#87

Merged
swatkatz merged 3 commits into
mainfrom
feature/mcp-server-docs
Jun 4, 2026
Merged

Add MCP server for TypeSpec docs and API signatures#87
swatkatz merged 3 commits into
mainfrom
feature/mcp-server-docs

Conversation

@swatkatz
Copy link
Copy Markdown

@swatkatz swatkatz commented Jun 4, 2026

Summary

  • Adds packages/mcp-server-typespec-docs, a local MCP server that exposes TypeSpec documentation and compiler API signatures to agents
  • Three tools: search_docs (full-text search), get_doc (fetch by path), get_type_signature (compiler API lookup)
  • Reads from local repo when available, falls back to fetching from GitHub for users who don't have pinterest/typespec cloned
  • Built with @modelcontextprotocol/sdk + minisearch (fuzzy full-text search)

Usage

If you have pinterest/typespec cloned:

cd packages/mcp-server-typespec-docs && npm install && npm run build

Add to .mcp.json:

"typespec-docs": {
  "type": "stdio",
  "command": "node",
  "args": ["<path-to-repo>/packages/mcp-server-typespec-docs/dist/server.js"]
}

If you don't have it cloned (e.g. working in pinboard): the server fetches docs from raw.githubusercontent.com/pinterest/typespec/main/ on first query and caches for the session.

Tools

Tool Description
search_docs(query, [topic]) Full-text search across all TypeSpec docs (language basics, extending-typespec, libraries, emitters, etc.)
get_doc(path) Fetch a specific doc page by relative path
get_type_signature(symbol) Look up TypeSpec compiler API type definitions + JSDoc (e.g. Realm, Model, mutateSubgraph)

Test plan

  • Server responds to MCP initialize handshake
  • search_docs("decorators", topic: "language-basics") returns decorators doc
  • search_docs("emitter framework") returns extending-typespec docs
  • get_doc("extending-typespec/create-decorators.md") returns full page
  • get_type_signature("Realm") returns class definition with JSDoc
  • get_type_signature("Model") returns correct interface from core/types.ts
  • Prettier + ESLint pass (monorepo config)
  • GitHub fallback (needs testing outside repo clone)

🤖 Generated with Claude Code

swatkatz and others added 3 commits June 4, 2026 17:07
Adds a new package (mcp-server-typespec-docs) that exposes three MCP tools:
- search_docs: full-text search across all TypeSpec documentation
- get_doc: fetch a specific doc page by path
- get_type_signature: look up compiler API type definitions and JSDoc

The server reads docs locally when run from within the pinterest/typespec
repo, and falls back to fetching from GitHub (raw.githubusercontent.com)
when run from elsewhere. Content is cached in memory for the session.

Built with @modelcontextprotocol/sdk + minisearch for full-text search
with fuzzy matching and relevance ranking.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@swatkatz swatkatz merged commit 6392d70 into main Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant