@publication-mcp-studio/client
v0.3.2
Published
Client SDK for integrating external apps with a hosted Publication MCP Studio deployment.
Readme
Publication Client Package
Typed client SDK for calling a hosted Publication MCP Studio REST/MCP service.
npm install @publication-mcp-studio/clientQuick Start
import { createPublicationClient } from '@publication-mcp-studio/client'
const publication = createPublicationClient({
origin: 'https://your-publication-service.example',
token: process.env.PUBLICATION_API_TOKEN,
})
const { articles, total } = await publication.listArticles({
status: 'published',
category: 'science',
tag: 'latex',
limit: 10,
})origin is the preferred v0.3 option. The client appends /api/publications by default. For backwards compatibility, baseUrl may be either an origin or a full publication API base path:
createPublicationClient({ baseUrl: 'https://example.com' })
createPublicationClient({ baseUrl: 'https://example.com/api/publications' })
createPublicationClient({ origin: 'https://example.com', pathPrefix: '/custom/publications' })Typed Metadata
type BlogMetadata = {
category?: string
imageUrl?: string
excerpt?: string
tags?: string[]
}
const client = createPublicationClient<BlogMetadata>({
origin: 'https://example.com',
token,
})
const article = await client.getArticle('my-post')
article.article.metadata.imageUrldefineArticleMetadataSchema(schema) is exported as a tiny helper for hosts that want to keep a runtime schema object beside the generic type.
v0.3.2 Notes
- Coordinated with
@publication-mcp-studio/[email protected]. originis the preferred constructor option.baseUrlis still accepted and may be either an origin (e.g.https://example.com) or a full publication API base path (e.g.https://example.com/api/publications).- All token records are now fully camelCase (
issuedAt,expiresAt,revokedAt,lastUsedAt,lastUsedRoute,lastUsedMethod,tokenType,profileId,profileLabel,profileEnabledSkillIds,tokenEnabledSkillIds,allowProfileSkillOverrides).
v0.3.0 Additions
- Category/tag filters plus offset and cursor pagination.
count/totalare real total counts when the server supportscountArticles().pageSizereports the returned page length.- CamelCase token records (
expiresAt,createdAt,revokedAt). PUBLICATION_SCOPESexported as the canonical scope tuple.PublicationClientErrorpreservesstatus,code, anddetails.listTools()andcallTool()helpers wrap JSON-RPC MCP calls.
Companion Hooks
React apps can install:
npm install @publication-mcp-studio/reactThen use useArticles() and useArticle() for the common public read path.
